#!/usr/bin/env bun import { mkdirSync, writeFileSync } from "node:fs"; import { dirname, resolve } from "node:path"; const outputFile = resolve("dist/raw-seal-openapi.json"); function dataResponse(description: string, dataSchema: any) { return { "200": { description, content: { "application/json": { schema: { type: "object", required: ["data"], properties: { data: dataSchema } } } } }, "401": { description: "未授权或 Token 无效", content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } } }, "400": { description: "请求参数错误", content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } } } }; } 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://{corpId}.sealai.cc", description: "Seal AI 企业租户环境 (例如: https://id01jdq2yidnmr.sealai.cc)", variables: { corpId: { default: "id01jdq2yidnmr", description: "合思/Seal 企业租户 ID (小写)" } } } ], 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"], "x-apifox-folder": "原始业务接口/Auth & Session", summary: "获取当前登录用户与租户信息", operationId: "getMe", responses: dataResponse("当前身份信息", { $ref: "#/components/schemas/MeData" }) } }, "/api/auth/get-session": { get: { tags: ["Auth & Session"], "x-apifox-folder": "原始业务接口/Auth & Session", summary: "获取当前会话及转授权信息", operationId: "getSession", responses: dataResponse("当前会话数据", { $ref: "#/components/schemas/SealSessionData" }) } }, "/api/auth/sms-otp/sign-in-password": { post: { tags: ["Auth & Session"], "x-apifox-folder": "原始业务接口/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" } } } } } } } }, "401": { description: "认证失败", content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } } } } } }, "/api/auth/oauth2/session/oem-hosecloud": { get: { tags: ["Auth & Session"], "x-apifox-folder": "原始业务接口/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" } } } } } }, "400": { description: "换票失败", content: { "application/json": { schema: { $ref: "#/components/schemas/ErrorResponse" } } } } } } }, "/api/v1/rules": { get: { tags: ["Approval Rules"], "x-apifox-folder": "原始业务接口/Approval Rules", summary: "获取当前草稿规则列表", operationId: "listApprovalRules", responses: dataResponse("规则列表数据", { $ref: "#/components/schemas/ApprovalRulesData" }) }, post: { tags: ["Approval Rules"], "x-apifox-folder": "原始业务接口/Approval Rules", summary: "新增审批规则草稿", operationId: "createApprovalRule", requestBody: { required: true, content: { "application/json": { schema: { $ref: "#/components/schemas/ApprovalRuleInput" } } } }, responses: dataResponse("创建成功的规则", { $ref: "#/components/schemas/ApprovalRule" }) } }, "/api/v1/rules/{ruleId}": { put: { tags: ["Approval Rules"], "x-apifox-folder": "原始业务接口/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: dataResponse("更新后的规则", { $ref: "#/components/schemas/ApprovalRule" }) }, delete: { tags: ["Approval Rules"], "x-apifox-folder": "原始业务接口/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"], "x-apifox-folder": "原始业务接口/Approval Rules", summary: "规则批量重排与重编号", operationId: "recodeApprovalRules", responses: { "200": { description: "重排结果" } } } }, "/api/v1/rule-set-versions": { get: { tags: ["Approval Rules"], "x-apifox-folder": "原始业务接口/Approval Rules", summary: "获取已发布规则版本列表", operationId: "listApprovalRuleVersions", responses: dataResponse("已发布规则版本列表", { type: "array", items: { $ref: "#/components/schemas/RuleSetVersion" } }) } }, "/api/v1/rule-set-versions/{versionId}": { get: { tags: ["Approval Rules"], "x-apifox-folder": "原始业务接口/Approval Rules", summary: "获取单个已发布规则版本详情", operationId: "getApprovalRuleVersion", parameters: [ { name: "versionId", in: "path", required: true, schema: { type: "string" }, description: "版本 ID" } ], responses: dataResponse("版本详情", { $ref: "#/components/schemas/RuleSetVersion" }) } }, "/api/v1/rule-set-versions/publish": { post: { tags: ["Approval Rules"], "x-apifox-folder": "原始业务接口/Approval Rules", summary: "将当前草稿规则发布为正式版本", operationId: "publishApprovalRuleVersion", requestBody: { required: true, content: { "application/json": { schema: { type: "object", required: ["versionName"], properties: { versionName: { type: "string", description: "新版本名称" } } } } } }, responses: dataResponse("发布结果", { $ref: "#/components/schemas/PublishVersionData" }) } }, "/api/v1/knowledge/articles": { get: { tags: ["Knowledge Documents"], "x-apifox-folder": "原始业务接口/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: dataResponse("知识文档列表", { $ref: "#/components/schemas/ApprovalDocumentListData" }) }, post: { tags: ["Knowledge Documents"], "x-apifox-folder": "原始业务接口/Knowledge Documents", summary: "新建知识库文档", operationId: "createApprovalDocument", requestBody: { required: true, content: { "application/json": { schema: { $ref: "#/components/schemas/ApprovalDocumentInput" } } } }, responses: dataResponse("创建成功的文档", { $ref: "#/components/schemas/ApprovalDocument" }) } }, "/api/v1/knowledge/articles/{documentId}": { get: { tags: ["Knowledge Documents"], "x-apifox-folder": "原始业务接口/Knowledge Documents", summary: "获取单个知识文档详情", operationId: "getApprovalDocument", parameters: [ { name: "documentId", in: "path", required: true, schema: { type: "string" } } ], responses: dataResponse("知识文档详情", { $ref: "#/components/schemas/ApprovalDocument" }) }, patch: { tags: ["Knowledge Documents"], "x-apifox-folder": "原始业务接口/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: dataResponse("更新后的文档", { $ref: "#/components/schemas/ApprovalDocument" }) } }, "/api/v1/agent/ai-approval/config": { get: { tags: ["Agent & Style Preferences"], "x-apifox-folder": "原始业务接口/Agent & Style Preferences", summary: "获取 AI 审批配置与偏好", operationId: "getApprovalStylePreferences", responses: dataResponse("AI 审批偏好配置", { $ref: "#/components/schemas/ApprovalStylePreferences" }) }, patch: { tags: ["Agent & Style Preferences"], "x-apifox-folder": "原始业务接口/Agent & Style Preferences", summary: "局部更新 AI 审批配置与偏好", operationId: "patchApprovalStylePreferences", requestBody: { required: true, content: { "application/json": { schema: { type: "object", description: "部分偏好字段" } } } }, responses: dataResponse("更新后的偏好配置", { $ref: "#/components/schemas/ApprovalStylePreferences" }) }, post: { tags: ["Agent & Style Preferences"], "x-apifox-folder": "原始业务接口/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"], "x-apifox-folder": "原始业务接口/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"], "x-apifox-folder": "原始业务接口/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"], "x-apifox-folder": "原始业务接口/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: dataResponse("审批运行记录列表", { $ref: "#/components/schemas/ApprovalRunListData" }) } }, "/api/v1/approvals/{runId}": { get: { tags: ["Approval Runs"], "x-apifox-folder": "原始业务接口/Approval Runs", summary: "获取单条审批运行记录详情", operationId: "getApprovalRun", parameters: [ { name: "runId", in: "path", required: true, schema: { type: "string" } } ], responses: dataResponse("审批运行详情", { $ref: "#/components/schemas/ApprovalRun" }) } }, "/api/v1/simulation/create-batch": { post: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/Simulation & Testing", summary: "创建合思指定单号/条件仿真测试批次", operationId: "createSimulationBatch", requestBody: { required: true, content: { "application/json": { schema: { $ref: "#/components/schemas/SimulationBatchParams" } } } }, responses: dataResponse("创建结果", { $ref: "#/components/schemas/SimulationCreateResult" }) } }, "/api/v1/simulation/create-material-pack-batch": { post: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/Simulation & Testing", summary: "创建材料包仿真测试批次", operationId: "createMaterialPackBatch", requestBody: { required: true, content: { "application/json": { schema: { $ref: "#/components/schemas/SimulationBatchParams" } } } }, responses: dataResponse("创建结果", { $ref: "#/components/schemas/SimulationCreateResult" }) } }, "/api/v1/simulation/batches": { get: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/Simulation & Testing", summary: "获取仿真测试批次列表", operationId: "listSimulationBatches", parameters: [ { name: "limit", in: "query", schema: { type: "integer", default: 50 } } ], responses: dataResponse("仿真批次列表", { type: "array", items: { $ref: "#/components/schemas/SimulationBatch" } }) } }, "/api/v1/simulation/batch/{batchId}": { get: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/Simulation & Testing", summary: "获取单个仿真测试批次详情", operationId: "getSimulationBatch", parameters: [ { name: "batchId", in: "path", required: true, schema: { type: "string" } } ], responses: dataResponse("仿真批次详情", { $ref: "#/components/schemas/SimulationBatch" }) } }, "/api/v1/simulation/batch/{batchId}/records": { get: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/Simulation & Testing", summary: "获取仿真批次产生的审批记录", operationId: "listSimulationBatchRecords", parameters: [ { name: "batchId", in: "path", required: true, schema: { type: "string" } } ], responses: dataResponse("审批记录列表", { type: "array", items: { $ref: "#/components/schemas/ApprovalRun" } }) } }, "/api/v1/simulation/batch/{batchId}/data": { delete: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/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"], "x-apifox-folder": "原始业务接口/Simulation & Testing", summary: "获取仿真单据模板列表", operationId: "listSimulationTemplates", responses: dataResponse("模板列表", { type: "array", items: { $ref: "#/components/schemas/SimulationTemplate" } }) } }, "/api/v1/simulation/integration-status": { get: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/Simulation & Testing", summary: "获取各外部系统仿真对接可用状态", operationId: "getSimulationIntegrationStatus", responses: dataResponse("对接可用性状态", { $ref: "#/components/schemas/SimulationIntegrationStatus" }) } }, "/api/v1/simulation/hosecloud-integrations": { get: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/Simulation & Testing", summary: "获取合思企业集成实例列表", operationId: "listSimulationHosecloudIntegrations", responses: dataResponse("合思集成实例列表", { type: "array", items: { $ref: "#/components/schemas/SimulationHosecloudIntegration" } }) } }, "/api/v1/simulation/hosecloud-specifications": { get: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/Simulation & Testing", summary: "获取合思审批流规格列表", operationId: "listSimulationSpecifications", responses: dataResponse("审批流规格列表", { type: "array", items: { $ref: "#/components/schemas/SimulationSpecification" } }) } }, "/api/v1/simulation/hosecloud-specifications-by-sign-key": { get: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/Simulation & Testing", summary: "按 signKey 获取合思审批流规格", operationId: "listSimulationSpecificationsBySignKey", parameters: [ { name: "signKey", in: "query", required: true, schema: { type: "string" } } ], responses: dataResponse("审批流规格列表", { type: "array", items: { $ref: "#/components/schemas/SimulationSpecification" } }) } }, "/api/v1/material-packages/upload": { post: { tags: ["Simulation & Testing"], "x-apifox-folder": "原始业务接口/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: dataResponse("上传解析结果", { $ref: "#/components/schemas/MaterialPackage" }) } }, "/api/v1/delegation/list": { get: { tags: ["Delegation"], "x-apifox-folder": "原始业务接口/Delegation", summary: "获取转授权/协助令牌列表", operationId: "listDelegations", responses: dataResponse("转授权列表", { type: "array", items: { $ref: "#/components/schemas/SealDelegationItem" } }) } }, "/api/v1/delegation/create": { post: { tags: ["Delegation"], "x-apifox-folder": "原始业务接口/Delegation", summary: "创建转授权协助链接", operationId: "createDelegation", requestBody: { required: false, content: { "application/json": { schema: { type: "object", properties: { note: { type: "string", description: "备注信息" } } } } } }, responses: dataResponse("创建结果与协助链接", { $ref: "#/components/schemas/SealDelegationCreateResult" }) } }, "/api/v1/delegation/revoke": { post: { tags: ["Delegation"], "x-apifox-folder": "原始业务接口/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"], "x-apifox-folder": "原始业务接口/Contacts & Users", summary: "获取根部门子部门列表", operationId: "getRootDepartmentChildren", responses: { "200": { description: "根部门子节点" } } } }, "/api/v1/contacts/local/users": { post: { tags: ["Contacts & Users"], "x-apifox-folder": "原始业务接口/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: dataResponse("创建结果与初始密码", { $ref: "#/components/schemas/SealUserCreateResult" }) } }, "/api/v1/contacts/local/users/{userId}/reset-password": { post: { tags: ["Contacts & Users"], "x-apifox-folder": "原始业务接口/Contacts & Users", summary: "重置本地用户密码", operationId: "resetUserPassword", parameters: [ { name: "userId", in: "path", required: true, schema: { type: "string" } } ], responses: dataResponse("重置后的临时密码", { $ref: "#/components/schemas/SealUserResetPasswordResult" }) } }, "/api/v1/contacts/users/{userId}": { get: { tags: ["Contacts & Users"], "x-apifox-folder": "原始业务接口/Contacts & Users", summary: "获取用户详情", operationId: "getUserDetail", parameters: [ { name: "userId", in: "path", required: true, schema: { type: "string" } } ], responses: dataResponse("用户详情", { $ref: "#/components/schemas/SealUserDetail" }) } }, "/api/v1/contacts/search": { get: { tags: ["Contacts & Users"], "x-apifox-folder": "原始业务接口/Contacts & Users", summary: "按关键字或手机号搜索用户/部门", operationId: "searchUsers", parameters: [ { name: "query", in: "query", schema: { type: "string" } } ], responses: dataResponse("搜索命中结果", { $ref: "#/components/schemas/SealContactSearchResult" }) } }, "/api/v1/contacts/local/users/{userId}": { delete: { tags: ["Contacts & Users"], "x-apifox-folder": "原始业务接口/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"], "x-apifox-folder": "原始业务接口/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"], "x-apifox-folder": "原始业务接口/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: dataResponse("企业 ID", { type: "object", properties: { corporationId: { type: "string" } } }) } }, "/api/hosecloud/outbound-config/sync": { post: { tags: ["HoseCloud OEM Integration"], "x-apifox-folder": "原始业务接口/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"], "x-apifox-folder": "原始业务接口/System, LLM & Billing", summary: "获取当前租户大模型配置", operationId: "getLlmConfig", responses: dataResponse("大模型配置", { $ref: "#/components/schemas/LlmConfig" }) } }, "/api/v1/llm/providers": { get: { tags: ["System, LLM & Billing"], "x-apifox-folder": "原始业务接口/System, LLM & Billing", summary: "获取系统支持的大模型提供商列表", operationId: "listLlmProviders", responses: dataResponse("大模型提供商", { type: "array", items: { $ref: "#/components/schemas/LlmProvider" } }) } }, "/api/v1/permissions/available": { get: { tags: ["System, LLM & Billing"], "x-apifox-folder": "原始业务接口/System, LLM & Billing", summary: "获取系统可用权限列表", operationId: "listAvailablePermissions", responses: dataResponse("可用权限列表", { $ref: "#/components/schemas/AvailablePermissionsData" }) } }, "/api/v1/permissions/configs": { get: { tags: ["System, LLM & Billing"], "x-apifox-folder": "原始业务接口/System, LLM & Billing", summary: "获取系统权限配置", operationId: "listPermissionConfigs", responses: dataResponse("权限配置", { $ref: "#/components/schemas/PermissionConfigsData" }) } }, "/api/v1/billing/status": { get: { tags: ["System, LLM & Billing"], "x-apifox-folder": "原始业务接口/System, LLM & Billing", summary: "获取租户订阅与计费状态", operationId: "getBillingStatus", responses: dataResponse("计费状态", { $ref: "#/components/schemas/BillingStatusData" }) } }, "/api/v1/billing/plans": { get: { tags: ["System, LLM & Billing"], "x-apifox-folder": "原始业务接口/System, LLM & Billing", summary: "获取计费套餐列表", operationId: "listBillingPlans", responses: { "200": { description: "套餐计划列表" } } } }, "/api/v1/billing/features": { get: { tags: ["System, LLM & Billing"], "x-apifox-folder": "原始业务接口/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 (Authorization: Bearer )" } }, schemas: { ErrorResponse: { type: "object", required: ["error"], properties: { error: { type: "object", required: ["code", "message"], properties: { code: { type: "string", description: "错误标识码 (例如: error:auth:invalid-token)" }, message: { type: "string", description: "错误详细描述" } } } } }, 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}`);