From b1b3455f151f928af8006899f60106267dbc9a82 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Wed, 26 Aug 2026 11:34:07 +0800 Subject: [PATCH] Add raw Seal OpenAPI generator and specification --- .gitignore | 2 + dist/raw-seal-openapi.json | 3176 +++++++++++++++++++++++++++++++ package.json | 1 + scripts/generate-raw-openapi.ts | 1823 ++++++++++++++++++ 4 files changed, 5002 insertions(+) create mode 100644 dist/raw-seal-openapi.json create mode 100644 scripts/generate-raw-openapi.ts diff --git a/.gitignore b/.gitignore index c8e47c8..5be060e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ enterprises/*.json # Local generated reports and exported deliverables. .local/ +.apifox/ + diff --git a/dist/raw-seal-openapi.json b/dist/raw-seal-openapi.json new file mode 100644 index 0000000..716a207 --- /dev/null +++ b/dist/raw-seal-openapi.json @@ -0,0 +1,3176 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "Seal AI Downstream Native API", + "version": "1.0.0", + "description": "Raw downstream Seal AI and HoseCloud business API contracts (without seal-home wrapper layer)." + }, + "servers": [ + { + "url": "https://seal.example.com", + "description": "Downstream Seal AI server root" + } + ], + "security": [ + { + "bearerAuth": [] + } + ], + "tags": [ + { + "name": "Auth & Session", + "description": "身份验证、当前会话与 SSO 换票" + }, + { + "name": "Approval Rules", + "description": "审批规则草稿、版本快照与发布" + }, + { + "name": "Knowledge Documents", + "description": "知识库规章与文档管理" + }, + { + "name": "Agent & Style Preferences", + "description": "审批偏好、深度策略与 Webhook 集成" + }, + { + "name": "Approval Runs", + "description": "审批记录、AI 决策结果与原始单据" + }, + { + "name": "Simulation & Testing", + "description": "仿真批次、单据模板与材料包测试" + }, + { + "name": "Delegation", + "description": "转授权令牌与协助链接" + }, + { + "name": "Contacts & Users", + "description": "部门架构与用户管理" + }, + { + "name": "HoseCloud OEM Integration", + "description": "合思企业绑定与出站 Webhook 配置" + }, + { + "name": "System, LLM & Billing", + "description": "大模型设置、系统权限与计费套餐" + } + ], + "paths": { + "/api/v1/auth/me": { + "get": { + "tags": [ + "Auth & Session" + ], + "summary": "获取当前登录用户与租户信息", + "operationId": "getMe", + "responses": { + "200": { + "description": "当前身份信息", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MeData" + } + } + } + } + } + } + }, + "/api/auth/get-session": { + "get": { + "tags": [ + "Auth & Session" + ], + "summary": "获取当前会话及转授权信息", + "operationId": "getSession", + "responses": { + "200": { + "description": "当前会话数据", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SealSessionData" + } + } + } + } + } + } + }, + "/api/auth/sms-otp/sign-in-password": { + "post": { + "tags": [ + "Auth & Session" + ], + "summary": "手机号与密码登录", + "operationId": "loginWithPhonePassword", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "phone", + "password" + ], + "properties": { + "phone": { + "type": "string", + "description": "手机号" + }, + "password": { + "type": "string", + "description": "登录密码" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "登录结果与 Token", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "user": { + "type": "object" + }, + "session": { + "type": "object", + "properties": { + "token": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/api/auth/oauth2/session/oem-hosecloud": { + "get": { + "tags": [ + "Auth & Session" + ], + "summary": "合思 OEM SSO 换取 Seal 会话 Token", + "operationId": "oauthHosecloudSession", + "parameters": [ + { + "name": "token", + "in": "query", + "required": true, + "schema": { + "type": "string" + }, + "description": "合思 closeapi 换票 token" + }, + { + "name": "returnToken", + "in": "query", + "schema": { + "type": "string", + "default": "1" + }, + "description": "是否直接返回 token 字段" + } + ], + "responses": { + "200": { + "description": "换票会话", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "token": { + "type": "string" + }, + "accessToken": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/api/v1/rules": { + "get": { + "tags": [ + "Approval Rules" + ], + "summary": "获取当前草稿规则列表", + "operationId": "listApprovalRules", + "responses": { + "200": { + "description": "规则列表数据", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalRulesData" + } + } + } + } + } + }, + "post": { + "tags": [ + "Approval Rules" + ], + "summary": "新增审批规则草稿", + "operationId": "createApprovalRule", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalRuleInput" + } + } + } + }, + "responses": { + "200": { + "description": "创建成功的规则", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalRule" + } + } + } + } + } + } + }, + "/api/v1/rules/{ruleId}": { + "put": { + "tags": [ + "Approval Rules" + ], + "summary": "修改审批规则草稿", + "operationId": "updateApprovalRule", + "parameters": [ + { + "name": "ruleId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "规则 ID" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalRuleUpdate" + } + } + } + }, + "responses": { + "200": { + "description": "更新后的规则", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalRule" + } + } + } + } + } + }, + "delete": { + "tags": [ + "Approval Rules" + ], + "summary": "删除审批规则草稿", + "operationId": "deleteApprovalRule", + "parameters": [ + { + "name": "ruleId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "规则 ID" + } + ], + "responses": { + "200": { + "description": "删除成功" + } + } + } + }, + "/api/v1/rules/batch-recode": { + "post": { + "tags": [ + "Approval Rules" + ], + "summary": "规则批量重排与重编号", + "operationId": "recodeApprovalRules", + "responses": { + "200": { + "description": "重排结果" + } + } + } + }, + "/api/v1/rule-set-versions": { + "get": { + "tags": [ + "Approval Rules" + ], + "summary": "获取已发布规则版本列表", + "operationId": "listApprovalRuleVersions", + "responses": { + "200": { + "description": "已发布规则版本列表", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RuleSetVersion" + } + } + } + } + } + } + } + }, + "/api/v1/rule-set-versions/{versionId}": { + "get": { + "tags": [ + "Approval Rules" + ], + "summary": "获取单个已发布规则版本详情", + "operationId": "getApprovalRuleVersion", + "parameters": [ + { + "name": "versionId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "版本 ID" + } + ], + "responses": { + "200": { + "description": "版本详情", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RuleSetVersion" + } + } + } + } + } + } + }, + "/api/v1/rule-set-versions/publish": { + "post": { + "tags": [ + "Approval Rules" + ], + "summary": "将当前草稿规则发布为正式版本", + "operationId": "publishApprovalRuleVersion", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "versionName" + ], + "properties": { + "versionName": { + "type": "string", + "description": "新版本名称" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "发布结果", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PublishVersionData" + } + } + } + } + } + } + }, + "/api/v1/knowledge/articles": { + "get": { + "tags": [ + "Knowledge Documents" + ], + "summary": "获取知识库文档列表", + "operationId": "listApprovalDocuments", + "parameters": [ + { + "name": "offset", + "in": "query", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "name": "limit", + "in": "query", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "sortBy", + "in": "query", + "schema": { + "type": "string", + "default": "createdAt" + } + }, + { + "name": "sortOrder", + "in": "query", + "schema": { + "type": "string", + "enum": [ + "asc", + "desc" + ], + "default": "desc" + } + } + ], + "responses": { + "200": { + "description": "知识文档列表", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalDocumentListData" + } + } + } + } + } + }, + "post": { + "tags": [ + "Knowledge Documents" + ], + "summary": "新建知识库文档", + "operationId": "createApprovalDocument", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalDocumentInput" + } + } + } + }, + "responses": { + "200": { + "description": "创建成功的文档", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalDocument" + } + } + } + } + } + } + }, + "/api/v1/knowledge/articles/{documentId}": { + "get": { + "tags": [ + "Knowledge Documents" + ], + "summary": "获取单个知识文档详情", + "operationId": "getApprovalDocument", + "parameters": [ + { + "name": "documentId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "知识文档详情", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalDocument" + } + } + } + } + } + }, + "patch": { + "tags": [ + "Knowledge Documents" + ], + "summary": "修改知识库文档", + "operationId": "updateApprovalDocument", + "parameters": [ + { + "name": "documentId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "attributes": { + "$ref": "#/components/schemas/ApprovalDocumentUpdate" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "更新后的文档", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalDocument" + } + } + } + } + } + } + }, + "/api/v1/agent/ai-approval/config": { + "get": { + "tags": [ + "Agent & Style Preferences" + ], + "summary": "获取 AI 审批配置与偏好", + "operationId": "getApprovalStylePreferences", + "responses": { + "200": { + "description": "AI 审批偏好配置", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalStylePreferences" + } + } + } + } + } + }, + "patch": { + "tags": [ + "Agent & Style Preferences" + ], + "summary": "局部更新 AI 审批配置与偏好", + "operationId": "patchApprovalStylePreferences", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "部分偏好字段" + } + } + } + }, + "responses": { + "200": { + "description": "更新后的偏好配置", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalStylePreferences" + } + } + } + } + } + }, + "post": { + "tags": [ + "Agent & Style Preferences" + ], + "summary": "覆盖保存 AI 审批配置与偏好", + "operationId": "saveApprovalStylePreferences", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalStylePreferences" + } + } + } + }, + "responses": { + "200": { + "description": "保存结果" + } + } + } + }, + "/api/v1/integrations/webhook/{webhookId}/document": { + "post": { + "tags": [ + "Agent & Style Preferences" + ], + "summary": "接收外部 Webhook 审批进单", + "operationId": "incomingWebhookDocument", + "parameters": [ + { + "name": "webhookId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "单据原始 payload" + } + } + } + }, + "responses": { + "200": { + "description": "进单响应" + } + } + } + }, + "/api/v1/integrations/webhook/{webhookId}/manual-result": { + "post": { + "tags": [ + "Agent & Style Preferences" + ], + "summary": "接收外部 Webhook 人工终审结果回传", + "operationId": "incomingWebhookManualResult", + "parameters": [ + { + "name": "webhookId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "人工审批结论" + } + } + } + }, + "responses": { + "200": { + "description": "回传响应" + } + } + } + }, + "/api/v1/approvals": { + "get": { + "tags": [ + "Approval Runs" + ], + "summary": "查询审批运行记录列表", + "operationId": "listApprovalRuns", + "parameters": [ + { + "name": "offset", + "in": "query", + "schema": { + "type": "integer", + "default": 0 + } + }, + { + "name": "limit", + "in": "query", + "schema": { + "type": "integer", + "default": 50 + } + }, + { + "name": "startDate", + "in": "query", + "schema": { + "type": "string" + }, + "description": "开始日期 YYYY-MM-DD" + }, + { + "name": "endDate", + "in": "query", + "schema": { + "type": "string" + }, + "description": "结束日期 YYYY-MM-DD" + }, + { + "name": "status", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "sourceSystem", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "taskMode", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "search", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "sourceDocumentSN", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "sourceDocumentId", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "审批运行记录列表", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalRunListData" + } + } + } + } + } + } + }, + "/api/v1/approvals/{runId}": { + "get": { + "tags": [ + "Approval Runs" + ], + "summary": "获取单条审批运行记录详情", + "operationId": "getApprovalRun", + "parameters": [ + { + "name": "runId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "审批运行详情", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ApprovalRun" + } + } + } + } + } + } + }, + "/api/v1/simulation/create-batch": { + "post": { + "tags": [ + "Simulation & Testing" + ], + "summary": "创建合思指定单号/条件仿真测试批次", + "operationId": "createSimulationBatch", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SimulationBatchParams" + } + } + } + }, + "responses": { + "200": { + "description": "创建结果", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SimulationCreateResult" + } + } + } + } + } + } + }, + "/api/v1/simulation/create-material-pack-batch": { + "post": { + "tags": [ + "Simulation & Testing" + ], + "summary": "创建材料包仿真测试批次", + "operationId": "createMaterialPackBatch", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SimulationBatchParams" + } + } + } + }, + "responses": { + "200": { + "description": "创建结果", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SimulationCreateResult" + } + } + } + } + } + } + }, + "/api/v1/simulation/batches": { + "get": { + "tags": [ + "Simulation & Testing" + ], + "summary": "获取仿真测试批次列表", + "operationId": "listSimulationBatches", + "parameters": [ + { + "name": "limit", + "in": "query", + "schema": { + "type": "integer", + "default": 50 + } + } + ], + "responses": { + "200": { + "description": "仿真批次列表", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SimulationBatch" + } + } + } + } + } + } + } + }, + "/api/v1/simulation/batch/{batchId}": { + "get": { + "tags": [ + "Simulation & Testing" + ], + "summary": "获取单个仿真测试批次详情", + "operationId": "getSimulationBatch", + "parameters": [ + { + "name": "batchId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "仿真批次详情", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SimulationBatch" + } + } + } + } + } + } + }, + "/api/v1/simulation/batch/{batchId}/records": { + "get": { + "tags": [ + "Simulation & Testing" + ], + "summary": "获取仿真批次产生的审批记录", + "operationId": "listSimulationBatchRecords", + "parameters": [ + { + "name": "batchId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "审批记录列表", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApprovalRun" + } + } + } + } + } + } + } + }, + "/api/v1/simulation/batch/{batchId}/data": { + "delete": { + "tags": [ + "Simulation & Testing" + ], + "summary": "清理仿真批次生成的业务测试数据", + "operationId": "cleanSimulationBatchData", + "parameters": [ + { + "name": "batchId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "清理结果" + } + } + } + }, + "/api/v1/simulation/templates": { + "get": { + "tags": [ + "Simulation & Testing" + ], + "summary": "获取仿真单据模板列表", + "operationId": "listSimulationTemplates", + "responses": { + "200": { + "description": "模板列表", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SimulationTemplate" + } + } + } + } + } + } + } + }, + "/api/v1/simulation/integration-status": { + "get": { + "tags": [ + "Simulation & Testing" + ], + "summary": "获取各外部系统仿真对接可用状态", + "operationId": "getSimulationIntegrationStatus", + "responses": { + "200": { + "description": "对接可用性状态", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SimulationIntegrationStatus" + } + } + } + } + } + } + }, + "/api/v1/simulation/hosecloud-integrations": { + "get": { + "tags": [ + "Simulation & Testing" + ], + "summary": "获取合思企业集成实例列表", + "operationId": "listSimulationHosecloudIntegrations", + "responses": { + "200": { + "description": "合思集成实例列表", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SimulationHosecloudIntegration" + } + } + } + } + } + } + } + }, + "/api/v1/simulation/hosecloud-specifications": { + "get": { + "tags": [ + "Simulation & Testing" + ], + "summary": "获取合思审批流规格列表", + "operationId": "listSimulationSpecifications", + "responses": { + "200": { + "description": "审批流规格列表", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SimulationSpecification" + } + } + } + } + } + } + } + }, + "/api/v1/simulation/hosecloud-specifications-by-sign-key": { + "get": { + "tags": [ + "Simulation & Testing" + ], + "summary": "按 signKey 获取合思审批流规格", + "operationId": "listSimulationSpecificationsBySignKey", + "parameters": [ + { + "name": "signKey", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "审批流规格列表", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SimulationSpecification" + } + } + } + } + } + } + } + }, + "/api/v1/material-packages/upload": { + "post": { + "tags": [ + "Simulation & Testing" + ], + "summary": "上传材料包 ZIP 文件", + "operationId": "uploadMaterialPackage", + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "required": [ + "file" + ], + "properties": { + "file": { + "type": "string", + "format": "binary", + "description": "材料包压缩文件" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "上传解析结果", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MaterialPackage" + } + } + } + } + } + } + }, + "/api/v1/delegation/list": { + "get": { + "tags": [ + "Delegation" + ], + "summary": "获取转授权/协助令牌列表", + "operationId": "listDelegations", + "responses": { + "200": { + "description": "转授权列表", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SealDelegationItem" + } + } + } + } + } + } + } + }, + "/api/v1/delegation/create": { + "post": { + "tags": [ + "Delegation" + ], + "summary": "创建转授权协助链接", + "operationId": "createDelegation", + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "note": { + "type": "string", + "description": "备注信息" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "创建结果与协助链接", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SealDelegationCreateResult" + } + } + } + } + } + } + }, + "/api/v1/delegation/revoke": { + "post": { + "tags": [ + "Delegation" + ], + "summary": "作废转授权令牌", + "operationId": "revokeDelegation", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "tokenId" + ], + "properties": { + "tokenId": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "作废结果" + } + } + } + }, + "/api/v1/contacts/departments/root/children": { + "get": { + "tags": [ + "Contacts & Users" + ], + "summary": "获取根部门子部门列表", + "operationId": "getRootDepartmentChildren", + "responses": { + "200": { + "description": "根部门子节点" + } + } + } + }, + "/api/v1/contacts/local/users": { + "post": { + "tags": [ + "Contacts & Users" + ], + "summary": "创建本地用户", + "operationId": "createLocalUser", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name", + "phone" + ], + "properties": { + "name": { + "type": "string", + "description": "姓名" + }, + "phone": { + "type": "string", + "description": "手机号" + }, + "permissions": { + "type": "array", + "items": { + "type": "string" + } + }, + "departmentIds": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "创建结果与初始密码", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SealUserCreateResult" + } + } + } + } + } + } + }, + "/api/v1/contacts/local/users/{userId}/reset-password": { + "post": { + "tags": [ + "Contacts & Users" + ], + "summary": "重置本地用户密码", + "operationId": "resetUserPassword", + "parameters": [ + { + "name": "userId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "重置后的临时密码", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SealUserResetPasswordResult" + } + } + } + } + } + } + }, + "/api/v1/contacts/users/{userId}": { + "get": { + "tags": [ + "Contacts & Users" + ], + "summary": "获取用户详情", + "operationId": "getUserDetail", + "parameters": [ + { + "name": "userId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "用户详情", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SealUserDetail" + } + } + } + } + } + } + }, + "/api/v1/contacts/search": { + "get": { + "tags": [ + "Contacts & Users" + ], + "summary": "按关键字或手机号搜索用户/部门", + "operationId": "searchUsers", + "parameters": [ + { + "name": "query", + "in": "query", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "搜索命中结果", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SealContactSearchResult" + } + } + } + } + } + } + }, + "/api/v1/contacts/local/users/{userId}": { + "delete": { + "tags": [ + "Contacts & Users" + ], + "summary": "删除/离职本地用户", + "operationId": "deleteLocalUser", + "parameters": [ + { + "name": "userId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "操作结果" + } + } + } + }, + "/api/v1/contacts/local/users/{userId}/activate": { + "post": { + "tags": [ + "Contacts & Users" + ], + "summary": "重新激活离职用户", + "operationId": "activateLocalUser", + "parameters": [ + { + "name": "userId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "激活结果" + } + } + } + }, + "/api/hosecloud/corporation": { + "post": { + "tags": [ + "HoseCloud OEM Integration" + ], + "summary": "验证并获取合思企业 CorporationId", + "operationId": "getHosecloudCorporation", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "apiKey", + "apiSecret" + ], + "properties": { + "apiKey": { + "type": "string" + }, + "apiSecret": { + "type": "string" + }, + "apiOrigin": { + "type": "string", + "default": "production" + }, + "customApiUrl": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "企业 ID", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "corporationId": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/api/hosecloud/outbound-config/sync": { + "post": { + "tags": [ + "HoseCloud OEM Integration" + ], + "summary": "同步合思出站配置与回调 Webhook", + "operationId": "syncHosecloudOutbound", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "signKey", + "webhookUrl", + "completionWebhookUrl", + "messageName", + "mode" + ], + "properties": { + "signKey": { + "type": "string" + }, + "webhookUrl": { + "type": "string" + }, + "completionWebhookUrl": { + "type": "string" + }, + "messageName": { + "type": "string" + }, + "mode": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "同步结果" + } + } + } + }, + "/api/v1/llm/config": { + "get": { + "tags": [ + "System, LLM & Billing" + ], + "summary": "获取当前租户大模型配置", + "operationId": "getLlmConfig", + "responses": { + "200": { + "description": "大模型配置", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LlmConfig" + } + } + } + } + } + } + }, + "/api/v1/llm/providers": { + "get": { + "tags": [ + "System, LLM & Billing" + ], + "summary": "获取系统支持的大模型提供商列表", + "operationId": "listLlmProviders", + "responses": { + "200": { + "description": "大模型提供商", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LlmProvider" + } + } + } + } + } + } + } + }, + "/api/v1/permissions/available": { + "get": { + "tags": [ + "System, LLM & Billing" + ], + "summary": "获取系统可用权限列表", + "operationId": "listAvailablePermissions", + "responses": { + "200": { + "description": "可用权限列表", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AvailablePermissionsData" + } + } + } + } + } + } + }, + "/api/v1/permissions/configs": { + "get": { + "tags": [ + "System, LLM & Billing" + ], + "summary": "获取系统权限配置", + "operationId": "listPermissionConfigs", + "responses": { + "200": { + "description": "权限配置", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PermissionConfigsData" + } + } + } + } + } + } + }, + "/api/v1/billing/status": { + "get": { + "tags": [ + "System, LLM & Billing" + ], + "summary": "获取租户订阅与计费状态", + "operationId": "getBillingStatus", + "responses": { + "200": { + "description": "计费状态", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BillingStatusData" + } + } + } + } + } + } + }, + "/api/v1/billing/plans": { + "get": { + "tags": [ + "System, LLM & Billing" + ], + "summary": "获取计费套餐列表", + "operationId": "listBillingPlans", + "responses": { + "200": { + "description": "套餐计划列表" + } + } + } + }, + "/api/v1/billing/features": { + "get": { + "tags": [ + "System, LLM & Billing" + ], + "summary": "获取计费功能开关与额度", + "operationId": "listBillingFeatures", + "responses": { + "200": { + "description": "功能特性与额度" + } + } + } + } + }, + "components": { + "securitySchemes": { + "bearerAuth": { + "type": "http", + "scheme": "bearer", + "bearerFormat": "JWT / Session Token", + "description": "Seal AI 下游原生 Bearer 认证 Token" + } + }, + "schemas": { + "HosecloudStaff": { + "type": "object", + "required": [ + "staffId" + ], + "properties": { + "staffId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "code": { + "type": "string", + "default": "" + }, + "bindTime": { + "type": "number" + } + } + }, + "SealUser": { + "type": "object", + "required": [ + "id", + "tenantId", + "name" + ], + "properties": { + "id": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "isAdmin": { + "type": "boolean", + "default": false + }, + "permissions": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "providerUserId": { + "type": "string" + }, + "hosecloudStaff": { + "$ref": "#/components/schemas/HosecloudStaff" + } + } + }, + "HoseCorpConfig": { + "type": "object", + "properties": { + "apiKey": { + "type": "string" + }, + "corporationId": { + "type": "string" + }, + "corporationName": { + "type": "string" + } + } + }, + "SealTenant": { + "type": "object", + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "tenantSlug": { + "type": "string" + }, + "isDemo": { + "type": "boolean", + "default": false + }, + "logoUrl": { + "type": "string", + "nullable": true + }, + "hoseCorpConfig": { + "$ref": "#/components/schemas/HoseCorpConfig" + } + } + }, + "MeData": { + "type": "object", + "required": [ + "user", + "tenant" + ], + "properties": { + "user": { + "$ref": "#/components/schemas/SealUser" + }, + "tenant": { + "$ref": "#/components/schemas/SealTenant" + } + } + }, + "SealSessionUser": { + "type": "object", + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string", + "nullable": true + }, + "emailVerified": { + "type": "boolean" + }, + "image": { + "type": "string", + "nullable": true + }, + "tenantId": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "providerUserId": { + "type": "string" + }, + "mobile": { + "type": "string", + "nullable": true + }, + "status": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "isAdmin": { + "type": "boolean", + "default": false + } + } + }, + "SealSessionInfo": { + "type": "object", + "required": [ + "id", + "expiresAt", + "userId" + ], + "properties": { + "id": { + "type": "string" + }, + "token": { + "type": "string" + }, + "expiresAt": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "ipAddress": { + "type": "string" + }, + "userAgent": { + "type": "string" + }, + "userId": { + "type": "string" + }, + "delegationId": { + "type": "string", + "nullable": true + } + } + }, + "SealSessionData": { + "type": "object", + "required": [ + "user", + "session" + ], + "properties": { + "user": { + "$ref": "#/components/schemas/SealSessionUser" + }, + "session": { + "$ref": "#/components/schemas/SealSessionInfo" + } + } + }, + "ApprovalRule": { + "type": "object", + "required": [ + "id", + "description", + "scope", + "strictness" + ], + "properties": { + "id": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "code": { + "type": "number" + }, + "description": { + "type": "string" + }, + "scope": { + "type": "string" + }, + "strictness": { + "type": "string" + }, + "status": { + "type": "string" + }, + "createdAt": { + "type": "number" + }, + "updatedAt": { + "type": "number" + } + } + }, + "ApprovalRuleInput": { + "type": "object", + "required": [ + "description", + "scope", + "strictness" + ], + "properties": { + "description": { + "type": "string" + }, + "scope": { + "type": "string" + }, + "strictness": { + "type": "string" + } + } + }, + "ApprovalRuleUpdate": { + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "scope": { + "type": "string" + }, + "strictness": { + "type": "string" + } + } + }, + "ApprovalRulesData": { + "type": "object", + "required": [ + "rules" + ], + "properties": { + "rules": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApprovalRule" + } + }, + "hasPendingDeletes": { + "type": "boolean", + "default": false + } + } + }, + "PublishedRuleSnapshot": { + "type": "object", + "required": [ + "description", + "scope", + "strictness" + ], + "properties": { + "code": { + "type": "string" + }, + "description": { + "type": "string" + }, + "scope": { + "type": "string" + }, + "strictness": { + "type": "string" + } + } + }, + "RuleSetVersion": { + "type": "object", + "required": [ + "id", + "versionNumber" + ], + "properties": { + "id": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "versionNumber": { + "type": "number" + }, + "versionName": { + "type": "string", + "nullable": true + }, + "publishedBy": { + "type": "string", + "nullable": true + }, + "publishedByName": { + "type": "string", + "nullable": true + }, + "rules": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PublishedRuleSnapshot" + }, + "default": [] + }, + "publishedAt": { + "type": "number" + }, + "createdAt": { + "type": "number" + } + } + }, + "PublishVersionData": { + "type": "object", + "required": [ + "version", + "rulesCount" + ], + "properties": { + "version": { + "$ref": "#/components/schemas/RuleSetVersion" + }, + "rulesCount": { + "type": "number" + } + } + }, + "ApprovalDocument": { + "type": "object", + "required": [ + "id", + "title", + "content" + ], + "properties": { + "id": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "title": { + "type": "string" + }, + "purpose": { + "type": "string", + "default": "" + }, + "contentType": { + "type": "string", + "default": "policy" + }, + "content": { + "type": "string" + }, + "status": { + "type": "string", + "default": "published" + }, + "enabled": { + "type": "boolean", + "default": true + }, + "scenarios": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "category": { + "type": "string", + "nullable": true + }, + "categoryTags": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "createdBy": { + "type": "string", + "nullable": true + }, + "createdByName": { + "type": "string", + "nullable": true + }, + "createdAt": { + "type": "number" + }, + "updatedAt": { + "type": "number" + }, + "updatedBy": { + "type": "string", + "nullable": true + }, + "updatedByName": { + "type": "string", + "nullable": true + }, + "isDeleted": { + "type": "boolean", + "default": false + } + } + }, + "ApprovalDocumentInput": { + "type": "object", + "required": [ + "title", + "purpose", + "content" + ], + "properties": { + "title": { + "type": "string" + }, + "purpose": { + "type": "string" + }, + "content": { + "type": "string" + }, + "contentType": { + "type": "string", + "default": "policy" + }, + "status": { + "type": "string", + "default": "published" + }, + "scenarios": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + } + } + }, + "ApprovalDocumentUpdate": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "purpose": { + "type": "string" + }, + "content": { + "type": "string" + }, + "contentType": { + "type": "string" + }, + "status": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "scenarios": { + "type": "array", + "items": { + "type": "string" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "ApprovalDocumentListData": { + "type": "object", + "required": [ + "articles" + ], + "properties": { + "articles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApprovalDocument" + } + }, + "total": { + "type": "number" + } + } + }, + "DecisionPreferences": { + "type": "object", + "properties": { + "explicitApprove": { + "type": "string", + "default": "" + }, + "explicitReject": { + "type": "string", + "default": "" + }, + "exemptApprove": { + "type": "string", + "default": "" + }, + "review": { + "type": "string", + "default": "" + } + } + }, + "WebhookEndpoint": { + "type": "object", + "required": [ + "id", + "url" + ], + "properties": { + "id": { + "type": "string" + }, + "url": { + "type": "string", + "format": "uri" + } + } + }, + "WebhookIntegration": { + "type": "object", + "required": [ + "type", + "id", + "name", + "mode", + "incomingDocumentWebhook", + "outgoingResultWebhook", + "incomingManualResultWebhook", + "secret" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "webhook" + ] + }, + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "mode": { + "type": "string", + "enum": [ + "assisted", + "semi_automatic", + "fully_automatic" + ] + }, + "incomingDocumentWebhook": { + "$ref": "#/components/schemas/WebhookEndpoint" + }, + "outgoingResultWebhook": { + "type": "string", + "format": "uri" + }, + "incomingManualResultWebhook": { + "$ref": "#/components/schemas/WebhookEndpoint" + }, + "secret": { + "type": "string" + }, + "autoApprovalRate": { + "type": "integer", + "minimum": 0, + "maximum": 100 + } + } + }, + "ApprovalIntegration": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string" + }, + "signKey": { + "type": "string" + }, + "outboundName": { + "type": "string" + }, + "mode": { + "type": "string" + }, + "autoApprovalRate": { + "type": "number" + }, + "apiKey": { + "type": "string" + }, + "apiSecret": { + "type": "string" + }, + "apiOrigin": { + "type": "string" + }, + "corporationId": { + "type": "string" + } + } + }, + "ApprovalStylePreferences": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "tone": { + "type": "string" + }, + "language": { + "type": "string" + }, + "detailLevel": { + "type": "string" + }, + "outputFormat": { + "type": "string" + }, + "examples": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "prohibitedPhrases": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "customInstructions": { + "type": "string" + }, + "updatedAt": { + "type": "number" + }, + "decisionPreferences": { + "$ref": "#/components/schemas/DecisionPreferences" + }, + "integrationSystem": { + "type": "string" + }, + "integrations": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApprovalIntegration" + }, + "default": [] + } + } + }, + "ApprovalRunDocument": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "sn": { + "type": "string" + }, + "title": { + "type": "string" + }, + "name": { + "type": "string" + }, + "fields": { + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "ApprovalRunSourceExtendData": { + "type": "object", + "properties": { + "_langfuseTraceId": { + "type": "string" + }, + "simulation_batch_id": { + "type": "string" + } + } + }, + "ApprovalRun": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "agentId": { + "type": "string" + }, + "status": { + "type": "string" + }, + "taskMode": { + "type": "string" + }, + "finalExecutionMode": { + "type": "string" + }, + "sourceSystem": { + "type": "string" + }, + "sourceDocumentSN": { + "type": "string" + }, + "sourceDocumentId": { + "type": "string" + }, + "documentId": { + "type": "string" + }, + "document": { + "$ref": "#/components/schemas/ApprovalRunDocument" + }, + "result": { + "type": "object" + }, + "pipelineData": { + "type": "object" + }, + "sourceExtendData": { + "$ref": "#/components/schemas/ApprovalRunSourceExtendData" + }, + "ruleSetVersionNumber": { + "type": "number" + }, + "ruleSetPublishedAt": { + "type": "number" + }, + "ruleSetPublishedByName": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "ApprovalRunListData": { + "type": "object", + "required": [ + "records" + ], + "properties": { + "records": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApprovalRun" + } + }, + "total": { + "type": "number" + }, + "page": { + "type": "number" + }, + "pageSize": { + "type": "number" + } + } + }, + "SealDelegationItem": { + "type": "object", + "required": [ + "id", + "link" + ], + "properties": { + "id": { + "type": "string" + }, + "expiresAt": { + "type": "number", + "nullable": true + }, + "revokedAt": { + "type": "number", + "nullable": true + }, + "createdAt": { + "type": "number", + "nullable": true + }, + "lastUsedAt": { + "type": "number", + "nullable": true + }, + "useCount": { + "type": "number", + "default": 0 + }, + "note": { + "type": "string", + "nullable": true + }, + "link": { + "type": "string" + } + } + }, + "SealDelegationCreateResult": { + "type": "object", + "required": [ + "id", + "token", + "link" + ], + "properties": { + "id": { + "type": "string" + }, + "token": { + "type": "string" + }, + "link": { + "type": "string" + } + } + }, + "SealUserCreateResult": { + "type": "object", + "required": [ + "userId", + "password" + ], + "properties": { + "userId": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "SealUserResetPasswordResult": { + "type": "object", + "required": [ + "password" + ], + "properties": { + "password": { + "type": "string" + } + } + }, + "SealUserDetail": { + "type": "object", + "required": [ + "_id", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "email": { + "type": "string" + }, + "departmentIds": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "status": { + "type": "string" + }, + "permissions": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "SealContactSearchResult": { + "type": "object", + "required": [ + "departments", + "users" + ], + "properties": { + "departments": { + "type": "array", + "items": { + "type": "object" + } + }, + "users": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SealUserDetail" + } + } + } + }, + "LlmConfig": { + "type": "object", + "required": [ + "provider" + ], + "properties": { + "provider": { + "type": "string" + }, + "config": { + "type": "object" + } + } + }, + "LlmProvider": { + "type": "object", + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "available": { + "type": "boolean", + "default": true + }, + "fields": { + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "AvailablePermissionsData": { + "type": "object", + "required": [ + "permissions" + ], + "properties": { + "permissions": { + "type": "array", + "items": { + "type": "object", + "required": [ + "key", + "name" + ], + "properties": { + "key": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + } + } + } + } + } + }, + "PermissionConfigsData": { + "type": "object", + "required": [ + "configs" + ], + "properties": { + "configs": { + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "BillingStatusData": { + "type": "object", + "required": [ + "subscriptions", + "features" + ], + "properties": { + "subscriptions": { + "type": "array", + "items": { + "type": "object" + } + }, + "features": { + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "SimulationBatchParams": { + "type": "object", + "required": [ + "approvalCode" + ], + "properties": { + "approvalCode": { + "type": "string" + }, + "nodeId": { + "type": "string" + }, + "flowIds": { + "type": "array", + "items": { + "type": "string" + }, + "maxItems": 100 + }, + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 100 + }, + "dataCollectionMode": { + "type": "string" + }, + "signKey": { + "type": "string" + }, + "rejectNodeName": { + "type": "string", + "nullable": true + }, + "skipInvoiceGeneration": { + "type": "boolean" + }, + "skipExpenseExtraction": { + "type": "boolean" + }, + "disableAttachmentCache": { + "type": "boolean" + }, + "thinkingDepthOverride": { + "type": "string", + "enum": [ + "default", + "medium", + "high" + ] + }, + "templateId": { + "type": "string" + }, + "packageIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "packageLabel": { + "type": "string" + }, + "runMode": { + "type": "string" + } + } + }, + "SimulationBatch": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "approvalCode": { + "type": "string" + }, + "nodeId": { + "type": "string" + }, + "sourceSystem": { + "type": "string" + }, + "status": { + "type": "string" + }, + "totalCount": { + "type": "number", + "default": 0 + }, + "processedCount": { + "type": "number", + "default": 0 + }, + "successCount": { + "type": "number", + "default": 0 + }, + "failedCount": { + "type": "number", + "default": 0 + }, + "createdCount": { + "type": "number", + "default": 0 + }, + "createFailedCount": { + "type": "number", + "default": 0 + }, + "params": { + "$ref": "#/components/schemas/SimulationBatchParams" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "SimulationCreateResult": { + "type": "object", + "required": [ + "batchId" + ], + "properties": { + "batchId": { + "type": "string" + } + } + }, + "SimulationTemplate": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "approvalSystem": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "SimulationIntegrationStatus": { + "type": "object", + "required": [ + "hasFeishu", + "hasHosecloud", + "hasWeaver", + "hasHelios", + "hasMaycur", + "hasMaycurStandard" + ], + "properties": { + "hasFeishu": { + "type": "boolean" + }, + "hasHosecloud": { + "type": "boolean" + }, + "hasWeaver": { + "type": "boolean" + }, + "hasHelios": { + "type": "boolean" + }, + "hasMaycur": { + "type": "boolean" + }, + "hasMaycurStandard": { + "type": "boolean" + } + } + }, + "SimulationHosecloudIntegration": { + "type": "object", + "properties": { + "signKey": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "corporationId": { + "type": "string" + } + } + }, + "SimulationSpecification": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "approvalSystem": { + "type": "string" + } + } + }, + "MaterialPackage": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + }, + "tenantId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "templateId": { + "type": "string" + }, + "originalFileName": { + "type": "string" + }, + "status": { + "type": "string" + }, + "documentCount": { + "type": "number" + }, + "attachmentCount": { + "type": "number" + }, + "uploadedBy": { + "type": "string" + } + } + } + } + } +} diff --git a/package.json b/package.json index 6e9e01e..4f1a36f 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "build:plugin": "node scripts/build-plugin.mjs", "bump": "bun run scripts/bump-version.ts", "openapi:bundle": "bun run scripts/bundle-openapi.ts", + "openapi:raw": "bun run scripts/generate-raw-openapi.ts", "test": "bun test" }, "dependencies": { diff --git a/scripts/generate-raw-openapi.ts b/scripts/generate-raw-openapi.ts new file mode 100644 index 0000000..03510e6 --- /dev/null +++ b/scripts/generate-raw-openapi.ts @@ -0,0 +1,1823 @@ +#!/usr/bin/env bun + +import { mkdirSync, writeFileSync } from "node:fs"; +import { dirname, resolve } from "node:path"; + +const outputFile = resolve("dist/raw-seal-openapi.json"); + +const spec = { + openapi: "3.1.0", + info: { + title: "Seal AI Downstream Native API", + version: "1.0.0", + description: "Raw downstream Seal AI and HoseCloud business API contracts (without seal-home wrapper layer)." + }, + servers: [ + { + url: "https://seal.example.com", + description: "Downstream Seal AI server root" + } + ], + security: [ + { + bearerAuth: [] + } + ], + tags: [ + { name: "Auth & Session", description: "身份验证、当前会话与 SSO 换票" }, + { name: "Approval Rules", description: "审批规则草稿、版本快照与发布" }, + { name: "Knowledge Documents", description: "知识库规章与文档管理" }, + { name: "Agent & Style Preferences", description: "审批偏好、深度策略与 Webhook 集成" }, + { name: "Approval Runs", description: "审批记录、AI 决策结果与原始单据" }, + { name: "Simulation & Testing", description: "仿真批次、单据模板与材料包测试" }, + { name: "Delegation", description: "转授权令牌与协助链接" }, + { name: "Contacts & Users", description: "部门架构与用户管理" }, + { name: "HoseCloud OEM Integration", description: "合思企业绑定与出站 Webhook 配置" }, + { name: "System, LLM & Billing", description: "大模型设置、系统权限与计费套餐" } + ], + paths: { + "/api/v1/auth/me": { + get: { + tags: ["Auth & Session"], + summary: "获取当前登录用户与租户信息", + operationId: "getMe", + responses: { + "200": { + description: "当前身份信息", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/MeData" } + } + } + } + } + } + }, + "/api/auth/get-session": { + get: { + tags: ["Auth & Session"], + summary: "获取当前会话及转授权信息", + operationId: "getSession", + responses: { + "200": { + description: "当前会话数据", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SealSessionData" } + } + } + } + } + } + }, + "/api/auth/sms-otp/sign-in-password": { + post: { + tags: ["Auth & Session"], + summary: "手机号与密码登录", + operationId: "loginWithPhonePassword", + requestBody: { + required: true, + content: { + "application/json": { + schema: { + type: "object", + required: ["phone", "password"], + properties: { + phone: { type: "string", description: "手机号" }, + password: { type: "string", description: "登录密码" } + } + } + } + } + }, + responses: { + "200": { + description: "登录结果与 Token", + content: { + "application/json": { + schema: { + type: "object", + properties: { + user: { type: "object" }, + session: { + type: "object", + properties: { + token: { type: "string" } + } + } + } + } + } + } + } + } + } + }, + "/api/auth/oauth2/session/oem-hosecloud": { + get: { + tags: ["Auth & Session"], + summary: "合思 OEM SSO 换取 Seal 会话 Token", + operationId: "oauthHosecloudSession", + parameters: [ + { + name: "token", + in: "query", + required: true, + schema: { type: "string" }, + description: "合思 closeapi 换票 token" + }, + { + name: "returnToken", + in: "query", + schema: { type: "string", default: "1" }, + description: "是否直接返回 token 字段" + } + ], + responses: { + "200": { + description: "换票会话", + content: { + "application/json": { + schema: { + type: "object", + properties: { + token: { type: "string" }, + accessToken: { type: "string" } + } + } + } + } + } + } + } + }, + "/api/v1/rules": { + get: { + tags: ["Approval Rules"], + summary: "获取当前草稿规则列表", + operationId: "listApprovalRules", + responses: { + "200": { + description: "规则列表数据", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalRulesData" } + } + } + } + } + }, + post: { + tags: ["Approval Rules"], + summary: "新增审批规则草稿", + operationId: "createApprovalRule", + requestBody: { + required: true, + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalRuleInput" } + } + } + }, + responses: { + "200": { + description: "创建成功的规则", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalRule" } + } + } + } + } + } + }, + "/api/v1/rules/{ruleId}": { + put: { + tags: ["Approval Rules"], + summary: "修改审批规则草稿", + operationId: "updateApprovalRule", + parameters: [ + { + name: "ruleId", + in: "path", + required: true, + schema: { type: "string" }, + description: "规则 ID" + } + ], + requestBody: { + required: true, + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalRuleUpdate" } + } + } + }, + responses: { + "200": { + description: "更新后的规则", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalRule" } + } + } + } + } + }, + delete: { + tags: ["Approval Rules"], + summary: "删除审批规则草稿", + operationId: "deleteApprovalRule", + parameters: [ + { + name: "ruleId", + in: "path", + required: true, + schema: { type: "string" }, + description: "规则 ID" + } + ], + responses: { + "200": { + description: "删除成功" + } + } + } + }, + "/api/v1/rules/batch-recode": { + post: { + tags: ["Approval Rules"], + summary: "规则批量重排与重编号", + operationId: "recodeApprovalRules", + responses: { + "200": { + description: "重排结果" + } + } + } + }, + "/api/v1/rule-set-versions": { + get: { + tags: ["Approval Rules"], + summary: "获取已发布规则版本列表", + operationId: "listApprovalRuleVersions", + responses: { + "200": { + description: "已发布规则版本列表", + content: { + "application/json": { + schema: { + type: "array", + items: { $ref: "#/components/schemas/RuleSetVersion" } + } + } + } + } + } + } + }, + "/api/v1/rule-set-versions/{versionId}": { + get: { + tags: ["Approval Rules"], + summary: "获取单个已发布规则版本详情", + operationId: "getApprovalRuleVersion", + parameters: [ + { + name: "versionId", + in: "path", + required: true, + schema: { type: "string" }, + description: "版本 ID" + } + ], + responses: { + "200": { + description: "版本详情", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/RuleSetVersion" } + } + } + } + } + } + }, + "/api/v1/rule-set-versions/publish": { + post: { + tags: ["Approval Rules"], + summary: "将当前草稿规则发布为正式版本", + operationId: "publishApprovalRuleVersion", + requestBody: { + required: true, + content: { + "application/json": { + schema: { + type: "object", + required: ["versionName"], + properties: { + versionName: { type: "string", description: "新版本名称" } + } + } + } + } + }, + responses: { + "200": { + description: "发布结果", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/PublishVersionData" } + } + } + } + } + } + }, + "/api/v1/knowledge/articles": { + get: { + tags: ["Knowledge Documents"], + summary: "获取知识库文档列表", + operationId: "listApprovalDocuments", + parameters: [ + { name: "offset", in: "query", schema: { type: "integer", default: 0 } }, + { name: "limit", in: "query", schema: { type: "integer", default: 20 } }, + { name: "sortBy", in: "query", schema: { type: "string", default: "createdAt" } }, + { name: "sortOrder", in: "query", schema: { type: "string", enum: ["asc", "desc"], default: "desc" } } + ], + responses: { + "200": { + description: "知识文档列表", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalDocumentListData" } + } + } + } + } + }, + post: { + tags: ["Knowledge Documents"], + summary: "新建知识库文档", + operationId: "createApprovalDocument", + requestBody: { + required: true, + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalDocumentInput" } + } + } + }, + responses: { + "200": { + description: "创建成功的文档", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalDocument" } + } + } + } + } + } + }, + "/api/v1/knowledge/articles/{documentId}": { + get: { + tags: ["Knowledge Documents"], + summary: "获取单个知识文档详情", + operationId: "getApprovalDocument", + parameters: [ + { name: "documentId", in: "path", required: true, schema: { type: "string" } } + ], + responses: { + "200": { + description: "知识文档详情", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalDocument" } + } + } + } + } + }, + patch: { + tags: ["Knowledge Documents"], + summary: "修改知识库文档", + operationId: "updateApprovalDocument", + parameters: [ + { name: "documentId", in: "path", required: true, schema: { type: "string" } } + ], + requestBody: { + required: true, + content: { + "application/json": { + schema: { + type: "object", + properties: { + attributes: { $ref: "#/components/schemas/ApprovalDocumentUpdate" } + } + } + } + } + }, + responses: { + "200": { + description: "更新后的文档", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalDocument" } + } + } + } + } + } + }, + "/api/v1/agent/ai-approval/config": { + get: { + tags: ["Agent & Style Preferences"], + summary: "获取 AI 审批配置与偏好", + operationId: "getApprovalStylePreferences", + responses: { + "200": { + description: "AI 审批偏好配置", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalStylePreferences" } + } + } + } + } + }, + patch: { + tags: ["Agent & Style Preferences"], + summary: "局部更新 AI 审批配置与偏好", + operationId: "patchApprovalStylePreferences", + requestBody: { + required: true, + content: { + "application/json": { + schema: { type: "object", description: "部分偏好字段" } + } + } + }, + responses: { + "200": { + description: "更新后的偏好配置", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalStylePreferences" } + } + } + } + } + }, + post: { + tags: ["Agent & Style Preferences"], + summary: "覆盖保存 AI 审批配置与偏好", + operationId: "saveApprovalStylePreferences", + requestBody: { + required: true, + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalStylePreferences" } + } + } + }, + responses: { + "200": { + description: "保存结果" + } + } + } + }, + "/api/v1/integrations/webhook/{webhookId}/document": { + post: { + tags: ["Agent & Style Preferences"], + summary: "接收外部 Webhook 审批进单", + operationId: "incomingWebhookDocument", + parameters: [ + { name: "webhookId", in: "path", required: true, schema: { type: "string" } } + ], + requestBody: { + required: true, + content: { + "application/json": { + schema: { type: "object", description: "单据原始 payload" } + } + } + }, + responses: { + "200": { + description: "进单响应" + } + } + } + }, + "/api/v1/integrations/webhook/{webhookId}/manual-result": { + post: { + tags: ["Agent & Style Preferences"], + summary: "接收外部 Webhook 人工终审结果回传", + operationId: "incomingWebhookManualResult", + parameters: [ + { name: "webhookId", in: "path", required: true, schema: { type: "string" } } + ], + requestBody: { + required: true, + content: { + "application/json": { + schema: { type: "object", description: "人工审批结论" } + } + } + }, + responses: { + "200": { + description: "回传响应" + } + } + } + }, + "/api/v1/approvals": { + get: { + tags: ["Approval Runs"], + summary: "查询审批运行记录列表", + operationId: "listApprovalRuns", + parameters: [ + { name: "offset", in: "query", schema: { type: "integer", default: 0 } }, + { name: "limit", in: "query", schema: { type: "integer", default: 50 } }, + { name: "startDate", in: "query", schema: { type: "string" }, description: "开始日期 YYYY-MM-DD" }, + { name: "endDate", in: "query", schema: { type: "string" }, description: "结束日期 YYYY-MM-DD" }, + { name: "status", in: "query", schema: { type: "string" } }, + { name: "sourceSystem", in: "query", schema: { type: "string" } }, + { name: "taskMode", in: "query", schema: { type: "string" } }, + { name: "search", in: "query", schema: { type: "string" } }, + { name: "sourceDocumentSN", in: "query", schema: { type: "string" } }, + { name: "sourceDocumentId", in: "query", schema: { type: "string" } } + ], + responses: { + "200": { + description: "审批运行记录列表", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalRunListData" } + } + } + } + } + } + }, + "/api/v1/approvals/{runId}": { + get: { + tags: ["Approval Runs"], + summary: "获取单条审批运行记录详情", + operationId: "getApprovalRun", + parameters: [ + { name: "runId", in: "path", required: true, schema: { type: "string" } } + ], + responses: { + "200": { + description: "审批运行详情", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/ApprovalRun" } + } + } + } + } + } + }, + "/api/v1/simulation/create-batch": { + post: { + tags: ["Simulation & Testing"], + summary: "创建合思指定单号/条件仿真测试批次", + operationId: "createSimulationBatch", + requestBody: { + required: true, + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SimulationBatchParams" } + } + } + }, + responses: { + "200": { + description: "创建结果", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SimulationCreateResult" } + } + } + } + } + } + }, + "/api/v1/simulation/create-material-pack-batch": { + post: { + tags: ["Simulation & Testing"], + summary: "创建材料包仿真测试批次", + operationId: "createMaterialPackBatch", + requestBody: { + required: true, + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SimulationBatchParams" } + } + } + }, + responses: { + "200": { + description: "创建结果", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SimulationCreateResult" } + } + } + } + } + } + }, + "/api/v1/simulation/batches": { + get: { + tags: ["Simulation & Testing"], + summary: "获取仿真测试批次列表", + operationId: "listSimulationBatches", + parameters: [ + { name: "limit", in: "query", schema: { type: "integer", default: 50 } } + ], + responses: { + "200": { + description: "仿真批次列表", + content: { + "application/json": { + schema: { + type: "array", + items: { $ref: "#/components/schemas/SimulationBatch" } + } + } + } + } + } + } + }, + "/api/v1/simulation/batch/{batchId}": { + get: { + tags: ["Simulation & Testing"], + summary: "获取单个仿真测试批次详情", + operationId: "getSimulationBatch", + parameters: [ + { name: "batchId", in: "path", required: true, schema: { type: "string" } } + ], + responses: { + "200": { + description: "仿真批次详情", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SimulationBatch" } + } + } + } + } + } + }, + "/api/v1/simulation/batch/{batchId}/records": { + get: { + tags: ["Simulation & Testing"], + summary: "获取仿真批次产生的审批记录", + operationId: "listSimulationBatchRecords", + parameters: [ + { name: "batchId", in: "path", required: true, schema: { type: "string" } } + ], + responses: { + "200": { + description: "审批记录列表", + content: { + "application/json": { + schema: { + type: "array", + items: { $ref: "#/components/schemas/ApprovalRun" } + } + } + } + } + } + } + }, + "/api/v1/simulation/batch/{batchId}/data": { + delete: { + tags: ["Simulation & Testing"], + summary: "清理仿真批次生成的业务测试数据", + operationId: "cleanSimulationBatchData", + parameters: [ + { name: "batchId", in: "path", required: true, schema: { type: "string" } } + ], + responses: { + "200": { + description: "清理结果" + } + } + } + }, + "/api/v1/simulation/templates": { + get: { + tags: ["Simulation & Testing"], + summary: "获取仿真单据模板列表", + operationId: "listSimulationTemplates", + responses: { + "200": { + description: "模板列表", + content: { + "application/json": { + schema: { + type: "array", + items: { $ref: "#/components/schemas/SimulationTemplate" } + } + } + } + } + } + } + }, + "/api/v1/simulation/integration-status": { + get: { + tags: ["Simulation & Testing"], + summary: "获取各外部系统仿真对接可用状态", + operationId: "getSimulationIntegrationStatus", + responses: { + "200": { + description: "对接可用性状态", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SimulationIntegrationStatus" } + } + } + } + } + } + }, + "/api/v1/simulation/hosecloud-integrations": { + get: { + tags: ["Simulation & Testing"], + summary: "获取合思企业集成实例列表", + operationId: "listSimulationHosecloudIntegrations", + responses: { + "200": { + description: "合思集成实例列表", + content: { + "application/json": { + schema: { + type: "array", + items: { $ref: "#/components/schemas/SimulationHosecloudIntegration" } + } + } + } + } + } + } + }, + "/api/v1/simulation/hosecloud-specifications": { + get: { + tags: ["Simulation & Testing"], + summary: "获取合思审批流规格列表", + operationId: "listSimulationSpecifications", + responses: { + "200": { + description: "审批流规格列表", + content: { + "application/json": { + schema: { + type: "array", + items: { $ref: "#/components/schemas/SimulationSpecification" } + } + } + } + } + } + } + }, + "/api/v1/simulation/hosecloud-specifications-by-sign-key": { + get: { + tags: ["Simulation & Testing"], + summary: "按 signKey 获取合思审批流规格", + operationId: "listSimulationSpecificationsBySignKey", + parameters: [ + { name: "signKey", in: "query", required: true, schema: { type: "string" } } + ], + responses: { + "200": { + description: "审批流规格列表", + content: { + "application/json": { + schema: { + type: "array", + items: { $ref: "#/components/schemas/SimulationSpecification" } + } + } + } + } + } + } + }, + "/api/v1/material-packages/upload": { + post: { + tags: ["Simulation & Testing"], + summary: "上传材料包 ZIP 文件", + operationId: "uploadMaterialPackage", + requestBody: { + required: true, + content: { + "multipart/form-data": { + schema: { + type: "object", + required: ["file"], + properties: { + file: { type: "string", format: "binary", description: "材料包压缩文件" } + } + } + } + } + }, + responses: { + "200": { + description: "上传解析结果", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/MaterialPackage" } + } + } + } + } + } + }, + "/api/v1/delegation/list": { + get: { + tags: ["Delegation"], + summary: "获取转授权/协助令牌列表", + operationId: "listDelegations", + responses: { + "200": { + description: "转授权列表", + content: { + "application/json": { + schema: { + type: "array", + items: { $ref: "#/components/schemas/SealDelegationItem" } + } + } + } + } + } + } + }, + "/api/v1/delegation/create": { + post: { + tags: ["Delegation"], + summary: "创建转授权协助链接", + operationId: "createDelegation", + requestBody: { + required: false, + content: { + "application/json": { + schema: { + type: "object", + properties: { + note: { type: "string", description: "备注信息" } + } + } + } + } + }, + responses: { + "200": { + description: "创建结果与协助链接", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SealDelegationCreateResult" } + } + } + } + } + } + }, + "/api/v1/delegation/revoke": { + post: { + tags: ["Delegation"], + summary: "作废转授权令牌", + operationId: "revokeDelegation", + requestBody: { + required: true, + content: { + "application/json": { + schema: { + type: "object", + required: ["tokenId"], + properties: { + tokenId: { type: "string" } + } + } + } + } + }, + responses: { + "200": { + description: "作废结果" + } + } + } + }, + "/api/v1/contacts/departments/root/children": { + get: { + tags: ["Contacts & Users"], + summary: "获取根部门子部门列表", + operationId: "getRootDepartmentChildren", + responses: { + "200": { + description: "根部门子节点" + } + } + } + }, + "/api/v1/contacts/local/users": { + post: { + tags: ["Contacts & Users"], + summary: "创建本地用户", + operationId: "createLocalUser", + requestBody: { + required: true, + content: { + "application/json": { + schema: { + type: "object", + required: ["name", "phone"], + properties: { + name: { type: "string", description: "姓名" }, + phone: { type: "string", description: "手机号" }, + permissions: { type: "array", items: { type: "string" } }, + departmentIds: { type: "array", items: { type: "string" } } + } + } + } + } + }, + responses: { + "200": { + description: "创建结果与初始密码", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SealUserCreateResult" } + } + } + } + } + } + }, + "/api/v1/contacts/local/users/{userId}/reset-password": { + post: { + tags: ["Contacts & Users"], + summary: "重置本地用户密码", + operationId: "resetUserPassword", + parameters: [ + { name: "userId", in: "path", required: true, schema: { type: "string" } } + ], + responses: { + "200": { + description: "重置后的临时密码", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SealUserResetPasswordResult" } + } + } + } + } + } + }, + "/api/v1/contacts/users/{userId}": { + get: { + tags: ["Contacts & Users"], + summary: "获取用户详情", + operationId: "getUserDetail", + parameters: [ + { name: "userId", in: "path", required: true, schema: { type: "string" } } + ], + responses: { + "200": { + description: "用户详情", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SealUserDetail" } + } + } + } + } + } + }, + "/api/v1/contacts/search": { + get: { + tags: ["Contacts & Users"], + summary: "按关键字或手机号搜索用户/部门", + operationId: "searchUsers", + parameters: [ + { name: "query", in: "query", schema: { type: "string" } } + ], + responses: { + "200": { + description: "搜索命中结果", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/SealContactSearchResult" } + } + } + } + } + } + }, + "/api/v1/contacts/local/users/{userId}": { + delete: { + tags: ["Contacts & Users"], + summary: "删除/离职本地用户", + operationId: "deleteLocalUser", + parameters: [ + { name: "userId", in: "path", required: true, schema: { type: "string" } } + ], + responses: { + "200": { + description: "操作结果" + } + } + } + }, + "/api/v1/contacts/local/users/{userId}/activate": { + post: { + tags: ["Contacts & Users"], + summary: "重新激活离职用户", + operationId: "activateLocalUser", + parameters: [ + { name: "userId", in: "path", required: true, schema: { type: "string" } } + ], + responses: { + "200": { + description: "激活结果" + } + } + } + }, + "/api/hosecloud/corporation": { + post: { + tags: ["HoseCloud OEM Integration"], + summary: "验证并获取合思企业 CorporationId", + operationId: "getHosecloudCorporation", + requestBody: { + required: true, + content: { + "application/json": { + schema: { + type: "object", + required: ["apiKey", "apiSecret"], + properties: { + apiKey: { type: "string" }, + apiSecret: { type: "string" }, + apiOrigin: { type: "string", default: "production" }, + customApiUrl: { type: "string" } + } + } + } + } + }, + responses: { + "200": { + description: "企业 ID", + content: { + "application/json": { + schema: { + type: "object", + properties: { + corporationId: { type: "string" } + } + } + } + } + } + } + } + }, + "/api/hosecloud/outbound-config/sync": { + post: { + tags: ["HoseCloud OEM Integration"], + summary: "同步合思出站配置与回调 Webhook", + operationId: "syncHosecloudOutbound", + requestBody: { + required: true, + content: { + "application/json": { + schema: { + type: "object", + required: ["signKey", "webhookUrl", "completionWebhookUrl", "messageName", "mode"], + properties: { + signKey: { type: "string" }, + webhookUrl: { type: "string" }, + completionWebhookUrl: { type: "string" }, + messageName: { type: "string" }, + mode: { type: "string" } + } + } + } + } + }, + responses: { + "200": { + description: "同步结果" + } + } + } + }, + "/api/v1/llm/config": { + get: { + tags: ["System, LLM & Billing"], + summary: "获取当前租户大模型配置", + operationId: "getLlmConfig", + responses: { + "200": { + description: "大模型配置", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/LlmConfig" } + } + } + } + } + } + }, + "/api/v1/llm/providers": { + get: { + tags: ["System, LLM & Billing"], + summary: "获取系统支持的大模型提供商列表", + operationId: "listLlmProviders", + responses: { + "200": { + description: "大模型提供商", + content: { + "application/json": { + schema: { + type: "array", + items: { $ref: "#/components/schemas/LlmProvider" } + } + } + } + } + } + } + }, + "/api/v1/permissions/available": { + get: { + tags: ["System, LLM & Billing"], + summary: "获取系统可用权限列表", + operationId: "listAvailablePermissions", + responses: { + "200": { + description: "可用权限列表", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/AvailablePermissionsData" } + } + } + } + } + } + }, + "/api/v1/permissions/configs": { + get: { + tags: ["System, LLM & Billing"], + summary: "获取系统权限配置", + operationId: "listPermissionConfigs", + responses: { + "200": { + description: "权限配置", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/PermissionConfigsData" } + } + } + } + } + } + }, + "/api/v1/billing/status": { + get: { + tags: ["System, LLM & Billing"], + summary: "获取租户订阅与计费状态", + operationId: "getBillingStatus", + responses: { + "200": { + description: "计费状态", + content: { + "application/json": { + schema: { $ref: "#/components/schemas/BillingStatusData" } + } + } + } + } + } + }, + "/api/v1/billing/plans": { + get: { + tags: ["System, LLM & Billing"], + summary: "获取计费套餐列表", + operationId: "listBillingPlans", + responses: { + "200": { + description: "套餐计划列表" + } + } + } + }, + "/api/v1/billing/features": { + get: { + tags: ["System, LLM & Billing"], + summary: "获取计费功能开关与额度", + operationId: "listBillingFeatures", + responses: { + "200": { + description: "功能特性与额度" + } + } + } + } + }, + components: { + securitySchemes: { + bearerAuth: { + type: "http", + scheme: "bearer", + bearerFormat: "JWT / Session Token", + description: "Seal AI 下游原生 Bearer 认证 Token" + } + }, + schemas: { + HosecloudStaff: { + type: "object", + required: ["staffId"], + properties: { + staffId: { type: "string" }, + name: { type: "string" }, + code: { type: "string", default: "" }, + bindTime: { type: "number" } + } + }, + SealUser: { + type: "object", + required: ["id", "tenantId", "name"], + properties: { + id: { type: "string" }, + tenantId: { type: "string" }, + name: { type: "string" }, + isAdmin: { type: "boolean", default: false }, + permissions: { type: "array", items: { type: "string" }, default: [] }, + providerUserId: { type: "string" }, + hosecloudStaff: { $ref: "#/components/schemas/HosecloudStaff" } + } + }, + HoseCorpConfig: { + type: "object", + properties: { + apiKey: { type: "string" }, + corporationId: { type: "string" }, + corporationName: { type: "string" } + } + }, + SealTenant: { + type: "object", + required: ["id", "name"], + properties: { + id: { type: "string" }, + name: { type: "string" }, + tenantSlug: { type: "string" }, + isDemo: { type: "boolean", default: false }, + logoUrl: { type: "string", nullable: true }, + hoseCorpConfig: { $ref: "#/components/schemas/HoseCorpConfig" } + } + }, + MeData: { + type: "object", + required: ["user", "tenant"], + properties: { + user: { $ref: "#/components/schemas/SealUser" }, + tenant: { $ref: "#/components/schemas/SealTenant" } + } + }, + SealSessionUser: { + type: "object", + required: ["id", "name"], + properties: { + id: { type: "string" }, + name: { type: "string" }, + email: { type: "string", nullable: true }, + emailVerified: { type: "boolean" }, + image: { type: "string", nullable: true }, + tenantId: { type: "string" }, + provider: { type: "string" }, + providerUserId: { type: "string" }, + mobile: { type: "string", nullable: true }, + status: { type: "string" }, + permissions: { type: "array", items: { type: "string" }, default: [] }, + isAdmin: { type: "boolean", default: false } + } + }, + SealSessionInfo: { + type: "object", + required: ["id", "expiresAt", "userId"], + properties: { + id: { type: "string" }, + token: { type: "string" }, + expiresAt: { type: "string" }, + createdAt: { type: "string" }, + updatedAt: { type: "string" }, + ipAddress: { type: "string" }, + userAgent: { type: "string" }, + userId: { type: "string" }, + delegationId: { type: "string", nullable: true } + } + }, + SealSessionData: { + type: "object", + required: ["user", "session"], + properties: { + user: { $ref: "#/components/schemas/SealSessionUser" }, + session: { $ref: "#/components/schemas/SealSessionInfo" } + } + }, + ApprovalRule: { + type: "object", + required: ["id", "description", "scope", "strictness"], + properties: { + id: { type: "string" }, + tenantId: { type: "string" }, + code: { type: "number" }, + description: { type: "string" }, + scope: { type: "string" }, + strictness: { type: "string" }, + status: { type: "string" }, + createdAt: { type: "number" }, + updatedAt: { type: "number" } + } + }, + ApprovalRuleInput: { + type: "object", + required: ["description", "scope", "strictness"], + properties: { + description: { type: "string" }, + scope: { type: "string" }, + strictness: { type: "string" } + } + }, + ApprovalRuleUpdate: { + type: "object", + properties: { + description: { type: "string" }, + scope: { type: "string" }, + strictness: { type: "string" } + } + }, + ApprovalRulesData: { + type: "object", + required: ["rules"], + properties: { + rules: { type: "array", items: { $ref: "#/components/schemas/ApprovalRule" } }, + hasPendingDeletes: { type: "boolean", default: false } + } + }, + PublishedRuleSnapshot: { + type: "object", + required: ["description", "scope", "strictness"], + properties: { + code: { type: "string" }, + description: { type: "string" }, + scope: { type: "string" }, + strictness: { type: "string" } + } + }, + RuleSetVersion: { + type: "object", + required: ["id", "versionNumber"], + properties: { + id: { type: "string" }, + tenantId: { type: "string" }, + versionNumber: { type: "number" }, + versionName: { type: "string", nullable: true }, + publishedBy: { type: "string", nullable: true }, + publishedByName: { type: "string", nullable: true }, + rules: { type: "array", items: { $ref: "#/components/schemas/PublishedRuleSnapshot" }, default: [] }, + publishedAt: { type: "number" }, + createdAt: { type: "number" } + } + }, + PublishVersionData: { + type: "object", + required: ["version", "rulesCount"], + properties: { + version: { $ref: "#/components/schemas/RuleSetVersion" }, + rulesCount: { type: "number" } + } + }, + ApprovalDocument: { + type: "object", + required: ["id", "title", "content"], + properties: { + id: { type: "string" }, + tenantId: { type: "string" }, + title: { type: "string" }, + purpose: { type: "string", default: "" }, + contentType: { type: "string", default: "policy" }, + content: { type: "string" }, + status: { type: "string", default: "published" }, + enabled: { type: "boolean", default: true }, + scenarios: { type: "array", items: { type: "string" }, default: [] }, + tags: { type: "array", items: { type: "string" }, default: [] }, + category: { type: "string", nullable: true }, + categoryTags: { type: "array", items: { type: "string" }, default: [] }, + createdBy: { type: "string", nullable: true }, + createdByName: { type: "string", nullable: true }, + createdAt: { type: "number" }, + updatedAt: { type: "number" }, + updatedBy: { type: "string", nullable: true }, + updatedByName: { type: "string", nullable: true }, + isDeleted: { type: "boolean", default: false } + } + }, + ApprovalDocumentInput: { + type: "object", + required: ["title", "purpose", "content"], + properties: { + title: { type: "string" }, + purpose: { type: "string" }, + content: { type: "string" }, + contentType: { type: "string", default: "policy" }, + status: { type: "string", default: "published" }, + scenarios: { type: "array", items: { type: "string" }, default: [] }, + tags: { type: "array", items: { type: "string" }, default: [] } + } + }, + ApprovalDocumentUpdate: { + type: "object", + properties: { + title: { type: "string" }, + purpose: { type: "string" }, + content: { type: "string" }, + contentType: { type: "string" }, + status: { type: "string" }, + enabled: { type: "boolean" }, + scenarios: { type: "array", items: { type: "string" } }, + tags: { type: "array", items: { type: "string" } } + } + }, + ApprovalDocumentListData: { + type: "object", + required: ["articles"], + properties: { + articles: { type: "array", items: { $ref: "#/components/schemas/ApprovalDocument" } }, + total: { type: "number" } + } + }, + DecisionPreferences: { + type: "object", + properties: { + explicitApprove: { type: "string", default: "" }, + explicitReject: { type: "string", default: "" }, + exemptApprove: { type: "string", default: "" }, + review: { type: "string", default: "" } + } + }, + WebhookEndpoint: { + type: "object", + required: ["id", "url"], + properties: { + id: { type: "string" }, + url: { type: "string", format: "uri" } + } + }, + WebhookIntegration: { + type: "object", + required: ["type", "id", "name", "mode", "incomingDocumentWebhook", "outgoingResultWebhook", "incomingManualResultWebhook", "secret"], + properties: { + type: { type: "string", enum: ["webhook"] }, + id: { type: "string" }, + name: { type: "string" }, + mode: { type: "string", enum: ["assisted", "semi_automatic", "fully_automatic"] }, + incomingDocumentWebhook: { $ref: "#/components/schemas/WebhookEndpoint" }, + outgoingResultWebhook: { type: "string", format: "uri" }, + incomingManualResultWebhook: { $ref: "#/components/schemas/WebhookEndpoint" }, + secret: { type: "string" }, + autoApprovalRate: { type: "integer", minimum: 0, maximum: 100 } + } + }, + ApprovalIntegration: { + type: "object", + required: ["type"], + properties: { + type: { type: "string" }, + signKey: { type: "string" }, + outboundName: { type: "string" }, + mode: { type: "string" }, + autoApprovalRate: { type: "number" }, + apiKey: { type: "string" }, + apiSecret: { type: "string" }, + apiOrigin: { type: "string" }, + corporationId: { type: "string" } + } + }, + ApprovalStylePreferences: { + type: "object", + properties: { + id: { type: "string" }, + tenantId: { type: "string" }, + tone: { type: "string" }, + language: { type: "string" }, + detailLevel: { type: "string" }, + outputFormat: { type: "string" }, + examples: { type: "array", items: { type: "string" }, default: [] }, + prohibitedPhrases: { type: "array", items: { type: "string" }, default: [] }, + customInstructions: { type: "string" }, + updatedAt: { type: "number" }, + decisionPreferences: { $ref: "#/components/schemas/DecisionPreferences" }, + integrationSystem: { type: "string" }, + integrations: { + type: "array", + items: { $ref: "#/components/schemas/ApprovalIntegration" }, + default: [] + } + } + }, + ApprovalRunDocument: { + type: "object", + properties: { + id: { type: "string" }, + sn: { type: "string" }, + title: { type: "string" }, + name: { type: "string" }, + fields: { type: "array", items: { type: "object" } } + } + }, + ApprovalRunSourceExtendData: { + type: "object", + properties: { + _langfuseTraceId: { type: "string" }, + simulation_batch_id: { type: "string" } + } + }, + ApprovalRun: { + type: "object", + required: ["id"], + properties: { + id: { type: "string" }, + tenantId: { type: "string" }, + agentId: { type: "string" }, + status: { type: "string" }, + taskMode: { type: "string" }, + finalExecutionMode: { type: "string" }, + sourceSystem: { type: "string" }, + sourceDocumentSN: { type: "string" }, + sourceDocumentId: { type: "string" }, + documentId: { type: "string" }, + document: { $ref: "#/components/schemas/ApprovalRunDocument" }, + result: { type: "object" }, + pipelineData: { type: "object" }, + sourceExtendData: { $ref: "#/components/schemas/ApprovalRunSourceExtendData" }, + ruleSetVersionNumber: { type: "number" }, + ruleSetPublishedAt: { type: "number" }, + ruleSetPublishedByName: { type: "string" }, + createdAt: { type: "string" }, + updatedAt: { type: "string" } + } + }, + ApprovalRunListData: { + type: "object", + required: ["records"], + properties: { + records: { type: "array", items: { $ref: "#/components/schemas/ApprovalRun" } }, + total: { type: "number" }, + page: { type: "number" }, + pageSize: { type: "number" } + } + }, + SealDelegationItem: { + type: "object", + required: ["id", "link"], + properties: { + id: { type: "string" }, + expiresAt: { type: "number", nullable: true }, + revokedAt: { type: "number", nullable: true }, + createdAt: { type: "number", nullable: true }, + lastUsedAt: { type: "number", nullable: true }, + useCount: { type: "number", default: 0 }, + note: { type: "string", nullable: true }, + link: { type: "string" } + } + }, + SealDelegationCreateResult: { + type: "object", + required: ["id", "token", "link"], + properties: { + id: { type: "string" }, + token: { type: "string" }, + link: { type: "string" } + } + }, + SealUserCreateResult: { + type: "object", + required: ["userId", "password"], + properties: { + userId: { type: "string" }, + password: { type: "string" } + } + }, + SealUserResetPasswordResult: { + type: "object", + required: ["password"], + properties: { + password: { type: "string" } + } + }, + SealUserDetail: { + type: "object", + required: ["_id", "name"], + properties: { + _id: { type: "string" }, + tenantId: { type: "string" }, + name: { type: "string" }, + mobile: { type: "string" }, + email: { type: "string" }, + departmentIds: { type: "array", items: { type: "string" }, default: [] }, + status: { type: "string" }, + permissions: { type: "array", items: { type: "string" }, default: [] }, + createdAt: { type: "string" }, + updatedAt: { type: "string" } + } + }, + SealContactSearchResult: { + type: "object", + required: ["departments", "users"], + properties: { + departments: { type: "array", items: { type: "object" } }, + users: { type: "array", items: { $ref: "#/components/schemas/SealUserDetail" } } + } + }, + LlmConfig: { + type: "object", + required: ["provider"], + properties: { + provider: { type: "string" }, + config: { type: "object" } + } + }, + LlmProvider: { + type: "object", + required: ["id", "name"], + properties: { + id: { type: "string" }, + name: { type: "string" }, + description: { type: "string" }, + available: { type: "boolean", default: true }, + fields: { type: "array", items: { type: "object" } } + } + }, + AvailablePermissionsData: { + type: "object", + required: ["permissions"], + properties: { + permissions: { + type: "array", + items: { + type: "object", + required: ["key", "name"], + properties: { + key: { type: "string" }, + name: { type: "string" }, + description: { type: "string" } + } + } + } + } + }, + PermissionConfigsData: { + type: "object", + required: ["configs"], + properties: { + configs: { type: "array", items: { type: "object" } } + } + }, + BillingStatusData: { + type: "object", + required: ["subscriptions", "features"], + properties: { + subscriptions: { type: "array", items: { type: "object" } }, + features: { type: "array", items: { type: "object" } } + } + }, + SimulationBatchParams: { + type: "object", + required: ["approvalCode"], + properties: { + approvalCode: { type: "string" }, + nodeId: { type: "string" }, + flowIds: { type: "array", items: { type: "string" }, maxItems: 100 }, + limit: { type: "integer", minimum: 1, maximum: 100 }, + dataCollectionMode: { type: "string" }, + signKey: { type: "string" }, + rejectNodeName: { type: "string", nullable: true }, + skipInvoiceGeneration: { type: "boolean" }, + skipExpenseExtraction: { type: "boolean" }, + disableAttachmentCache: { type: "boolean" }, + thinkingDepthOverride: { type: "string", enum: ["default", "medium", "high"] }, + templateId: { type: "string" }, + packageIds: { type: "array", items: { type: "string" } }, + packageLabel: { type: "string" }, + runMode: { type: "string" } + } + }, + SimulationBatch: { + type: "object", + required: ["id"], + properties: { + id: { type: "string" }, + tenantId: { type: "string" }, + approvalCode: { type: "string" }, + nodeId: { type: "string" }, + sourceSystem: { type: "string" }, + status: { type: "string" }, + totalCount: { type: "number", default: 0 }, + processedCount: { type: "number", default: 0 }, + successCount: { type: "number", default: 0 }, + failedCount: { type: "number", default: 0 }, + createdCount: { type: "number", default: 0 }, + createFailedCount: { type: "number", default: 0 }, + params: { $ref: "#/components/schemas/SimulationBatchParams" }, + createdAt: { type: "string" }, + updatedAt: { type: "string" } + } + }, + SimulationCreateResult: { + type: "object", + required: ["batchId"], + properties: { + batchId: { type: "string" } + } + }, + SimulationTemplate: { + type: "object", + required: ["id"], + properties: { + id: { type: "string" }, + tenantId: { type: "string" }, + name: { type: "string" }, + description: { type: "string" }, + approvalSystem: { type: "string" }, + createdAt: { type: "string" }, + updatedAt: { type: "string" } + } + }, + SimulationIntegrationStatus: { + type: "object", + required: ["hasFeishu", "hasHosecloud", "hasWeaver", "hasHelios", "hasMaycur", "hasMaycurStandard"], + properties: { + hasFeishu: { type: "boolean" }, + hasHosecloud: { type: "boolean" }, + hasWeaver: { type: "boolean" }, + hasHelios: { type: "boolean" }, + hasMaycur: { type: "boolean" }, + hasMaycurStandard: { type: "boolean" } + } + }, + SimulationHosecloudIntegration: { + type: "object", + properties: { + signKey: { type: "string" }, + displayName: { type: "string" }, + corporationId: { type: "string" } + } + }, + SimulationSpecification: { + type: "object", + properties: { + id: { type: "string" }, + code: { type: "string" }, + name: { type: "string" }, + approvalSystem: { type: "string" } + } + }, + MaterialPackage: { + type: "object", + required: ["id"], + properties: { + id: { type: "string" }, + tenantId: { type: "string" }, + name: { type: "string" }, + templateId: { type: "string" }, + originalFileName: { type: "string" }, + status: { type: "string" }, + documentCount: { type: "number" }, + attachmentCount: { type: "number" }, + uploadedBy: { type: "string" } + } + } + } + } +}; + +mkdirSync(dirname(outputFile), { recursive: true }); +writeFileSync(outputFile, `${JSON.stringify(spec, null, 2)}\n`); +console.log(`Wrote ${outputFile}`);