From 912ec7d77f4bef751f27413a17f5492101dbca32 Mon Sep 17 00:00:00 2001 From: zizi Date: Sun, 24 May 2026 20:38:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E6=90=AD=E5=BB=BA=20Muse=20?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AB=AF=E6=B2=BB=E7=90=86=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/muse/account/__tests__/index.spec.ts | 140 + .../web-antd/src/api/muse/account/index.ts | 599 +++ .../apps/web-antd/src/api/muse/ai/index.ts | 543 +++ .../api/muse/audit/__tests__/index.spec.ts | 63 + .../apps/web-antd/src/api/muse/audit/index.ts | 173 + .../apps/web-antd/src/api/muse/client.ts | 63 + .../__tests__/governance-api.test.ts | 179 + .../src/api/muse/governance/function-chain.ts | 271 ++ .../src/api/muse/governance/meta-schema.ts | 754 +++ .../src/api/muse/jobs/__tests__/index.spec.ts | 83 + .../apps/web-antd/src/api/muse/jobs/index.ts | 223 + .../muse/knowledge/__tests__/index.test.ts | 87 + .../web-antd/src/api/muse/knowledge/index.ts | 885 ++++ .../api/muse/market/__tests__/index.test.ts | 113 + .../web-antd/src/api/muse/market/index.ts | 541 +++ .../api/muse/newapi/__tests__/index.spec.ts | 96 + .../web-antd/src/api/muse/newapi/index.ts | 35 + .../apps/web-antd/src/api/types/account.ts | 2957 ++++++++++++ muse-admin/apps/web-antd/src/api/types/ai.ts | 3350 ++++++++++++++ .../apps/web-antd/src/api/types/base.ts | 140 + .../apps/web-antd/src/api/types/content.ts | 3898 ++++++++++++++++ .../apps/web-antd/src/api/types/index.ts | 11 + .../apps/web-antd/src/api/types/knowledge.ts | 4061 +++++++++++++++++ .../apps/web-antd/src/api/types/market.ts | 2970 ++++++++++++ .../apps/web-antd/src/api/types/meta.ts | 1560 +++++++ .../src/router/routes/modules/muse.ts | 117 + .../web-antd/src/views/muse/account/index.vue | 844 ++++ .../src/views/muse/ai/__tests__/index.test.ts | 213 + .../apps/web-antd/src/views/muse/ai/index.vue | 1026 +++++ .../web-antd/src/views/muse/audit/index.vue | 461 ++ .../muse/governance/function-orch/index.vue | 499 ++ .../muse/governance/meta-schema/detail.vue | 822 ++++ .../muse/governance/meta-schema/index.vue | 291 ++ .../web-antd/src/views/muse/jobs/index.vue | 705 +++ .../muse/knowledge/__tests__/index.test.ts | 71 + .../src/views/muse/knowledge/index.vue | 563 +++ .../views/muse/market/__tests__/index.test.ts | 86 + .../web-antd/src/views/muse/market/index.vue | 739 +++ .../web-antd/src/views/muse/newapi/index.vue | 758 +++ 39 files changed, 30990 insertions(+) create mode 100644 muse-admin/apps/web-antd/src/api/muse/account/__tests__/index.spec.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/account/index.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/ai/index.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/audit/__tests__/index.spec.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/audit/index.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/client.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/governance/__tests__/governance-api.test.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/governance/function-chain.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/governance/meta-schema.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/jobs/__tests__/index.spec.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/jobs/index.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/knowledge/__tests__/index.test.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/knowledge/index.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/market/__tests__/index.test.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/market/index.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/newapi/__tests__/index.spec.ts create mode 100644 muse-admin/apps/web-antd/src/api/muse/newapi/index.ts create mode 100644 muse-admin/apps/web-antd/src/api/types/account.ts create mode 100644 muse-admin/apps/web-antd/src/api/types/ai.ts create mode 100644 muse-admin/apps/web-antd/src/api/types/base.ts create mode 100644 muse-admin/apps/web-antd/src/api/types/content.ts create mode 100644 muse-admin/apps/web-antd/src/api/types/index.ts create mode 100644 muse-admin/apps/web-antd/src/api/types/knowledge.ts create mode 100644 muse-admin/apps/web-antd/src/api/types/market.ts create mode 100644 muse-admin/apps/web-antd/src/api/types/meta.ts create mode 100644 muse-admin/apps/web-antd/src/router/routes/modules/muse.ts create mode 100644 muse-admin/apps/web-antd/src/views/muse/account/index.vue create mode 100644 muse-admin/apps/web-antd/src/views/muse/ai/__tests__/index.test.ts create mode 100644 muse-admin/apps/web-antd/src/views/muse/ai/index.vue create mode 100644 muse-admin/apps/web-antd/src/views/muse/audit/index.vue create mode 100644 muse-admin/apps/web-antd/src/views/muse/governance/function-orch/index.vue create mode 100644 muse-admin/apps/web-antd/src/views/muse/governance/meta-schema/detail.vue create mode 100644 muse-admin/apps/web-antd/src/views/muse/governance/meta-schema/index.vue create mode 100644 muse-admin/apps/web-antd/src/views/muse/jobs/index.vue create mode 100644 muse-admin/apps/web-antd/src/views/muse/knowledge/__tests__/index.test.ts create mode 100644 muse-admin/apps/web-antd/src/views/muse/knowledge/index.vue create mode 100644 muse-admin/apps/web-antd/src/views/muse/market/__tests__/index.test.ts create mode 100644 muse-admin/apps/web-antd/src/views/muse/market/index.vue create mode 100644 muse-admin/apps/web-antd/src/views/muse/newapi/index.vue diff --git a/muse-admin/apps/web-antd/src/api/muse/account/__tests__/index.spec.ts b/muse-admin/apps/web-antd/src/api/muse/account/__tests__/index.spec.ts new file mode 100644 index 00000000..03fdc258 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/account/__tests__/index.spec.ts @@ -0,0 +1,140 @@ +import { beforeEach, describe, expect, it, vi } from 'vitest'; + +import { + createCallAttributionJobApi, + createNewApiBindingApi, + createQuotaAdjustmentApi, + createQuotaRequestApi, + getBalanceSnapshotsApi, + getCallAttributionJobApi, + getIntegrationCallByCorrelationApi, + getUserEntitlementsApi, + listAccountUsersApi, + listPurchaseRecordsApi, + listQuotaAdjustmentsApi, + listUsageRecordsApi, +} from '../index'; + +const { museAdminApiMock } = vi.hoisted(() => ({ + museAdminApiMock: { + get: vi.fn(), + post: vi.fn(), + }, +})); + +vi.mock('#/api/muse/client', () => ({ + museAdminApi: museAdminApiMock, +})); + +describe('muse account api', () => { + beforeEach(() => { + vi.clearAllMocks(); + }); + + it('按契约查询用户账户摘要列表', async () => { + await listAccountUsersApi({ pageNo: 1, pageSize: 20, status: 'active' }); + + expect(museAdminApiMock.get).toHaveBeenCalledWith('/account/users', { + pageNo: 1, + pageSize: 20, + status: 'active', + }); + }); + + it('按用户查询权益、配额调整和余额快照', async () => { + await getUserEntitlementsApi('user/1'); + await listQuotaAdjustmentsApi('user/1', { + pageNo: 1, + pageSize: 10, + sourceType: 'manual', + }); + await getBalanceSnapshotsApi('user/1', { pageNo: 1, pageSize: 10 }); + + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 1, + '/account/users/user%2F1/entitlements', + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 2, + '/account/users/user%2F1/quota-adjustments', + { pageNo: 1, pageSize: 10, sourceType: 'manual' }, + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 3, + '/account/users/user%2F1/balance-snapshots', + { pageNo: 1, pageSize: 10 }, + ); + }); + + it('提交需要审计和幂等键的账户命令', async () => { + await createQuotaAdjustmentApi('u1', { + adjustments: [ + { + beforeSnapshot: { limit: 100, remaining: 20, used: 80 }, + delta: 10, + resourceType: 'ai_tokens', + }, + ], + commandId: 'cmd-1', + reason: '人工补偿', + }); + await createNewApiBindingApi('u1', { + commandId: 'cmd-2', + reason: '绑定重验', + }); + await createQuotaRequestApi('u1', { + commandId: 'cmd-3', + requestType: 'balance_config', + }); + + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 1, + '/account/users/u1/quota-adjustments', + expect.objectContaining({ commandId: 'cmd-1', reason: '人工补偿' }), + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 2, + '/account/users/u1/new-api-binding', + expect.objectContaining({ commandId: 'cmd-2' }), + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 3, + '/account/users/u1/quota-requests', + expect.objectContaining({ commandId: 'cmd-3' }), + ); + }); + + it('查询 New-API 调用归属、外部调用、用量和购买摘要', async () => { + await createCallAttributionJobApi({ + commandId: 'cmd-4', + correlationId: 'corr-1', + }); + await getCallAttributionJobApi('job/1'); + await getIntegrationCallByCorrelationApi('corr/1'); + await listUsageRecordsApi({ pageNo: 1, pageSize: 20, userId: 'u1' }); + await listPurchaseRecordsApi({ pageNo: 1, pageSize: 20, status: 'failed' }); + + expect(museAdminApiMock.post).toHaveBeenCalledWith( + '/account/call-attribution-jobs', + expect.objectContaining({ commandId: 'cmd-4' }), + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 1, + '/account/call-attribution-jobs/job%2F1', + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 2, + '/account/integration-calls/by-correlation/corr%2F1', + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 3, + '/account/usage-records', + { pageNo: 1, pageSize: 20, userId: 'u1' }, + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 4, + '/account/purchase-records', + { pageNo: 1, pageSize: 20, status: 'failed' }, + ); + }); +}); diff --git a/muse-admin/apps/web-antd/src/api/muse/account/index.ts b/muse-admin/apps/web-antd/src/api/muse/account/index.ts new file mode 100644 index 00000000..b5b9bba4 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/account/index.ts @@ -0,0 +1,599 @@ +import type { PageResult } from '@vben/request'; + +import { museAdminApi } from '#/api/muse/client'; + +/** Muse 管理端通用 ID,后端对业务 ID 统一按字符串安全处理。 */ +export type MuseAdminId = number | string; + +/** 管理端分页查询参数。 */ +export interface MuseAdminPageQuery { + /** 查询参数索引签名,兼容 Muse client 的可序列化参数约束。 */ + [key: string]: boolean | number | string | undefined; + /** 当前页码,从 1 开始。 */ + pageNo: number; + /** 每页数量。 */ + pageSize: number; +} + +/** 账户状态:正常、受限、封禁。 */ +export type AccountStatus = 'active' | 'restricted' | 'suspended'; + +/** 配额状态:正常、低余量、耗尽、过期。 */ +export type QuotaStatus = 'expired' | 'exhausted' | 'low' | 'normal'; + +/** New-API 网关绑定状态。 */ +export type NewApiBindingStatus = + | 'bound' + | 'pending' + | 'sync_failed' + | 'unbound'; + +/** 配额调整来源类型。 */ +export type QuotaAdjustmentSourceType = + | 'export_rollback' + | 'manual' + | 'market_compensation' + | 'newapi_callback' + | 'plan_change'; + +/** 调用归属状态。 */ +export type AttributionStatus = 'attributed' | 'failed' | 'pending'; + +/** 购买记录状态。 */ +export type PurchaseStatus = 'completed' | 'failed' | 'processing' | 'refunded'; + +/** 账户列表查询条件。 */ +export interface AccountUserQuery extends MuseAdminPageQuery { + /** 昵称或账号 ID 关键词。 */ + keyword?: string; + /** 账号状态筛选。 */ + status?: AccountStatus; + /** 权益来源筛选。 */ + entitlementSource?: string; +} + +/** 管理端用户账户治理摘要。 */ +export interface AdminAccountUserSummary { + /** 用户 ID。 */ + userId: string; + /** 用户昵称,允许为脱敏昵称。 */ + nickname: string; + /** 头像 URL。 */ + avatar?: string; + /** 账号状态。 */ + status: AccountStatus; + /** 权益来源摘要。 */ + entitlementSource: string; + /** 配额状态。 */ + quotaStatus: QuotaStatus; + /** New-API 网关绑定状态。 */ + newApiBindingStatus?: NewApiBindingStatus; + /** 风险标记列表。 */ + riskFlags?: string[]; + /** 注册时间。 */ + createdAt?: string; + /** 最近活跃时间。 */ + lastActiveAt?: string; +} + +/** 用户权益项。 */ +export interface Entitlement { + /** 权益 ID。 */ + id: string; + /** 权益资源类型,例如 ai_tokens、storage、publish_slots。 */ + resourceType: string; + /** 额度上限,-1 表示无限制。 */ + limit: number; + /** 已使用量。 */ + used: number; + /** 剩余额度。 */ + remaining?: number; + /** 权益来源,例如套餐、管理员授权或市场补偿。 */ + source?: string; + /** 到期时间。 */ + expiresAt: string; +} + +/** 用户配额项。 */ +export interface Quota { + /** 配额 ID。 */ + id: string; + /** 配额资源类型。 */ + resourceType: string; + /** 总配额。 */ + total: number; + /** 已使用量。 */ + used?: number; + /** 剩余配额。 */ + remaining: number; + /** 配额重置时间。 */ + resetAt: string; + /** 每分钟频率限制。 */ + limitPerMinute?: number; +} + +/** 管理端用户权益和配额详情。 */ +export interface AdminUserEntitlementDetail { + /** 用户 ID。 */ + userId: string; + /** 权益列表。 */ + entitlements: Entitlement[]; + /** 配额列表。 */ + quotas: Quota[]; + /** 权益来源说明。 */ + entitlementSource?: string; + /** 最近权益变更时间。 */ + lastModifiedAt?: string; + /** 最近变更操作者脱敏摘要。 */ + lastModifiedBy?: string; +} + +/** 配额快照摘要。 */ +export interface QuotaSnapshot { + /** 额度上限。 */ + limit?: number; + /** 已使用量。 */ + used?: number; + /** 剩余额度。 */ + remaining?: number; +} + +/** 配额调整项。 */ +export interface QuotaAdjustmentItem { + /** 权益资源类型。 */ + resourceType: string; + /** 调整增量,正数增加,负数减少。 */ + delta: number; + /** 调整前权益快照,用于后端校验和审计。 */ + beforeSnapshot: QuotaSnapshot; + /** 新的到期时间。 */ + expiresAt?: string; +} + +/** 管理端配额调整请求。 */ +export interface QuotaAdjustmentRequest { + /** 幂等键,防止重复调整。 */ + commandId: string; + /** 调整项列表。 */ + adjustments: QuotaAdjustmentItem[]; + /** 调整原因,写入审计日志。 */ + reason: string; + /** 关联的外部调用 ID。 */ + correlationId?: string; + /** 审批或复核引用。 */ + approvalRef?: string; +} + +/** 配额调整结果。 */ +export interface QuotaAdjustmentResult { + /** 调整记录 ID。 */ + adjustmentId: string; + /** 请求幂等键。 */ + commandId: string; + /** 调整结果状态。 */ + status: 'applied' | 'idempotency_conflict' | 'idempotent_hit'; + /** 调整后权益快照。 */ + afterSnapshot?: QuotaSnapshot & { + /** 权益资源类型。 */ + resourceType?: string; + }; +} + +/** 配额调整记录查询条件。 */ +export interface QuotaAdjustmentQuery extends MuseAdminPageQuery { + /** 调整来源类型筛选。 */ + sourceType?: QuotaAdjustmentSourceType; +} + +/** 配额调整 ledger 记录。 */ +export interface QuotaAdjustmentLedgerEntry { + /** 调整记录 ID。 */ + adjustmentId: string; + /** 幂等键。 */ + commandId: string; + /** 调整来源类型。 */ + sourceType: QuotaAdjustmentSourceType; + /** 权益资源类型。 */ + resourceType: string; + /** 调整增量。 */ + delta: number; + /** 调整前快照。 */ + beforeSnapshot?: QuotaSnapshot; + /** 调整后快照。 */ + afterSnapshot?: QuotaSnapshot; + /** 关联外部调用 ID。 */ + correlationId?: string; + /** 调整原因。 */ + reason?: string; + /** 操作者脱敏摘要。 */ + operatorSummary: string; + /** 审计状态。 */ + auditStatus?: 'audited' | 'pending_audit'; + /** 调整时间。 */ + createdAt: string; +} + +/** New-API 绑定列表查询条件。 */ +export interface NewApiBindingQuery extends MuseAdminPageQuery { + /** 绑定状态筛选。 */ + bindingStatus?: NewApiBindingStatus; +} + +/** New-API 网关用户绑定摘要。 */ +export interface NewApiBindingSummary { + /** Muse 用户 ID。 */ + userId: string; + /** 用户昵称。 */ + nickname?: string; + /** 绑定状态。 */ + bindingStatus: NewApiBindingStatus; + /** 绑定时间。 */ + boundAt?: string; + /** 最近同步时间。 */ + lastSyncAt?: string; + /** 同步失败原因,仅失败时返回。 */ + syncErrorMessage?: string; +} + +/** 创建或刷新 New-API 绑定请求。 */ +export interface NewApiBindingCreateRequest { + /** 幂等键。 */ + commandId: string; + /** 是否强制刷新已有绑定。 */ + forceRefresh?: boolean; + /** 创建或刷新原因。 */ + reason?: string; +} + +/** New-API 网关绑定结果。 */ +export interface NewApiBindingResult { + /** 绑定记录 ID。 */ + bindingId: string; + /** 绑定操作结果状态。 */ + status: 'created' | 'idempotency_conflict' | 'idempotent_hit' | 'refreshed'; + /** 请求幂等键。 */ + commandId: string; + /** 绑定时间。 */ + boundAt?: string; +} + +/** 管理端发起 New-API 额度配置请求。 */ +export interface AdminQuotaRequestCreate { + /** 幂等键。 */ + commandId: string; + /** 额度配置类型。 */ + requestType: 'balance_config' | 'plan_config' | 'subscription_sync'; + /** 请求原因,写入审计日志。 */ + reason?: string; + /** 目标额度配置。 */ + targetQuota?: { + /** 权益资源类型。 */ + resourceType?: string; + /** 目标额度上限。 */ + limit?: number; + }; +} + +/** 额度配置请求创建结果。 */ +export interface QuotaRequestResult { + /** 额度请求 ID。 */ + requestId: string; + /** 外部调用关联 ID。 */ + correlationId: string; + /** 请求初始状态。 */ + status: 'idempotent_hit' | 'processing' | 'queued'; +} + +/** New-API 余额和权益快照条目。 */ +export interface BalanceSnapshotEntry { + /** 快照 ID。 */ + snapshotId: string; + /** 权益资源类型。 */ + resourceType: string; + /** 余额,不暴露供应商路由或成本策略。 */ + balance: number; + /** 已使用配额。 */ + usedQuota?: number; + /** 总配额。 */ + totalQuota?: number; + /** 到期时间。 */ + expiresAt?: string; + /** 快照捕获时间。 */ + capturedAt: string; + /** 快照来源。 */ + source?: string; +} + +/** 创建调用归属 job 请求。 */ +export interface CallAttributionJobCreate { + /** 幂等键。 */ + commandId: string; + /** New-API 调用关联 ID。 */ + correlationId: string; + /** 可选的 New-API callId 白名单。 */ + callIds?: string[]; + /** 调用审计记录 revision 乐观锁。 */ + expectedCallRevision?: number; + /** 归因校验模式,当前仅支持严格模式。 */ + verificationMode?: 'strict'; + /** 归属原因。 */ + reason?: string; +} + +/** 调用归属 job 创建结果。 */ +export interface CallAttributionJobResult { + /** 调用归属 job ID。 */ + jobId: string; + /** job 初始状态。 */ + status: 'idempotent_hit' | 'processing' | 'queued'; +} + +/** 调用归属 job 详情。 */ +export interface CallAttributionJobDetail { + /** 调用归属 job ID。 */ + jobId: string; + /** 执行状态。 */ + status: + | 'completed' + | 'failed' + | 'partially_completed' + | 'processing' + | 'queued'; + /** 归属用户 ID。 */ + userId: string; + /** 已归属调用数。 */ + attributedCallCount?: number; + /** 待归属调用数。 */ + pendingCallCount?: number; + /** 归属失败调用数。 */ + failedCallCount?: number; + /** 失败原因。 */ + failedReason?: string; + /** 补偿建议。 */ + compensationSuggestion?: string; + /** 创建时间。 */ + createdAt: string; + /** 完成时间。 */ + completedAt?: string; +} + +/** 外部集成调用详情。 */ +export interface IntegrationCallDetail { + /** 外部调用关联 ID。 */ + correlationId: string; + /** 外部调用状态。 */ + status: + | 'attributed' + | 'deduplicated' + | 'failed' + | 'pending_attribution' + | 'retrying' + | 'success'; + /** 请求类型。 */ + requestType?: string; + /** 重试组内调用 ID 列表。 */ + retryGroup?: string[]; + /** 归属状态。 */ + attributionStatus?: AttributionStatus; + /** 归属用户 ID。 */ + attributedUserId?: string; + /** 首次调用时间。 */ + createdAt: string; + /** 最近重试时间。 */ + lastRetryAt?: string; + /** 错误信息。 */ + errorMessage?: string; +} + +/** 用量摘要查询条件。 */ +export interface UsageRecordQuery extends MuseAdminPageQuery { + /** 用户 ID 筛选。 */ + userId?: string; + /** 统计周期。 */ + period?: 'billing_cycle' | 'month' | 'today' | 'week'; + /** 归属状态筛选。 */ + attributionStatus?: AttributionStatus; +} + +/** 按作品归属的用量摘要。 */ +export interface WorkUsageSummary { + /** 作品 ID。 */ + workId?: string; + /** 作品标题,允许为脱敏摘要。 */ + workTitle?: string; + /** Token 数。 */ + tokens?: number; +} + +/** 按智能体归属的用量摘要。 */ +export interface AgentUsageSummary { + /** 智能体 ID。 */ + agentId?: string; + /** 智能体名称。 */ + agentName?: string; + /** Token 数。 */ + tokens?: number; +} + +/** 管理端用量记录。 */ +export interface AdminUsageRecord { + /** 记录 ID。 */ + recordId: string; + /** 用户 ID。 */ + userId: string; + /** 用户昵称。 */ + nickname?: string; + /** 统计周期。 */ + period: string; + /** 总输入 Token 数。 */ + totalInputTokens?: number; + /** 总输出 Token 数。 */ + totalOutputTokens?: number; + /** 总 Token 数。 */ + totalTokens: number; + /** 待归属记录数。 */ + pendingAttributionCount?: number; + /** 归属失败记录数。 */ + failedAttributionCount?: number; + /** 归属状态。 */ + attributionStatus: AttributionStatus; + /** 按作品归属摘要。 */ + byWork?: WorkUsageSummary[]; + /** 按智能体归属摘要。 */ + byAgent?: AgentUsageSummary[]; +} + +/** 购买记录查询条件。 */ +export interface PurchaseRecordQuery extends MuseAdminPageQuery { + /** 用户 ID 筛选。 */ + userId?: string; + /** 购买状态筛选。 */ + status?: PurchaseStatus; +} + +/** 管理端购买记录摘要。 */ +export interface AdminPurchaseRecord { + /** 记录 ID。 */ + recordId: string; + /** 用户 ID。 */ + userId: string; + /** 用户昵称。 */ + nickname?: string; + /** 资产类型。 */ + assetType: 'agent' | 'knowledge_base' | 'work'; + /** 资产名称。 */ + assetName?: string; + /** 购买类型。 */ + purchaseType?: 'admin_grant' | 'external' | 'free' | 'paid'; + /** 金额,免费为 0。 */ + amount?: number; + /** 购买状态。 */ + status: PurchaseStatus; + /** 外部订单引用,必须为脱敏摘要。 */ + externalOrderRef?: string; + /** 授权结果摘要。 */ + authorizationResult?: string; + /** 购买时间。 */ + createdAt: string; +} + +/** 将路径参数编码,避免斜杠等字符破坏 Muse 管理端 URL。 */ +function encodePath(value: MuseAdminId) { + return encodeURIComponent(String(value)); +} + +/** 查询用户账户治理摘要列表。 */ +export function listAccountUsersApi(params: AccountUserQuery) { + return museAdminApi.get>( + '/account/users', + params, + ); +} + +/** 查询指定用户的权益和配额详情。 */ +export function getUserEntitlementsApi(userId: MuseAdminId) { + return museAdminApi.get( + `/account/users/${encodePath(userId)}/entitlements`, + ); +} + +/** 人工调整用户配额,必须带原因和幂等键。 */ +export function createQuotaAdjustmentApi( + userId: MuseAdminId, + data: QuotaAdjustmentRequest, +) { + return museAdminApi.post( + `/account/users/${encodePath(userId)}/quota-adjustments`, + data, + ); +} + +/** 查询指定用户的配额调整 ledger。 */ +export function listQuotaAdjustmentsApi( + userId: MuseAdminId, + params: QuotaAdjustmentQuery, +) { + return museAdminApi.get>( + `/account/users/${encodePath(userId)}/quota-adjustments`, + params, + ); +} + +/** 查询 New-API 网关用户绑定状态列表。 */ +export function listNewApiBindingsApi(params: NewApiBindingQuery) { + return museAdminApi.get>( + '/account/new-api-bindings', + params, + ); +} + +/** 创建或刷新指定用户的 New-API 网关绑定。 */ +export function createNewApiBindingApi( + userId: MuseAdminId, + data: NewApiBindingCreateRequest, +) { + return museAdminApi.post( + `/account/users/${encodePath(userId)}/new-api-binding`, + data, + ); +} + +/** 向 New-API 发起额度配置请求。 */ +export function createQuotaRequestApi( + userId: MuseAdminId, + data: AdminQuotaRequestCreate, +) { + return museAdminApi.post( + `/account/users/${encodePath(userId)}/quota-requests`, + data, + ); +} + +/** 查询指定用户的 New-API 余额和权益快照摘要。 */ +export function getBalanceSnapshotsApi( + userId: MuseAdminId, + params: MuseAdminPageQuery, +) { + return museAdminApi.get>( + `/account/users/${encodePath(userId)}/balance-snapshots`, + params, + ); +} + +/** 创建调用归属 job。 */ +export function createCallAttributionJobApi(data: CallAttributionJobCreate) { + return museAdminApi.post( + '/account/call-attribution-jobs', + data, + ); +} + +/** 查询调用归属 job 的执行状态。 */ +export function getCallAttributionJobApi(jobId: MuseAdminId) { + return museAdminApi.get( + `/account/call-attribution-jobs/${encodePath(jobId)}`, + ); +} + +/** 按 correlationId 查询外部调用去重、重试和归属状态。 */ +export function getIntegrationCallByCorrelationApi(correlationId: MuseAdminId) { + return museAdminApi.get( + `/account/integration-calls/by-correlation/${encodePath(correlationId)}`, + ); +} + +/** 查询全平台脱敏用量摘要。 */ +export function listUsageRecordsApi(params: UsageRecordQuery) { + return museAdminApi.get>( + '/account/usage-records', + params, + ); +} + +/** 查询全平台脱敏购买记录摘要。 */ +export function listPurchaseRecordsApi(params: PurchaseRecordQuery) { + return museAdminApi.get>( + '/account/purchase-records', + params, + ); +} diff --git a/muse-admin/apps/web-antd/src/api/muse/ai/index.ts b/muse-admin/apps/web-antd/src/api/muse/ai/index.ts new file mode 100644 index 00000000..01165e0d --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/ai/index.ts @@ -0,0 +1,543 @@ +import { museAdminApi } from '#/api/muse/client'; + +/** AI 配置域分页查询基础参数。 */ +export interface MuseAiPageParams { + /** 允许业务查询扩展字段透传到 URL query。 */ + [key: string]: boolean | number | string | undefined; + /** 页码,从 1 开始。 */ + pageNo: number; + /** 每页条数,后端契约上限为 100。 */ + pageSize: number; +} + +/** AI 配置域分页返回结构。 */ +export interface MuseAiPageResult { + /** 当前页数据列表。 */ + list: T[]; + /** 当前页码。 */ + pageNo?: number; + /** 每页条数。 */ + pageSize?: number; + /** 总记录数。 */ + total: number; +} + +/** Prompt 模板摘要。 */ +export interface PromptSummaryVO { + /** Prompt 唯一标识。 */ + promptKey: string; + /** Prompt 展示名称。 */ + name?: string; + /** 当前激活版本号。 */ + activeVersion: number; + /** 最新版本号。 */ + latestVersion?: number; + /** 模板变量数量。 */ + variableCount?: number; + /** 最近更新时间,ISO date-time 字符串。 */ + updatedAt: string; +} + +/** Prompt 列表查询参数。 */ +export interface PromptPageParams extends MuseAiPageParams { + /** Prompt key 精确或模糊筛选,由后端实现匹配语义。 */ + promptKey?: string; +} + +/** Prompt 变量类型。 */ +export type PromptVariableType = 'boolean' | 'number' | 'string'; + +/** Prompt 模板变量定义。 */ +export interface PromptVariableDTO { + /** 变量名称。 */ + name: string; + /** 变量类型。 */ + type: PromptVariableType; + /** 是否必填。 */ + required?: boolean; + /** 默认值,统一以字符串保存,运行时由后端按 type 解析。 */ + defaultValue?: string; +} + +/** 新建 Prompt 版本请求。 */ +export interface CreatePromptVersionDTO { + /** Prompt 正文内容。 */ + content: string; + /** 模板变量定义。 */ + variables?: PromptVariableDTO[]; + /** 版本变更说明。 */ + changeNote?: string; + /** 幂等键。 */ + commandId?: string; +} + +/** 新建 Prompt 版本返回。 */ +export interface CreatePromptVersionResultVO { + /** Prompt 唯一标识。 */ + promptKey?: string; + /** 创建出的版本号。 */ + version?: number; +} + +/** 激活 Prompt 版本请求。 */ +export interface ActivatePromptVersionDTO { + /** 幂等键。 */ + commandId: string; + /** 激活原因。 */ + reason?: string; +} + +/** 激活 Prompt 版本返回。 */ +export interface ActivatePromptVersionResultVO { + /** Prompt 唯一标识。 */ + promptKey?: string; + /** 激活后的版本号。 */ + activeVersion?: number; +} + +/** 管理端 Agent 范围,user 只允许治理摘要只读展示。 */ +export type AdminAgentScope = 'system' | 'user'; + +/** Agent 状态。 */ +export type AdminAgentStatus = 'active' | 'archived'; + +/** Agent 列表筛选范围。 */ +export type AdminAgentScopeFilter = AdminAgentScope | 'all'; + +/** 管理端 Agent 摘要。 */ +export interface AdminAgentSummaryVO { + /** Agent ID,前端按字符串处理以避免 int64 精度风险。 */ + agentId: string; + /** Agent 名称。 */ + name: string; + /** Agent 描述。 */ + description?: string; + /** Agent 范围:system=系统预置,user=用户创建。 */ + scope: AdminAgentScope; + /** 当前激活版本号。 */ + activeVersion?: number; + /** 关联的 Prompt key。 */ + promptKey?: string; + /** Agent 状态。 */ + status: AdminAgentStatus; + /** 最近更新时间,ISO date-time 字符串。 */ + updatedAt: string; +} + +/** Agent 列表查询参数。 */ +export interface AdminAgentPageParams extends MuseAiPageParams { + /** Agent 范围筛选,默认 all。 */ + scope?: AdminAgentScopeFilter; +} + +/** 创建系统 Agent 请求。 */ +export interface CreateSystemAgentDTO { + /** 固定为 system;管理端不能创建 user scope Agent。 */ + scope?: 'system'; + /** Agent 名称。 */ + name: string; + /** Agent 描述。 */ + description?: string; + /** 关联的 Prompt key。 */ + promptKey: string; + /** 槽位绑定配置,例如知识库、MetaSchema 或模型参数摘要。 */ + slotBindings?: Record; + /** 已经由 Security facade 批准的系统级工具授权 ID 列表。 */ + toolGrantIds?: string[]; + /** 幂等键。 */ + commandId: string; +} + +/** 创建系统 Agent 返回。 */ +export interface CreateSystemAgentResultVO { + /** 创建出的系统 Agent ID。 */ + agentId?: string; +} + +/** 新建系统 Agent 版本请求。 */ +export interface CreateSystemAgentVersionDTO { + /** 新版本名称。 */ + name?: string; + /** 新版本描述。 */ + description?: string; + /** 新版本绑定的 Prompt key。 */ + promptKey?: string; + /** 新版本槽位绑定配置。 */ + slotBindings?: Record; + /** 已经由 Security facade 批准的系统级工具授权 ID 列表。 */ + toolGrantIds?: string[]; + /** 版本变更说明。 */ + changeNote: string; + /** 幂等键。 */ + commandId: string; +} + +/** 新建系统 Agent 版本返回。 */ +export interface CreateSystemAgentVersionResultVO { + /** 系统 Agent ID。 */ + agentId?: string; + /** 创建出的版本号。 */ + version?: number; +} + +/** Tool Grant 审批状态。 */ +export type ToolGrantStatus = 'approved' | 'pending' | 'rejected' | 'revoked'; + +/** Tool Grant 授权范围类型。 */ +export type ToolGrantScopeType = + | 'chapter' + | 'external_endpoint' + | 'knowledge_base' + | 'market_asset' + | 'system' + | 'work'; + +/** Tool Grant 范围 owner 类型。 */ +export type ToolGrantOwnerType = + | 'knowledge' + | 'market' + | 'system' + | 'user' + | 'work'; + +/** Tool Grant 资源引用类型。 */ +export type ToolGrantResourceType = + | 'block' + | 'chapter' + | 'endpoint' + | 'knowledge_base' + | 'market_asset' + | 'work'; + +/** Tool Grant 可访问资源引用。 */ +export interface ToolGrantResourceRefVO { + /** 资源类型。 */ + resourceType: ToolGrantResourceType; + /** 资源 ID 或受控 endpoint key。 */ + resourceId: string; +} + +/** Security facade 批准后的工具可用范围。 */ +export interface ToolGrantScopeVO { + /** 授权范围类型。 */ + scopeType: ToolGrantScopeType; + /** 范围 owner 类型。 */ + ownerType: ToolGrantOwnerType; + /** 可访问资源引用,跨作品资源必须由 Security facade 单独批准。 */ + resourceRefs: ToolGrantResourceRefVO[]; + /** 是否允许跨作品访问,只能由 Security facade 审批结果置为 true。 */ + crossWorkAllowed?: boolean; +} + +/** Tool Grant 预算周期。 */ +export type ToolGrantBudgetPeriod = 'daily' | 'monthly' | 'per_task'; + +/** Security facade 批准后的工具调用预算。 */ +export interface ToolGrantBudgetVO { + /** 预算周期。 */ + period: ToolGrantBudgetPeriod; + /** 周期内最大调用次数。 */ + maxCalls: number; + /** 周期内最大 token 用量;0 表示该工具不消耗 token 预算。 */ + maxTokens?: number; + /** 周期内最大成本,单位为分。 */ + maxCostCents?: number; +} + +/** Tool Grant 网络外发模式。 */ +export type ToolGrantNetworkMode = 'allowlist' | 'internal_only' | 'none'; + +/** Tool Grant 用户内容外发策略。 */ +export type ToolGrantDataPolicy = + | 'approved_context_only' + | 'no_user_content' + | 'redacted_user_content'; + +/** Security facade 批准后的外发策略。 */ +export interface ToolGrantOutboundPolicyVO { + /** 网络外发模式。 */ + networkMode: ToolGrantNetworkMode; + /** 允许访问的外部目的地 key 或域名;networkMode=allowlist 时必填非空。 */ + allowedDestinations: string[]; + /** 用户内容外发策略。 */ + dataPolicy: ToolGrantDataPolicy; +} + +/** Tool Grant 摘要。 */ +export interface ToolGrantSummaryVO { + /** Tool Grant ID。 */ + grantId: string; + /** 目标智能体 ID。 */ + agentId: string; + /** 目标智能体名称。 */ + agentName?: string; + /** 工具类型。 */ + toolType: string; + /** Security facade 批准后的工具可用范围。 */ + scope: ToolGrantScopeVO; + /** Security facade 批准后的工具调用预算。 */ + budget: ToolGrantBudgetVO; + /** Security facade 批准后的外发策略。 */ + outboundPolicy: ToolGrantOutboundPolicyVO; + /** 审批状态。 */ + status: ToolGrantStatus; + /** 审批人。 */ + approvedBy?: string; + /** Security facade 审批记录 ID。 */ + securityApprovalId?: string; + /** 创建时间,ISO date-time 字符串。 */ + createdAt: string; +} + +/** Tool Grant 列表查询参数。 */ +export interface ToolGrantPageParams extends MuseAiPageParams { + /** 按审批状态筛选。 */ + status?: ToolGrantStatus; +} + +/** 登记或调整 Tool Grant 请求。 */ +export interface CreateOrAdjustToolGrantDTO { + /** 目标智能体 ID。 */ + agentId: string; + /** 工具类型,例如 web_search、file_read、api_call。 */ + toolType: string; + /** Security facade 批准后的工具可用范围。 */ + scope: ToolGrantScopeVO; + /** Security facade 批准后的工具调用预算。 */ + budget: ToolGrantBudgetVO; + /** Security facade 批准后的外发策略。 */ + outboundPolicy: ToolGrantOutboundPolicyVO; + /** 幂等键。 */ + commandId: string; + /** 授权或调整原因。 */ + reason: string; +} + +/** 登记或调整 Tool Grant 返回。 */ +export interface CreateOrAdjustToolGrantResultVO { + /** Tool Grant ID。 */ + grantId?: string; + /** 调整后的状态。 */ + status?: Extract; +} + +/** 质量策略摘要。 */ +export interface QualityPolicySummaryVO { + /** 质量策略唯一标识。 */ + policyKey: string; + /** 质量策略名称。 */ + name?: string; + /** 质量策略描述。 */ + description?: string; + /** 当前激活版本号。 */ + activeVersion: number; + /** 最新版本号。 */ + latestVersion?: number; + /** 质量维度数量。 */ + dimensionCount?: number; + /** 最近更新时间,ISO date-time 字符串。 */ + updatedAt: string; +} + +/** 质量策略列表查询参数。 */ +export type QualityPolicyPageParams = MuseAiPageParams; + +/** 质量维度配置。 */ +export interface QualityDimensionDTO { + /** 质量维度名称,例如 canon_compliance、character_voice。 */ + name: string; + /** 通过阈值。 */ + threshold: number; + /** 维度权重。 */ + weight?: number; +} + +/** 新建质量策略版本请求。 */ +export interface CreateQualityPolicyVersionDTO { + /** 质量维度配置列表。 */ + dimensions: QualityDimensionDTO[]; + /** 版本变更说明。 */ + changeNote?: string; + /** 幂等键。 */ + commandId?: string; +} + +/** 新建质量策略版本返回。 */ +export interface CreateQualityPolicyVersionResultVO { + /** 质量策略唯一标识。 */ + policyKey?: string; + /** 创建出的版本号。 */ + version?: number; +} + +/** 评估运行状态。 */ +export type EvaluationRunStatus = + | 'cancelled' + | 'completed' + | 'failed' + | 'queued' + | 'running'; + +/** 离线评估运行详情。 */ +export interface EvaluationRunVO { + /** 评估运行 ID。 */ + runId: string; + /** 质量策略唯一标识。 */ + policyKey: string; + /** 质量策略版本;为空时表示使用 active 版本。 */ + policyVersion?: number; + /** 评估数据集引用。 */ + datasetReference?: string; + /** 采样数量。 */ + sampleSize?: number; + /** 评估运行状态。 */ + status: EvaluationRunStatus; + /** 总样本数。 */ + totalSamples?: number; + /** 通过样本数。 */ + passedSamples?: number; + /** 未通过样本数。 */ + failedSamples?: number; + /** 总体评分。 */ + overallScore?: number; + /** 各维度评分,key 为维度名称,value 为评分。 */ + dimensionScores?: Record; + /** 开始时间,ISO date-time 字符串。 */ + startedAt?: string; + /** 完成时间,ISO date-time 字符串。 */ + completedAt?: string; + /** 创建时间,ISO date-time 字符串。 */ + createdAt: string; + /** 失败原因。 */ + errorMessage?: string; +} + +/** 启动离线评估请求。 */ +export interface StartEvaluationRunDTO { + /** 使用的质量策略 key。 */ + policyKey: string; + /** 使用的质量策略版本,不填则使用 active 版本。 */ + policyVersion?: number; + /** 评估数据集引用。 */ + datasetReference: string; + /** 采样数量。 */ + sampleSize?: number; + /** 幂等键。 */ + commandId?: string; +} + +/** 启动离线评估返回。 */ +export interface StartEvaluationRunResultVO { + /** 评估运行 ID。 */ + runId?: string; + /** 后端异步任务 ID。 */ + jobId?: string; +} + +/** 查询 Prompt 分页列表。 */ +export function getPromptPageApi(params: PromptPageParams) { + return museAdminApi.get>( + '/ai/prompts', + params, + ); +} + +/** 新建 Prompt 版本。 */ +export function createPromptVersionApi( + promptKey: string, + data: CreatePromptVersionDTO, +) { + return museAdminApi.post( + `/ai/prompts/${encodeURIComponent(promptKey)}/versions`, + data, + ); +} + +/** 激活 Prompt 版本。 */ +export function activatePromptVersionApi( + promptKey: string, + version: number, + data: ActivatePromptVersionDTO, +) { + return museAdminApi.post( + `/ai/prompts/${encodeURIComponent(promptKey)}/versions/${version}/activate`, + data, + ); +} + +/** 查询管理端 Agent 分页列表,user scope 只用于治理摘要只读展示。 */ +export function getAgentPageApi(params: AdminAgentPageParams) { + return museAdminApi.get>( + '/ai/agents', + params, + ); +} + +/** 创建系统 Agent;管理端不提供用户私有 Agent 写接口。 */ +export function createSystemAgentApi(data: CreateSystemAgentDTO) { + return museAdminApi.post('/ai/agents', { + ...data, + scope: 'system', + }); +} + +/** 新建系统 Agent 版本;服务端仍必须拒绝 user scope Agent。 */ +export function createSystemAgentVersionApi( + agentId: string, + data: CreateSystemAgentVersionDTO, +) { + return museAdminApi.post( + `/ai/agents/${encodeURIComponent(agentId)}/versions`, + data, + ); +} + +/** 查询 Tool Grant 分页列表。 */ +export function getToolGrantPageApi(params: ToolGrantPageParams) { + return museAdminApi.get>( + '/ai/tool-grants', + params, + ); +} + +/** 登记或调整 Security facade 审批后的 Tool Grant。 */ +export function createOrAdjustToolGrantApi(data: CreateOrAdjustToolGrantDTO) { + return museAdminApi.post( + '/ai/tool-grants', + data, + ); +} + +/** 查询质量策略分页列表。 */ +export function getQualityPolicyPageApi(params: QualityPolicyPageParams) { + return museAdminApi.get>( + '/ai/quality-policies', + params, + ); +} + +/** 新建质量策略版本。 */ +export function createQualityPolicyVersionApi( + policyKey: string, + data: CreateQualityPolicyVersionDTO, +) { + return museAdminApi.post( + `/ai/quality-policies/${encodeURIComponent(policyKey)}/versions`, + data, + ); +} + +/** 启动离线评估运行。 */ +export function startEvaluationRunApi(data: StartEvaluationRunDTO) { + return museAdminApi.post( + '/ai/evaluation-runs', + data, + ); +} + +/** 查询离线评估运行详情。 */ +export function getEvaluationRunApi(runId: string) { + return museAdminApi.get( + `/ai/evaluation-runs/${encodeURIComponent(runId)}`, + ); +} diff --git a/muse-admin/apps/web-antd/src/api/muse/audit/__tests__/index.spec.ts b/muse-admin/apps/web-antd/src/api/muse/audit/__tests__/index.spec.ts new file mode 100644 index 00000000..c685d8dc --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/audit/__tests__/index.spec.ts @@ -0,0 +1,63 @@ +import { beforeEach, describe, expect, it, vi } from 'vitest'; + +import { + getApiAccessLogApi, + getBusinessAuditEventApi, + listApiAccessLogsApi, + listBusinessAuditEventsApi, +} from '../index'; + +const { museAdminApiMock } = vi.hoisted(() => ({ + museAdminApiMock: { + get: vi.fn(), + }, +})); + +vi.mock('#/api/muse/client', () => ({ + museAdminApi: museAdminApiMock, +})); + +describe('muse audit api', () => { + beforeEach(() => { + vi.clearAllMocks(); + }); + + it('查询接口调用日志和脱敏详情', async () => { + await listApiAccessLogsApi({ + module: 'account', + pageNo: 1, + pageSize: 20, + status: 'failed', + }); + await getApiAccessLogApi('log/1'); + + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 1, + '/audit/api-logs', + { module: 'account', pageNo: 1, pageSize: 20, status: 'failed' }, + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 2, + '/audit/api-logs/log%2F1', + ); + }); + + it('查询 append-only 业务审计日志和脱敏 before/after 摘要', async () => { + await listBusinessAuditEventsApi({ + eventType: 'quota_adjusted', + pageNo: 1, + pageSize: 20, + }); + await getBusinessAuditEventApi('event/1'); + + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 1, + '/audit/business-events', + { eventType: 'quota_adjusted', pageNo: 1, pageSize: 20 }, + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 2, + '/audit/business-events/event%2F1', + ); + }); +}); diff --git a/muse-admin/apps/web-antd/src/api/muse/audit/index.ts b/muse-admin/apps/web-antd/src/api/muse/audit/index.ts new file mode 100644 index 00000000..a1fe8f53 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/audit/index.ts @@ -0,0 +1,173 @@ +import type { PageResult } from '@vben/request'; + +import { museAdminApi } from '#/api/muse/client'; + +/** 审计日志通用 ID。 */ +export type MuseAuditId = number | string; + +/** 审计分页查询参数。 */ +export interface MuseAuditPageQuery { + /** 查询参数索引签名,兼容 Muse client 的可序列化参数约束。 */ + [key: string]: boolean | number | string | undefined; + /** 当前页码,从 1 开始。 */ + pageNo: number; + /** 每页数量。 */ + pageSize: number; +} + +/** 接口调用状态。 */ +export type ApiAccessLogStatus = + | 'failed' + | 'redacted' + | 'sensitive' + | 'slow' + | 'success'; + +/** HTTP 方法。 */ +export type ApiAccessMethod = 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT'; + +/** 接口调用日志查询条件。 */ +export interface ApiAccessLogQuery extends MuseAuditPageQuery { + /** 请求链路 ID 筛选。 */ + requestId?: string; + /** 调用人摘要筛选。 */ + actor?: string; + /** 业务模块筛选。 */ + module?: string; + /** 调用状态筛选。 */ + status?: ApiAccessLogStatus; + /** 开始时间。 */ + startTime?: string; + /** 结束时间。 */ + endTime?: string; +} + +/** 接口调用日志摘要。 */ +export interface ApiAccessLogSummary { + /** 日志 ID。 */ + logId: number; + /** 请求链路 ID。 */ + requestId: string; + /** 调用人脱敏摘要。 */ + actor: string; + /** 调用人类型。 */ + actorType?: 'admin' | 'anonymous' | 'system' | 'user'; + /** 业务模块。 */ + module?: string; + /** HTTP 方法。 */ + method: ApiAccessMethod; + /** 脱敏路径摘要。 */ + pathSummary: string; + /** 关联对象脱敏摘要。 */ + objectSummary?: string; + /** 客户端 IP 脱敏摘要。 */ + clientIp?: string; + /** 调用状态。 */ + status: ApiAccessLogStatus; + /** HTTP 状态码。 */ + statusCode: number; + /** 接口耗时毫秒数。 */ + durationMs: number; + /** 错误码。 */ + errorCode?: string; + /** 错误摘要。 */ + errorSummary?: string; + /** 创建时间。 */ + createdAt: string; +} + +/** 脱敏摘要对象。 */ +export type RedactedSummary = Record; + +/** 接口调用日志脱敏详情。 */ +export interface ApiAccessLogDetail extends ApiAccessLogSummary { + /** 请求头脱敏摘要,不含 token、secret、cookie 或完整 header。 */ + requestHeadersSummary?: Record; + /** 请求体脱敏摘要,不含用户私有正文全文。 */ + requestBodySummary?: RedactedSummary; + /** 响应体脱敏摘要,不含用户私有正文全文。 */ + responseBodySummary?: RedactedSummary; + /** 查看敏感详情时写入的业务审计事件 ID。 */ + relatedAuditEventId?: number; +} + +/** 业务审计日志查询条件。 */ +export interface BusinessAuditEventQuery extends MuseAuditPageQuery { + /** 审计事件类型筛选。 */ + eventType?: string; + /** 开始时间。 */ + startTime?: string; + /** 结束时间。 */ + endTime?: string; +} + +/** 业务审计事件摘要。 */ +export interface BusinessAuditEventSummary { + /** 审计事件 ID。 */ + eventId: number; + /** 审计事件类型。 */ + eventType: string; + /** 操作者脱敏摘要。 */ + operator: string; + /** 操作资源类型。 */ + resourceType?: string; + /** 操作资源 ID。 */ + resourceId?: string; + /** 操作摘要。 */ + summary?: string; + /** 创建时间。 */ + createdAt: string; +} + +/** 业务审计事件详情。 */ +export interface BusinessAuditEventDetail extends BusinessAuditEventSummary { + /** 操作理由。 */ + reason?: string; + /** 操作结果。 */ + result?: 'failed' | 'pending_review' | 'rejected' | 'success'; + /** 变更前脱敏快照摘要。 */ + beforeSnapshot?: RedactedSummary; + /** 变更后脱敏快照摘要。 */ + afterSnapshot?: RedactedSummary; + /** 影响范围摘要。 */ + impactSummary?: string; + /** 审批或复核摘要。 */ + approvalSummary?: string; + /** 是否 append-only。 */ + immutable?: boolean; +} + +/** 编码路径参数,避免特殊字符破坏审计 URL。 */ +function encodePath(value: MuseAuditId) { + return encodeURIComponent(String(value)); +} + +/** 查询接口调用日志列表。 */ +export function listApiAccessLogsApi(params: ApiAccessLogQuery) { + return museAdminApi.get>( + '/audit/api-logs', + params, + ); +} + +/** 查询单条接口调用日志脱敏详情。 */ +export function getApiAccessLogApi(logId: MuseAuditId) { + return museAdminApi.get( + `/audit/api-logs/${encodePath(logId)}`, + ); +} + +/** 查询业务审计事件摘要列表。 */ +export function listBusinessAuditEventsApi(params: BusinessAuditEventQuery) { + return museAdminApi.get>( + '/audit/business-events', + params, + ); +} + +/** 查询业务审计事件脱敏详情。 */ +export function getBusinessAuditEventApi(eventId: MuseAuditId) { + return museAdminApi.get( + `/audit/business-events/${encodePath(eventId)}`, + ); +} diff --git a/muse-admin/apps/web-antd/src/api/muse/client.ts b/muse-admin/apps/web-antd/src/api/muse/client.ts new file mode 100644 index 00000000..27b4b113 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/client.ts @@ -0,0 +1,63 @@ +import { requestClient } from '#/api/request'; + +/** + * Muse 管理端 API 客户端 + * + * 统一收口 `/admin-api/muse/**` 请求,避免页面层拼错前缀或遗漏版本头。 + * Vben 的 requestClient 已经按 `code/data/msg` 解包,这里返回值即为后端 data。 + */ +const MUSE_ADMIN_BASE_URL = '/admin-api/muse'; + +/** Muse API v1 强制版本头,所有管理端请求都必须显式携带。 */ +const MUSE_API_HEADERS = { + 'X-API-Version': '1', +} as const; + +/** 查询参数对象;各业务模块用具名 interface 描述字段,这里保持兼容。 */ +type MuseQueryParams = object; + +/** 请求体对象,保留 unknown 是为了让各业务 API 自己定义 DTO。 */ +type MuseRequestBody = unknown; + +/** 拼接 Muse 管理端路径,确保调用方不能越过 `/admin-api/muse` 边界。 */ +function toMuseUrl(url: string) { + return `${MUSE_ADMIN_BASE_URL}${url}`; +} + +export const museAdminApi = { + /** GET 查询接口,适用于列表、详情和只读摘要。 */ + get: (url: string, params?: MuseQueryParams) => + requestClient.get(toMuseUrl(url), { + headers: MUSE_API_HEADERS, + params, + }), + + /** POST 命令接口,适用于创建、发布、重试等需要审计的动作。 */ + post: (url: string, data?: MuseRequestBody) => + requestClient.post(toMuseUrl(url), data, { + headers: MUSE_API_HEADERS, + }), + + /** PUT 更新接口,保留给兼容后端契约使用。 */ + put: (url: string, data?: MuseRequestBody) => + requestClient.put(toMuseUrl(url), data, { + headers: MUSE_API_HEADERS, + }), + + /** PATCH 局部更新接口,Vben requestClient 没有快捷方法,因此走通用 request。 */ + patch: (url: string, data?: MuseRequestBody) => + requestClient.request(toMuseUrl(url), { + data, + headers: MUSE_API_HEADERS, + method: 'PATCH', + }), + + /** DELETE 删除或停用接口,只用于契约明确的管理端资源。 */ + delete: (url: string, params?: MuseQueryParams) => + requestClient.delete(toMuseUrl(url), { + headers: MUSE_API_HEADERS, + params, + }), +}; + +export type { MuseQueryParams, MuseRequestBody }; diff --git a/muse-admin/apps/web-antd/src/api/muse/governance/__tests__/governance-api.test.ts b/muse-admin/apps/web-antd/src/api/muse/governance/__tests__/governance-api.test.ts new file mode 100644 index 00000000..ec834e29 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/governance/__tests__/governance-api.test.ts @@ -0,0 +1,179 @@ +import { beforeEach, describe, expect, it, vi } from 'vitest'; + +import { + activateMetaSchemaVersionApi, + getMetaSchemaApi, + listMetaSchemasApi, + previewMetaSchemaDraftImpactApi, + publishMetaSchemaDraftApi, + saveMetaSchemaDraftApi, + setMetaSchemaGrayRulesApi, + validateMetaSchemaDraftApi, +} from '../meta-schema'; +import { + activateFunctionChainVersionApi, + getProtectionNodeApi, + listFunctionChainsApi, + listProtectionNodesApi, + previewFunctionChainImpactApi, +} from '../function-chain'; + +const museAdminApiMock = vi.hoisted(() => ({ + get: vi.fn(), + post: vi.fn(), +})); + +vi.mock('#/api/muse/client', () => ({ + museAdminApi: museAdminApiMock, +})); + +describe('muse governance api wrappers', () => { + beforeEach(() => { + museAdminApiMock.get.mockReset(); + museAdminApiMock.post.mockReset(); + }); + + it('MetaSchema 接口只通过统一 Muse 管理端客户端访问治理路径', async () => { + const draftRequest = { + commandId: 'cmd-save-draft', + displayName: '作品元结构', + expectedVersion: 1, + fields: [], + }; + const publishRequest = { + commandId: 'cmd-publish', + expectedVersion: 1, + impactPreviewId: 'impact-1', + reason: '字段结构发布', + validationResultId: 'validation-1', + }; + + await listMetaSchemasApi({ + keyword: 'story', + pageNo: 1, + pageSize: 20, + scope: 'work', + }); + await getMetaSchemaApi('work/story'); + await saveMetaSchemaDraftApi('work/story', draftRequest); + await validateMetaSchemaDraftApi('work/story', 2); + await previewMetaSchemaDraftImpactApi('work/story', 2); + await publishMetaSchemaDraftApi('work/story', 2, publishRequest); + await activateMetaSchemaVersionApi('work/story', 3, { + activateMode: 'gray', + commandId: 'cmd-activate', + expectedActiveVersion: 1, + grayRules: { + percentage: 10, + strategy: 'percentage', + }, + impactPreviewId: 'impact-1', + reason: '灰度激活', + validationResultId: 'validation-1', + }); + await setMetaSchemaGrayRulesApi('work/story', 3, { + action: 'adjust', + commandId: 'cmd-gray', + grayRules: { + percentage: 20, + strategy: 'percentage', + }, + reason: '扩大灰度', + }); + + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 1, + '/governance/meta-schemas', + { + keyword: 'story', + pageNo: 1, + pageSize: 20, + scope: 'work', + }, + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 2, + '/governance/meta-schemas/work%2Fstory', + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 1, + '/governance/meta-schemas/work%2Fstory/drafts', + draftRequest, + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 2, + '/governance/meta-schemas/work%2Fstory/drafts/2/validate', + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 3, + '/governance/meta-schemas/work%2Fstory/drafts/2/impact-preview', + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 4, + '/governance/meta-schemas/work%2Fstory/drafts/2/publish', + publishRequest, + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 5, + '/governance/meta-schemas/work%2Fstory/versions/3/activate', + expect.objectContaining({ + activateMode: 'gray', + grayRules: { percentage: 10, strategy: 'percentage' }, + }), + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 6, + '/governance/meta-schemas/work%2Fstory/versions/3/gray-rules', + expect.objectContaining({ + action: 'adjust', + grayRules: { percentage: 20, strategy: 'percentage' }, + }), + ); + }); + + it('功能编排接口保留保护节点只读与链路激活的治理边界', async () => { + const impactRequest = { + commandId: 'cmd-preview', + expectedCurrentVersion: 4, + targetVersion: 5, + }; + const activateRequest = { + commandId: 'cmd-activate-chain', + expectedActiveVersion: 4, + impactPreviewId: 'impact-chain-1', + reason: '激活新编排', + validationResultId: 'validation-chain-1', + }; + + await listProtectionNodesApi({ chainKey: 'story-pipeline', pageNo: 1, pageSize: 50 }); + await getProtectionNodeApi('shadow/canonical-guard'); + await listFunctionChainsApi({ pageNo: 1, pageSize: 20 }); + await previewFunctionChainImpactApi('story-pipeline', impactRequest); + await activateFunctionChainVersionApi('story-pipeline', 5, activateRequest); + + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 1, + '/governance/protection-nodes', + { chainKey: 'story-pipeline', pageNo: 1, pageSize: 50 }, + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 2, + '/governance/protection-nodes/shadow%2Fcanonical-guard', + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 3, + '/governance/function-chains', + { pageNo: 1, pageSize: 20 }, + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 1, + '/governance/function-chains/story-pipeline/impact-preview', + impactRequest, + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 2, + '/governance/function-chains/story-pipeline/versions/5/activate', + activateRequest, + ); + }); +}); diff --git a/muse-admin/apps/web-antd/src/api/muse/governance/function-chain.ts b/muse-admin/apps/web-antd/src/api/muse/governance/function-chain.ts new file mode 100644 index 00000000..32641e64 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/governance/function-chain.ts @@ -0,0 +1,271 @@ +import { museAdminApi } from '#/api/muse/client'; + +/** 保护节点类型。 */ +export type ProtectionNodeType = + | 'chunking' + | 'input_output_compliance' + | 'quality_gate' + | 'rag_indexing' + | 'semantic_safety' + | 'static_check'; + +/** 功能链路状态,OpenAPI 未强制返回时仅用于前端兼容展示。 */ +export type FunctionChainStatus = + | 'active' + | 'draft' + | 'protection_node_missing' + | 'publish_failed' + | 'slot_contract_missing'; + +/** 保护节点变更类型。 */ +export type ProtectionNodeChangeType = 'added' | 'modified' | 'removed'; + +/** 槽位变更类型。 */ +export type SlotChangeType = + | 'added' + | 'protection_boundary_violation' + | 'protection_upgraded' + | 'removed'; + +/** 分页查询参数。 */ +export interface GovernancePageParams { + /** 当前页码,从 1 开始。 */ + pageNo: number; + /** 每页条数。 */ + pageSize: number; +} + +/** 分页结果。 */ +export interface GovernancePageResult { + /** 当前页数据列表。 */ + list: T[]; + /** 符合条件的总条数。 */ + total: number; +} + +/** 保护节点列表查询参数。 */ +export interface ProtectionNodeListParams + extends GovernancePageParams, + Record { + /** 按所属功能链路筛选。 */ + chainKey?: string; +} + +/** 保护节点摘要。 */ +export interface ProtectionNodeSummary { + /** 保护节点业务标识。 */ + nodeKey: string; + /** 显示名称。 */ + displayName: string; + /** 保护节点类型。 */ + nodeType: ProtectionNodeType; + /** 是否不可替换,保护节点不可被用户替换、覆盖或降级为开放槽位。 */ + irreplaceable: boolean; + /** 不可替换原因。 */ + irreplaceableReason?: string; + /** 所属功能链路标识。 */ + chainKey?: string; + /** 审计摘要。 */ + auditSummary?: string; +} + +/** 保护节点可观测指标。 */ +export interface ProtectionNodeMetric { + /** 指标名称。 */ + metricName?: string; + /** 指标值。 */ + metricValue?: string; + /** 指标说明。 */ + description?: string; +} + +/** 保护节点详情。 */ +export interface ProtectionNodeDetail { + /** 保护节点业务标识。 */ + nodeKey: string; + /** 显示名称。 */ + displayName: string; + /** 节点说明。 */ + description?: string; + /** 保护节点类型。 */ + nodeType: ProtectionNodeType; + /** 是否不可替换,服务端必须拒绝降级为用户可替换槽位。 */ + irreplaceable: boolean; + /** 不可替换原因。 */ + irreplaceableReason?: string; + /** 权限要求。 */ + permissionRequirement?: string; + /** 审计要求。 */ + auditRequirement?: string; + /** Shadow 到 Canonical 的边界说明。 */ + shadowToCanonicalBoundary?: string; + /** 所属功能链路标识。 */ + chainKey?: string; + /** 所属功能链路名称。 */ + chainDisplayName?: string; + /** 可观测指标。 */ + observabilityMetrics?: ProtectionNodeMetric[]; + /** 更新时间。 */ + updatedAt?: string; +} + +/** 功能链路摘要。 */ +export interface FunctionChainSummary { + /** 功能链路业务标识。 */ + chainKey: string; + /** 显示名称。 */ + displayName: string; + /** 链路说明。 */ + description?: string; + /** 当前激活版本号。 */ + activeVersion: number; + /** 开放槽位数,只表示可替换的非保护节点。 */ + openSlotCount?: number; + /** 不可替换保护节点数。 */ + protectionNodeCount?: number; + /** 更新时间。 */ + updatedAt?: string; + /** 链路状态,OpenAPI 未强制返回时页面降级为根据版本展示。 */ + status?: FunctionChainStatus; +} + +/** 功能链路列表查询参数。 */ +export interface FunctionChainListParams + extends GovernancePageParams, + Record { + /** 按链路名称或标识搜索,后端若未实现会忽略。 */ + keyword?: string; + /** 按链路状态筛选,后端若未实现会忽略。 */ + status?: FunctionChainStatus; +} + +/** 功能链路影响预览请求。 */ +export interface FunctionChainImpactPreviewRequest { + /** 幂等键。 */ + commandId: string; + /** 预发布的目标版本号。 */ + targetVersion?: number; + /** 期望当前激活版本,乐观锁。 */ + expectedCurrentVersion?: number; +} + +/** 保护节点影响明细。 */ +export interface ProtectionNodeImpactDetail { + /** 保护节点业务标识。 */ + nodeKey?: string; + /** 变更类型。 */ + changeType?: ProtectionNodeChangeType; + /** 影响说明。 */ + impactDescription?: string; +} + +/** 开放槽位变更明细。 */ +export interface SlotChangeDetail { + /** 槽位业务标识。 */ + slotKey?: string; + /** 变更类型,protection_boundary_violation 必须阻断激活。 */ + changeType?: SlotChangeType; + /** 影响说明。 */ + impactDescription?: string; +} + +/** 功能链路影响预览。 */ +export interface FunctionChainImpactPreview { + /** 影响预览记录 ID。 */ + impactPreviewId?: string; + /** 功能链路业务标识。 */ + chainKey?: string; + /** 目标版本号。 */ + targetVersion?: number; + /** 受影响智能体槽位绑定数。 */ + affectedAgentSlotBindings?: number; + /** 受影响 AI 运行时任务数。 */ + affectedAIRuntimeTasks?: number; + /** 保护节点变更数。 */ + affectedProtectionNodeChanges?: number; + /** 保护节点影响明细。 */ + protectionNodeImpactDetails?: ProtectionNodeImpactDetail[]; + /** 开放槽位变更明细。 */ + slotChanges?: SlotChangeDetail[]; +} + +/** 功能链路激活请求。 */ +export interface FunctionChainActivateRequest { + /** 幂等键。 */ + commandId: string; + /** 激活理由。 */ + reason: string; + /** 影响预览引用 ID。 */ + impactPreviewId: string; + /** 激活前校验结果引用 ID。 */ + validationResultId: string; + /** 期望当前激活版本,乐观锁。 */ + expectedActiveVersion: number; +} + +/** 功能链路激活响应。 */ +export interface FunctionChainActivateResponse { + /** 功能链路业务标识。 */ + chainKey?: string; + /** 已激活版本号。 */ + activatedVersion?: number; + /** 前一个激活版本号。 */ + previousActiveVersion?: number; + /** 受影响槽位绑定数。 */ + affectedSlotBindings?: number; + /** 受影响运行时任务数。 */ + affectedRuntimeTasks?: number; +} + +/** 编码路径参数,避免业务标识中的斜杠逃逸治理资源路径。 */ +function encodePathParam(value: string | number) { + return encodeURIComponent(String(value)); +} + +/** 查询保护节点注册表。 */ +export function listProtectionNodesApi(params: ProtectionNodeListParams) { + return museAdminApi.get>( + '/governance/protection-nodes', + params, + ); +} + +/** 查询保护节点详情。 */ +export function getProtectionNodeApi(nodeKey: string) { + return museAdminApi.get( + `/governance/protection-nodes/${encodePathParam(nodeKey)}`, + ); +} + +/** 查询系统功能链路列表。 */ +export function listFunctionChainsApi(params: FunctionChainListParams) { + return museAdminApi.get>( + '/governance/function-chains', + params, + ); +} + +/** 预览功能链路版本发布或激活影响。 */ +export function previewFunctionChainImpactApi( + chainKey: string, + data: FunctionChainImpactPreviewRequest, +) { + return museAdminApi.post( + `/governance/function-chains/${encodePathParam(chainKey)}/impact-preview`, + data, + ); +} + +/** 激活功能链路版本。 */ +export function activateFunctionChainVersionApi( + chainKey: string, + version: number, + data: FunctionChainActivateRequest, +) { + return museAdminApi.post( + `/governance/function-chains/${encodePathParam( + chainKey, + )}/versions/${encodePathParam(version)}/activate`, + data, + ); +} diff --git a/muse-admin/apps/web-antd/src/api/muse/governance/meta-schema.ts b/muse-admin/apps/web-antd/src/api/muse/governance/meta-schema.ts new file mode 100644 index 00000000..4f26748d --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/governance/meta-schema.ts @@ -0,0 +1,754 @@ +import { museAdminApi } from '#/api/muse/client'; + +/** MetaSchema 作用域。 */ +export type MetaSchemaScope = 'global' | 'tenant' | 'user' | 'work'; + +/** MetaSchema 字段类型。 */ +export type MetaFieldType = + | 'boolean' + | 'date' + | 'enum' + | 'json' + | 'number' + | 'relation' + | 'string' + | 'text'; + +/** MetaSchema 版本状态。 */ +export type MetaSchemaStatus = + | 'active' + | 'archived' + | 'deprecated' + | 'draft' + | 'published'; + +/** MetaSchema 迁移风险等级。 */ +export type MetaSchemaMigrationRisk = 'high' | 'low' | 'medium' | 'none' | 'unknown'; + +/** MetaSchema 灰度策略。 */ +export type GrayRuleStrategy = 'percentage' | 'tenant_whitelist' | 'user_whitelist'; + +/** MetaSchema 激活模式。 */ +export type MetaSchemaActivateMode = 'full' | 'gray'; + +/** MetaSchema 灰度规则操作。 */ +export type MetaSchemaGrayRulesAction = 'adjust' | 'remove' | 'set'; + +/** MetaSchema 废弃后建议动作。 */ +export type MetaSchemaDeprecateNextAction = + | 'activate_replacement' + | 'migrate_data' + | 'review_impact'; + +/** MetaSchema 发布后建议动作。 */ +export type MetaSchemaPublishNextAction = 'activate' | 'gray_release' | 'impact_review'; + +/** 字段兼容性变更类型。 */ +export type MetaSchemaBreakingChangeType = + | 'enum_removed' + | 'reference_changed' + | 'required_added' + | 'type_changed' + | 'visibility_restricted'; + +/** 分页查询参数。 */ +export interface GovernancePageParams { + /** 当前页码,从 1 开始。 */ + pageNo: number; + /** 每页条数。 */ + pageSize: number; +} + +/** 分页结果。 */ +export interface GovernancePageResult { + /** 当前页数据列表。 */ + list: T[]; + /** 符合条件的总条数。 */ + total: number; +} + +/** MetaSchema 列表查询参数。 */ +export interface MetaSchemaListParams + extends GovernancePageParams, + Record { + /** 按 schemaKey 或 displayName 模糊搜索。 */ + keyword?: string; + /** 按作用域筛选。 */ + scope?: MetaSchemaScope; + /** 按目标类型筛选,例如 work / chapter / block / agent / knowledge_base。 */ + targetType?: string; +} + +/** MetaField 可见性策略。 */ +export interface MetaFieldVisibility { + /** 是否进入用户可见投影。 */ + uiVisible?: boolean; + /** 是否允许进入 AI 上下文组装。 */ + aiContext?: boolean; + /** 用户端是否允许保存该动态字段。 */ + userEditable?: boolean; + /** 是否允许用户搜索或筛选。 */ + userSearchable?: boolean; + /** 是否可被导出预检纳入。 */ + exportable?: boolean; +} + +/** 字段废弃信息。 */ +export interface FieldDeprecationInfo { + /** 替代字段标识。 */ + replacementFieldKey?: string; + /** 保留期,例如 6m / 1y。 */ + retentionPeriod?: string; + /** 迁移提示。 */ + migrationHint?: string; +} + +/** MetaField 定义。 */ +export interface MetaField { + /** 字段业务标识。 */ + fieldKey: string; + /** 字段显示名称。 */ + displayName: string; + /** 字段类型。 */ + fieldType: MetaFieldType; + /** 字段作用域。 */ + scope?: MetaSchemaScope; + /** 默认值,按字段类型由服务端解释。 */ + defaultValue?: unknown; + /** 是否必填。 */ + required?: boolean; + /** 枚举字段可选值。 */ + enumValues?: string[]; + /** 校验规则,例如 min / max / pattern。 */ + validationRules?: Record; + /** 字段可见性策略。 */ + visibility?: MetaFieldVisibility; + /** 字段是否已废弃。 */ + deprecated?: boolean; + /** 字段废弃信息。 */ + deprecatedInfo?: FieldDeprecationInfo; + /** 字段继承来源 schemaKey。 */ + inheritedFrom?: string; + /** 该字段是否绑定保护节点边界。 */ + protectionNodeBound?: boolean; +} + +/** 灰度规则摘要。 */ +export interface GrayRulesSummary { + /** 灰度策略。 */ + strategy?: GrayRuleStrategy; + /** 灰度范围描述。 */ + scope?: string; + /** 回滚入口说明。 */ + rollbackEntry?: string; +} + +/** 灰度规则配置。 */ +export interface GrayRulesConfig { + /** 灰度策略。 */ + strategy?: GrayRuleStrategy; + /** 租户白名单,strategy=tenant_whitelist 时生效。 */ + tenantWhitelist?: string[]; + /** 灰度百分比,strategy=percentage 时生效。 */ + percentage?: number; + /** 用户白名单,strategy=user_whitelist 时生效。 */ + userWhitelist?: string[]; +} + +/** MetaSchema 列表影响摘要。 */ +export interface MetaSchemaImpactSummary { + /** 受影响作品数。 */ + affectedWorkCount?: number; + /** 受影响投影数。 */ + affectedProjectionCount?: number; + /** 受影响 AI 上下文引用数。 */ + affectedAIContextCount?: number; +} + +/** MetaSchema 列表摘要。 */ +export interface MetaSchemaSummary { + /** Schema 业务标识。 */ + schemaKey: string; + /** 显示名称。 */ + displayName: string; + /** 作用域。 */ + scope: MetaSchemaScope; + /** 目标类型,例如 work / chapter / block / agent / knowledge_base。 */ + targetType?: string; + /** 主字段类型,OpenAPI 未强制返回时列表页提示进入详情查看字段集合。 */ + fieldType?: MetaFieldType; + /** 当前激活版本号。 */ + activeVersion: number; + /** 当前灰度版本号。 */ + grayVersion?: number; + /** 最新草稿版本号。 */ + draftVersion?: number; + /** 字段数量。 */ + fieldCount?: number; + /** 更新时间。 */ + updatedAt?: string; + /** 列表状态,OpenAPI 未强制返回时由页面根据版本字段降级展示。 */ + status?: MetaSchemaStatus; + /** 迁移风险等级,OpenAPI 未返回时页面不造风险结论。 */ + migrationRisk?: MetaSchemaMigrationRisk; + /** 轻量影响摘要,OpenAPI 未返回时页面提示进入详情预览。 */ + impactSummary?: MetaSchemaImpactSummary; +} + +/** 字段继承关系。 */ +export interface InheritedSchemaSummary { + /** 被继承的 schemaKey。 */ + schemaKey?: string; + /** 从该 Schema 继承的字段数量。 */ + inheritedFieldCount?: number; +} + +/** MetaSchema 详情。 */ +export interface MetaSchemaDetail { + /** Schema 业务标识。 */ + schemaKey: string; + /** 显示名称。 */ + displayName: string; + /** 说明。 */ + description?: string; + /** 作用域。 */ + scope: MetaSchemaScope; + /** 目标类型。 */ + targetType?: string; + /** 当前激活版本号。 */ + activeVersion: number; + /** 当前激活版本发布时间。 */ + activeVersionPublishedAt?: string; + /** 当前灰度版本号。 */ + grayVersion?: number; + /** 当前灰度版本发布时间。 */ + grayVersionPublishedAt?: string; + /** 灰度规则摘要。 */ + grayRules?: GrayRulesSummary; + /** 当前 active 版本字段列表。 */ + fields?: MetaField[]; + /** 字段继承关系。 */ + inheritedSchemas?: InheritedSchemaSummary[]; + /** 影响摘要。 */ + impactSummary?: MetaSchemaImpactSummary; + /** 创建时间。 */ + createdAt?: string; + /** 更新时间。 */ + updatedAt?: string; +} + +/** MetaSchema 版本差异。 */ +export interface MetaSchemaVersionDiff { + /** 新增字段 fieldKey 列表。 */ + addedFields?: string[]; + /** 删除字段 fieldKey 列表。 */ + removedFields?: string[]; + /** 变更字段 fieldKey 列表。 */ + modifiedFields?: string[]; + /** 废弃字段 fieldKey 列表。 */ + deprecatedFields?: string[]; +} + +/** MetaSchema 发布审计记录。 */ +export interface MetaSchemaPublishRecord { + /** 幂等命令 ID。 */ + commandId?: string; + /** 发布理由。 */ + reason?: string; + /** 关联校验结果 ID。 */ + validationResultId?: string; + /** 关联影响预览 ID。 */ + impactPreviewId?: string; + /** 发布时期望的当前版本。 */ + expectedVersion?: number; +} + +/** MetaSchema 版本详情。 */ +export interface MetaSchemaVersionDetail { + /** Schema 业务标识。 */ + schemaKey: string; + /** 版本号。 */ + version: number; + /** 版本状态。 */ + status: MetaSchemaStatus; + /** 字段列表。 */ + fields?: MetaField[]; + /** 与前一版本的字段差异。 */ + fieldDiff?: MetaSchemaVersionDiff; + /** 发布审计记录。 */ + publishRecord?: MetaSchemaPublishRecord; + /** 发布时间。 */ + publishedAt?: string; + /** 发布操作者。 */ + publishedBy?: string; + /** 激活时间。 */ + activatedAt?: string; + /** 废弃时间。 */ + deprecatedAt?: string; + /** 创建时间。 */ + createdAt?: string; +} + +/** MetaSchema 草稿保存请求。 */ +export interface MetaSchemaDraftRequest { + /** 幂等键。 */ + commandId: string; + /** 期望当前 active 版本,用于乐观锁。 */ + expectedVersion?: number; + /** 显示名称。 */ + displayName?: string; + /** 说明。 */ + description?: string; + /** 完整字段定义,全量替换。 */ + fields?: MetaField[]; +} + +/** MetaSchema 草稿保存响应。 */ +export interface MetaSchemaDraftResponse { + /** 分配的草稿版本号。 */ + draftVersion?: number; + /** 校验摘要。 */ + validationSummary?: ValidationResult; + /** 当前激活版本号。 */ + currentActiveVersion?: number; +} + +/** 校验错误。 */ +export interface ValidationError { + /** 错误码。 */ + code: string; + /** 错误信息。 */ + message: string; + /** 关联字段标识。 */ + fieldKey?: string; + /** 错误详情。 */ + detail?: string; +} + +/** 校验警告。 */ +export interface ValidationWarning { + /** 警告码。 */ + code: string; + /** 警告信息。 */ + message: string; + /** 关联字段标识。 */ + fieldKey?: string; + /** 警告详情。 */ + detail?: string; +} + +/** 兼容性破坏项。 */ +export interface BreakingChange { + /** 关联字段标识。 */ + fieldKey?: string; + /** 变更类型。 */ + changeType?: MetaSchemaBreakingChangeType; + /** 变更说明。 */ + description?: string; +} + +/** 保护节点边界违规。 */ +export interface ProtectionNodeBoundaryViolation { + /** 关联字段标识。 */ + fieldKey?: string; + /** 保护节点标识。 */ + nodeKey?: string; + /** 违规说明。 */ + violation?: string; +} + +/** 兼容性分析结果。 */ +export interface CompatibilityResult { + /** 是否兼容上一版本。 */ + compatible?: boolean; + /** 破坏性变更列表。 */ + breakingChanges?: BreakingChange[]; + /** 保护节点边界违规列表。 */ + protectionNodeBoundaryViolations?: ProtectionNodeBoundaryViolation[]; +} + +/** 校验结果。 */ +export interface ValidationResult { + /** 是否校验通过。 */ + valid?: boolean; + /** 校验错误列表。 */ + errors?: ValidationError[]; + /** 校验警告列表。 */ + warnings?: ValidationWarning[]; + /** 兼容性分析结果。 */ + compatibilityResult?: CompatibilityResult; +} + +/** 作品影响摘要。 */ +export interface WorkImpactSummary { + /** 受影响作品数。 */ + affectedWorkCount?: number; + /** 受动态字段影响的作品数。 */ + affectedDynamicFieldWorkCount?: number; + /** 使用已废弃字段的作品数。 */ + worksWithDeprecatedFields?: number; +} + +/** 规划影响摘要。 */ +export interface PlanningImpactSummary { + /** 受影响规划章节数。 */ + affectedPlanningSections?: number; + /** 使用已废弃字段的规划数量。 */ + planningUsingDeprecatedFields?: number; +} + +/** 知识投影影响摘要。 */ +export interface KnowledgeProjectionImpactSummary { + /** 受影响投影数。 */ + affectedProjections?: number; + /** 需要重建的投影数。 */ + projectionsNeedingRebuild?: number; + /** 可见性变化的投影数。 */ + projectionsWithVisibilityChange?: number; +} + +/** AI 上下文影响摘要。 */ +export interface AIContextImpactSummary { + /** 受影响 AI 上下文数。 */ + affectedAIContexts?: number; + /** 字段被移除的上下文数。 */ + contextsWithFieldRemoved?: number; + /** 可见性变化的上下文数。 */ + contextsWithVisibilityChange?: number; +} + +/** 导出影响摘要。 */ +export interface ExportImpactSummary { + /** 受影响导出策略数。 */ + affectedExportPolicies?: number; + /** 字段被移除的导出策略数。 */ + exportsWithFieldRemoved?: number; + /** 可见性变化的导出策略数。 */ + exportsWithVisibilityChange?: number; +} + +/** MetaSchema 影响预览。 */ +export interface MetaSchemaImpactPreview { + /** 影响预览记录 ID,供发布或激活引用。 */ + impactPreviewId?: string; + /** Schema 业务标识。 */ + schemaKey?: string; + /** 草稿版本号。 */ + draftVersion?: number; + /** 作品影响摘要。 */ + workImpact?: WorkImpactSummary; + /** 规划影响摘要。 */ + planningImpact?: PlanningImpactSummary; + /** 知识投影影响摘要。 */ + knowledgeProjectionImpact?: KnowledgeProjectionImpactSummary; + /** AI 上下文影响摘要。 */ + aiContextImpact?: AIContextImpactSummary; + /** 导出影响摘要。 */ + exportImpact?: ExportImpactSummary; + /** 受影响投影总数。 */ + totalAffectedProjectionCount?: number; +} + +/** MetaSchema 发布请求。 */ +export interface MetaSchemaPublishRequest { + /** 幂等键。 */ + commandId: string; + /** 发布理由。 */ + reason: string; + /** 期望当前版本,乐观锁。 */ + expectedVersion: number; + /** 校验结果引用 ID。 */ + validationResultId: string; + /** 影响预览引用 ID。 */ + impactPreviewId: string; + /** 是否自动激活;产品约束下应保持 false,由 activate 单独处理。 */ + autoActivate?: boolean; +} + +/** MetaSchema 发布后建议动作。 */ +export interface MetaSchemaNextAction { + /** 建议动作。 */ + action?: MetaSchemaPublishNextAction; + /** 动作说明。 */ + description?: string; +} + +/** MetaSchema 发布响应。 */ +export interface MetaSchemaPublishResponse { + /** 发布后的版本号。 */ + publishedVersion?: number; + /** 发布后状态。 */ + status?: 'published'; + /** 当前激活版本号。 */ + currentActiveVersion?: number; + /** 受影响投影数。 */ + affectedProjectionCount?: number; + /** 发布后建议动作。 */ + nextActions?: MetaSchemaNextAction[]; +} + +/** MetaSchema 激活请求。 */ +export interface MetaSchemaActivateRequest { + /** 幂等键。 */ + commandId: string; + /** 激活理由。 */ + reason: string; + /** 激活模式。 */ + activateMode?: MetaSchemaActivateMode; + /** 灰度规则。 */ + grayRules?: GrayRulesConfig; + /** 期望当前激活版本,乐观锁。 */ + expectedActiveVersion: number; + /** 激活前校验结果引用 ID。 */ + validationResultId: string; + /** 激活影响预览引用 ID。 */ + impactPreviewId: string; +} + +/** MetaSchema 激活响应。 */ +export interface MetaSchemaActivateResponse { + /** Schema 业务标识。 */ + schemaKey?: string; + /** 已激活版本号。 */ + activatedVersion?: number; + /** 激活模式。 */ + activateMode?: MetaSchemaActivateMode; + /** 前一个激活版本号。 */ + previousActiveVersion?: number; + /** 受影响投影数。 */ + affectedProjectionCount?: number; + /** 投影重建任务 ID。 */ + projectionRebuildJobId?: string; +} + +/** MetaSchema 回滚请求。 */ +export interface MetaSchemaRollbackRequest { + /** 幂等键。 */ + commandId: string; + /** 回滚理由。 */ + reason: string; + /** 期望当前激活版本,乐观锁。 */ + expectedActiveVersion: number; + /** 回滚前校验结果引用 ID。 */ + validationResultId: string; + /** 回滚影响预览引用 ID。 */ + impactPreviewId: string; +} + +/** MetaSchema 回滚响应。 */ +export interface MetaSchemaRollbackResponse { + /** Schema 业务标识。 */ + schemaKey?: string; + /** 回滚目标版本号。 */ + rolledBackToVersion?: number; + /** 前一个激活版本号。 */ + previousActiveVersion?: number; + /** 受影响投影数。 */ + affectedProjectionCount?: number; + /** 投影重建任务 ID。 */ + projectionRebuildJobId?: string; + /** 投影失效任务 ID。 */ + projectionInvalidateJobId?: string; +} + +/** 废弃字段请求项。 */ +export interface DeprecateFieldRequest { + /** 被废弃字段标识。 */ + fieldKey: string; + /** 替代字段标识。 */ + replacementFieldKey?: string; + /** 保留期,例如 6m / 1y。 */ + retentionPeriod?: string; + /** 迁移提示。 */ + migrationHint?: string; +} + +/** MetaSchema 废弃请求。 */ +export interface MetaSchemaDeprecateRequest { + /** 幂等键。 */ + commandId: string; + /** 废弃理由。 */ + reason: string; + /** 期望被废弃版本,乐观锁。 */ + expectedVersion: number; + /** 废弃前校验结果引用 ID。 */ + validationResultId: string; + /** 废弃影响预览引用 ID。 */ + impactPreviewId: string; + /** 要废弃的字段列表。 */ + deprecateFields?: DeprecateFieldRequest[]; + /** 是否废弃整个版本。 */ + deprecateEntireVersion?: boolean; + /** 替代版本号。 */ + replacementVersion?: number; +} + +/** MetaSchema 废弃响应建议动作。 */ +export interface MetaSchemaDeprecateNextActionItem { + /** 建议动作。 */ + action?: MetaSchemaDeprecateNextAction; + /** 动作说明。 */ + description?: string; +} + +/** MetaSchema 废弃响应。 */ +export interface MetaSchemaDeprecateResponse { + /** Schema 业务标识。 */ + schemaKey?: string; + /** 废弃版本号。 */ + version?: number; + /** 已废弃字段列表。 */ + deprecatedFields?: string[]; + /** 是否废弃整个版本。 */ + entireVersionDeprecated?: boolean; + /** 受影响投影数。 */ + affectedProjectionCount?: number; + /** 下一步建议动作。 */ + nextActions?: MetaSchemaDeprecateNextActionItem[]; +} + +/** MetaSchema 灰度规则请求。 */ +export interface MetaSchemaGrayRulesRequest { + /** 幂等键。 */ + commandId: string; + /** 调整理由。 */ + reason: string; + /** 操作类型。 */ + action?: MetaSchemaGrayRulesAction; + /** 灰度规则。 */ + grayRules?: GrayRulesConfig; +} + +/** MetaSchema 灰度规则响应。 */ +export interface MetaSchemaGrayRulesResponse { + /** Schema 业务标识。 */ + schemaKey?: string; + /** 版本号。 */ + version?: number; + /** 灰度规则。 */ + grayRules?: GrayRulesConfig; + /** 当前灰度影响范围描述。 */ + affectedScope?: string; + /** 回滚入口。 */ + rollbackEntry?: string; +} + +/** 编码路径参数,避免 schemaKey 中的斜杠逃逸治理资源路径。 */ +function encodePathParam(value: string | number) { + return encodeURIComponent(String(value)); +} + +/** 拼接 MetaSchema 资源路径。 */ +function metaSchemaPath(schemaKey: string) { + return `/governance/meta-schemas/${encodePathParam(schemaKey)}`; +} + +/** 查询 MetaSchema 列表和版本摘要。 */ +export function listMetaSchemasApi(params: MetaSchemaListParams) { + return museAdminApi.get>( + '/governance/meta-schemas', + params, + ); +} + +/** 查询 MetaSchema 详情、当前 active 版本和灰度摘要。 */ +export function getMetaSchemaApi(schemaKey: string) { + return museAdminApi.get(metaSchemaPath(schemaKey)); +} + +/** 查询指定 MetaSchema 版本详情。 */ +export function getMetaSchemaVersionApi(schemaKey: string, version: number) { + return museAdminApi.get( + `${metaSchemaPath(schemaKey)}/versions/${encodePathParam(version)}`, + ); +} + +/** 保存 MetaSchema 草稿。 */ +export function saveMetaSchemaDraftApi( + schemaKey: string, + data: MetaSchemaDraftRequest, +) { + return museAdminApi.post( + `${metaSchemaPath(schemaKey)}/drafts`, + data, + ); +} + +/** 校验 MetaSchema 草稿。 */ +export function validateMetaSchemaDraftApi(schemaKey: string, draftVersion: number) { + return museAdminApi.post( + `${metaSchemaPath(schemaKey)}/drafts/${encodePathParam(draftVersion)}/validate`, + ); +} + +/** 预览 MetaSchema 草稿发布影响。 */ +export function previewMetaSchemaDraftImpactApi( + schemaKey: string, + draftVersion: number, +) { + return museAdminApi.post( + `${metaSchemaPath(schemaKey)}/drafts/${encodePathParam( + draftVersion, + )}/impact-preview`, + ); +} + +/** 发布 MetaSchema 草稿为新版本。 */ +export function publishMetaSchemaDraftApi( + schemaKey: string, + draftVersion: number, + data: MetaSchemaPublishRequest, +) { + return museAdminApi.post( + `${metaSchemaPath(schemaKey)}/drafts/${encodePathParam(draftVersion)}/publish`, + data, + ); +} + +/** 激活指定 MetaSchema 版本,支持全量或灰度。 */ +export function activateMetaSchemaVersionApi( + schemaKey: string, + version: number, + data: MetaSchemaActivateRequest, +) { + return museAdminApi.post( + `${metaSchemaPath(schemaKey)}/versions/${encodePathParam(version)}/activate`, + data, + ); +} + +/** 回滚到指定 MetaSchema 版本。 */ +export function rollbackMetaSchemaVersionApi( + schemaKey: string, + version: number, + data: MetaSchemaRollbackRequest, +) { + return museAdminApi.post( + `${metaSchemaPath(schemaKey)}/versions/${encodePathParam(version)}/rollback`, + data, + ); +} + +/** 废弃指定 MetaSchema 版本或字段。 */ +export function deprecateMetaSchemaVersionApi( + schemaKey: string, + version: number, + data: MetaSchemaDeprecateRequest, +) { + return museAdminApi.post( + `${metaSchemaPath(schemaKey)}/versions/${encodePathParam(version)}/deprecate`, + data, + ); +} + +/** 设置或调整 MetaSchema 灰度规则。 */ +export function setMetaSchemaGrayRulesApi( + schemaKey: string, + version: number, + data: MetaSchemaGrayRulesRequest, +) { + return museAdminApi.post( + `${metaSchemaPath(schemaKey)}/versions/${encodePathParam(version)}/gray-rules`, + data, + ); +} diff --git a/muse-admin/apps/web-antd/src/api/muse/jobs/__tests__/index.spec.ts b/muse-admin/apps/web-antd/src/api/muse/jobs/__tests__/index.spec.ts new file mode 100644 index 00000000..e6105649 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/jobs/__tests__/index.spec.ts @@ -0,0 +1,83 @@ +import { beforeEach, describe, expect, it, vi } from 'vitest'; + +import { + cancelJobApi, + getJobApi, + getSourceEventApi, + listJobsApi, + listSourceEventsApi, + retryJobApi, + retrySourceEventApi, +} from '../index'; + +const { museAdminApiMock } = vi.hoisted(() => ({ + museAdminApiMock: { + get: vi.fn(), + post: vi.fn(), + }, +})); + +vi.mock('#/api/muse/client', () => ({ + museAdminApi: museAdminApiMock, +})); + +describe('muse jobs api', () => { + beforeEach(() => { + vi.clearAllMocks(); + }); + + it('查询任务列表和任务详情', async () => { + await listJobsApi({ owner: 'ai', pageNo: 1, pageSize: 20 }); + await getJobApi('job/1'); + + expect(museAdminApiMock.get).toHaveBeenNthCalledWith(1, '/jobs', { + owner: 'ai', + pageNo: 1, + pageSize: 20, + }); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith(2, '/jobs/job%2F1'); + }); + + it('提交任务重试和取消命令', async () => { + await retryJobApi('42', { commandId: 'cmd-retry', reason: '重验通过' }); + await cancelJobApi('42', { commandId: 'cmd-cancel', reason: '来源召回' }); + + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 1, + '/jobs/42/retry', + expect.objectContaining({ commandId: 'cmd-retry' }), + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 2, + '/jobs/42/cancel', + expect.objectContaining({ commandId: 'cmd-cancel' }), + ); + }); + + it('查询和重试来源事件传播', async () => { + await listSourceEventsApi({ + pageNo: 1, + pageSize: 20, + sourceStatus: 'revoked', + }); + await getSourceEventApi('event/1'); + await retrySourceEventApi('event/1', { + commandId: 'cmd-event', + reason: '补偿传播', + }); + + expect(museAdminApiMock.get).toHaveBeenNthCalledWith(1, '/source-events', { + pageNo: 1, + pageSize: 20, + sourceStatus: 'revoked', + }); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 2, + '/source-events/event%2F1', + ); + expect(museAdminApiMock.post).toHaveBeenCalledWith( + '/source-events/event%2F1/retry', + expect.objectContaining({ commandId: 'cmd-event' }), + ); + }); +}); diff --git a/muse-admin/apps/web-antd/src/api/muse/jobs/index.ts b/muse-admin/apps/web-antd/src/api/muse/jobs/index.ts new file mode 100644 index 00000000..50a1014f --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/jobs/index.ts @@ -0,0 +1,223 @@ +import type { PageResult } from '@vben/request'; + +import { museAdminApi } from '#/api/muse/client'; + +/** Muse 任务治理通用 ID。 */ +export type MuseJobId = number | string; + +/** 任务分页查询参数。 */ +export interface MuseJobPageQuery { + /** 查询参数索引签名,兼容 Muse client 的可序列化参数约束。 */ + [key: string]: boolean | number | string | undefined; + /** 当前页码,从 1 开始。 */ + pageNo: number; + /** 每页数量。 */ + pageSize: number; +} + +/** Muse 异步任务状态。 */ +export type JobStatus = + | 'cancelled' + | 'completed' + | 'failed' + | 'queued' + | 'running'; + +/** 来源状态。 */ +export type SourceStatus = + | 'active' + | 'blocked' + | 'delisted' + | 'owner_missing' + | 'recalled' + | 'revoked' + | 'stale' + | 'unauthorized'; + +/** 来源状态对应的动作策略。 */ +export type SourceActionPolicy = + | 'allowed' + | 'blocked' + | 'needs_recheck' + | 'read_only'; + +/** 任务列表查询条件。 */ +export interface JobListQuery extends MuseJobPageQuery { + /** 任务状态筛选。 */ + status?: JobStatus; + /** owner 模块筛选。 */ + owner?: string; +} + +/** Muse 异步任务摘要。 */ +export interface JobSummary { + /** 任务 ID。 */ + jobId: number; + /** 任务类型。 */ + type: string; + /** 任务状态。 */ + status: JobStatus; + /** owner 模块。 */ + owner: string; + /** 创建者脱敏摘要。 */ + createdBy?: string; + /** 已重试次数。 */ + retryCount?: number; + /** 创建时间。 */ + createdAt: string; + /** 完成时间。 */ + completedAt?: string; +} + +/** Muse 异步任务详情。 */ +export interface JobDetail extends JobSummary { + /** 任务输入参数摘要,不能包含用户私有正文。 */ + input?: Record; + /** 任务结果摘要,不能包含候选正文全文。 */ + result?: Record; + /** 失败原因摘要。 */ + errorMessage?: string; + /** 失败阶段。 */ + failedStage?: string; + /** 是否可重试。 */ + retryable?: boolean; + /** 重试组 ID。 */ + retryGroupId?: string; + /** 关联 ID。 */ + correlationId?: string; + /** 开始时间。 */ + startedAt?: string; + /** 建议的下一步操作。 */ + nextActions?: string[]; +} + +/** 任务命令请求。 */ +export interface JobCommandRequest { + /** 幂等键。 */ + commandId?: string; + /** 操作原因,写入审计摘要。 */ + reason?: string; +} + +/** 任务命令结果。 */ +export interface JobCommandResult { + /** 任务 ID。 */ + jobId?: number; + /** 命令执行后的任务状态。 */ + status?: JobStatus; +} + +/** 来源事件列表查询条件。 */ +export interface SourceEventQuery extends MuseJobPageQuery { + /** 来源类型筛选。 */ + sourceType?: string; + /** 来源状态筛选。 */ + sourceStatus?: SourceStatus; +} + +/** 来源事件摘要。 */ +export interface SourceEventSummary { + /** 来源事件 ID。 */ + eventId: number; + /** 来源对象类型。 */ + sourceType: string; + /** 来源对象 ID。 */ + sourceId: number; + /** 来源状态。 */ + sourceStatus: SourceStatus; + /** 动作策略。 */ + actionPolicy: SourceActionPolicy; + /** 影响范围描述。 */ + affectedScope?: string; + /** 事件创建时间。 */ + createdAt: string; +} + +/** 来源状态原因归因。 */ +export interface SourceReasonAttribution { + /** 原因摘要。 */ + reason?: string; + /** 原因来源。 */ + source?: string; +} + +/** 来源事件详情。 */ +export interface SourceEventDetail extends SourceEventSummary { + /** 原因归因列表。 */ + reasonAttributions: SourceReasonAttribution[]; + /** 受影响绑定数。 */ + affectedBindings?: number; + /** 受影响任务数。 */ + affectedTasks?: number; + /** 传播状态。 */ + propagationStatus?: string; + /** 关联传播任务 ID。 */ + jobId?: number; + /** 建议的下一步操作。 */ + nextActions?: string[]; +} + +/** 来源事件重试结果。 */ +export interface SourceEventRetryResult { + /** 新建或复用的传播任务 ID。 */ + jobId?: number; + /** 重试提交后的状态。 */ + status?: string; +} + +/** 编码路径参数,避免特殊字符破坏任务治理 URL。 */ +function encodePath(value: MuseJobId) { + return encodeURIComponent(String(value)); +} + +/** 查询 Muse 异步任务列表。 */ +export function listJobsApi(params: JobListQuery) { + return museAdminApi.get>('/jobs', params); +} + +/** 查看任务详情。 */ +export function getJobApi(jobId: MuseJobId) { + return museAdminApi.get(`/jobs/${encodePath(jobId)}`); +} + +/** 重试任务;管理员必须先完成授权、来源和幂等重验。 */ +export function retryJobApi(jobId: MuseJobId, data?: JobCommandRequest) { + return museAdminApi.post( + `/jobs/${encodePath(jobId)}/retry`, + data, + ); +} + +/** 取消任务;已完成任务不可取消,由服务端最终校验。 */ +export function cancelJobApi(jobId: MuseJobId, data?: JobCommandRequest) { + return museAdminApi.post( + `/jobs/${encodePath(jobId)}/cancel`, + data, + ); +} + +/** 查询来源状态事件列表。 */ +export function listSourceEventsApi(params: SourceEventQuery) { + return museAdminApi.get>( + '/source-events', + params, + ); +} + +/** 查看来源事件详情。 */ +export function getSourceEventApi(eventId: MuseJobId) { + return museAdminApi.get( + `/source-events/${encodePath(eventId)}`, + ); +} + +/** 重试来源事件传播。 */ +export function retrySourceEventApi( + eventId: MuseJobId, + data?: JobCommandRequest, +) { + return museAdminApi.post( + `/source-events/${encodePath(eventId)}/retry`, + data, + ); +} diff --git a/muse-admin/apps/web-antd/src/api/muse/knowledge/__tests__/index.test.ts b/muse-admin/apps/web-antd/src/api/muse/knowledge/__tests__/index.test.ts new file mode 100644 index 00000000..49ea0383 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/knowledge/__tests__/index.test.ts @@ -0,0 +1,87 @@ +import { describe, expect, it, vi } from 'vitest'; + +import { + disableGlobalKnowledgeBaseApi, + getGlobalKnowledgeBaseApi, + getGlobalKnowledgeBaseListApi, + getGlobalKBSourceBindingsApi, + previewGlobalKBImpactApi, + reindexGlobalKnowledgeBaseApi, + retryGlobalKBSourceEventApi, + saveGlobalKBAccessPolicyDraftApi, +} from '../index'; + +const clientMocks = vi.hoisted(() => ({ + get: vi.fn(), + post: vi.fn(), +})); + +vi.mock('#/api/muse/client', () => ({ + museAdminApi: { + get: clientMocks.get, + post: clientMocks.post, + }, +})); + +describe('muse knowledge admin api', () => { + it('按 OpenAPI 契约调用全局知识库查询和治理端点', async () => { + await getGlobalKnowledgeBaseListApi({ pageNo: 1, pageSize: 20 }); + await getGlobalKnowledgeBaseApi('kb-1'); + await saveGlobalKBAccessPolicyDraftApi('kb-1', { + canGenerate: true, + canSearch: true, + commandId: 'cmd-policy', + scope: 'role_based', + }); + await previewGlobalKBImpactApi('kb-1', { actionType: 'disable' }); + await disableGlobalKnowledgeBaseApi('kb-1', { + commandId: 'cmd-disable', + reason: '违规资料停用', + }); + await reindexGlobalKnowledgeBaseApi('kb-1', { + commandId: 'cmd-reindex', + scope: 'failed_only', + }); + await retryGlobalKBSourceEventApi('kb-1', { + commandId: 'cmd-source', + eventType: 'status_changed', + reason: '重新传播来源状态', + }); + await getGlobalKBSourceBindingsApi({ + pageNo: 1, + pageSize: 10, + sourceType: 'global_kb', + }); + + expect(clientMocks.get).toHaveBeenCalledWith('/knowledge/global-kbs', { + pageNo: 1, + pageSize: 20, + }); + expect(clientMocks.get).toHaveBeenCalledWith('/knowledge/global-kbs/kb-1'); + expect(clientMocks.post).toHaveBeenCalledWith( + '/knowledge/global-kbs/kb-1/access-policies/drafts', + expect.objectContaining({ commandId: 'cmd-policy' }), + ); + expect(clientMocks.post).toHaveBeenCalledWith( + '/knowledge/global-kbs/kb-1/impact-preview', + { actionType: 'disable' }, + ); + expect(clientMocks.post).toHaveBeenCalledWith( + '/knowledge/global-kbs/kb-1/disable', + expect.objectContaining({ reason: '违规资料停用' }), + ); + expect(clientMocks.post).toHaveBeenCalledWith( + '/knowledge/global-kbs/kb-1/reindex', + expect.objectContaining({ scope: 'failed_only' }), + ); + expect(clientMocks.post).toHaveBeenCalledWith( + '/knowledge/global-kbs/kb-1/source-events', + expect.objectContaining({ eventType: 'status_changed' }), + ); + expect(clientMocks.get).toHaveBeenCalledWith('/knowledge/source-bindings', { + pageNo: 1, + pageSize: 10, + sourceType: 'global_kb', + }); + }); +}); diff --git a/muse-admin/apps/web-antd/src/api/muse/knowledge/index.ts b/muse-admin/apps/web-antd/src/api/muse/knowledge/index.ts new file mode 100644 index 00000000..4475fd22 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/knowledge/index.ts @@ -0,0 +1,885 @@ +import type { PageResult } from '@vben/request'; + +import { museAdminApi } from '#/api/muse/client'; + +import type { MuseQueryParams } from '#/api/muse/client'; + +/** 将强类型查询对象收敛为 Muse client 支持的可序列化查询参数。 */ +function toMuseQueryParams(params: object): MuseQueryParams { + return params as MuseQueryParams; +} + +/** 全局知识库启停和处理状态。 */ +export type GlobalKnowledgeBaseStatus = + | 'active' + | 'disabled' + | 'failed' + | 'processing'; + +/** 全局知识库可见范围。 */ +export type GlobalKnowledgeVisibilityScope = 'all' | 'custom' | 'role_based'; + +/** 全局知识资料处理状态。 */ +export type GlobalKBDocumentProcessingStatus = + | 'deleting' + | 'failed' + | 'generative' + | 'pending_process' + | 'pending_scan' + | 'processing' + | 'scan_blocked' + | 'searchable'; + +/** 全局知识任务状态。 */ +export type GlobalKBProcessingTaskStatus = + | 'cancelling' + | 'cleaning' + | 'completed' + | 'failed' + | 'indexing' + | 'parsing' + | 'queued' + | 'scanning'; + +/** 全局知识影响预览动作。 */ +export type GlobalKBImpactActionType = + | 'disable' + | 'document_delete' + | 'enable' + | 'policy_publish' + | 'version_activate'; + +/** 全局知识来源事件类型。 */ +export type GlobalKBSourceEventType = + | 'document_deleted' + | 'kb_disabled' + | 'kb_enabled' + | 'policy_changed' + | 'status_changed' + | 'version_changed'; + +/** 来源动作策略,重验要求放在策略而不是来源状态里。 */ +export type SourceActionPolicy = + | 'allowed' + | 'blocked' + | 'needs_recheck' + | 'read_only'; + +/** 来源绑定状态。 */ +export type SourceBindingStatus = + | 'active' + | 'blocked' + | 'delisted' + | 'owner_missing' + | 'recalled' + | 'revoked' + | 'stale' + | 'unauthorized'; + +/** 来源绑定类型。 */ +export type SourceBindingType = 'global_kb' | 'market_kb' | 'user_kb'; + +/** 来源目标 owner。 */ +export type SourceBindingTargetOwner = + | 'account' + | 'ai' + | 'content' + | 'knowledge' + | 'market'; + +/** 通用分页查询参数。 */ +export interface MusePageQuery { + /** 页码,从 1 开始。 */ + pageNo?: number; + /** 每页条数,上限由后端控制。 */ + pageSize?: number; +} + +/** 全局知识库列表筛选条件。 */ +export interface GlobalKnowledgeBaseQuery extends MusePageQuery { + /** 搜索关键词,匹配名称或说明。 */ + keyword?: string; + /** 知识库状态筛选。 */ + status?: GlobalKnowledgeBaseStatus; + /** 分类标签筛选。 */ + category?: string; +} + +/** 全局知识库处理摘要。 */ +export interface GlobalKBProcessingSummaryVO { + /** 已可用于生成的资料数量。 */ + generativeCount?: number; + /** 处理失败的资料数量。 */ + failedCount?: number; + /** 仍在处理中的资料数量。 */ + processingCount?: number; + /** 已可用于检索的资料数量。 */ + searchableCount?: number; +} + +/** 全局知识库列表项。 */ +export interface GlobalKnowledgeBaseSummaryVO { + /** 当前授权策略版本。 */ + activePolicyVersion?: number; + /** 已绑定作品或目标对象数量。 */ + bindingCount?: number; + /** 分类标签。 */ + category?: string; + /** 当前激活知识库版本。 */ + currentVersion?: number; + /** 创建时间。 */ + createdAt?: string; + /** 知识库说明。 */ + description?: string; + /** 资料数量。 */ + documentCount?: number; + /** 全局知识库 ID。 */ + kbId: string; + /** 知识库名称。 */ + name: string; + /** 当前处理和可用性状态。 */ + status: GlobalKnowledgeBaseStatus; + /** 最近更新时间。 */ + updatedAt?: string; +} + +/** 全局知识库详情。 */ +export interface GlobalKnowledgeBaseDetailVO + extends GlobalKnowledgeBaseSummaryVO { + /** 资料处理聚合摘要。 */ + processingSummary?: GlobalKBProcessingSummaryVO; + /** 可见范围。 */ + visibilityScope?: GlobalKnowledgeVisibilityScope | string; +} + +/** 创建全局知识库请求。 */ +export interface CreateGlobalKnowledgeBaseDTO { + /** 分类标签。 */ + category?: string; + /** 幂等命令 ID。 */ + commandId: string; + /** 知识库说明。 */ + description?: string; + /** 知识库名称。 */ + name: string; + /** 可见范围。 */ + visibilityScope?: GlobalKnowledgeVisibilityScope; +} + +/** 创建全局知识库结果。 */ +export interface CreateGlobalKnowledgeBaseResultVO { + /** 新建知识库 ID。 */ + kbId?: string; + /** 新建后的初始状态。 */ + status?: 'draft'; +} + +/** 更新全局知识库请求。 */ +export interface UpdateGlobalKnowledgeBaseDTO { + /** 分类标签。 */ + category?: string; + /** 幂等命令 ID。 */ + commandId: string; + /** 停用时的原因摘要。 */ + disableReason?: string; + /** 知识库说明。 */ + description?: string; + /** 知识库名称。 */ + name?: string; + /** 可见范围。 */ + visibilityScope?: GlobalKnowledgeVisibilityScope; +} + +/** 更新全局知识库结果。 */ +export interface UpdateGlobalKnowledgeBaseResultVO { + /** 知识库 ID。 */ + kbId?: string; + /** 更新时间。 */ + updatedAt?: string; +} + +/** 全局知识资料列表筛选条件。 */ +export interface GlobalKBDocumentQuery extends MusePageQuery { + /** 资料处理状态筛选。 */ + processingStatus?: GlobalKBDocumentProcessingStatus; +} + +/** 全局知识资料列表项。 */ +export interface GlobalKBDocumentSummaryVO { + /** 资料 ID。 */ + documentId: string; + /** 失败原因摘要,不返回原文全文。 */ + failureReason?: string; + /** 是否可用于生成。 */ + isGenerative?: boolean; + /** 是否可用于检索。 */ + isSearchable?: boolean; + /** 资料名称。 */ + name: string; + /** 资料处理状态。 */ + processingStatus?: GlobalKBDocumentProcessingStatus | string; + /** 扫描状态。 */ + scanStatus?: string; + /** 资料大小,单位字节。 */ + size?: number; + /** 资料类型,如 file、entry、link。 */ + type?: string; + /** 最近更新时间。 */ + updatedAt?: string; + /** 资料版本。 */ + version?: number; +} + +/** 全局知识资料版本摘要。 */ +export interface GlobalKBDocumentVersionVO { + /** 创建时间。 */ + createdAt?: string; + /** 版本处理状态。 */ + processingStatus?: string; + /** 资料版本号。 */ + version?: number; +} + +/** 全局知识资料详情。 */ +export interface GlobalKBDocumentDetailVO extends GlobalKBDocumentSummaryVO { + /** 当前资料版本。 */ + currentVersion?: number; + /** 索引状态。 */ + indexStatus?: string; + /** 解析状态。 */ + parseStatus?: string; + /** 资料版本列表。 */ + versions?: GlobalKBDocumentVersionVO[]; +} + +/** 上传或登记资料请求。 */ +export interface UploadGlobalKBDocumentDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 手写条目内容。 */ + entryContent?: string; + /** 上传文件,实际调用方可传 File 或 FormData 中的文件字段。 */ + file?: Blob | File | string; + /** 外链资料 URL。 */ + linkUrl?: string; + /** 来源说明。 */ + sourceDescription?: string; +} + +/** 上传或登记资料结果。 */ +export interface UploadGlobalKBDocumentResultVO { + /** 资料 ID。 */ + documentId?: string; + /** 进入待扫描后的处理状态。 */ + processingStatus?: 'pending_scan'; + /** 扫描任务 ID。 */ + scanTaskId?: string; +} + +/** 停用资料请求。 */ +export interface DeleteGlobalKBDocumentDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 停用原因。 */ + reason?: string; +} + +/** 停用资料结果。 */ +export interface DeleteGlobalKBDocumentResultVO { + /** 受影响绑定数量。 */ + affectedBindings?: number; + /** 传播出的来源事件 ID。 */ + sourceEventId?: string; +} + +/** 新增资料版本请求。 */ +export interface CreateGlobalKBDocumentVersionDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 上传文件。 */ + file?: Blob | File | string; + /** 来源说明。 */ + sourceDescription?: string; +} + +/** 新增资料版本结果。 */ +export interface CreateGlobalKBDocumentVersionResultVO { + /** 资料 ID。 */ + documentId?: string; + /** 新版本号。 */ + newVersion?: number; + /** 处理任务 ID。 */ + processingTaskId?: string; +} + +/** 全局知识库版本摘要。 */ +export interface GlobalKBVersionVO { + /** 激活时间。 */ + activatedAt?: string; + /** 变更摘要。 */ + changeSummary?: string; + /** 创建时间。 */ + createdAt?: string; + /** 资料数量。 */ + documentCount?: number; + /** 可生成资料数量。 */ + generativeCount?: number; + /** 是否当前激活版本。 */ + isActive?: boolean; + /** 可检索资料数量。 */ + searchableCount?: number; + /** 版本号。 */ + version?: number; +} + +/** 全局知识库版本列表结果。 */ +export interface GlobalKBVersionListVO { + /** 当前激活版本。 */ + currentActiveVersion?: number; + /** 版本列表。 */ + versions?: GlobalKBVersionVO[]; +} + +/** 激活全局知识库版本请求。 */ +export interface ActivateGlobalKBVersionDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 影响预览引用 ID。 */ + impactPreviewReference?: string; + /** 激活原因。 */ + reason: string; +} + +/** 激活全局知识库版本结果。 */ +export interface ActivateGlobalKBVersionResultVO { + /** 激活后的版本号。 */ + activeVersion?: number; + /** 来源事件 ID。 */ + sourceEventId?: string; +} + +/** 全局知识库授权策略。 */ +export interface GlobalKBAccessPolicyVO { + /** 是否允许复制。 */ + canCopy?: boolean; + /** 是否允许导出或外发。 */ + canExport?: boolean; + /** 是否允许生成使用。 */ + canGenerate?: boolean; + /** 是否允许检索。 */ + canSearch?: boolean; + /** 创建时间。 */ + createdAt?: string; + /** 过期时间。 */ + expiresAt?: string; + /** 是否当前激活策略。 */ + isActive?: boolean; + /** 策略 ID。 */ + policyId?: string; + /** 发布时间。 */ + publishedAt?: string; + /** 授权范围。 */ + scope?: string; + /** 策略版本。 */ + version?: number; +} + +/** 授权策略列表结果。 */ +export interface GlobalKBAccessPolicyListVO { + /** 当前激活授权策略版本。 */ + activePolicyVersion?: number; + /** 授权策略列表。 */ + policies?: GlobalKBAccessPolicyVO[]; +} + +/** 保存授权策略草稿请求。 */ +export interface SaveGlobalKBAccessPolicyDraftDTO { + /** 允许的角色列表,角色范围授权时必填。 */ + allowedRoles?: string[]; + /** 是否允许复制。 */ + canCopy?: boolean; + /** 是否允许导出或进入外发链路。 */ + canExport?: boolean; + /** 是否允许生成使用。 */ + canGenerate?: boolean; + /** 是否允许检索。 */ + canSearch?: boolean; + /** 幂等命令 ID。 */ + commandId: string; + /** 外发范围限制。 */ + externalScope?: string; + /** 过期时间。 */ + expiresAt?: string; + /** 授权范围。 */ + scope: string; +} + +/** 保存授权策略草稿结果。 */ +export interface SaveGlobalKBAccessPolicyDraftResultVO { + /** 草稿 ID。 */ + draftId?: string; + /** 草稿版本。 */ + draftVersion?: number; +} + +/** 发布授权策略请求。 */ +export interface PublishGlobalKBAccessPolicyDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 影响预览引用 ID。 */ + impactPreviewReference?: string; + /** 发布原因。 */ + reason: string; +} + +/** 发布授权策略结果。 */ +export interface PublishGlobalKBAccessPolicyResultVO { + /** 发布后的激活策略版本。 */ + activePolicyVersion?: number; + /** 来源事件 ID。 */ + sourceEventId?: string; +} + +/** 启用或停用全局知识库请求。 */ +export interface GlobalKBEnableDisableDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 操作原因。 */ + reason: string; +} + +/** 启用全局知识库结果。 */ +export interface EnableGlobalKnowledgeBaseResultVO { + /** 启用后的状态。 */ + status?: 'active'; +} + +/** 停用全局知识库结果。 */ +export interface DisableGlobalKnowledgeBaseResultVO { + /** 受影响绑定数量。 */ + affectedBindings?: number; + /** 来源事件 ID。 */ + sourceEventId?: string; + /** 停用后的状态。 */ + status?: 'disabled'; +} + +/** 全局知识库影响预览请求。 */ +export interface PreviewGlobalKBImpactDTO { + /** 预览动作类型。 */ + actionType: GlobalKBImpactActionType; + /** 目标版本,激活版本时必填。 */ + targetVersion?: number; +} + +/** 全局知识库影响预览结果。 */ +export interface GlobalKBImpactPreviewVO { + /** 受影响绑定数量。 */ + affectedBindings?: number; + /** 受影响安装数量。 */ + affectedInstalls?: number; + /** 受影响作品数量。 */ + affectedWorks?: number; + /** 预览过期时间。 */ + expiresAt?: string; + /** 影响预览引用 ID。 */ + impactId?: string; + /** 风险摘要。 */ + riskSummary?: string; + /** 运行中任务数量。 */ + runningTasks?: number; +} + +/** 重建全局知识库索引请求。 */ +export interface ReindexGlobalKnowledgeBaseDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 重建范围。 */ + scope?: 'failed_only' | 'full' | 'incremental'; +} + +/** 异步任务句柄。 */ +export interface GlobalKBJobResultVO { + /** 任务 ID。 */ + jobId?: string; + /** 轮询地址。 */ + pollUrl?: string; + /** 任务状态。 */ + status?: 'queued' | string; +} + +/** 全局知识库处理任务列表筛选。 */ +export interface GlobalKBProcessingTaskQuery extends MusePageQuery { + /** 任务状态筛选。 */ + status?: GlobalKBProcessingTaskStatus; +} + +/** 全局知识库处理任务摘要。 */ +export interface GlobalKBProcessingTaskSummaryVO { + /** 资料数量。 */ + documentCount?: number; + /** 失败数量。 */ + failedCount?: number; + /** 失败原因摘要。 */ + failureReason?: string; + /** 当前处理阶段。 */ + stage?: string; + /** 开始时间。 */ + startedAt?: string; + /** 任务状态。 */ + status?: GlobalKBProcessingTaskStatus | string; + /** 任务 ID。 */ + taskId: string; + /** 任务类型,如 scan、clean、parse、index。 */ + taskType?: string; + /** 最近更新时间。 */ + updatedAt?: string; +} + +/** 触发来源事件请求。 */ +export interface TriggerGlobalKBSourceEventDTO { + /** 来源动作策略。 */ + actionPolicy?: SourceActionPolicy; + /** 幂等命令 ID。 */ + commandId: string; + /** 事件类型。 */ + eventType: GlobalKBSourceEventType; + /** 事件原因。 */ + reason: string; + /** 目标版本。 */ + targetVersion?: number; +} + +/** 触发来源事件结果。 */ +export interface TriggerGlobalKBSourceEventResultVO { + /** 受影响目标数量。 */ + affectedTargets?: number; + /** 来源事件 ID。 */ + eventId?: string; +} + +/** 来源绑定查询条件。 */ +export interface SourceBindingQuery extends MusePageQuery { + /** 来源状态。 */ + sourceStatus?: SourceBindingStatus; + /** 来源类型。 */ + sourceType?: SourceBindingType; + /** 目标 owner。 */ + targetOwner?: SourceBindingTargetOwner; +} + +/** 来源绑定摘要。 */ +export interface SourceBindingSummaryVO { + /** 动作策略。 */ + actionPolicy?: SourceActionPolicy | string; + /** 受影响作品数量。 */ + affectedWorkCount?: number; + /** 绑定 ID。 */ + bindingId: string; + /** 来源 ID。 */ + sourceId?: string; + /** 来源状态。 */ + sourceStatus?: SourceBindingStatus | string; + /** 来源类型。 */ + sourceType?: SourceBindingType | string; + /** 来源版本。 */ + sourceVersion?: number; + /** 目标 ID。 */ + targetId?: string; + /** 目标 owner。 */ + targetOwner?: SourceBindingTargetOwner | string; + /** 最近更新时间。 */ + updatedAt?: string; +} + +/** 知识草稿治理查询条件。 */ +export interface KnowledgeDraftGovernanceQuery extends MusePageQuery { + /** 来源类型。 */ + sourceType?: 'external' | 'extraction' | 'import'; + /** 草稿状态。 */ + status?: 'confirmed' | 'conflicted' | 'failed' | 'ignored' | 'pending'; +} + +/** 知识草稿治理摘要。 */ +export interface KnowledgeDraftGovernanceSummaryVO { + /** 冲突数量。 */ + conflictCount?: number; + /** 创建时间。 */ + createdAt?: string; + /** 草稿 ID。 */ + draftId: string; + /** 实体类型。 */ + entityType?: string; + /** 来源类型。 */ + sourceType?: string; + /** 草稿状态。 */ + status?: string; + /** 最近更新时间。 */ + updatedAt?: string; + /** 作品 ID。 */ + workId?: string; + /** 作品标题摘要。 */ + workTitle?: string; +} + +/** 投影任务查询条件。 */ +export interface KnowledgeProjectionTaskQuery extends MusePageQuery { + /** 任务状态。 */ + status?: 'completed' | 'failed' | 'queued' | 'running'; +} + +/** 投影任务摘要。 */ +export interface KnowledgeProjectionTaskSummaryVO { + /** 受影响投影数量。 */ + affectedProjectionCount?: number; + /** 完成时间。 */ + completedAt?: string; + /** 失败原因摘要。 */ + failureReason?: string; + /** 来源知识库 ID。 */ + sourceKbId?: string; + /** 来源知识库名称。 */ + sourceKbName?: string; + /** 开始时间。 */ + startedAt?: string; + /** 任务状态。 */ + status?: string; + /** 任务 ID。 */ + taskId: string; + /** 任务类型。 */ + taskType?: string; +} + +/** 查询全局知识库分页列表。 */ +export function getGlobalKnowledgeBaseListApi( + params: GlobalKnowledgeBaseQuery, +) { + return museAdminApi.get>( + '/knowledge/global-kbs', + toMuseQueryParams(params), + ); +} + +/** 创建全局知识库。 */ +export function createGlobalKnowledgeBaseApi( + data: CreateGlobalKnowledgeBaseDTO, +) { + return museAdminApi.post( + '/knowledge/global-kbs', + data, + ); +} + +/** 查询全局知识库详情。 */ +export function getGlobalKnowledgeBaseApi(kbId: string) { + return museAdminApi.get( + `/knowledge/global-kbs/${kbId}`, + ); +} + +/** 更新全局知识库基础信息。 */ +export function updateGlobalKnowledgeBaseApi( + kbId: string, + data: UpdateGlobalKnowledgeBaseDTO, +) { + return museAdminApi.patch( + `/knowledge/global-kbs/${kbId}`, + data, + ); +} + +/** 查询全局知识库资料分页列表。 */ +export function getGlobalKBDocumentsApi( + kbId: string, + params: GlobalKBDocumentQuery, +) { + return museAdminApi.get>( + `/knowledge/global-kbs/${kbId}/documents`, + toMuseQueryParams(params), + ); +} + +/** 上传或登记全局知识库资料。 */ +export function uploadGlobalKBDocumentApi( + kbId: string, + data: FormData | UploadGlobalKBDocumentDTO, +) { + return museAdminApi.post( + `/knowledge/global-kbs/${kbId}/documents`, + data, + ); +} + +/** 查询全局知识库资料详情。 */ +export function getGlobalKBDocumentApi(kbId: string, documentId: string) { + return museAdminApi.get( + `/knowledge/global-kbs/${kbId}/documents/${documentId}`, + ); +} + +/** 停用全局知识库资料。 */ +export function deleteGlobalKBDocumentApi( + kbId: string, + documentId: string, + data: DeleteGlobalKBDocumentDTO, +) { + return museAdminApi.delete( + `/knowledge/global-kbs/${kbId}/documents/${documentId}`, + toMuseQueryParams(data), + ); +} + +/** 新增全局知识库资料版本。 */ +export function createGlobalKBDocumentVersionApi( + kbId: string, + documentId: string, + data: FormData | CreateGlobalKBDocumentVersionDTO, +) { + return museAdminApi.post( + `/knowledge/global-kbs/${kbId}/documents/${documentId}/versions`, + data, + ); +} + +/** 查询全局知识库版本列表。 */ +export function getGlobalKBVersionsApi(kbId: string) { + return museAdminApi.get( + `/knowledge/global-kbs/${kbId}/versions`, + ); +} + +/** 激活全局知识库版本。 */ +export function activateGlobalKBVersionApi( + kbId: string, + version: number, + data: ActivateGlobalKBVersionDTO, +) { + return museAdminApi.post( + `/knowledge/global-kbs/${kbId}/versions/${version}/activate`, + data, + ); +} + +/** 查询全局知识库授权策略列表。 */ +export function getGlobalKBAccessPoliciesApi(kbId: string) { + return museAdminApi.get( + `/knowledge/global-kbs/${kbId}/access-policies`, + ); +} + +/** 保存全局知识库授权策略草稿。 */ +export function saveGlobalKBAccessPolicyDraftApi( + kbId: string, + data: SaveGlobalKBAccessPolicyDraftDTO, +) { + return museAdminApi.post( + `/knowledge/global-kbs/${kbId}/access-policies/drafts`, + data, + ); +} + +/** 发布全局知识库授权策略。 */ +export function publishGlobalKBAccessPolicyApi( + kbId: string, + draftId: string, + data: PublishGlobalKBAccessPolicyDTO, +) { + return museAdminApi.post( + `/knowledge/global-kbs/${kbId}/access-policies/drafts/${draftId}/publish`, + data, + ); +} + +/** 启用全局知识库。 */ +export function enableGlobalKnowledgeBaseApi( + kbId: string, + data: GlobalKBEnableDisableDTO, +) { + return museAdminApi.post( + `/knowledge/global-kbs/${kbId}/enable`, + data, + ); +} + +/** 停用全局知识库。 */ +export function disableGlobalKnowledgeBaseApi( + kbId: string, + data: GlobalKBEnableDisableDTO, +) { + return museAdminApi.post( + `/knowledge/global-kbs/${kbId}/disable`, + data, + ); +} + +/** 预览全局知识库治理影响。 */ +export function previewGlobalKBImpactApi( + kbId: string, + data: PreviewGlobalKBImpactDTO, +) { + return museAdminApi.post( + `/knowledge/global-kbs/${kbId}/impact-preview`, + data, + ); +} + +/** 重建全局知识库索引。 */ +export function reindexGlobalKnowledgeBaseApi( + kbId: string, + data: ReindexGlobalKnowledgeBaseDTO, +) { + return museAdminApi.post( + `/knowledge/global-kbs/${kbId}/reindex`, + data, + ); +} + +/** 查询全局知识库资料处理任务。 */ +export function getGlobalKBProcessingTasksApi( + kbId: string, + params: GlobalKBProcessingTaskQuery, +) { + return museAdminApi.get>( + `/knowledge/global-kbs/${kbId}/processing-tasks`, + toMuseQueryParams(params), + ); +} + +/** 触发或重试全局知识库来源状态传播。 */ +export function retryGlobalKBSourceEventApi( + kbId: string, + data: TriggerGlobalKBSourceEventDTO, +) { + return museAdminApi.post( + `/knowledge/global-kbs/${kbId}/source-events`, + data, + ); +} + +/** 查询来源绑定和来源状态。 */ +export function getGlobalKBSourceBindingsApi(params: SourceBindingQuery) { + return museAdminApi.get>( + '/knowledge/source-bindings', + toMuseQueryParams(params), + ); +} + +/** 查询知识草稿治理摘要。 */ +export function getKnowledgeDraftsGovernanceApi( + params: KnowledgeDraftGovernanceQuery, +) { + return museAdminApi.get>( + '/knowledge/drafts', + toMuseQueryParams(params), + ); +} + +/** 查询知识投影和索引任务。 */ +export function getKnowledgeProjectionTasksApi( + params: KnowledgeProjectionTaskQuery, +) { + return museAdminApi.get>( + '/knowledge/projection-tasks', + toMuseQueryParams(params), + ); +} diff --git a/muse-admin/apps/web-antd/src/api/muse/market/__tests__/index.test.ts b/muse-admin/apps/web-antd/src/api/muse/market/__tests__/index.test.ts new file mode 100644 index 00000000..62c378c6 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/market/__tests__/index.test.ts @@ -0,0 +1,113 @@ +import { describe, expect, it, vi } from 'vitest'; + +import { + approveMarketPublishRequestApi, + delistMarketAssetApi, + getMarketAppealApi, + getMarketAssetApi, + getMarketAssetListApi, + getMarketAppealListApi, + getMarketPublishRequestListApi, + previewMarketGovernanceImpactApi, + recallMarketAssetApi, + rejectMarketPublishRequestApi, + resolveMarketAppealApi, +} from '../index'; + +const clientMocks = vi.hoisted(() => ({ + get: vi.fn(), + post: vi.fn(), +})); + +vi.mock('#/api/muse/client', () => ({ + museAdminApi: { + get: clientMocks.get, + post: clientMocks.post, + }, +})); + +describe('muse market admin api', () => { + it('按 OpenAPI 契约调用市场审核、治理和申诉端点', async () => { + await getMarketAssetListApi({ assetType: 'knowledge_base', pageNo: 1 }); + await getMarketAssetApi('asset-1'); + await previewMarketGovernanceImpactApi('asset-1', { + actionType: 'recall', + commandId: 'cmd-preview', + scope: 'full_recall', + }); + await delistMarketAssetApi('asset-1', { + commandId: 'cmd-delist', + expectedStatus: 'listed', + impactPreviewId: 'preview-1', + reason: '权利声明失效', + scope: 'full_delist', + }); + await recallMarketAssetApi('asset-1', { + basis: '合规召回', + commandId: 'cmd-recall', + expectedStatus: 'listed', + impactPreviewId: 'preview-2', + reason: '安全风险', + scope: 'full_recall', + }); + await getMarketPublishRequestListApi({ status: 'pending' }); + await approveMarketPublishRequestApi('request-1', { + commandId: 'cmd-approve', + expectedStatus: 'pending', + note: '材料完整', + validationResultId: 'validation-1', + }); + await rejectMarketPublishRequestApi('request-2', { + commandId: 'cmd-reject', + expectedStatus: 'reviewing', + reason: '隐私材料不足', + validationResultId: 'validation-2', + }); + await getMarketAppealListApi({ status: 'reviewing' }); + await getMarketAppealApi('appeal-1'); + await resolveMarketAppealApi('appeal-1', { + commandId: 'cmd-resolve', + expectedStatus: 'reviewing', + impactPreviewId: 'preview-3', + reason: '维持原处理', + resolution: 'maintained', + }); + + expect(clientMocks.get).toHaveBeenCalledWith('/market/assets', { + assetType: 'knowledge_base', + pageNo: 1, + }); + expect(clientMocks.get).toHaveBeenCalledWith('/market/assets/asset-1'); + expect(clientMocks.post).toHaveBeenCalledWith( + '/market/assets/asset-1/governance-impact', + expect.objectContaining({ actionType: 'recall' }), + ); + expect(clientMocks.post).toHaveBeenCalledWith( + '/market/assets/asset-1/delist', + expect.objectContaining({ scope: 'full_delist' }), + ); + expect(clientMocks.post).toHaveBeenCalledWith( + '/market/assets/asset-1/recall', + expect.objectContaining({ basis: '合规召回' }), + ); + expect(clientMocks.get).toHaveBeenCalledWith('/market/publish-requests', { + status: 'pending', + }); + expect(clientMocks.post).toHaveBeenCalledWith( + '/market/publish-requests/request-1/approve', + expect.objectContaining({ validationResultId: 'validation-1' }), + ); + expect(clientMocks.post).toHaveBeenCalledWith( + '/market/publish-requests/request-2/reject', + expect.objectContaining({ reason: '隐私材料不足' }), + ); + expect(clientMocks.get).toHaveBeenCalledWith('/market/appeals', { + status: 'reviewing', + }); + expect(clientMocks.get).toHaveBeenCalledWith('/market/appeals/appeal-1'); + expect(clientMocks.post).toHaveBeenCalledWith( + '/market/appeals/appeal-1/resolve', + expect.objectContaining({ resolution: 'maintained' }), + ); + }); +}); diff --git a/muse-admin/apps/web-antd/src/api/muse/market/index.ts b/muse-admin/apps/web-antd/src/api/muse/market/index.ts new file mode 100644 index 00000000..1ad86237 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/market/index.ts @@ -0,0 +1,541 @@ +import type { PageResult } from '@vben/request'; + +import { museAdminApi } from '#/api/muse/client'; + +import type { MuseQueryParams } from '#/api/muse/client'; + +/** 将强类型查询对象收敛为 Muse client 支持的可序列化查询参数。 */ +function toMuseQueryParams(params: object): MuseQueryParams { + return params as MuseQueryParams; +} + +/** 市场资产类型。 */ +export type MarketAssetType = 'agent' | 'knowledge_base' | 'work'; + +/** 市场资产上架生命周期状态。 */ +export type MarketListingStatus = + | 'delisted' + | 'listed' + | 'not_listed' + | 'recalled'; + +/** 市场审核状态。 */ +export type MarketReviewStatus = + | 'approved' + | 'compliance_blocked' + | 'needs_supplement' + | 'pending' + | 'rejected' + | 'reviewing'; + +/** 市场来源状态,只描述来源可用性。 */ +export type MarketSourceStatus = + | 'authorization_expired' + | 'available' + | 'source_delisted' + | 'source_recalled' + | 'source_revoked' + | 'unavailable'; + +/** 管理端资产动作策略筛选值。 */ +export type MarketActionPolicyFilter = + | 'normal' + | 'stop_generation' + | 'stop_new_acquire' + | 'stop_new_bind' + | 'stop_new_install'; + +/** 治理影响预览动作。 */ +export type MarketGovernanceActionType = + | 'delist' + | 'recall' + | 'revoke_license' + | 'stop_generation'; + +/** 市场治理范围。 */ +export type MarketGovernanceScope = + | 'full_delist' + | 'full_recall' + | 'stop_generation' + | 'stop_new_acquire' + | 'stop_new_bind' + | 'stop_new_install'; + +/** 申诉类型。 */ +export type MarketAppealType = + | 'delist' + | 'license_revocation' + | 'recall' + | 'review_rejection' + | 'usage_impact'; + +/** 申诉状态。 */ +export type MarketAppealStatus = + | 'closed' + | 'maintained' + | 'pending' + | 'restored' + | 'reviewing' + | 'supplementing'; + +/** 申诉处理结论。 */ +export type MarketAppealResolution = + | 'closed' + | 'maintained' + | 'partially_restored' + | 'restored'; + +/** 通用分页查询参数。 */ +export interface MuseMarketPageQuery { + /** 页码,从 1 开始。 */ + pageNo?: number; + /** 每页条数,上限由后端控制。 */ + pageSize?: number; +} + +/** 当前治理策略下的动作限制。 */ +export interface AssetActionPolicyVO { + /** 获取授权策略。 */ + acquirePolicy?: 'allowed' | 'stop_new_acquire'; + /** 绑定策略。 */ + bindPolicy?: 'allowed' | 'stop_new_bind'; + /** 生成使用策略。 */ + generationPolicy?: 'allowed' | 'stop_generation'; + /** 安装策略。 */ + installPolicy?: 'allowed' | 'stop_new_install'; + /** 需要目标 owner 重验的原因列表。 */ + recheckReasons?: string[]; +} + +/** 市场许可信息。 */ +export interface LicenseInfoVO { + /** 允许用途。 */ + allowedUses: string[]; + /** 外部订单或授权引用。 */ + externalOrderRef?: string; + /** 许可类型。 */ + licenseType: string; + /** 价格或权益展示文案。 */ + priceDisplay?: string; + /** 禁止用途。 */ + prohibitedUses: string[]; + /** 有效期说明。 */ + validityPeriod?: string; +} + +/** 市场资产列表筛选。 */ +export interface MarketAssetQuery extends MuseMarketPageQuery { + /** 动作策略筛选。 */ + actionPolicy?: MarketActionPolicyFilter; + /** 资产类型筛选。 */ + assetType?: MarketAssetType; + /** 资产名称搜索。 */ + keyword?: string; + /** 上架状态筛选。 */ + listingStatus?: MarketListingStatus; + /** 发布者 ID。 */ + publisherId?: string; +} + +/** 管理端市场资产列表项。 */ +export interface AdminMarketAssetSummaryVO { + /** 动作策略。 */ + actionPolicy?: AssetActionPolicyVO; + /** 申诉数量。 */ + appealCount?: number; + /** 市场资产 ID。 */ + assetId: string; + /** 资产类型。 */ + assetType: MarketAssetType; + /** 绑定数量。 */ + bindCount?: number; + /** 安装数量。 */ + installCount?: number; + /** 上架生命周期状态。 */ + listingStatus: MarketListingStatus; + /** 资产名称。 */ + name: string; + /** 发布者 ID。 */ + publisherId?: string; + /** 发布者名称。 */ + publisherName: string; + /** 审核状态。 */ + reviewStatus: MarketReviewStatus; + /** 来源状态。 */ + sourceStatus?: MarketSourceStatus; + /** 资产版本。 */ + version?: string; +} + +/** 治理历史条目。 */ +export interface AdminGovernanceHistoryItemVO { + /** 治理动作。 */ + action?: string; + /** 操作人 ID。 */ + operatorId?: string; + /** 操作时间。 */ + operatedAt?: string; + /** 治理原因。 */ + reason?: string; + /** 治理范围。 */ + scope?: string; +} + +/** 管理端市场资产详情。 */ +export interface AdminMarketAssetDetailVO + extends AdminMarketAssetSummaryVO { + /** 受影响任务数量。 */ + affectedTaskCount?: number; + /** 关联申诉摘要。 */ + appeals?: AdminAppealSummaryVO[]; + /** 治理历史。 */ + governanceHistory?: AdminGovernanceHistoryItemVO[]; + /** 许可信息。 */ + licenseInfo?: LicenseInfoVO; + /** 来源引用摘要,不包含用户私有正文。 */ + sourceReferenceSummary?: string; +} + +/** 受影响数量聚合。 */ +export interface AffectedCountsVO { + /** 授权记录数量。 */ + authorizationCount?: number; + /** 绑定数量。 */ + bindingCount?: number; + /** 安装数量。 */ + installationCount?: number; + /** 知识草稿数量。 */ + knowledgeDraftCount?: number; + /** 运行中任务数量。 */ + runningTaskCount?: number; + /** Shadow 候选数量。 */ + shadowCandidateCount?: number; +} + +/** 治理影响预览请求。 */ +export interface PreviewMarketGovernanceImpactDTO { + /** 拟执行治理动作类型。 */ + actionType: MarketGovernanceActionType; + /** 幂等命令 ID。 */ + commandId: string; + /** 治理范围。 */ + scope?: Exclude; +} + +/** 治理影响预览结果。 */ +export interface AdminGovernanceImpactPreviewVO { + /** 受影响数量聚合。 */ + affectedCounts: AffectedCountsVO; + /** 可替代资产建议。 */ + alternativeAssets?: string[]; + /** 治理动作类型。 */ + actionType: MarketGovernanceActionType; + /** 通知范围说明。 */ + notificationScope?: string; + /** 预览 ID。 */ + previewId: string; + /** 治理范围。 */ + scope: string; + /** 来源引用摘要。 */ + sourceReferenceSummary?: string; +} + +/** 下架市场资产请求。 */ +export interface DelistMarketAssetDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 期望当前状态,避免盲下架。 */ + expectedStatus: 'listed'; + /** 影响预览 ID。 */ + impactPreviewId: string; + /** 下架原因。 */ + reason: string; + /** 下架范围。 */ + scope: Exclude; +} + +/** 召回市场资产请求。 */ +export interface RecallMarketAssetDTO { + /** 召回依据。 */ + basis: string; + /** 幂等命令 ID。 */ + commandId: string; + /** 是否启动法务保全限制。 */ + exportPreservation?: boolean; + /** 期望当前状态,避免盲召回。 */ + expectedStatus: 'delisted' | 'listed'; + /** 影响预览 ID。 */ + impactPreviewId: string; + /** 召回原因。 */ + reason: string; + /** 召回范围。 */ + scope: 'full_recall' | 'stop_generation'; +} + +/** 发布申请列表筛选。 */ +export interface MarketPublishRequestQuery extends MuseMarketPageQuery { + /** 资产类型筛选。 */ + assetType?: MarketAssetType; + /** 发布者 ID。 */ + publisherId?: string; + /** 风险标签筛选。 */ + riskTag?: string; + /** 审核状态筛选。 */ + status?: MarketReviewStatus; +} + +/** 管理端发布申请摘要。 */ +export interface AdminPublishRequestSummaryVO { + /** 市场资产 ID。 */ + assetId: string; + /** 资产名称。 */ + assetName: string; + /** 资产类型。 */ + assetType: MarketAssetType; + /** 隐私/密钥检查结果。 */ + privacyCheckResult?: string; + /** 发布者 ID。 */ + publisherId?: string; + /** 发布者名称。 */ + publisherName?: string; + /** 发布申请 ID。 */ + requestId: string; + /** 风险标签。 */ + riskTags?: string[]; + /** 权利声明摘要。 */ + rightsDeclaration?: string; + /** 提交时间。 */ + submittedAt?: string; + /** 审核状态。 */ + status: MarketReviewStatus; + /** 资产版本。 */ + version?: string; +} + +/** 审核通过发布申请请求。 */ +export interface ApproveMarketPublishRequestDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 审核证据标签。 */ + evidenceTags?: string[]; + /** 期望当前审核状态。 */ + expectedStatus: 'needs_supplement' | 'pending' | 'reviewing'; + /** 审核通过说明。 */ + note: string; + /** 审核校验结果引用 ID。 */ + validationResultId: string; +} + +/** 驳回发布申请请求。 */ +export interface RejectMarketPublishRequestDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 审核证据标签。 */ + evidenceTags?: string[]; + /** 期望当前审核状态。 */ + expectedStatus: 'needs_supplement' | 'pending' | 'reviewing'; + /** 驳回理由。 */ + reason: string; + /** 是否要求发布者补充材料后重新提交。 */ + requireSupplement?: boolean; + /** 需要补充的项目列表。 */ + supplementItems?: string[]; + /** 审核校验结果引用 ID。 */ + validationResultId: string; +} + +/** 申诉列表筛选。 */ +export interface MarketAppealQuery extends MuseMarketPageQuery { + /** 申诉人 ID。 */ + appellantId?: string; + /** 申诉类型筛选。 */ + appealType?: MarketAppealType; + /** 关联资产 ID。 */ + assetId?: string; + /** 申诉状态筛选。 */ + status?: MarketAppealStatus; +} + +/** 管理端申诉摘要。 */ +export interface AdminAppealSummaryVO { + /** 申诉 ID。 */ + appealId: string; + /** 申诉类型。 */ + appealType: MarketAppealType; + /** 申诉人 ID。 */ + appellantId?: string; + /** 申诉人名称。 */ + appellantName?: string; + /** 资产 ID。 */ + assetId: string; + /** 资产名称。 */ + assetName?: string; + /** 处理人 ID。 */ + processorId?: string; + /** 申诉状态。 */ + status: MarketAppealStatus; + /** 提交时间。 */ + submittedAt?: string; +} + +/** 申诉处理历史条目。 */ +export interface AppealProcessingHistoryItemVO { + /** 处理动作。 */ + action?: string; + /** 处理人 ID。 */ + processorId?: string; + /** 处理时间。 */ + processedAt?: string; + /** 处理原因。 */ + reason?: string; +} + +/** 申诉补充材料记录。 */ +export interface AppealSupplementRecordVO { + /** 附件 ID 列表。 */ + attachmentIds?: string[]; + /** 补充说明。 */ + description?: string; + /** 提交时间。 */ + submittedAt?: string; + /** 提交人 ID。 */ + submittedBy?: string; + /** 补充材料 ID。 */ + supplementId?: string; +} + +/** 管理端申诉详情。 */ +export interface AdminAppealDetailVO extends AdminAppealSummaryVO { + /** 资产版本。 */ + assetVersion?: string; + /** 当前治理状态。 */ + currentGovernanceStatus?: string; + /** 证据材料标识列表。 */ + evidenceMaterials?: string[]; + /** 原审核、下架或召回结论。 */ + originalResult?: string; + /** 处理历史。 */ + processingHistory?: AppealProcessingHistoryItemVO[]; + /** 申诉理由。 */ + reason: string; + /** 补充材料记录。 */ + supplementRecords?: AppealSupplementRecordVO[]; +} + +/** 处理市场申诉请求。 */ +export interface ResolveMarketAppealDTO { + /** 幂等命令 ID。 */ + commandId: string; + /** 处理证据标签。 */ + evidenceTags?: string[]; + /** 期望当前申诉状态。 */ + expectedStatus: 'pending' | 'reviewing' | 'supplementing'; + /** 恢复或关闭时关联的影响预览 ID。 */ + impactPreviewId: string; + /** 处理理由。 */ + reason: string; + /** 处理结论。 */ + resolution: MarketAppealResolution; + /** 是否要求申诉人补充材料。 */ + requireSupplement?: boolean; + /** 需要补充的项目。 */ + supplementItems?: string[]; +} + +/** 查询市场资产分页列表。 */ +export function getMarketAssetListApi(params: MarketAssetQuery) { + return museAdminApi.get>( + '/market/assets', + toMuseQueryParams(params), + ); +} + +/** 查询市场资产治理详情。 */ +export function getMarketAssetApi(assetId: string) { + return museAdminApi.get( + `/market/assets/${assetId}`, + ); +} + +/** 预览市场资产治理影响。 */ +export function previewMarketGovernanceImpactApi( + assetId: string, + data: PreviewMarketGovernanceImpactDTO, +) { + return museAdminApi.post( + `/market/assets/${assetId}/governance-impact`, + data, + ); +} + +/** 下架市场资产。 */ +export function delistMarketAssetApi( + assetId: string, + data: DelistMarketAssetDTO, +) { + return museAdminApi.post(`/market/assets/${assetId}/delist`, data); +} + +/** 召回市场资产。 */ +export function recallMarketAssetApi( + assetId: string, + data: RecallMarketAssetDTO, +) { + return museAdminApi.post(`/market/assets/${assetId}/recall`, data); +} + +/** 查询发布申请审核队列。 */ +export function getMarketPublishRequestListApi( + params: MarketPublishRequestQuery, +) { + return museAdminApi.get>( + '/market/publish-requests', + toMuseQueryParams(params), + ); +} + +/** 审核通过发布申请。 */ +export function approveMarketPublishRequestApi( + requestId: string, + data: ApproveMarketPublishRequestDTO, +) { + return museAdminApi.post( + `/market/publish-requests/${requestId}/approve`, + data, + ); +} + +/** 驳回发布申请。 */ +export function rejectMarketPublishRequestApi( + requestId: string, + data: RejectMarketPublishRequestDTO, +) { + return museAdminApi.post( + `/market/publish-requests/${requestId}/reject`, + data, + ); +} + +/** 查询市场申诉列表。 */ +export function getMarketAppealListApi(params: MarketAppealQuery) { + return museAdminApi.get>( + '/market/appeals', + toMuseQueryParams(params), + ); +} + +/** 查询市场申诉详情。 */ +export function getMarketAppealApi(appealId: string) { + return museAdminApi.get(`/market/appeals/${appealId}`); +} + +/** 处理市场申诉。 */ +export function resolveMarketAppealApi( + appealId: string, + data: ResolveMarketAppealDTO, +) { + return museAdminApi.post( + `/market/appeals/${appealId}/resolve`, + data, + ); +} diff --git a/muse-admin/apps/web-antd/src/api/muse/newapi/__tests__/index.spec.ts b/muse-admin/apps/web-antd/src/api/muse/newapi/__tests__/index.spec.ts new file mode 100644 index 00000000..2977299c --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/newapi/__tests__/index.spec.ts @@ -0,0 +1,96 @@ +import { beforeEach, describe, expect, it, vi } from 'vitest'; + +import { + createNewApiCallAttributionJobApi, + createNewApiGatewayBindingApi, + createNewApiQuotaRequestApi, + getNewApiIntegrationCallApi, + listNewApiBalanceSnapshotsApi, + listNewApiGatewayUsersApi, + listNewApiUsageRecordsApi, +} from '../index'; + +const { museAdminApiMock } = vi.hoisted(() => ({ + museAdminApiMock: { + get: vi.fn(), + post: vi.fn(), + }, +})); + +vi.mock('#/api/muse/client', () => ({ + museAdminApi: museAdminApiMock, +})); + +describe('muse newapi api', () => { + beforeEach(() => { + vi.clearAllMocks(); + }); + + it('只通过账户契约查询网关绑定、余额和用量摘要', async () => { + await listNewApiGatewayUsersApi({ + bindingStatus: 'sync_failed', + pageNo: 1, + pageSize: 20, + }); + await listNewApiBalanceSnapshotsApi('u1', { pageNo: 1, pageSize: 10 }); + await listNewApiUsageRecordsApi({ + attributionStatus: 'pending', + pageNo: 1, + pageSize: 20, + }); + + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 1, + '/account/new-api-bindings', + { bindingStatus: 'sync_failed', pageNo: 1, pageSize: 20 }, + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 2, + '/account/users/u1/balance-snapshots', + { pageNo: 1, pageSize: 10 }, + ); + expect(museAdminApiMock.get).toHaveBeenNthCalledWith( + 3, + '/account/usage-records', + { attributionStatus: 'pending', pageNo: 1, pageSize: 20 }, + ); + }); + + it('提交网关绑定、额度请求和调用归属命令', async () => { + await createNewApiGatewayBindingApi('u1', { + commandId: 'cmd-bind', + forceRefresh: true, + reason: '同步失败重试', + }); + await createNewApiQuotaRequestApi('u1', { + commandId: 'cmd-quota', + requestType: 'subscription_sync', + reason: '套餐对账', + }); + await createNewApiCallAttributionJobApi({ + commandId: 'cmd-attr', + correlationId: 'corr-1', + verificationMode: 'strict', + }); + await getNewApiIntegrationCallApi('corr/1'); + + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 1, + '/account/users/u1/new-api-binding', + expect.objectContaining({ commandId: 'cmd-bind' }), + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 2, + '/account/users/u1/quota-requests', + expect.objectContaining({ commandId: 'cmd-quota' }), + ); + expect(museAdminApiMock.post).toHaveBeenNthCalledWith( + 3, + '/account/call-attribution-jobs', + expect.objectContaining({ commandId: 'cmd-attr' }), + ); + expect(museAdminApiMock.get).toHaveBeenCalledWith( + '/account/integration-calls/by-correlation/corr%2F1', + ); + }); +}); diff --git a/muse-admin/apps/web-antd/src/api/muse/newapi/index.ts b/muse-admin/apps/web-antd/src/api/muse/newapi/index.ts new file mode 100644 index 00000000..bfa3abde --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/muse/newapi/index.ts @@ -0,0 +1,35 @@ +/** + * New-API 网关治理 API + * + * New-API 的管理端能力由账户域契约承接。本文件提供页面语义化别名, + * 避免 New-API 页面直接理解账户域内部命名,同时不新增不存在的后端路径。 + */ + +export type { + AdminQuotaRequestCreate, + AdminUsageRecord, + BalanceSnapshotEntry, + CallAttributionJobCreate, + CallAttributionJobDetail, + CallAttributionJobResult, + IntegrationCallDetail, + MuseAdminId, + MuseAdminPageQuery, + NewApiBindingCreateRequest, + NewApiBindingQuery, + NewApiBindingResult, + NewApiBindingStatus, + NewApiBindingSummary, + QuotaRequestResult, + UsageRecordQuery, +} from '../account'; + +export { + createCallAttributionJobApi as createNewApiCallAttributionJobApi, + createNewApiBindingApi as createNewApiGatewayBindingApi, + createQuotaRequestApi as createNewApiQuotaRequestApi, + getBalanceSnapshotsApi as listNewApiBalanceSnapshotsApi, + getIntegrationCallByCorrelationApi as getNewApiIntegrationCallApi, + listNewApiBindingsApi as listNewApiGatewayUsersApi, + listUsageRecordsApi as listNewApiUsageRecordsApi, +} from '../account'; diff --git a/muse-admin/apps/web-antd/src/api/types/account.ts b/muse-admin/apps/web-antd/src/api/types/account.ts new file mode 100644 index 00000000..131dc860 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/types/account.ts @@ -0,0 +1,2957 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export interface paths { + "/admin-api/muse/account/users": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 用户账户摘要 + * @description 管理员查询用户账户列表和治理摘要,含账号状态、权益来源、配额状态和风险标记。 + */ + get: operations["adminListAccountUsers"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/users/{userId}/entitlements": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查看用户权益和配额 + * @description 管理员查看指定用户的权益档位、配额额度、剩余、到期和限流状态。 + */ + get: operations["adminGetUserEntitlements"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/users/{userId}/quota-adjustments": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 配额调整 ledger + * @description 查询指定用户的配额调整记录,展示调整来源、幂等键、前后快照和审计状态。 + */ + get: operations["adminListQuotaAdjustments"]; + put?: never; + /** + * 调整用户配额 + * @description 管理员人工调整用户配额。每次调整必须记录 commandId、correlationId、调整原因、前后权益快照、操作者和幂等状态。 + * 适用于人工调整、套餐变更、市场补偿、导出扣减回滚或 New-API 配置请求回填。 + */ + post: operations["adminCreateQuotaAdjustment"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/new-api-bindings": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 网关用户绑定状态列表 + * @description 管理员查询所有用户的 New-API 网关用户绑定状态,含绑定时间、同步状态和异常标记。 + */ + get: operations["adminListNewApiBindings"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/users/{userId}/new-api-binding": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 创建或刷新 New-API 网关用户绑定 + * @description 管理员为指定用户创建或刷新 New-API 网关用户绑定。必须带 commandId 保证幂等。 + * 绑定成功后用户的 AI 调用将通过该网关用户路由和计费。 + */ + post: operations["adminCreateNewApiBinding"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/users/{userId}/quota-requests": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 向 New-API 发起额度配置请求 + * @description 管理员为指定用户向 New-API 发起额度配置请求。返回 requestId 和 correlationId。 + * 后续可通过 correlationId 查询外部调用状态和归属。 + */ + post: operations["adminCreateQuotaRequest"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/users/{userId}/balance-snapshots": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * New-API 余额和权益快照摘要 + * @description 管理员查看指定用户的 New-API 余额和权益快照。不含底层供应商路由或成本策略。 + */ + get: operations["adminGetBalanceSnapshots"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/call-attribution-jobs": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 创建调用归属 job + * @description 管理员创建调用归属 job,只能基于 New-API 已记录的 correlationId/callIds 归因。 + * 服务端必须从调用审计记录校验 user/work/agent/asset/license 关系,不能信任请求体直接指定归因事实。 + * 必须带 commandId 保证幂等。 + */ + post: operations["adminCreateCallAttributionJob"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/call-attribution-jobs/{jobId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询调用归属状态 + * @description 查询调用归属 job 的执行状态、失败原因和补偿建议。 + */ + get: operations["adminGetCallAttributionJob"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/integration-calls/by-correlation/{correlationId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 按 correlationId 查询外部调用 + * @description 管理员按 correlationId 查询外部调用去重、重试组和归属状态。 + */ + get: operations["adminGetIntegrationCallByCorrelation"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/usage-records": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 用量摘要 + * @description 管理员查询全平台用量摘要,含 Token 消耗、归属分布、待归属和异常。 + */ + get: operations["adminListUsageRecords"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/account/purchase-records": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 购买记录摘要 + * @description 管理员查询全平台购买记录摘要,含购买、免费获取、管理员授权和外部订单。 + */ + get: operations["adminListPurchaseRecords"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/me": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 当前用户、权益摘要、默认入口、可见产品空间 + * @description 获取当前登录用户的账户摘要,含资料、权益摘要、默认入口和可见产品空间。 + * 不返回系统权限表、后台菜单、New-API token、Prompt secret 或私有审计字段。 + */ + get: operations["getCurrentUser"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/profile": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 个人资料 + * @description 获取当前用户个人资料,含头像、昵称、联系方式脱敏值、验证状态和账号状态。 + */ + get: operations["getProfile"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + /** + * 修改资料 + * @description 修改当前用户个人资料。必须带 commandId 保证幂等,带 expectedVersion 做乐观锁。 + * 联系方式变更需走单独验证流程,不在此接口直接修改。 + */ + patch: operations["updateProfile"]; + trace?: never; + }; + "/app-api/muse/account/entitlements": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 权益和配额 + * @description 获取当前用户权益和配额,含套餐、额度、剩余、到期和限流状态。 + * 只展示当前账户可用权益,不暴露底层供应商路由或成本策略。 + */ + get: operations["getAppEntitlements"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/usage": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 用量摘要 + * @description 获取当前用户账户级用量摘要,含 Token 消耗、归属分布、待归属和异常。 + * 不展示底层模型路由、供应商成本日志或管理员调账。 + */ + get: operations["getAppUsage"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/new-api-binding": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 当前用户 New-API 网关用户绑定摘要 + * @description 获取当前用户的 New-API 网关用户绑定状态。 + * 不暴露 New-API token、provider authority 或供应商路由。 + */ + get: operations["getAppNewApiBinding"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/new-api-binding/recheck": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 发起网关用户绑定重验 + * @description 用户发起 New-API 网关用户绑定重验。必须带 commandId 保证幂等。 + * 重验是异步任务,返回 jobId 供后续轮询。 + */ + post: operations["appRecheckNewApiBinding"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/balance-snapshots": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 余额和权益快照摘要 + * @description 获取当前用户的 New-API 余额和权益快照。 + * 不暴露底层供应商路由、成本策略或完整 Prompt/Response。 + */ + get: operations["getAppBalanceSnapshots"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/quota-requests": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 发起本人套餐或余额同步请求 + * @description 用户发起本人套餐或余额同步请求。返回 requestId 和 correlationId。 + * 后续可通过 requestId 查询额度请求状态,通过 correlationId 查询外部调用。 + */ + post: operations["appCreateQuotaRequest"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/quota-requests/{requestId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询额度请求状态 + * @description 查询当前用户额度请求的状态、correlationId 和失败原因。 + */ + get: operations["appGetQuotaRequest"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/integration-calls/by-correlation/{correlationId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询本人外部调用 + * @description 按 correlationId 查询当前用户的外部调用去重、重试和归属状态。 + * 只能查本人可见调用,不暴露 New-API token 或私有审计字段。 + */ + get: operations["appGetIntegrationCallByCorrelation"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/purchases": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 购买记录 + * @description 获取当前用户购买记录,含购买、免费获取、管理员授权和外部订单引用。 + * 不做 checkout、退款、发票和收益结算。金额和外部引用按权限脱敏。 + */ + get: operations["appListPurchases"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/licenses": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 授权记录 + * @description 获取当前用户授权获取记录,含资产类型、来源、许可、版本、授权状态和安装/绑定摘要。 + * 不做市场发现、购买、安装、绑定或许可变更。 + */ + get: operations["appListLicenses"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/publish-records": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 发布记录 + * @description 获取当前用户发布记录总览,含资产类型、版本、审核状态、市场状态和阻断原因。 + * 不审核、上架、下架、申诉或编辑资产正文。 + */ + get: operations["appListPublishRecords"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/security-events": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 安全事件摘要 + * @description 获取当前用户安全事件摘要列表,含事件类型、严重度和时间。 + * 只返回当前账户可处理项,敏感值脱敏。 + */ + get: operations["appListSecurityEvents"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/security-events/{eventId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 安全事件详情 + * @description 获取安全事件详情,含事件类型、发生时间、来源 IP、设备信息、影响范围和处理建议。 + * 安全事件只能由事件所属用户查看。 + */ + get: operations["appGetSecurityEvent"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/security-events/{eventId}/acknowledge": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 确认安全事件 + * @description 用户确认/处理安全事件,标记用户已知晓或已采取措施。 + * 确认操作是 append-only,不删除安全事件记录。 + * action=session_revoked 时,后端应联动 session 管理服务使相关会话失效。 + * 必须带 commandId 保证幂等,写审计。 + */ + post: operations["appAcknowledgeSecurityEvent"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/export-tasks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 创建个人中心导出任务 + * @description 创建个人资料、账户记录或安全事件导出任务。 + * 必须带 commandId 保证幂等。大范围或高敏导出需要 step-up。 + * 不改变任何业务事实,只生成导出包。 + */ + post: operations["appCreateExportTask"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/export-tasks/{taskId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询个人中心导出任务 + * @description 查询个人中心导出任务的执行状态和下载凭证。 + */ + get: operations["appGetExportTask"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/account/downloads/{credentialId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 下载个人中心导出包 + * @description 使用下载凭证下载个人中心导出包。 + * 来源 revoked/recalled/blocked/unauthorized 或授权过期时返回 SOURCE_BLOCKED。 + */ + get: operations["appDownloadExport"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: { + /** @description 管理端用户账户摘要 */ + AdminAccountUserSummary: { + /** @description 用户 ID */ + userId: string; + /** @description 用户昵称 */ + nickname: string; + /** + * Format: uri + * @description 头像 URL + */ + avatar?: string; + /** + * @description 账号状态 + * @enum {string} + */ + status: "active" | "restricted" | "suspended"; + /** @description 权益来源(套餐名或管理员授权) */ + entitlementSource: string; + /** + * @description 配额状态 + * @enum {string} + */ + quotaStatus: "normal" | "low" | "exhausted" | "expired"; + /** + * @description New-API 网关绑定状态 + * @enum {string} + */ + newApiBindingStatus?: "bound" | "unbound" | "sync_failed" | "pending"; + /** @description 风险标记列表 */ + riskFlags?: string[]; + /** + * Format: date-time + * @description 注册时间 + */ + createdAt?: string; + /** + * Format: date-time + * @description 最近活跃时间 + */ + lastActiveAt?: string; + }; + /** @description 管理端用户权益和配额详情 */ + AdminUserEntitlementDetail: { + /** @description 用户 ID */ + userId: string; + /** @description 权益列表 */ + entitlements: components["schemas"]["Entitlement"][]; + /** @description 配额列表 */ + quotas: components["schemas"]["Quota"][]; + /** @description 权益来源说明 */ + entitlementSource?: string; + /** + * Format: date-time + * @description 最近权益变更时间 + */ + lastModifiedAt?: string; + /** @description 最近变更操作者摘要(脱敏) */ + lastModifiedBy?: string; + }; + /** @description 配额调整请求 */ + QuotaAdjustmentRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 调整项列表 */ + adjustments: { + /** @description 权益资源类型 */ + resourceType: string; + /** @description 调整增量(正数为增加,负数为减少) */ + delta: number; + /** @description 调整前权益快照 */ + beforeSnapshot: { + limit?: number; + used?: number; + remaining?: number; + }; + /** + * Format: date-time + * @description 新的到期时间(可选) + */ + expiresAt?: string; + }[]; + /** @description 调整原因(写入审计日志) */ + reason: string; + /** @description 关联的外部调用 ID(New-API 回填时使用) */ + correlationId?: string; + /** @description 审批引用(需要复核时使用) */ + approvalRef?: string; + }; + /** @description 配额调整结果 */ + QuotaAdjustmentResult: { + /** @description 调整记录 ID */ + adjustmentId: string; + /** @description 请求幂等键 */ + commandId: string; + /** + * @description 调整状态 + * @enum {string} + */ + status: "applied" | "idempotent_hit" | "idempotency_conflict"; + /** @description 调整后权益快照 */ + afterSnapshot?: { + resourceType?: string; + limit?: number; + used?: number; + remaining?: number; + }; + }; + /** @description 配额调整 ledger 记录 */ + QuotaAdjustmentLedgerEntry: { + /** @description 调整记录 ID */ + adjustmentId: string; + /** @description 幂等键 */ + commandId: string; + /** + * @description 调整来源类型 + * @enum {string} + */ + sourceType: "manual" | "plan_change" | "market_compensation" | "export_rollback" | "newapi_callback"; + /** @description 权益资源类型 */ + resourceType: string; + /** @description 调整增量 */ + delta: number; + /** @description 调整前快照 */ + beforeSnapshot?: { + limit?: number; + used?: number; + remaining?: number; + }; + /** @description 调整后快照 */ + afterSnapshot?: { + limit?: number; + used?: number; + remaining?: number; + }; + /** @description 关联外部调用 ID */ + correlationId?: string; + /** @description 调整原因 */ + reason?: string; + /** @description 操作者摘要(脱敏) */ + operatorSummary: string; + /** + * @description 审计状态 + * @enum {string} + */ + auditStatus?: "audited" | "pending_audit"; + /** + * Format: date-time + * @description 调整时间 + */ + createdAt: string; + }; + /** @description New-API 网关用户绑定摘要 */ + NewApiBindingSummary: { + /** @description 用户 ID */ + userId: string; + /** @description 用户昵称 */ + nickname?: string; + /** + * @description 绑定状态 + * @enum {string} + */ + bindingStatus: "bound" | "unbound" | "sync_failed" | "pending"; + /** + * Format: date-time + * @description 绑定时间 + */ + boundAt?: string; + /** + * Format: date-time + * @description 最近同步时间 + */ + lastSyncAt?: string; + /** @description 同步失败原因(仅失败时返回) */ + syncErrorMessage?: string; + }; + /** @description New-API 网关绑定结果 */ + NewApiBindingResult: { + /** @description 绑定记录 ID */ + bindingId: string; + /** + * @description 绑定操作结果状态 + * @enum {string} + */ + status: "created" | "refreshed" | "idempotent_hit" | "idempotency_conflict"; + /** @description 请求幂等键 */ + commandId: string; + /** + * Format: date-time + * @description 绑定时间 + */ + boundAt?: string; + }; + /** @description 管理端发起额度配置请求 */ + AdminQuotaRequestCreate: { + /** @description 幂等键 */ + commandId: string; + /** + * @description 额度配置类型 + * @enum {string} + */ + requestType: "plan_config" | "balance_config" | "subscription_sync"; + /** @description 请求原因(写入审计日志) */ + reason?: string; + /** @description 目标额度配置 */ + targetQuota?: { + resourceType?: string; + limit?: number; + }; + }; + /** @description 额度请求创建结果 */ + QuotaRequestResult: { + /** @description 额度请求 ID */ + requestId: string; + /** @description 外部调用关联 ID,后续可用于查询调用状态 */ + correlationId: string; + /** + * @description 请求初始状态 + * @enum {string} + */ + status: "queued" | "processing" | "idempotent_hit"; + }; + /** @description 额度请求状态 */ + QuotaRequestStatus: { + /** @description 额度请求 ID */ + requestId: string; + /** @description 外部调用关联 ID */ + correlationId: string; + /** + * @description 请求状态 + * @enum {string} + */ + status: "queued" | "processing" | "completed" | "failed" | "idempotent_hit"; + /** @description 失败原因(仅失败时返回) */ + failedReason?: string; + /** + * Format: date-time + * @description 完成时间 + */ + completedAt?: string; + /** + * Format: date-time + * @description 创建时间 + */ + createdAt?: string; + }; + /** @description 余额和权益快照条目 */ + BalanceSnapshotEntry: { + /** @description 快照 ID */ + snapshotId: string; + /** @description 权益资源类型 */ + resourceType: string; + /** @description 余额(不暴露供应商路由或成本策略) */ + balance: number; + /** @description 已使用配额 */ + usedQuota?: number; + /** @description 总配额 */ + totalQuota?: number; + /** + * Format: date-time + * @description 到期时间 + */ + expiresAt?: string; + /** + * Format: date-time + * @description 快照捕获时间 + */ + capturedAt: string; + /** @description 快照来源(套餐/管理员/市场补偿等) */ + source?: string; + }; + /** + * @description 创建调用归属 job 请求。归因事实必须由服务端根据 correlationId/callIds 对已记录 New-API 调用、 + * 业务任务和授权记录进行校验后得出,禁止在请求体中任意指定 user/work/asset/license 归属。 + */ + CallAttributionJobCreate: { + /** @description 幂等键 */ + commandId: string; + /** @description New-API 调用关联 ID,必须已存在于服务端调用审计记录 */ + correlationId: string; + /** @description 可选的 New-API callId 白名单;未传时归因该 correlationId 下所有未归因调用 */ + callIds?: string[]; + /** @description 调用审计记录 revision 乐观锁,避免对过期调用集归因 */ + expectedCallRevision?: number; + /** + * @description 归因校验模式;strict 下必须校验调用、任务、作品、资产和授权关系一致 + * @default strict + * @enum {string} + */ + verificationMode: "strict"; + /** @description 归属原因 */ + reason?: string; + }; + /** @description 调用归属 job 创建结果 */ + CallAttributionJobResult: { + /** @description 调用归属 job ID */ + jobId: string; + /** + * @description job 初始状态 + * @enum {string} + */ + status: "queued" | "processing" | "idempotent_hit"; + }; + /** @description 调用归属 job 详情 */ + CallAttributionJobDetail: { + /** @description 调用归属 job ID */ + jobId: string; + /** + * @description 执行状态 + * @enum {string} + */ + status: "queued" | "processing" | "completed" | "failed" | "partially_completed"; + /** @description 归属用户 ID */ + userId: string; + /** @description 已归属调用数 */ + attributedCallCount?: number; + /** @description 待归属调用数 */ + pendingCallCount?: number; + /** @description 归属失败调用数 */ + failedCallCount?: number; + /** @description 失败原因(仅失败时返回) */ + failedReason?: string; + /** @description 补偿建议(失败时提供) */ + compensationSuggestion?: string; + /** + * Format: date-time + * @description 创建时间 + */ + createdAt: string; + /** + * Format: date-time + * @description 完成时间 + */ + completedAt?: string; + }; + /** @description 外部调用详情 */ + IntegrationCallDetail: { + /** @description 外部调用关联 ID */ + correlationId: string; + /** + * @description 调用状态 + * @enum {string} + */ + status: "success" | "failed" | "retrying" | "deduplicated" | "attributed" | "pending_attribution"; + /** @description 请求类型(额度配置/余额查询等) */ + requestType?: string; + /** @description 重试组内的调用 ID 列表 */ + retryGroup?: string[]; + /** + * @description 归属状态 + * @enum {string} + */ + attributionStatus?: "attributed" | "pending" | "failed"; + /** @description 归属用户 ID */ + attributedUserId?: string; + /** + * Format: date-time + * @description 首次调用时间 + */ + createdAt: string; + /** + * Format: date-time + * @description 最近重试时间 + */ + lastRetryAt?: string; + /** @description 错误信息(仅失败时返回) */ + errorMessage?: string; + }; + /** @description 管理端用量记录 */ + AdminUsageRecord: { + /** @description 记录 ID */ + recordId: string; + /** @description 用户 ID */ + userId: string; + /** @description 用户昵称 */ + nickname?: string; + /** @description 统计周期 */ + period: string; + /** @description 总输入 Token 数 */ + totalInputTokens?: number; + /** @description 总输出 Token 数 */ + totalOutputTokens?: number; + /** @description 总 Token 数 */ + totalTokens: number; + /** @description 待归属记录数 */ + pendingAttributionCount?: number; + /** @description 归属失败记录数 */ + failedAttributionCount?: number; + /** + * @description 归属状态 + * @enum {string} + */ + attributionStatus: "attributed" | "pending" | "failed"; + /** @description 按作品归属摘要 */ + byWork?: { + workId?: string; + workTitle?: string; + tokens?: number; + }[]; + /** @description 按智能体归属摘要 */ + byAgent?: { + agentId?: string; + agentName?: string; + tokens?: number; + }[]; + }; + /** @description 管理端购买记录 */ + AdminPurchaseRecord: { + /** @description 记录 ID */ + recordId: string; + /** @description 用户 ID */ + userId: string; + /** @description 用户昵称 */ + nickname?: string; + /** + * @description 资产类型 + * @enum {string} + */ + assetType: "work" | "agent" | "knowledge_base"; + /** @description 资产名称 */ + assetName?: string; + /** + * @description 购买类型 + * @enum {string} + */ + purchaseType?: "paid" | "free" | "admin_grant" | "external"; + /** @description 金额(免费为 0) */ + amount?: number; + /** + * @description 购买状态 + * @enum {string} + */ + status: "completed" | "processing" | "failed" | "refunded"; + /** @description 外部订单引用(脱敏) */ + externalOrderRef?: string; + /** @description 授权结果摘要 */ + authorizationResult?: string; + /** + * Format: date-time + * @description 购买时间 + */ + createdAt: string; + }; + /** @description 当前用户摘要 */ + CurrentUserSummary: { + /** @description 用户 ID */ + userId: string; + /** @description 用户昵称 */ + nickname: string; + /** + * Format: uri + * @description 头像 URL + */ + avatar?: string; + /** + * @description 账号状态 + * @enum {string} + */ + status: "active" | "restricted" | "suspended"; + /** @description 邮箱是否已验证 */ + emailVerified?: boolean; + /** @description 手机号是否已验证 */ + phoneVerified?: boolean; + /** @description 是否启用二次验证 */ + mfaEnabled?: boolean; + /** @description 权益摘要 */ + entitlementSummary: { + /** @description 当前套餐名 */ + planName?: string; + /** @description 剩余配额 */ + remainingQuota?: number; + /** + * @description 配额状态 + * @enum {string} + */ + quotaStatus?: "normal" | "low" | "exhausted" | "expired"; + /** + * Format: date-time + * @description 权益到期时间 + */ + expiresAt?: string; + }; + /** @description 待处理安全风险数 */ + securityRiskCount?: number; + /** @description 默认入口路径 */ + defaultEntry: string; + /** @description 可见产品空间列表 */ + visibleProductSpaces: { + /** @description 空间标识(work/agent/knowledge/market) */ + spaceKey?: string; + /** @description 空间显示名称 */ + spaceName?: string; + /** @description 空间入口路径 */ + entryPath?: string; + }[]; + }; + /** @description 个人资料 */ + AccountProfile: { + /** @description 用户 ID */ + userId: string; + /** @description 昵称 */ + nickname: string; + /** + * Format: uri + * @description 头像 URL + */ + avatar?: string; + /** @description 公开署名 */ + publicPenName?: string; + /** @description 邮箱脱敏值 */ + emailMasked?: string; + /** @description 手机号脱敏值 */ + phoneMasked?: string; + /** @description 邮箱是否已验证 */ + emailVerified: boolean; + /** @description 手机号是否已验证 */ + phoneVerified: boolean; + /** + * @description 账号状态 + * @enum {string} + */ + status: "active" | "restricted" | "suspended"; + /** + * Format: date-time + * @description 注册时间 + */ + createdAt?: string; + /** + * Format: date-time + * @description 最近资料更新时间 + */ + lastProfileUpdatedAt?: string; + /** @description 资料版本号(乐观锁) */ + version?: number; + }; + /** @description 修改资料请求 */ + ProfileUpdateRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 期望资料版本号(乐观锁) */ + expectedVersion: number; + /** @description 新昵称 */ + nickname?: string; + /** + * Format: uri + * @description 新头像 URL + */ + avatar?: string; + /** @description 新公开署名 */ + publicPenName?: string; + }; + /** @description 用户端权益和配额详情 */ + AppEntitlementDetail: { + /** @description 当前套餐名 */ + planName?: string; + /** @description 权益来源说明 */ + entitlementSource?: string; + /** @description 权益列表 */ + entitlements: components["schemas"]["Entitlement"][]; + /** @description 配额列表 */ + quotas: components["schemas"]["Quota"][]; + /** @description 限流信息 */ + rateLimits?: { + resourceType?: string; + limitPerMinute?: number; + currentUsage?: number; + }[]; + /** @description 发布能力 */ + publishCapability?: { + maxPublishableAssets?: number; + currentPublished?: number; + }; + /** + * Format: date-time + * @description 权益到期时间 + */ + expiresAt?: string; + }; + /** @description 用户端用量摘要 */ + AppUsageSummary: { + /** @description 统计周期 */ + period?: string; + /** @description 总输入 Token 数 */ + totalInputTokens?: number; + /** @description 总输出 Token 数 */ + totalOutputTokens?: number; + /** @description 待归属记录数 */ + pendingAttributionCount?: number; + /** @description 计量异常记录数 */ + anomalyCount?: number; + /** @description 按模型的用量分布 */ + byModel?: { + [key: string]: number; + }; + /** @description 按日期的用量分布 */ + byDate?: { + /** Format: date */ + date?: string; + inputTokens?: number; + outputTokens?: number; + }[]; + /** @description 按归属对象类型的用量分布 */ + byAttribution?: { + /** @enum {string} */ + attributionType?: "work" | "agent" | "knowledge" | "market"; + tokens?: number; + label?: string; + }[]; + }; + /** @description 用户端 New-API 网关用户绑定摘要 */ + AppNewApiBindingSummary: { + /** + * @description 绑定状态 + * @enum {string} + */ + bindingStatus: "bound" | "unbound" | "sync_failed" | "pending"; + /** + * Format: date-time + * @description 绑定时间 + */ + boundAt?: string; + /** + * Format: date-time + * @description 最近同步时间 + */ + lastSyncAt?: string; + /** @description 是否可以发起重验 */ + canRecheck?: boolean; + }; + /** @description 用户端购买记录 */ + AppPurchaseRecord: { + /** @description 记录编号 */ + recordId: string; + /** + * @description 资产类型 + * @enum {string} + */ + assetType: "work" | "agent" | "knowledge_base"; + /** @description 资产名称 */ + assetName?: string; + /** + * @description 购买类型 + * @enum {string} + */ + purchaseType: "paid" | "free" | "admin_grant" | "external"; + /** @description 金额(免费为 0) */ + amount?: number; + /** + * @description 购买状态 + * @enum {string} + */ + status: "completed" | "processing" | "failed" | "external_pending" | "refunded"; + /** @description 外部订单引用(脱敏) */ + externalOrderRef?: string; + /** @description 授权结果摘要 */ + authorizationResultSummary?: string; + /** + * Format: date-time + * @description 购买时间 + */ + createdAt: string; + }; + /** @description 用户端授权记录 */ + AppLicenseRecord: { + /** @description 授权记录 ID */ + licenseId: string; + /** + * @description 资产类型 + * @enum {string} + */ + assetType: "work" | "agent" | "knowledge_base"; + /** @description 资产名称 */ + assetName: string; + /** @description 发布者 */ + publisherName?: string; + /** @description 版本 */ + version?: string; + /** @description 许可范围摘要 */ + licenseScope?: string; + /** + * @description 授权状态 + * @enum {string} + */ + licenseStatus: "active" | "uninstalled" | "installed" | "bound" | "expired" | "delisted" | "recalled"; + /** @description 授权记录的动作策略;重验要求不得写入 licenseStatus */ + actionPolicy?: { + /** @description 需要重验的原因列表,例如 authorization_snapshot_expired / source_version_changed */ + recheckReasons?: string[]; + /** @enum {string} */ + installPolicy?: "allowed" | "blocked"; + /** @enum {string} */ + bindPolicy?: "allowed" | "blocked"; + }; + /** + * Format: date-time + * @description 获取时间 + */ + acquiredAt?: string; + /** + * Format: date-time + * @description 到期时间 + */ + expiresAt?: string; + /** @description 安装状态摘要 */ + installSummary?: string; + /** @description 绑定状态摘要 */ + bindingSummary?: string; + /** @description 异常原因(授权失效/下架/需重验时返回) */ + anomalyReason?: string; + }; + /** @description 用户端发布记录 */ + AppPublishRecord: { + /** @description 发布记录 ID */ + recordId: string; + /** + * @description 资产类型 + * @enum {string} + */ + assetType: "work" | "agent" | "knowledge_base"; + /** @description 资产名称 */ + assetName: string; + /** @description 版本 */ + version?: string; + /** + * @description 审核状态 + * @enum {string} + */ + reviewStatus: "draft" | "submitted" | "under_review" | "needs_supplement" | "approved" | "listed" | "delisted" | "appealed"; + /** + * @description 市场状态 + * @enum {string} + */ + marketStatus?: "not_listed" | "listed" | "delisted" | "recalled"; + /** @description 阻断原因摘要 */ + blockingReason?: string; + /** + * Format: date-time + * @description 提交时间 + */ + submittedAt?: string; + /** + * Format: date-time + * @description 最近更新时间 + */ + lastUpdatedAt?: string; + }; + /** @description 安全事件摘要 */ + SecurityEventSummary: { + /** @description 安全事件 ID */ + eventId: string; + /** + * @description 事件类型 + * @enum {string} + */ + eventType: "login_anomaly" | "credential_expired" | "sensitive_export" | "access_denied_burst" | "device_change" | "permission_escalation"; + /** + * @description 严重程度 + * @enum {string} + */ + severity: "info" | "warning" | "critical"; + /** + * Format: date-time + * @description 事件发生时间 + */ + occurredAt: string; + /** @description 事件简短描述 */ + description?: string; + /** @description 是否已确认 */ + acknowledged?: boolean; + }; + /** @description 安全事件详情 */ + SecurityEventDetail: { + /** @description 安全事件 ID */ + eventId: string; + /** + * @description 事件类型 + * @enum {string} + */ + eventType: "login_anomaly" | "credential_expired" | "sensitive_export" | "access_denied_burst" | "device_change" | "permission_escalation"; + /** + * @description 严重程度 + * @enum {string} + */ + severity: "info" | "warning" | "critical"; + /** + * Format: date-time + * @description 事件发生时间 + */ + occurredAt: string; + /** @description 来源 IP 地址(脱敏) */ + sourceIp?: string; + /** @description 设备信息摘要 */ + deviceInfo?: { + /** @description User-Agent 摘要 */ + userAgent?: string; + /** @description 平台 */ + platform?: string; + /** @description 地理位置摘要 */ + location?: string; + }; + /** @description 影响范围描述 */ + affectedScope: string; + /** @description 事件详细描述 */ + description: string; + /** @description 建议处理措施列表 */ + suggestedActions: string[]; + /** + * Format: date-time + * @description 用户确认时间(未确认为空) + */ + acknowledgedAt?: string; + /** @description 用户确认时选择的处理措施 */ + acknowledgedAction?: string; + }; + /** @description 确认安全事件请求 */ + SecurityEventAcknowledgeRequest: { + /** @description 幂等键 */ + commandId: string; + /** + * @description 确认动作: + * - acknowledged: 已知晓 + * - password_changed: 已修改密码 + * - session_revoked: 已撤销相关会话 + * - false_positive: 标记为误报 + * @enum {string} + */ + action: "acknowledged" | "password_changed" | "session_revoked" | "false_positive"; + /** @description 可选,用户备注 */ + note?: string; + }; + /** @description 安全事件确认结果 */ + SecurityEventAcknowledgeResult: { + /** @description 安全事件 ID */ + eventId: string; + /** @description 是否确认成功 */ + acknowledged: boolean; + /** @description 确认动作 */ + action: string; + /** + * Format: date-time + * @description 确认时间 + */ + acknowledgedAt?: string; + /** @description 处理后风险摘要 */ + riskSummary?: string; + /** @description 后续建议 */ + nextSteps?: string[]; + }; + /** @description 创建个人中心导出任务请求 */ + AccountExportTaskCreate: { + /** @description 幂等键 */ + commandId: string; + /** + * @description 导出类型 + * @enum {string} + */ + exportType: "profile" | "usage" | "security_events" | "purchases" | "licenses"; + /** @description 时间范围(安全事件和用量导出必填) */ + dateRange?: { + /** Format: date */ + startDate?: string; + /** Format: date */ + endDate?: string; + }; + /** + * @description 脱敏规则 + * @default standard + * @enum {string} + */ + desensitizationRule: "standard" | "strict"; + }; + /** @description 导出任务创建结果 */ + AccountExportTaskResult: { + /** @description 导出任务 ID */ + taskId: string; + /** + * @description 任务初始状态 + * @enum {string} + */ + status: "queued" | "processing" | "idempotent_hit"; + /** + * Format: date-time + * @description 预计完成时间 + */ + estimatedCompletionAt?: string; + }; + /** @description 导出任务详情 */ + AccountExportTaskDetail: { + /** @description 导出任务 ID */ + taskId: string; + /** + * @description 导出类型 + * @enum {string} + */ + exportType: "profile" | "usage" | "security_events" | "purchases" | "licenses"; + /** + * @description 任务状态 + * @enum {string} + */ + status: "queued" | "processing" | "completed" | "failed"; + /** @description 下载凭证 ID(完成时返回) */ + downloadCredentialId?: string; + /** + * Format: date-time + * @description 下载凭证过期时间 + */ + downloadExpiresAt?: string; + /** @description 失败原因(仅失败时返回) */ + failedReason?: string; + /** + * Format: date-time + * @description 创建时间 + */ + createdAt: string; + /** + * Format: date-time + * @description 完成时间 + */ + completedAt?: string; + }; + /** @description 权益项 */ + Entitlement: { + /** @description 权益 ID */ + id: string; + /** @description 权益资源类型(如 ai_tokens, storage, publish_slots 等) */ + resourceType: string; + /** @description 额度上限(-1 表示无限制) */ + limit: number; + /** @description 已使用量 */ + used: number; + /** @description 剩余额度 */ + remaining?: number; + /** @description 权益来源(套餐/管理员/市场补偿等) */ + source?: string; + /** + * Format: date-time + * @description 到期时间 + */ + expiresAt: string; + }; + /** @description 配额项 */ + Quota: { + /** @description 配额 ID */ + id: string; + /** @description 配额资源类型 */ + resourceType: string; + /** @description 总配额 */ + total: number; + /** @description 已使用量 */ + used?: number; + /** @description 剩余配额 */ + remaining: number; + /** + * Format: date-time + * @description 配额重置时间 + */ + resetAt: string; + /** @description 频率限制(每分钟) */ + limitPerMinute?: number; + }; + CommonResult: { + /** + * @description 业务状态码,0 表示成功 + * @example 0 + */ + code: number; + /** @description 响应数据,类型视具体接口而定 */ + data?: unknown; + /** + * @description 提示信息 + * @example success + */ + msg: string; + }; + PaginatedResult: { + /** + * @description 总记录数 + * @example 150 + */ + total: number; + /** + * @description 当前页码 + * @example 1 + */ + pageNo: number; + /** + * @description 每页条数 + * @example 20 + */ + pageSize: number; + /** @description 当前页数据列表 */ + list: unknown[]; + }; + ErrorResponse: { + /** + * @description 错误码格式: {system}-{module}-{category}-{sequence} + * 示例: MUSE-CONTENT-001-0001 + * @example MUSE-CONTENT-001-0001 + */ + code: string; + /** @description 人类可读的错误描述 */ + msg: string; + /** @description 详细错误信息(仅开发环境返回) */ + detail?: string; + }; + }; + responses: { + /** @description 未认证或 token 过期 */ + Unauthorized: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 无权限 */ + Forbidden: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源不存在 */ + NotFound: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 请求参数有误 */ + BadRequest: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源冲突 */ + Conflict: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + parameters: { + /** @description 用户 ID */ + userIdPath: string; + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + XApiVersion: "1"; + /** @description 页码,从 1 开始 */ + pageNo: number; + /** @description 每页条数,上限 100 */ + pageSize: number; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + adminListAccountUsers: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按昵称或账号 ID 模糊搜索 */ + keyword?: string; + /** @description 账号状态筛选 */ + status?: "active" | "restricted" | "suspended"; + /** @description 权益来源筛选 */ + entitlementSource?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 用户账户摘要分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AdminAccountUserSummary"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminGetUserEntitlements: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 用户 ID */ + userId: components["parameters"]["userIdPath"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 用户权益和配额详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AdminUserEntitlementDetail"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + }; + }; + adminListQuotaAdjustments: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 调整来源类型筛选 */ + sourceType?: "manual" | "plan_change" | "market_compensation" | "export_rollback" | "newapi_callback"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 用户 ID */ + userId: components["parameters"]["userIdPath"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 配额调整记录分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["QuotaAdjustmentLedgerEntry"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminCreateQuotaAdjustment: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 用户 ID */ + userId: components["parameters"]["userIdPath"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["QuotaAdjustmentRequest"]; + }; + }; + responses: { + /** @description 配额调整成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["QuotaAdjustmentResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 409: components["responses"]["Conflict"]; + }; + }; + adminListNewApiBindings: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 绑定状态筛选 */ + bindingStatus?: "bound" | "unbound" | "sync_failed" | "pending"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 网关用户绑定状态分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["NewApiBindingSummary"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminCreateNewApiBinding: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 用户 ID */ + userId: components["parameters"]["userIdPath"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** + * @description 是否强制刷新已有绑定(绑定异常时使用) + * @default false + */ + forceRefresh?: boolean; + /** @description 创建或刷新原因(写入审计日志) */ + reason?: string; + }; + }; + }; + responses: { + /** @description 绑定创建或刷新成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["NewApiBindingResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + }; + }; + adminCreateQuotaRequest: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 用户 ID */ + userId: components["parameters"]["userIdPath"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["AdminQuotaRequestCreate"]; + }; + }; + responses: { + /** @description 额度配置请求已创建 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["QuotaRequestResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + }; + }; + adminGetBalanceSnapshots: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 用户 ID */ + userId: components["parameters"]["userIdPath"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 余额和权益快照摘要 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["BalanceSnapshotEntry"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminCreateCallAttributionJob: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CallAttributionJobCreate"]; + }; + }; + responses: { + /** @description 调用归属 job 已创建 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["CallAttributionJobResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminGetCallAttributionJob: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 调用归属 job ID */ + jobId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 调用归属 job 详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["CallAttributionJobDetail"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + }; + }; + adminGetIntegrationCallByCorrelation: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 外部调用关联 ID */ + correlationId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 外部调用详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["IntegrationCallDetail"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + }; + }; + adminListUsageRecords: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按用户筛选 */ + userId?: string; + /** @description 时间范围 */ + period?: "today" | "week" | "month" | "billing_cycle"; + /** @description 归属状态筛选 */ + attributionStatus?: "attributed" | "pending" | "failed"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 用量摘要分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AdminUsageRecord"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListPurchaseRecords: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按用户筛选 */ + userId?: string; + /** @description 购买状态筛选 */ + status?: "completed" | "processing" | "failed" | "refunded"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 购买记录分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AdminPurchaseRecord"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getCurrentUser: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 当前用户摘要 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["CurrentUserSummary"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + getProfile: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 个人资料 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AccountProfile"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + updateProfile: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["ProfileUpdateRequest"]; + }; + }; + responses: { + /** @description 资料更新成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AccountProfile"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + getAppEntitlements: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 权益和配额 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AppEntitlementDetail"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + getAppUsage: { + parameters: { + query?: { + /** @description 时间范围 */ + period?: "today" | "week" | "month" | "billing_cycle"; + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 用量摘要 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AppUsageSummary"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + getAppNewApiBinding: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 网关用户绑定摘要 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AppNewApiBindingSummary"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + appRecheckNewApiBinding: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 重验任务已创建 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @description 异步任务 ID,用于轮询状态 */ + jobId?: string; + /** + * @description 任务初始状态 + * @enum {string} + */ + status?: "queued" | "processing"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + getAppBalanceSnapshots: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 余额和权益快照摘要 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["BalanceSnapshotEntry"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + appCreateQuotaRequest: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** + * @description 请求类型:套餐同步或余额同步 + * @enum {string} + */ + requestType?: "plan_sync" | "balance_sync"; + }; + }; + }; + responses: { + /** @description 额度请求已创建 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["QuotaRequestResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + appGetQuotaRequest: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 额度请求 ID */ + requestId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 额度请求详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["QuotaRequestStatus"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 404: components["responses"]["NotFound"]; + }; + }; + appGetIntegrationCallByCorrelation: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 外部调用关联 ID */ + correlationId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 外部调用详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["IntegrationCallDetail"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + }; + }; + appListPurchases: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 购买状态筛选 */ + status?: "completed" | "processing" | "failed" | "external_pending" | "refunded"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 购买记录分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AppPurchaseRecord"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + appListLicenses: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 资产类型筛选 */ + assetType?: "work" | "agent" | "knowledge_base"; + /** @description 授权状态筛选 */ + licenseStatus?: "active" | "uninstalled" | "installed" | "bound" | "expired" | "delisted" | "recalled"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 授权记录分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AppLicenseRecord"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + appListPublishRecords: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 资产类型筛选 */ + assetType?: "work" | "agent" | "knowledge_base"; + /** @description 审核状态筛选 */ + reviewStatus?: "draft" | "submitted" | "under_review" | "needs_supplement" | "approved" | "listed" | "delisted" | "appealed"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 发布记录分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AppPublishRecord"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + appListSecurityEvents: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 严重程度筛选 */ + severity?: "info" | "warning" | "critical"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 安全事件摘要分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["SecurityEventSummary"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + appGetSecurityEvent: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 安全事件 ID */ + eventId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 安全事件详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["SecurityEventDetail"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + }; + }; + appAcknowledgeSecurityEvent: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 安全事件 ID */ + eventId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["SecurityEventAcknowledgeRequest"]; + }; + }; + responses: { + /** @description 安全事件确认成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["SecurityEventAcknowledgeResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + 409: components["responses"]["Conflict"]; + }; + }; + appCreateExportTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["AccountExportTaskCreate"]; + }; + }; + responses: { + /** @description 导出任务已创建 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AccountExportTaskResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + appGetExportTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 导出任务 ID */ + taskId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 导出任务详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AccountExportTaskDetail"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 404: components["responses"]["NotFound"]; + }; + }; + appDownloadExport: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 下载凭证 ID */ + credentialId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 导出包文件流 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/octet-stream": string; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + }; + }; +} diff --git a/muse-admin/apps/web-antd/src/api/types/ai.ts b/muse-admin/apps/web-antd/src/api/types/ai.ts new file mode 100644 index 00000000..4c7d9b79 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/types/ai.ts @@ -0,0 +1,3350 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export interface paths { + "/admin-api/muse/ai/prompts": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Prompt 列表 */ + get: operations["adminListPrompts"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/ai/prompts/{promptKey}/versions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 新建 Prompt 版本 */ + post: operations["adminCreatePromptVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/ai/prompts/{promptKey}/versions/{version}/activate": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 激活 Prompt 版本 */ + post: operations["adminActivatePromptVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/ai/agents": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * Agent 列表 + * @description 管理端可按 scope 查看 system/user Agent 清单,用于治理、审计和排障。 + * 该列表不赋予管理员修改用户私有智能体的权限;用户 Agent 写操作只能走 App Agent owner API。 + */ + get: operations["adminListAgents"]; + put?: never; + /** + * 创建系统 Agent + * @description 仅创建 scope=system 的系统级 Agent。管理员不能通过该接口创建或修改用户私有 Agent; + * 用户 Agent 的创建、版本和配置写入由 /app-api/muse/agents owner API 承担。 + */ + post: operations["adminCreateAgent"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/ai/agents/{agentId}/versions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 新建系统 Agent 版本 + * @description 仅对 scope=system 的 Agent 生效。若 agentId 属于用户私有 Agent,服务端必须拒绝, + * 不得通过管理端为 user scope Agent 创建版本。 + */ + post: operations["adminCreateAgentVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/ai/tool-grants": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Tool Grant 列表 */ + get: operations["adminListToolGrants"]; + put?: never; + /** + * 登记 Security facade 审批后的工具授权 + * @description Tool Grant 的审批权威属于 Security facade。该接口只登记或调整已通过审批的工具授权, + * AI runtime 只能消费授权结果,不能通过本接口自授权或扩权。 + */ + post: operations["adminCreateOrAdjustToolGrant"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/ai/tasks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** AI 任务列表 */ + get: operations["adminListAiTasks"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/ai/quality-policies": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 质量策略列表 */ + get: operations["adminListQualityPolicies"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/ai/quality-policies/{policyKey}/versions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 新建质量策略版本 */ + post: operations["adminCreateQualityPolicyVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/ai/evaluation-runs": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 启动离线评估 */ + post: operations["adminStartEvaluationRun"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/ai/evaluation-runs/{runId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询离线评估运行 */ + get: operations["adminGetEvaluationRun"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/jobs": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询 Muse 异步任务 */ + get: operations["adminListJobs"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/jobs/{jobId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查看任务详情 */ + get: operations["adminGetJob"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/jobs/{jobId}/retry": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 重试任务 */ + post: operations["adminRetryJob"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/jobs/{jobId}/cancel": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 取消任务 */ + post: operations["adminCancelJob"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/source-events": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询来源状态事件 */ + get: operations["adminListSourceEvents"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/source-events/{eventId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 来源事件详情 */ + get: operations["adminGetSourceEvent"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/source-events/{eventId}/retry": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 重试来源传播 */ + post: operations["adminRetrySourceEvent"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/audit/api-logs": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询接口调用日志 + * @description 查询系统接口调用的轻量脱敏日志,用于排障、风控和基础审计留痕。 + * 响应不得包含请求体全文、响应体全文、token、secret、完整 header 或用户私有正文。 + */ + get: operations["adminListApiAccessLogs"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/audit/api-logs/{logId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询接口调用日志详情 + * @description 查询单条接口调用日志的脱敏详情。敏感详情查看本身必须写入业务审计事件。 + */ + get: operations["adminGetApiAccessLog"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/audit/business-events": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询业务审计摘要 */ + get: operations["adminListBusinessAuditEvents"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/audit/business-events/{eventId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询业务审计详情 + * @description 查询高危操作、敏感读取、配置变更和治理动作的审计详情。 + * before/after 快照必须为脱敏摘要,审计事件 append-only,不提供修改或删除接口。 + */ + get: operations["adminGetBusinessAuditEvent"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/ai/tasks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 创建生成/续写/扩写/润色/检测/规划任务 + * @description AI Orchestration 只接收任务意图和可验证上下文引用,负责排队、候选、Shadow 和评测。 + * 来源快照与运行权限包由服务端通过 Agent BC + Security facade 生成或记录,客户端不能提交上下文事实或伪造权限。 + */ + post: operations["createAiTask"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/ai/tasks/{taskId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询 AI 任务 */ + get: operations["getAiTask"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/ai/tasks/{taskId}/stream": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** AI 任务 SSE 流 */ + get: operations["streamAiTask"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/suggestions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 当前作品候选列表 */ + get: operations["listWorkSuggestions"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/suggestions/{suggestionId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 候选详情 */ + get: operations["getSuggestion"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/suggestions/{suggestionId}/reject": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 丢弃候选 */ + post: operations["rejectSuggestion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/agents": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 用户可用智能体列表 */ + get: operations["listUserAgents"]; + put?: never; + /** 创建用户智能体 */ + post: operations["createUserAgent"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/agents/{agentId}/versions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 新建智能体版本 */ + post: operations["createAgentVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/agents/{agentId}/test": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 试用智能体 */ + post: operations["testAgent"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/agent-slots": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 作品槽位列表 */ + get: operations["listWorkAgentSlots"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/agent-slots/{slotKey}/prechecks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 槽位预检 */ + post: operations["precheckAgentSlot"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/agent-slots/{slotKey}/bind": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 绑定槽位 */ + post: operations["bindAgentSlot"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/jobs/{jobId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询当前用户可见任务 */ + get: operations["getUserJob"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/jobs/{jobId}/cancel": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 取消当前用户可取消任务 */ + post: operations["cancelUserJob"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/source-status/query": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 按上下文查询来源可用状态 */ + post: operations["querySourceStatus"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/source-status/recheck": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 发起来源重验 */ + post: operations["recheckSourceStatus"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: { + PromptSummary: { + /** @description Prompt 唯一标识 */ + promptKey: string; + /** @description Prompt 名称 */ + name?: string; + /** @description 当前激活版本号 */ + activeVersion: number; + /** @description 最新版本号 */ + latestVersion?: number; + /** @description 模板变量数量 */ + variableCount?: number; + /** Format: date-time */ + updatedAt: string; + }; + AdminAgentSummary: { + /** Format: int64 */ + agentId: number; + name: string; + description?: string; + /** + * @description system=系统预置, user=用户创建 + * @enum {string} + */ + scope: "system" | "user"; + activeVersion?: number; + /** @description 关联的 Prompt key */ + promptKey?: string; + /** @enum {string} */ + status: "active" | "archived"; + /** Format: date-time */ + updatedAt: string; + }; + ToolGrantSummary: { + /** Format: int64 */ + grantId: number; + /** Format: int64 */ + agentId: number; + agentName?: string; + /** @description 工具类型 */ + toolType: string; + scope: components["schemas"]["ToolGrantScope"]; + budget: components["schemas"]["ToolGrantBudget"]; + outboundPolicy: components["schemas"]["ToolGrantOutboundPolicy"]; + /** @enum {string} */ + status: "pending" | "approved" | "rejected" | "revoked"; + /** @description 审批人 */ + approvedBy?: string; + /** @description Security facade 审批记录 ID */ + securityApprovalId?: string; + /** Format: date-time */ + createdAt: string; + }; + /** @description Security facade 批准后的工具可用范围,AI runtime 只能按该范围消费。 */ + ToolGrantScope: { + /** + * @description 授权范围类型 + * @enum {string} + */ + scopeType: "system" | "work" | "chapter" | "knowledge_base" | "market_asset" | "external_endpoint"; + /** + * @description 范围 owner 类型 + * @enum {string} + */ + ownerType: "system" | "user" | "work" | "knowledge" | "market"; + /** @description 可访问资源引用;跨作品资源必须由 Security facade 单独批准。 */ + resourceRefs: { + /** @enum {string} */ + resourceType: "work" | "chapter" | "block" | "knowledge_base" | "market_asset" | "endpoint"; + /** @description 资源 ID 或受控 endpoint key */ + resourceId: string; + }[]; + /** + * @description 是否允许跨作品访问;只能由 Security facade 审批结果置为 true。 + * @default false + */ + crossWorkAllowed: boolean; + }; + /** @description Security facade 批准后的工具调用预算。 */ + ToolGrantBudget: { + /** + * @description 预算周期 + * @enum {string} + */ + period: "per_task" | "daily" | "monthly"; + /** @description 周期内最大调用次数 */ + maxCalls: number; + /** @description 周期内最大 token 用量;0 表示该工具不消耗 token 预算。 */ + maxTokens?: number; + /** @description 周期内最大成本,单位为分。 */ + maxCostCents?: number; + }; + /** @description Security facade 批准后的外发策略。 */ + ToolGrantOutboundPolicy: { + /** + * @description 网络外发模式 + * @enum {string} + */ + networkMode: "none" | "internal_only" | "allowlist"; + /** @description 允许访问的外部目的地 key 或域名;networkMode=allowlist 时必填非空。 */ + allowedDestinations: string[]; + /** + * @description 用户内容外发策略 + * @enum {string} + */ + dataPolicy: "no_user_content" | "redacted_user_content" | "approved_context_only"; + }; + AiTaskSummary: { + /** Format: int64 */ + taskId: number; + /** + * @description 任务类型 + * @enum {string} + */ + taskType: "generation" | "continuation" | "expansion" | "polish" | "detection" | "planning"; + /** @enum {string} */ + status: "queued" | "running" | "completed" | "failed" | "cancelled"; + /** @description 任务所属用户 */ + userId?: string; + /** + * Format: int64 + * @description 关联作品 ID + */ + workId?: number; + /** + * Format: int64 + * @description 使用的智能体 ID + */ + agentId?: number; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + completedAt?: string; + }; + QualityPolicySummary: { + /** @description 质量策略唯一标识 */ + policyKey: string; + name?: string; + description?: string; + activeVersion: number; + latestVersion?: number; + /** @description 质量维度数量 */ + dimensionCount?: number; + /** Format: date-time */ + updatedAt: string; + }; + EvaluationRun: { + /** Format: int64 */ + runId: number; + policyKey: string; + policyVersion?: number; + datasetReference?: string; + sampleSize?: number; + /** @enum {string} */ + status: "queued" | "running" | "completed" | "failed" | "cancelled"; + /** @description 总样本数 */ + totalSamples?: number; + /** @description 通过样本数 */ + passedSamples?: number; + /** @description 未通过样本数 */ + failedSamples?: number; + /** + * Format: double + * @description 总体评分 + */ + overallScore?: number; + /** @description 各维度评分 */ + dimensionScores?: { + [key: string]: number; + }; + /** Format: date-time */ + startedAt?: string; + /** Format: date-time */ + completedAt?: string; + /** Format: date-time */ + createdAt: string; + errorMessage?: string; + }; + JobSummary: { + /** Format: int64 */ + jobId: number; + /** @description 任务类型(如 knowledge_extraction, export, evaluation 等) */ + type: string; + /** @enum {string} */ + status: "queued" | "running" | "completed" | "failed" | "cancelled"; + /** @description owner 模块 */ + owner: string; + /** @description 创建者 */ + createdBy?: string; + /** @description 已重试次数 */ + retryCount?: number; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + completedAt?: string; + }; + JobDetail: { + /** Format: int64 */ + jobId: number; + type: string; + /** @enum {string} */ + status: "queued" | "running" | "completed" | "failed" | "cancelled"; + owner: string; + createdBy?: string; + /** @description 任务输入参数 */ + input?: Record; + /** @description 任务结果(完成时) */ + result?: Record; + /** @description 失败原因 */ + errorMessage?: string; + /** @description 失败阶段 */ + failedStage?: string; + /** @description 是否可重试 */ + retryable?: boolean; + retryCount?: number; + /** @description 重试组 ID */ + retryGroupId?: string; + /** @description 关联 ID */ + correlationId?: string; + /** Format: date-time */ + startedAt?: string; + /** Format: date-time */ + completedAt?: string; + /** Format: date-time */ + createdAt: string; + /** @description 建议的下一步操作 */ + nextActions?: string[]; + }; + SourceEventSummary: { + /** Format: int64 */ + eventId: number; + /** @description 来源对象类型 */ + sourceType: string; + /** + * Format: int64 + * @description 来源对象 ID + */ + sourceId: number; + /** @enum {string} */ + sourceStatus: "active" | "stale" | "revoked" | "recalled" | "delisted" | "blocked" | "owner_missing" | "unauthorized"; + /** @enum {string} */ + actionPolicy: "allowed" | "read_only" | "blocked" | "needs_recheck"; + /** @description 影响范围描述 */ + affectedScope?: string; + /** Format: date-time */ + createdAt: string; + }; + SourceEventDetail: { + /** Format: int64 */ + eventId: number; + sourceType: string; + /** Format: int64 */ + sourceId: number; + /** @enum {string} */ + sourceStatus: "active" | "stale" | "revoked" | "recalled" | "delisted" | "blocked" | "owner_missing" | "unauthorized"; + /** @enum {string} */ + actionPolicy: "allowed" | "read_only" | "blocked" | "needs_recheck"; + /** @description 原因归因列表 */ + reasonAttributions: { + reason?: string; + source?: string; + }[]; + /** @description 受影响的绑定数 */ + affectedBindings?: number; + /** @description 受影响的任务数 */ + affectedTasks?: number; + /** @description 传播状态 */ + propagationStatus?: string; + /** + * Format: int64 + * @description 关联的传播任务 ID + */ + jobId?: number; + nextActions?: string[]; + /** Format: date-time */ + createdAt: string; + }; + ApiAccessLogSummary: { + /** Format: int64 */ + logId: number; + /** @description 请求链路 ID */ + requestId: string; + /** @description 调用人脱敏摘要 */ + actor: string; + /** @enum {string} */ + actorType?: "admin" | "system" | "user" | "anonymous"; + /** @description 业务模块 */ + module?: string; + /** @enum {string} */ + method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; + /** @description 脱敏路径摘要,不能包含敏感查询参数 */ + pathSummary: string; + /** @description 关联对象脱敏摘要 */ + objectSummary?: string; + /** @description 客户端 IP 脱敏摘要 */ + clientIp?: string; + /** @enum {string} */ + status: "success" | "failed" | "slow" | "sensitive" | "redacted"; + statusCode: number; + /** @description 接口耗时毫秒数 */ + durationMs: number; + errorCode?: string; + errorSummary?: string; + /** Format: date-time */ + createdAt: string; + }; + ApiAccessLogDetail: components["schemas"]["ApiAccessLogSummary"] & { + /** @description 请求头脱敏摘要,不包含 token、secret、cookie 或完整 header */ + requestHeadersSummary?: { + [key: string]: string; + }; + /** @description 请求体脱敏摘要,不包含用户私有正文全文 */ + requestBodySummary?: { + [key: string]: unknown; + }; + /** @description 响应体脱敏摘要,不包含用户私有正文全文 */ + responseBodySummary?: { + [key: string]: unknown; + }; + /** + * Format: int64 + * @description 查看敏感调用详情时写入的业务审计事件 ID + */ + relatedAuditEventId?: number; + }; + BusinessAuditEventSummary: { + /** Format: int64 */ + eventId: number; + /** @description 审计事件类型 */ + eventType: string; + /** @description 操作者 */ + operator: string; + /** @description 操作资源类型 */ + resourceType?: string; + /** @description 操作资源 ID */ + resourceId?: string; + /** @description 操作摘要 */ + summary?: string; + /** Format: date-time */ + createdAt: string; + }; + BusinessAuditEventDetail: components["schemas"]["BusinessAuditEventSummary"] & { + /** @description 操作理由 */ + reason?: string; + /** + * @description 操作结果 + * @enum {string} + */ + result?: "success" | "failed" | "rejected" | "pending_review"; + /** @description 变更前脱敏快照摘要 */ + beforeSnapshot?: { + [key: string]: unknown; + }; + /** @description 变更后脱敏快照摘要 */ + afterSnapshot?: { + [key: string]: unknown; + }; + /** @description 影响范围摘要 */ + impactSummary?: string; + /** @description 审批或复核摘要 */ + approvalSummary?: string; + /** @description 审计事件是否 append-only */ + immutable?: boolean; + }; + /** @description 用户本次希望 AI 编排完成的任务意图,不携带上下文事实。 */ + AiTaskIntent: { + /** + * @description 任务意图类型 + * @enum {string} + */ + kind: "generation" | "continuation" | "expansion" | "polish" | "detection" | "planning"; + /** @description 用户补充指令;只能表达意图,不能作为已授权上下文事实。 */ + userInstruction?: string; + /** + * @description 期望输出落点,实际落点由服务端根据任务类型和权限决定。 + * @default suggestion + * @enum {string} + */ + outputTarget: "suggestion" | "planning_candidate" | "evaluation_report" | "shadow_candidate"; + }; + /** @description 可验证的上下文引用;服务端按 owner、作品归属和权限重新取数。 */ + AiContextRef: { + /** + * @description 引用类型 + * @enum {string} + */ + refType: "work" | "chapter" | "block"; + /** + * Format: int64 + * @description 引用对象 ID;chapter/block 必须属于 workId 指向的作品。 + */ + refId: number; + /** @description 调用方看到的对象 revision,仅用于 stale 检测,不授予权限。 */ + expectedRevision?: number; + }; + /** @description 可验证的智能体覆盖引用;服务端仍必须通过 Agent BC 和 Security facade 校验。 */ + AgentOverrideRef: { + /** + * Format: int64 + * @description 覆盖使用的智能体 ID + */ + agentId: number; + /** @description 覆盖使用的智能体版本 */ + agentVersion: number; + /** @description 覆盖默认槽位智能体的原因 */ + reason: string; + }; + /** + * @description 客户端只能提交任务意图、作品/章节/Block 上下文引用、agentSlotKey 或 agentOverrideRef。 + * 服务端负责生成来源快照与 Runtime Permission Envelope;客户端不得提交上下文块数组、正文片段或授权快照。 + */ + CreateAiTaskRequest: { + /** @description 幂等键 */ + commandId: string; + intent: components["schemas"]["AiTaskIntent"]; + /** + * Format: int64 + * @description 目标作品 ID;服务端以此作为上下文和权限边界。 + */ + workId?: number; + /** + * Format: int64 + * @description 目标 Block 引用(正文生成/续写等场景必填);服务端校验其归属 workId。 + */ + blockId?: number; + /** + * Format: int64 + * @description 目标章节引用;服务端校验其归属 workId。 + */ + chapterId?: number; + /** @description 作品内智能体槽位 key,由 Agent BC 解析为具体 Agent 版本。 */ + agentSlotKey?: string; + agentOverrideRef?: components["schemas"]["AgentOverrideRef"]; + /** @description 附加上下文引用;只能传 ID/revision,不能传正文或跨作品事实。 */ + additionalContextRefs?: components["schemas"]["AiContextRef"][]; + /** + * @description 服务端可读取的最大上下文范围;最终裁剪受 Runtime Permission Envelope 约束。 + * @default work + * @enum {string} + */ + contextScope: "none" | "work" | "chapter" | "block"; + }; + AiTaskDetail: { + /** Format: int64 */ + taskId: number; + /** @enum {string} */ + taskType: "generation" | "continuation" | "expansion" | "polish" | "detection" | "planning"; + /** Format: int64 */ + agentId: number; + agentName?: string; + /** Format: int64 */ + workId?: number; + /** Format: int64 */ + blockId?: number; + /** @enum {string} */ + status: "queued" | "running" | "streaming" | "completed" | "failed" | "cancelled"; + /** + * Format: int64 + * @description 任务完成后关联的候选 ID + */ + suggestionId?: number; + /** @description 来源版本 */ + sourceRevision?: number; + /** @description 服务端记录的来源快照 ID */ + sourceSnapshotId?: string; + /** @description 服务端生成的运行权限包 ID */ + runtimePermissionEnvelopeId?: string; + /** @description 各质量维度评分 */ + qualityScores?: { + [key: string]: number; + }; + errorMessage?: string; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + completedAt?: string; + }; + SuggestionSummary: { + /** Format: int64 */ + suggestionId: number; + /** + * Format: int64 + * @description 关联的 AI 任务 ID + */ + taskId?: number; + /** Format: int64 */ + blockId?: number; + /** Format: int64 */ + agentId?: number; + agentName?: string; + /** @enum {string} */ + taskType: "generation" | "continuation" | "expansion" | "polish" | "detection" | "planning"; + /** @enum {string} */ + status: "pending" | "accepted" | "rejected"; + /** @description 生成时的来源版本号 */ + sourceRevision?: number; + /** @description 变更摘要 */ + diffSummary?: string; + /** @description 质量门控是否通过 */ + qualityPassed?: boolean; + /** Format: date-time */ + createdAt: string; + }; + SuggestionDetail: { + /** Format: int64 */ + suggestionId: number; + /** Format: int64 */ + taskId: number; + /** Format: int64 */ + blockId?: number; + /** Format: int64 */ + agentId?: number; + agentName?: string; + /** @enum {string} */ + taskType?: "generation" | "continuation" | "expansion" | "polish" | "detection" | "planning"; + /** @enum {string} */ + status: "pending" | "accepted" | "rejected"; + /** @description 候选正文内容 */ + content?: string; + /** @description 与当前 Block 正文的 diff 内容 */ + diffContent?: string; + /** @description 生成时的来源版本号 */ + sourceRevision: number; + /** @description 服务端记录的来源快照 ID */ + sourceSnapshotId?: string; + /** @description 服务端记录的授权快照 ID;不接受客户端伪造为运行权限。 */ + authorizationSnapshotId?: string; + /** @description 各质量维度的评分 */ + qualityScores?: { + [key: string]: number; + }; + /** @description 候选质量结果版本 */ + qualityResultVersion?: number; + /** @description 输出合规结果 ID */ + outputComplianceResultId?: string; + /** @description 静态检查结果 ID */ + staticCheckResultId?: string; + /** Format: date-time */ + createdAt: string; + }; + AgentSummary: { + /** Format: int64 */ + agentId: number; + name: string; + description?: string; + /** + * @description system=系统预置, mine=用户自建 + * @enum {string} + */ + scope: "system" | "mine"; + activeVersion?: number; + /** @enum {string} */ + status: "active" | "archived"; + /** Format: date-time */ + updatedAt: string; + }; + AgentTestRequest: { + /** + * Format: int64 + * @description 可选,关联作品上下文;不传时使用沙箱上下文 + */ + workId?: number; + /** + * @description 决定试用时可读取的上下文范围 + * @default none + * @enum {string} + */ + contextScope: "none" | "work" | "chapter"; + /** + * @description 决定本次试用是否计费 + * @default charge + * @enum {string} + */ + usagePolicy: "charge" | "free_trial"; + /** + * @description preview_only 只返回预览不落库,shadow 写入 Shadow Candidate 供后续决策 + * @default preview_only + * @enum {string} + */ + outputTarget: "preview_only" | "shadow"; + /** @description 试用输入内容 */ + input: { + /** @description 试用输入提示词 */ + prompt: string; + }; + /** @description 幂等键 */ + commandId: string; + }; + AgentTestResult: { + /** @description 本次试用会话 ID,用于关联后续查询和审计 */ + trialSessionId: string; + /** @description 智能体输出预览内容 */ + outputPreview?: Record; + /** @description 本次试用是否实际计费 */ + usageCharged: boolean; + /** + * @description 输出实际落点 + * @enum {string} + */ + outputDestination: "preview_only" | "shadow_candidate"; + /** + * Format: int64 + * @description outputDestination=shadow_candidate 时关联的候选 ID + */ + suggestionId?: number; + /** + * Format: int64 + * @description 若异步执行,返回任务 ID 供轮询 + */ + jobId?: number; + }; + AgentSlotSummary: { + /** @description 槽位标识 */ + slotKey: string; + /** @description 槽位名称 */ + slotName: string; + /** @description 槽位类型 */ + slotType?: string; + /** @description 是否为保护节点(保护节点不可替换) */ + protected: boolean; + /** + * Format: int64 + * @description 已绑定的智能体 ID + */ + boundAgentId?: number; + /** @description 已绑定的智能体名称 */ + boundAgentName?: string; + /** @description 已绑定的智能体版本 */ + boundAgentVersion?: number; + /** @description 槽位当前 revision */ + revision: number; + /** @description 来源状态 */ + sourceStatus?: string; + }; + UserJobDetail: { + /** Format: int64 */ + jobId: number; + type: string; + /** @enum {string} */ + status: "queued" | "running" | "completed" | "failed" | "cancelled"; + /** @description 任务结果(完成时) */ + result?: Record; + /** @description 失败原因 */ + errorMessage?: string; + /** @description 是否可重试 */ + retryable?: boolean; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + completedAt?: string; + }; + SourceStatusQueryRequest: { + /** @description 来源对象类型 */ + sourceType: string; + /** + * Format: int64 + * @description 来源对象 ID + */ + sourceId: number; + /** + * @description 用途 + * @enum {string} + */ + purpose: "bind" | "generate" | "export" | "publish" | "confirm" | "install" | "handoff"; + /** + * @description 目标 owner + * @enum {string} + */ + targetOwner: "content" | "knowledge" | "ai" | "market" | "account"; + /** + * Format: int64 + * @description 目标对象 ID + */ + targetId: number; + /** @description 调用方当前持有的来源版本 */ + sourceRevision?: number; + /** @description 调用方当前持有的授权快照 */ + authorizationSnapshotId?: string; + }; + SourceStatusResult: { + /** + * @description 来源状态 + * @enum {string} + */ + sourceStatus: "active" | "stale" | "revoked" | "recalled" | "delisted" | "blocked" | "owner_missing" | "unauthorized"; + /** + * @description 动作策略 + * @enum {string} + */ + actionPolicy: "allowed" | "read_only" | "blocked" | "needs_recheck"; + /** @description 阻断原因列表 */ + blockedReasons?: string[]; + /** @description 需重验原因(ActionPolicy 层面的补充信息,说明为何 actionPolicy=needs_recheck) */ + needsRecheckReasons?: string[]; + /** @description 原因归因列表 */ + reasonAttributions?: { + reason?: string; + source?: string; + }[]; + /** @description 关联的来源事件 */ + sourceEvents?: { + eventId?: string; + eventType?: string; + /** Format: date-time */ + occurredAt?: string; + }[]; + /** @description 建议的下一步操作 */ + nextActions?: string[]; + /** @description 当前来源版本 */ + currentSourceVersion?: number; + /** @description 当前授权快照 ID */ + currentAuthorizationSnapshotId?: string; + /** + * Format: int64 + * @description 可选,关联的异步任务 ID + */ + jobId?: number; + }; + SSEChunkEvent: { + /** + * @description SSE 事件类型 + * @enum {string} + */ + event: "chunk"; + data: { + /** @description AI 生成的文本片段 */ + content: string; + /** @description 片段序号,从 1 递增 */ + sequenceNo: number; + }; + }; + SSEQualityCheckEvent: { + /** + * @description SSE 事件类型 + * @enum {string} + */ + event: "quality_check"; + data: { + /** @description 质量维度名称(如 fluency, coherence, safety) */ + dimension: string; + /** + * Format: double + * @description 质量评分(0-1) + */ + score: number; + /** @description 该维度是否通过阈值 */ + passed: boolean; + }; + }; + SSEDoneEvent: { + /** + * @description SSE 事件类型 + * @enum {string} + */ + event: "done"; + data: { + /** + * Format: int64 + * @description AI 任务 ID + */ + taskId: number; + /** + * Format: int64 + * @description 生成的候选 ID + */ + suggestionId: number; + /** @description 任务完成摘要 */ + summary?: string; + }; + }; + SSEErrorEvent: { + /** + * @description SSE 事件类型 + * @enum {string} + */ + event: "error"; + data: { + /** @description 错误码,格式 MUSE-AI-XXX-XXXX */ + code: string; + /** @description 人类可读的错误描述 */ + message: string; + /** @description 详细错误信息(仅开发环境返回) */ + detail?: string; + /** @description 是否可重试 */ + retryable?: boolean; + }; + }; + CommonResult: { + /** + * @description 业务状态码,0 表示成功 + * @example 0 + */ + code: number; + /** @description 响应数据,类型视具体接口而定 */ + data?: unknown; + /** + * @description 提示信息 + * @example success + */ + msg: string; + }; + PaginatedResult: { + /** + * @description 总记录数 + * @example 150 + */ + total: number; + /** + * @description 当前页码 + * @example 1 + */ + pageNo: number; + /** + * @description 每页条数 + * @example 20 + */ + pageSize: number; + /** @description 当前页数据列表 */ + list: unknown[]; + }; + ErrorResponse: { + /** + * @description 错误码格式: {system}-{module}-{category}-{sequence} + * 示例: MUSE-CONTENT-001-0001 + * @example MUSE-CONTENT-001-0001 + */ + code: string; + /** @description 人类可读的错误描述 */ + msg: string; + /** @description 详细错误信息(仅开发环境返回) */ + detail?: string; + }; + }; + responses: { + /** @description 请求参数有误 */ + BadRequest: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 未认证或 token 过期 */ + Unauthorized: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 无权限 */ + Forbidden: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源冲突 */ + Conflict: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + parameters: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + XApiVersion: "1"; + /** @description 页码,从 1 开始 */ + pageNo: number; + /** @description 每页条数,上限 100 */ + pageSize: number; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + adminListPrompts: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按 promptKey 筛选 */ + promptKey?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Prompt 分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["PromptSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminCreatePromptVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description Prompt 唯一标识 */ + promptKey: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description Prompt 正文内容 */ + content: string; + /** @description 模板变量定义 */ + variables?: { + name: string; + /** @enum {string} */ + type: "string" | "number" | "boolean"; + required?: boolean; + defaultValue?: string; + }[]; + /** @description 版本变更说明 */ + changeNote?: string; + /** @description 幂等键 */ + commandId?: string; + }; + }; + }; + responses: { + /** @description Prompt 版本创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + promptKey?: string; + version?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminActivatePromptVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + promptKey: string; + version: number; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 激活原因 */ + reason?: string; + }; + }; + }; + responses: { + /** @description Prompt 版本已激活 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + promptKey?: string; + activeVersion?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListAgents: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description Agent 范围筛选,默认 all */ + scope?: "system" | "user" | "all"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Agent 分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AdminAgentSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminCreateAgent: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * @description 固定为 system;请求体如传入 scope 也只能是 system,不能创建 user scope Agent。 + * @default system + * @enum {string} + */ + scope?: "system"; + /** @description Agent 名称 */ + name: string; + /** @description Agent 描述 */ + description?: string; + /** @description 关联的 Prompt key */ + promptKey: string; + /** @description 槽位绑定配置(知识库/MetaSchema/模型参数) */ + slotBindings?: Record; + /** @description 关联的系统级工具授权 ID 列表,必须来自 Security facade 已批准的授权。 */ + toolGrantIds?: string[]; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 系统 Agent 创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + agentId?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminCreateAgentVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 目标 Agent ID,必须为 system scope。 */ + agentId: number; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + name?: string; + description?: string; + promptKey?: string; + slotBindings?: Record; + /** @description 关联的系统级工具授权 ID 列表,必须来自 Security facade 已批准的授权。 */ + toolGrantIds?: string[]; + /** @description 版本变更说明 */ + changeNote: string; + /** @description 幂等键 */ + commandId: string; + } | unknown | unknown | unknown | unknown | unknown; + }; + }; + responses: { + /** @description Agent 版本创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + agentId?: number; + version?: number; + }; + }; + }; + }; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListToolGrants: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按审批状态筛选 */ + status?: "pending" | "approved" | "rejected" | "revoked"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Tool Grant 分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["ToolGrantSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminCreateOrAdjustToolGrant: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: int64 + * @description 目标智能体 ID + */ + agentId: number; + /** @description 工具类型(例如 web_search, file_read, api_call) */ + toolType: string; + scope: components["schemas"]["ToolGrantScope"]; + budget: components["schemas"]["ToolGrantBudget"]; + outboundPolicy: components["schemas"]["ToolGrantOutboundPolicy"]; + /** @description 幂等键 */ + commandId: string; + /** @description 授权/调整原因 */ + reason: string; + }; + }; + }; + responses: { + /** @description Security facade 审批后的工具授权已登记或调整 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + grantId?: number; + /** @enum {string} */ + status?: "approved" | "revoked"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListAiTasks: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按任务状态筛选 */ + status?: "queued" | "running" | "completed" | "failed" | "cancelled"; + /** @description 按任务类型筛选 */ + taskType?: "generation" | "continuation" | "expansion" | "polish" | "detection" | "planning"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description AI 任务分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AiTaskSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListQualityPolicies: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 质量策略分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["QualityPolicySummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminCreateQualityPolicyVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 质量策略唯一标识 */ + policyKey: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 质量维度配置列表 */ + dimensions: { + /** @description 质量维度名称 */ + name: string; + /** + * Format: double + * @description 通过阈值 + */ + threshold: number; + /** + * Format: double + * @description 权重 + */ + weight?: number; + }[]; + /** @description 版本变更说明 */ + changeNote?: string; + /** @description 幂等键 */ + commandId?: string; + }; + }; + }; + responses: { + /** @description 质量策略版本创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + policyKey?: string; + version?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminStartEvaluationRun: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 使用的质量策略 key */ + policyKey: string; + /** @description 使用的质量策略版本,不填则使用 active 版本 */ + policyVersion?: number; + /** @description 评估数据集引用 */ + datasetReference: string; + /** @description 采样数量 */ + sampleSize?: number; + /** @description 幂等键 */ + commandId?: string; + }; + }; + }; + responses: { + /** @description 评估任务已提交 */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + runId?: number; + /** Format: int64 */ + jobId?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminGetEvaluationRun: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + runId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 评估运行详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["EvaluationRun"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListJobs: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + status?: "queued" | "running" | "completed" | "failed" | "cancelled"; + /** @description 按 owner 模块筛选 */ + owner?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 异步任务分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["JobSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminGetJob: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + jobId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 任务详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["JobDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminRetryJob: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + jobId: number; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId?: string; + }; + }; + }; + responses: { + /** @description 任务已重新排队 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + jobId?: number; + /** @enum {string} */ + status?: "queued" | "running"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminCancelJob: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + jobId: number; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId?: string; + /** @description 取消原因 */ + reason?: string; + }; + }; + }; + responses: { + /** @description 任务已取消 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + jobId?: number; + /** @enum {string} */ + status?: "cancelled"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListSourceEvents: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 来源类型筛选 */ + sourceType?: string; + /** @description 来源状态筛选 */ + sourceStatus?: "active" | "stale" | "revoked" | "recalled" | "delisted" | "blocked" | "owner_missing" | "unauthorized"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 来源状态事件分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["SourceEventSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminGetSourceEvent: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + eventId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 来源事件详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["SourceEventDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminRetrySourceEvent: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + eventId: number; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId?: string; + /** @description 重试原因 */ + reason?: string; + }; + }; + }; + responses: { + /** @description 来源传播重试已提交 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + jobId?: number; + status?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListApiAccessLogs: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 请求 ID 筛选 */ + requestId?: string; + /** @description 调用人摘要筛选 */ + actor?: string; + /** @description 业务模块筛选 */ + module?: string; + /** @description 调用状态筛选 */ + status?: "success" | "failed" | "slow" | "sensitive" | "redacted"; + startTime?: string; + endTime?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 接口调用日志分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["ApiAccessLogSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminGetApiAccessLog: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + logId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 接口调用日志详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ApiAccessLogDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListBusinessAuditEvents: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 审计事件类型筛选 */ + eventType?: string; + startTime?: string; + endTime?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 业务审计分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["BusinessAuditEventSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminGetBusinessAuditEvent: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + eventId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 业务审计详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["BusinessAuditEventDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createAiTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateAiTaskRequest"]; + }; + }; + responses: { + /** @description AI 任务已提交 */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + taskId?: number; + /** Format: int64 */ + jobId?: number; + /** @description 轮询地址 */ + pollUrl?: string; + /** @description 服务端为本次任务创建或记录的来源快照 ID */ + sourceSnapshotId?: string; + /** @description 服务端生成的运行权限包 ID;客户端不可自选、跨作品拼装或伪造。 */ + runtimePermissionEnvelopeId?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getAiTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + taskId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description AI 任务详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AiTaskDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + streamAiTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + taskId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description SSE 事件流 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "text/event-stream": components["schemas"]["SSEChunkEvent"] | components["schemas"]["SSEQualityCheckEvent"] | components["schemas"]["SSEDoneEvent"] | components["schemas"]["SSEErrorEvent"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + listWorkSuggestions: { + parameters: { + query?: { + /** @description 按候选状态筛选 */ + status?: "pending" | "accepted" | "rejected"; + /** @description 按 Block 筛选 */ + blockId?: number; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 候选列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["SuggestionSummary"][]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getSuggestion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + suggestionId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 候选详情(含生成内容 diff) */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["SuggestionDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + rejectSuggestion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + suggestionId: number; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 拒绝原因(可选,用于改进生成质量) */ + reason?: string; + }; + }; + }; + responses: { + /** @description 已丢弃 */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + listUserAgents: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 智能体范围,默认 all */ + scope?: "system" | "mine" | "all"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 智能体分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AgentSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createUserAgent: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 智能体名称 */ + name: string; + /** @description 智能体描述 */ + description?: string; + /** @description 系统提示词模板 */ + promptTemplate?: string; + /** @description 槽位绑定配置 */ + slotBindings?: Record; + /** @description 幂等键 */ + commandId?: string; + }; + }; + }; + responses: { + /** @description 创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + agentId?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createAgentVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + agentId: number; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + name?: string; + description?: string; + promptTemplate?: string; + slotBindings?: Record; + /** @description 版本变更说明 */ + changeNote?: string; + /** @description 幂等键 */ + commandId?: string; + }; + }; + }; + responses: { + /** @description 版本创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + agentId?: number; + version?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + testAgent: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + agentId: number; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["AgentTestRequest"]; + }; + }; + responses: { + /** @description 试用结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AgentTestResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + listWorkAgentSlots: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 作品槽位列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AgentSlotSummary"][]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + precheckAgentSlot: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: number; + /** @description 槽位标识 */ + slotKey: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** + * Format: int64 + * @description 来源智能体 ID + */ + sourceAgentId: number; + /** @description 来源智能体版本 */ + sourceAgentVersion: number; + /** @description 授权快照 ID */ + authorizationSnapshotId?: string; + /** @description 目标槽位当前 revision */ + expectedSlotRevision?: number; + }; + }; + }; + responses: { + /** @description 预检通过,返回绑定凭证 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @description 槽位绑定预检 ID,供 bind 接口消费 */ + agentSlotPrecheckId?: string; + /** + * Format: date-time + * @description 预检过期时间 + */ + expiresAt?: string; + }; + }; + }; + }; + /** @description 来源状态阻断/预检过期/revision 冲突 */ + 409: components["responses"]["Conflict"]; + }; + }; + bindAgentSlot: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: number; + /** @description 槽位标识 */ + slotKey: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 预检接口返回的绑定凭证,必须由 AI owner 原子消费 */ + agentSlotPrecheckId: string; + /** + * Format: int64 + * @description 绑定来源智能体 ID + */ + sourceAgentId: number; + /** @description 绑定来源智能体版本 */ + sourceAgentVersion: number; + /** @description 授权快照 ID */ + authorizationSnapshotId?: string; + /** @description 目标槽位当前 revision */ + expectedSlotRevision: number; + }; + }; + }; + responses: { + /** @description 槽位绑定成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @description 绑定后的新槽位 revision */ + slotRevision?: number; + /** @description 来源状态 */ + sourceStatus?: string; + }; + }; + }; + }; + /** @description 预检过期/revision 冲突/来源阻断 */ + 409: components["responses"]["Conflict"]; + }; + }; + getUserJob: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + jobId: number; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 用户可见任务详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["UserJobDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + cancelUserJob: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + jobId: number; + }; + cookie?: never; + }; + requestBody?: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId?: string; + }; + }; + }; + responses: { + /** @description 任务已取消 */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + querySourceStatus: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["SourceStatusQueryRequest"]; + }; + }; + responses: { + /** @description 来源可用状态 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["SourceStatusResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + recheckSourceStatus: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 来源对象类型 */ + sourceType: string; + /** + * Format: int64 + * @description 来源对象 ID + */ + sourceId: number; + /** @description 调用方当前持有的来源版本 */ + sourceRevision?: number; + /** + * @description 用途 + * @enum {string} + */ + purpose: "bind" | "generate" | "export" | "publish" | "confirm" | "install" | "handoff"; + /** + * @description 目标 owner + * @enum {string} + */ + targetOwner: "content" | "knowledge" | "ai" | "market" | "account"; + /** + * Format: int64 + * @description 目标对象 ID + */ + targetId: number; + /** @description 调用方当前持有的授权快照 */ + authorizationSnapshotId?: string; + }; + }; + }; + responses: { + /** @description 重验任务已提交 */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: int64 */ + jobId?: number; + pollUrl?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; +} diff --git a/muse-admin/apps/web-antd/src/api/types/base.ts b/muse-admin/apps/web-antd/src/api/types/base.ts new file mode 100644 index 00000000..33c3c23f --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/types/base.ts @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export type paths = Record; +export type webhooks = Record; +export interface components { + schemas: { + CommonResult: { + /** + * @description 业务状态码,0 表示成功 + * @example 0 + */ + code: number; + /** @description 响应数据,类型视具体接口而定 */ + data?: unknown; + /** + * @description 提示信息 + * @example success + */ + msg: string; + }; + PaginatedResult: { + /** + * @description 总记录数 + * @example 150 + */ + total: number; + /** + * @description 当前页码 + * @example 1 + */ + pageNo: number; + /** + * @description 每页条数 + * @example 20 + */ + pageSize: number; + /** @description 当前页数据列表 */ + list: unknown[]; + }; + ErrorResponse: { + /** + * @description 错误码格式: {system}-{module}-{category}-{sequence} + * 示例: MUSE-CONTENT-001-0001 + * @example MUSE-CONTENT-001-0001 + */ + code: string; + /** @description 人类可读的错误描述 */ + msg: string; + /** @description 详细错误信息(仅开发环境返回) */ + detail?: string; + }; + TimestampMixin: { + /** + * Format: date-time + * @description 创建时间 + */ + createdAt?: string; + /** + * Format: date-time + * @description 最后更新时间 + */ + updatedAt?: string; + }; + }; + responses: { + /** @description 请求参数有误 */ + BadRequest: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 未认证或 token 过期 */ + Unauthorized: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 无权限 */ + Forbidden: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源不存在 */ + NotFound: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源冲突 */ + Conflict: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 服务器内部错误 */ + InternalError: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + parameters: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + XApiVersion: "1"; + /** @description 页码,从 1 开始 */ + pageNo: number; + /** @description 每页条数,上限 100 */ + pageSize: number; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export type operations = Record; diff --git a/muse-admin/apps/web-antd/src/api/types/content.ts b/muse-admin/apps/web-antd/src/api/types/content.ts new file mode 100644 index 00000000..f4715a84 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/types/content.ts @@ -0,0 +1,3898 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export interface paths { + "/app-api/muse/works": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 获取作品列表 */ + get: operations["listWorks"]; + put?: never; + /** 创建新作品 */ + post: operations["createWork"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 获取作品详情 */ + get: operations["getWork"]; + /** 更新作品 */ + put: operations["updateWork"]; + post?: never; + /** 删除作品 */ + delete: operations["deleteWork"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/chapters": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 获取作品章节列表 */ + get: operations["listChapters"]; + put?: never; + /** 创建章节 */ + post: operations["createChapter"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/chapters/{chapterId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 获取章节详情 + * @description 必须先校验调用方拥有 workId 权限,并校验 chapterId 属于该 workId。 + */ + get: operations["getChapter"]; + /** + * 更新章节 + * @description 必须校验 work owner、chapterId 从属关系、commandId 幂等和 expectedRevision 乐观锁。 + */ + put: operations["updateChapter"]; + post?: never; + /** + * 删除章节 + * @description 必须校验 work owner、chapterId 从属关系、commandId 幂等和 expectedRevision 乐观锁。 + */ + delete: operations["deleteChapter"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/chapters/{chapterId}/reorder": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** + * 调整章节排序 + * @description 必须校验 work owner、章节从属关系、commandId 幂等、expectedRevision 和重排源快照。 + */ + put: operations["reorderChapters"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/chapters/{chapterId}/blocks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 获取章节 Block 列表 + * @description 必须先校验调用方拥有 workId 权限,并校验 chapterId 属于该 workId。 + */ + get: operations["listBlocks"]; + put?: never; + /** + * 创建 Block + * @description 必须校验 work owner、chapterId 从属关系、commandId 幂等和 expectedChapterRevision。 + */ + post: operations["createBlock"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/blocks/{blockId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 获取 Block 详情 + * @description 必须先校验调用方拥有 workId 权限,并校验 blockId 属于该 workId。 + */ + get: operations["getBlock"]; + /** + * 保存 Block 正文 + * @description 必须校验 work owner、blockId 从属关系、commandId 幂等、expectedRevision 乐观锁和 sourceSnapshot。 + */ + put: operations["saveBlock"]; + post?: never; + /** + * 删除 Block + * @description 必须校验 work owner、blockId 从属关系、commandId 幂等、expectedRevision 和 sourceSnapshot。 + */ + delete: operations["deleteBlock"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/blocks/{blockId}/split": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 分割 Block + * @description 必须校验 work owner、blockId 从属关系、commandId 幂等、expectedRevision 和 sourceSnapshot。 + */ + post: operations["splitBlock"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/blocks/{blockId}/merge": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 合并 Block + * @description 必须校验 work owner、blockId 从属关系、目标相邻 Block、commandId 幂等、expectedRevision 和 sourceSnapshot。 + */ + post: operations["mergeBlocks"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/export": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 导出作品 */ + post: operations["exportWork"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/content/works": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询作品列表和治理摘要 + * @description 管理员查询作品列表,返回治理摘要信息。 + * 默认不返回用户私有正文全文,确需查看必须另有合规访问设计。 + */ + get: operations["adminListWorks"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/content/works/{workId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查看作品元信息、章节摘要、异常摘要 + * @description 管理员查看作品元信息。默认不返回用户私有正文全文, + * 确需查看必须另有合规访问设计、审计和最小化字段。 + */ + get: operations["adminGetWork"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/content/works/{workId}/chapters": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查看章节列表 + * @description 管理员查看作品的章节列表,不含正文全文。 + */ + get: operations["adminListChapters"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/content/import-tasks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询导入任务 */ + get: operations["adminListImportTasks"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/content/export-tasks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询导出任务 */ + get: operations["adminListExportTasks"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/content/works/{workId}/risk-actions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 异常内容治理动作 + * @description 管理员对异常内容执行治理动作。必须带 commandId、操作者、权限点、变更理由和审计字段。 + * 高危治理进入业务审计。 + */ + post: operations["adminRiskAction"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/blocks/{blockId}/source-attribution": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查看当前 Block revision 来源归因 + * @description 返回 Block 当前 revision 的来源归因信息,包含来源对象、来源版本、 + * 授权快照和许可限制。前端可据此展示内容来源标签和合规提示。 + * 必须先校验调用方拥有 workId 权限,并校验 blockId 属于该 workId。 + */ + get: operations["getBlockSourceAttribution"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/blocks/{blockId}/suggestion-merges": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 接受或修改后合并 AI 候选到 Canonical Block + * @description Content/Work owner 的最终写入命令,用于承接 AI Orchestration 产生的 suggestion 投影并写入 Canonical Block。 + * AI Orchestration 仍拥有候选运行事实;Content 只在提交时查询/校验 suggestionId、来源状态、授权快照、 + * 质量结果版本、输出合规结果、静态检查结果、work owner、blockId 从属关系、expectedBlockRevision 和 commandId 幂等。 + */ + post: operations["mergeBlockSuggestion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/meta-projections": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询作品维度用户可见 MetaSchema 投影 + * @description 返回作品维度用户可见的 MetaSchema 投影列表。 + * 投影不是事实源,只是 MetaSchema、用户权限、来源状态和目标对象版本计算后的 read model。 + */ + get: operations["listMetaProjections"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/meta-projections/{projectionKey}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询指定投影结构、字段数据和版本 + * @description 返回指定投影的结构、字段数据和版本信息。 + * 包含 schemaVersion、projectionVersion、dataRevision、sourceSnapshot 和可见字段列表。 + */ + get: operations["getMetaProjection"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/dynamic-fields/validate": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 校验动态字段数据,不写入 + * @description 只做校验和路由建议,不写入任何 Canonical fact。 + * 正式写入必须回到目标 owner API。Schema 过期返回 SCHEMA_STALE; + * 字段已废弃返回 FIELD_DEPRECATED;投影过期返回 PROJECTION_STALE。 + */ + post: operations["validateDynamicFields"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/planning": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询当前作品可见规划结构 + * @description 返回作品可见规划结构、已确认规划数据、revision 和来源摘要。 + * 规划正式数据由用户确认后进入 content owner;AI 只能产生 Planning Candidate,不直接写正式规划。 + */ + get: operations["getPlanning"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/planning/{sectionKey}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + /** + * 保存规划项 + * @description 保存规划项,必须带 commandId 和 expectedRevision。 + * 涉及 MetaSchema 管控的动态字段写入时,expectedSchemaVersion 和 expectedProjectionVersion 必须校验。 + */ + put: operations["savePlanningItem"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/planning/candidates": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询规划候选 + * @description 查询 AI Orchestration owner 提供的规划候选投影;Content 不拥有候选运行事实。 + */ + get: operations["listPlanningCandidates"]; + put?: never; + /** + * 请求 AI 生成规划候选 + * @description 通过 Content/Work 上下文请求 AI Orchestration 生成规划候选,支持生成、补全、整理和多组选项。 + * AI Orchestration 拥有生成任务、候选运行事实和评测结果;Content 只提供 work 上下文引用, + * 并在用户确认时把候选内容写入 Canonical 规划。 + */ + post: operations["createPlanningCandidate"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/planning/candidates/{candidateId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询候选详情 + * @description 返回 AI Orchestration owner 提供的候选详情、来源、质量结果和 diff 投影。 + */ + get: operations["getPlanningCandidate"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/planning/candidates/{candidateId}/confirm": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 确认候选进入正式规划 + * @description Content/Work owner 的最终写入命令:确认 AI 候选进入正式规划,必须带 commandId 和 expectedRevision。 + * 确认时目标 owner 必须重验 work 权限、候选状态、来源状态、授权快照、 + * 质量结果和目标 revision。确认成功只写正式规划项和业务审计, + * 不写正文或 Local KB,也不接管 AI 候选运行事实。 + */ + post: operations["confirmPlanningCandidate"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/planning/candidates/{candidateId}/discard": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 丢弃候选 + * @description 丢弃候选,必须带 commandId 和原因。 + */ + post: operations["discardPlanningCandidate"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/planning/style-checks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 请求 AI 文风检查 + * @description 通过 Content/Work 上下文请求 AI Orchestration 执行文风检查,返回 jobId 供轮询。 + * AI Orchestration 拥有运行事实和评测结果;Content 只暴露作品维度结果投影。 + */ + post: operations["createStyleCheck"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/planning/style-checks/{jobId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询文风检查结果 + * @description 查询 AI Orchestration owner 提供的文风检查结果、风险标记和建议入口投影。 + */ + get: operations["getStyleCheckResult"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/import-tasks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 上传并创建导入任务 + * @description 上传文件并创建导入任务。导入上传必须绑定 owner、用途、大小、MIME、hash、 + * 扫描状态、source snapshot、authorization snapshot、保留期和清理策略; + * 扫描 blocked/failed 的文件不得创建 Parse Job。 + */ + post: operations["createImportTask"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/import-tasks/{taskId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询导入任务 */ + get: operations["getImportTask"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/parse-jobs": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 请求 AI 全书解析任务 + * @description 基于 Content 拥有的导入任务/导入上下文引用,请求 AI Orchestration 创建全书解析任务。 + * AI Orchestration 拥有 Parse Job、章节解析结果、评测和重试运行事实;Content 只保存导入上下文引用、 + * 导入文件安全状态和最终被确认写入 Canonical 的结果。 + * Parse Job 必须绑定 workId、发起人、Content 上下文引用、source snapshot、 + * authorization snapshot、解析配置版本、Runtime Permission Envelope 和重试组。 + */ + post: operations["createParseJob"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/parse-jobs/{jobId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询 AI 解析任务投影 + * @description Content 只查询 AI Orchestration owner 的 Parse Job 投影,不拥有解析运行事实。 + */ + get: operations["getParseJob"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/parse-jobs/{jobId}/retry": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 重试解析任务 + * @description 通过 Content 导入上下文引用向 AI Orchestration 请求重试;重试状态和运行事实仍由 AI owner 负责。 + */ + post: operations["retryParseJob"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/parse-jobs/{jobId}/chapters": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * AI 章节解析结果 + * @description 返回 AI Orchestration owner 在 Parse Job 下产生的章节解析结果投影。 + */ + get: operations["listParseJobChapters"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/chapter-parse-results/{resultId}/confirm": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 章节审阅确认 + * @description 章节审阅确认是对 AI Orchestration owner 章节解析结果的用户决策投影确认。 + * Content 不拥有 Chapter Parse Result 或 Review 运行事实;确认后只把导入上下文引用和用户决策交给 + * Knowledge owner 生成或刷新 Knowledge Draft,不写正式知识。 + */ + post: operations["confirmChapterParseResult"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/chapter-parse-results/{resultId}/reject": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 章节驳回 + * @description 章节驳回是对 AI Orchestration owner 章节解析结果的用户决策。 + * Content 不拥有或删除 AI Shadow 运行事实,只传递驳回原因和导入上下文引用。 + * 不删除原始导入文件。 + */ + post: operations["rejectChapterParseResult"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/parse-jobs/{jobId}/chapters/batch-confirm": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 批量确认章节 + * @description 批量确认 AI Orchestration owner 的章节解析结果投影,返回逐章成功、失败和部分失败摘要。 + * 以章节为事务边界,允许部分失败;某章失败不得回滚已成功章节。 + * Content 只保存导入上下文和最终进入 Canonical 的结果引用,不拥有 AI 解析运行事实。 + */ + post: operations["batchConfirmChapters"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/export-tasks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 创建导出任务 + * @description 创建导出任务,必须带 commandId 幂等键。 + * 下载凭证必须携带来源传播版本和授权快照。 + */ + post: operations["createExportTask"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/export-tasks/{taskId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询导出任务 */ + get: operations["getExportTask"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/downloads/{credentialId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 下载导出包 + * @description 使用下载凭证下载导出包。来源 revoked/recalled/blocked/unauthorized + * 或授权过期时返回 SOURCE_BLOCKED、SOURCE_NEEDS_RECHECK 或 PRECHECK_EXPIRED, + * 不能继续下载。 + */ + get: operations["downloadExportPackage"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: { + Work: { + /** Format: uuid */ + id: string; + title: string; + description?: string; + genre?: string; + /** Format: uri */ + coverImageUrl?: string; + /** @enum {string} */ + status: "draft" | "active" | "archived"; + /** @description 总字数 */ + wordCount?: number; + /** @description 章节数 */ + chapterCount?: number; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + updatedAt: string; + }; + WorkSummary: { + /** Format: uuid */ + id: string; + title: string; + genre?: string; + /** @enum {string} */ + status: "draft" | "active" | "archived"; + wordCount?: number; + chapterCount?: number; + /** Format: date-time */ + updatedAt: string; + }; + Chapter: { + /** Format: uuid */ + id: string; + /** Format: uuid */ + workId: string; + title: string; + sortOrder: number; + /** @enum {string} */ + status: "draft" | "completed"; + wordCount?: number; + blockCount?: number; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + updatedAt: string; + }; + ChapterDetail: components["schemas"]["Chapter"] & { + blocks?: components["schemas"]["Block"][]; + }; + Block: { + /** Format: uuid */ + id: string; + /** Format: uuid */ + workId: string; + /** Format: uuid */ + chapterId: string; + /** @enum {string} */ + blockType: "scene" | "section" | "note"; + title?: string; + /** @description ProseMirror JSON 格式的正文内容 */ + content: string; + sortOrder: number; + /** @description 乐观锁版本号,每次保存 +1 */ + version: number; + wordCount?: number; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + updatedAt: string; + }; + /** + * @description Content/Work 写命令的来源快照。用于在写入 Canonical 前校验调用方看到的内容版本、 + * 来源状态、授权快照和目标 owner 边界,避免只凭 chapterId/blockId 裸写。 + */ + ContentSourceSnapshot: { + /** @description 来源类型,如 user_original、ai_suggestion、imported_content */ + sourceType?: string; + /** @description 来源对象 ID */ + sourceId?: string; + /** @description 调用方看到的来源版本 */ + sourceVersion?: number; + /** @description 授权快照 ID */ + authorizationSnapshotId?: string; + /** @description 调用方看到的目标内容 revision */ + contentRevision?: number; + }; + /** @description 更新章节请求;服务端必须校验 work owner、chapterId 从属关系、commandId 幂等和 expectedRevision。 */ + UpdateChapterRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 章节当前 revision(乐观锁) */ + expectedRevision: number; + title?: string; + sortOrder?: number; + /** @enum {string} */ + status?: "draft" | "completed"; + sourceSnapshot?: components["schemas"]["ContentSourceSnapshot"]; + /** @description 用户修改原因 */ + auditReason?: string; + }; + /** @description 删除章节请求;服务端必须校验 work owner、chapterId 从属关系、commandId 幂等和 expectedRevision。 */ + DeleteChapterRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 章节当前 revision(乐观锁) */ + expectedRevision: number; + sourceSnapshot?: components["schemas"]["ContentSourceSnapshot"]; + /** @description 删除原因 */ + reason?: string; + }; + /** @description 章节重排请求;服务端必须校验 work owner、章节从属关系、commandId 幂等、expectedRevision 和 sourceSnapshot。 */ + ReorderChapterRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 作品章节排序 revision 或目标章节 revision(乐观锁) */ + expectedRevision: number; + newSortOrder: number; + sourceSnapshot: components["schemas"]["ContentSourceSnapshot"]; + }; + /** @description 创建 Block 请求;服务端必须校验 work owner、chapterId 从属关系、commandId 幂等和 expectedChapterRevision。 */ + CreateBlockRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description Block 正文内容(JSON 格式的 ProseMirror 文档) */ + content: string; + /** + * @description Block 类型 + * @enum {string} + */ + blockType: "scene" | "section" | "note"; + /** @description 章节当前 revision(乐观锁) */ + expectedChapterRevision: number; + sortOrder?: number; + title?: string; + sourceSnapshot?: components["schemas"]["ContentSourceSnapshot"]; + }; + /** @description 保存 Block 正文请求;服务端必须校验 work owner、blockId 从属关系、commandId 幂等、expectedRevision 和 sourceSnapshot。 */ + SaveBlockRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description Block 正文(ProseMirror JSON) */ + content: string; + /** @description Block 当前 revision(乐观锁) */ + expectedRevision: number; + sourceSnapshot: components["schemas"]["ContentSourceSnapshot"]; + /** @description 用户保存或覆盖原因 */ + auditReason?: string; + }; + /** @description 删除 Block 请求;服务端必须校验 work owner、blockId 从属关系、commandId 幂等、expectedRevision 和 sourceSnapshot。 */ + DeleteBlockRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description Block 当前 revision(乐观锁) */ + expectedRevision: number; + sourceSnapshot: components["schemas"]["ContentSourceSnapshot"]; + /** @description 删除原因 */ + reason?: string; + }; + /** @description 分割 Block 请求;服务端必须校验 work owner、blockId 从属关系、commandId 幂等、expectedRevision 和 sourceSnapshot。 */ + SplitBlockRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 分割位置(字符偏移量) */ + splitPosition: number; + /** @description Block 当前 revision(乐观锁) */ + expectedRevision: number; + sourceSnapshot: components["schemas"]["ContentSourceSnapshot"]; + }; + /** @description 合并 Block 请求;服务端必须校验 work owner、blockId/targetBlockId 从属关系、commandId 幂等、expectedRevision 和 sourceSnapshot。 */ + MergeBlockRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 源 Block 当前 revision(乐观锁) */ + expectedRevision: number; + /** + * Format: uuid + * @description 目标相邻 Block ID;不传时默认与下一个 Block 合并 + */ + targetBlockId?: string; + sourceSnapshot: components["schemas"]["ContentSourceSnapshot"]; + }; + /** + * @description 接受或修改后合并 AI suggestion 的 Content owner 写入请求。 + * 服务端必须实时查询/校验 AI owner 的 suggestion 投影和来源状态,再写 Canonical Block。 + */ + MergeBlockSuggestionRequest: { + /** + * Format: uuid + * @description AI Orchestration owner 产生的候选 ID + */ + suggestionId: string; + /** @description 幂等键 */ + commandId: string; + /** @description 目标 Block 当前 revision(乐观锁) */ + expectedBlockRevision: number; + /** + * @description 用户决策类型 + * @enum {string} + */ + decisionType: "accept" | "modify_then_merge"; + /** + * @description 写入方式:原样接受或修改后合并 + * @enum {string} + */ + mergeMode: "accept_as_is" | "merge_after_edit"; + /** @description 修改后合并时的最终 Block 正文(mergeMode=merge_after_edit 时必填) */ + finalContent?: string; + /** @description 候选质量结果版本 */ + qualityResultVersion?: number; + /** @description 输出合规结果 ID */ + outputComplianceResultId?: string; + /** @description 静态检查结果 ID */ + staticCheckResultId?: string; + sourceSnapshot: components["schemas"]["ContentSourceSnapshot"]; + /** @description 用户接受或修改合并原因 */ + auditReason?: string; + }; + /** @description AI suggestion 写入 Canonical Block 的结果 */ + MergeBlockSuggestionResult: { + /** Format: uuid */ + blockId: string; + /** Format: uuid */ + suggestionId: string; + /** @description Block 保存成功后的新 revision */ + newRevision: number; + /** @enum {string} */ + decisionType: "accept" | "modify_then_merge"; + sourceAttribution?: components["schemas"]["SourceAttribution"]; + }; + /** @description 管理员视角的作品列表项,含治理摘要 */ + AdminWorkSummary: { + /** Format: uuid */ + id: string; + title: string; + genre?: string; + /** @enum {string} */ + status: "draft" | "active" | "archived"; + /** @description 作品所有者用户 ID */ + ownerId: string; + wordCount?: number; + chapterCount?: number; + /** @description 异常标记列表 */ + riskFlags?: { + /** @description 异常类型,如 content_violation、copyright_issue */ + riskType?: string; + /** @enum {string} */ + severity?: "low" | "medium" | "high" | "critical"; + /** @description 异常描述摘要 */ + description?: string; + }[]; + /** + * Format: date-time + * @description 最近一次治理动作时间 + */ + lastGovernanceActionAt?: string; + /** Format: date-time */ + createdAt?: string; + /** Format: date-time */ + updatedAt: string; + }; + /** @description 管理员视角的作品详情,含章节摘要和异常摘要 */ + AdminWorkDetail: { + /** Format: uuid */ + id: string; + title: string; + description?: string; + genre?: string; + /** @enum {string} */ + status: "draft" | "active" | "archived"; + /** @description 作品所有者用户 ID */ + ownerId: string; + wordCount?: number; + chapterCount?: number; + /** @description 章节摘要列表(不含正文全文) */ + chapterSummaries?: components["schemas"]["AdminChapterSummary"][]; + /** @description 异常摘要 */ + exceptionSummary?: { + /** @description 总异常标记数 */ + totalRiskFlags?: number; + /** @description 严重异常数 */ + criticalCount?: number; + /** @description 进行中的治理动作数 */ + activeGovernanceActions?: number; + /** @description 最近异常类型 */ + latestRiskType?: string; + }; + /** @description 治理操作历史摘要 */ + governanceHistory?: { + /** @description 治理动作类型 */ + action?: string; + /** @description 操作者 ID */ + operatorId?: string; + reason?: string; + /** Format: date-time */ + operatedAt?: string; + }[]; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + updatedAt: string; + }; + /** @description 管理员视角的章节摘要,不含正文全文 */ + AdminChapterSummary: { + /** Format: uuid */ + id: string; + title: string; + sortOrder: number; + /** @enum {string} */ + status: "draft" | "completed"; + wordCount?: number; + blockCount?: number; + riskFlags?: { + riskType?: string; + /** @enum {string} */ + severity?: "low" | "medium" | "high" | "critical"; + }[]; + }; + /** @description 异常内容治理动作请求 */ + RiskActionRequest: { + /** @description 幂等键 */ + commandId: string; + /** + * @description 治理动作类型: + * warn - 发出警告通知 + * restrict - 限制部分功能 + * block_content - 阻断内容访问 + * force_archive - 强制归档作品 + * notify_owner - 通知作品所有者 + * @enum {string} + */ + action: "warn" | "restrict" | "block_content" | "force_archive" | "notify_owner"; + /** @description 治理原因,必须填写 */ + reason: string; + /** + * @description 治理范围粒度,默认 work + * @enum {string} + */ + targetScope?: "work" | "chapter" | "block"; + /** @description 指定治理的章节或 Block ID(粒度非 work 时必填) */ + targetIds?: string[]; + /** @description 作品当前版本号,用于乐观锁 */ + expectedVersion?: number; + /** @description 限制时长,如 P7D(7 天),仅 restrict 动作适用 */ + duration?: string; + }; + /** @description 治理动作执行结果 */ + RiskActionResult: { + /** @description 治理动作记录 ID */ + actionId?: string; + /** @enum {string} */ + status?: "executed" | "pending_notification"; + /** @description 实际影响的范围描述 */ + affectedScope?: string; + /** @description 审计日志 ID */ + auditLogId?: string; + }; + /** @description 导入任务摘要(管理端列表用) */ + ImportTaskSummary: { + /** Format: uuid */ + id: string; + /** Format: uuid */ + workId: string; + workTitle?: string; + fileName?: string; + /** Format: int64 */ + fileSize?: number; + /** @enum {string} */ + format?: "txt" | "epub" | "docx" | "markdown"; + /** @enum {string} */ + status: "queued" | "processing" | "completed" | "failed"; + ownerId?: string; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + completedAt?: string; + }; + /** @description 导出任务摘要(管理端列表用) */ + ExportTaskSummary: { + /** Format: uuid */ + id: string; + /** Format: uuid */ + workId: string; + workTitle?: string; + /** @enum {string} */ + format?: "txt" | "epub" | "docx"; + /** @enum {string} */ + status: "queued" | "processing" | "completed" | "failed"; + ownerId?: string; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + completedAt?: string; + }; + /** @description Block 当前 revision 的来源归因信息 */ + SourceAttribution: { + /** Format: uuid */ + blockId: string; + /** @description Block 当前 revision 号 */ + revision: number; + /** @description 来源归因列表 */ + sources?: { + /** + * @description 来源类型 + * @enum {string} + */ + sourceType: "user_original" | "ai_suggestion" | "knowledge_reference" | "market_asset" | "imported_content"; + /** @description 来源对象 ID */ + sourceId: string; + /** @description 来源对象名称 */ + sourceName?: string; + /** + * @description 贡献类型 + * @enum {string} + */ + contributionType: "full" | "partial" | "reference" | "context"; + /** @description 授权快照 ID */ + authorizationSnapshotId?: string; + /** @description 来源版本号 */ + sourceVersion?: number; + /** @description 许可限制列表 */ + licenseRestrictions?: string[]; + }[]; + /** @description 来源谱系信息 */ + lineage?: { + /** @description 关联的 AI 候选 ID */ + parentSuggestionId?: string; + /** Format: date-time */ + acceptedAt?: string; + /** @enum {string} */ + acceptMode?: "accept_as_is" | "merge_after_edit"; + }; + }; + /** @description 作品维度 MetaSchema 投影摘要 */ + MetaProjectionSummary: { + /** @description 投影标识,如 setting、worldview、character */ + projectionKey: string; + /** @description 投影名称 */ + projectionName?: string; + /** @description 本次投影使用的 MetaSchema 版本 */ + schemaVersion: number; + /** @description 可见投影版本,用于判断前端缓存是否过期 */ + projectionVersion: number; + /** @description 目标对象动态字段数据 revision */ + dataRevision?: number; + /** @description 可见字段数量 */ + fieldCount?: number; + }; + /** @description 投影详情,含结构和字段数据 */ + MetaProjectionDetail: { + projectionKey: string; + projectionName?: string; + /** @description 使用的 MetaSchema active 或灰度版本 */ + schemaVersion: number; + /** @description 可见投影版本 */ + projectionVersion: number; + /** @description 目标对象动态字段数据 revision */ + dataRevision: number; + /** @description 来源对象、来源版本、授权快照和来源状态摘要 */ + sourceSnapshot?: { + sourceType?: string; + sourceId?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + /** @enum {string} */ + sourceStatus?: "active" | "stale" | "revoked" | "recalled" | "blocked" | "owner_missing" | "unauthorized"; + }; + /** @description 仅包含当前用户可见、可编辑、可搜索或可导出的字段 */ + fields: { + fieldKey: string; + fieldName?: string; + /** @enum {string} */ + fieldType: "text" | "number" | "boolean" | "enum" | "reference" | "structured" | "date"; + required?: boolean; + /** @description 是否进入用户可见投影 */ + uiVisible: boolean; + /** @description 是否允许进入 AI 上下文组装 */ + aiContext?: boolean; + /** @description 用户端是否允许保存该动态字段 */ + userEditable?: boolean; + /** @description 是否允许用户搜索或筛选 */ + userSearchable?: boolean; + /** @description 是否可被导出预检纳入 */ + exportable?: boolean; + /** @description 字段是否已废弃 */ + deprecated?: boolean; + /** @description 废弃时的迁移提示 */ + migrationHint?: string; + /** @description 写入 owner 标识 */ + writeOwner?: string; + /** @description owner 写入命令路径 */ + ownerCommand?: string; + /** @description 当前字段值 */ + value?: unknown; + /** @description 枚举可选值(fieldType=enum 时) */ + enumValues?: string[]; + }[]; + }; + /** @description 动态字段校验请求 */ + DynamicFieldValidationRequest: { + /** @description 待校验的动态字段数据 */ + fields: { + fieldKey: string; + /** @description 字段值 */ + value: unknown; + }[]; + /** @description 调用方持有的 MetaSchema 版本 */ + schemaVersion: number; + /** @description 调用方持有的投影版本 */ + projectionVersion: number; + /** @description 调用方持有的数据 revision */ + dataRevision?: number; + }; + /** @description 动态字段校验结果 */ + DynamicFieldValidationResult: { + /** @description 整体是否合法 */ + valid?: boolean; + fieldResults?: { + fieldKey?: string; + valid?: boolean; + errors?: { + /** @enum {string} */ + errorCode?: "REQUIRED_MISSING" | "TYPE_MISMATCH" | "ENUM_INVALID" | "REFERENCE_INVALID" | "FIELD_DEPRECATED" | "VALUE_OUT_OF_RANGE"; + message?: string; + }[]; + }[]; + /** @description Schema 是否已过期 */ + schemaStale?: boolean; + /** @description 投影是否已过期 */ + projectionStale?: boolean; + currentSchemaVersion?: number; + currentProjectionVersion?: number; + currentDataRevision?: number; + /** @description 写入路由建议,指引前端到正确的 owner 命令 */ + routeSuggestions?: { + fieldKey?: string; + writeOwner?: string; + /** @description 建议的 owner 命令路径 */ + ownerCommand?: string; + }[]; + }; + /** @description 作品规划结构 */ + PlanningStructure: { + /** Format: uuid */ + workId: string; + /** @description 规划数据 revision */ + revision: number; + /** @description 已确认的规划项列表 */ + sections?: components["schemas"]["PlanningSection"][]; + /** @description 来源摘要 */ + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + }; + /** @description 规划项数据 */ + PlanningSection: { + /** @description 规划项标识,如 setting、worldview、character、plot-beat */ + sectionKey: string; + sectionName?: string; + /** @description 规划项内容(结构化 JSON) */ + content?: Record; + /** @description 该规划项的 revision */ + revision: number; + /** @description 使用的 MetaSchema 版本 */ + schemaVersion?: number; + /** @description 使用的投影版本 */ + projectionVersion?: number; + /** Format: date-time */ + updatedAt?: string; + }; + /** @description 保存规划项请求 */ + SavePlanningItemRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 规划项内容(结构化 JSON) */ + content: Record; + /** @description 目标规划 section 的当前 revision */ + expectedRevision: number; + /** @description 调用方持有的 MetaSchema 版本(涉及动态字段时必须) */ + expectedSchemaVersion?: number; + /** @description 调用方持有的投影版本(涉及动态字段时必须) */ + expectedProjectionVersion?: number; + /** @description 来源快照摘要 */ + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + /** @description 用户保存或覆盖原因 */ + auditReason?: string; + }; + /** @description 规划项保存结果 */ + PlanningItemSaveResult: { + sectionKey?: string; + newRevision?: number; + /** Format: date-time */ + updatedAt?: string; + }; + /** @description 请求 AI Orchestration 生成规划候选的上下文引用;Content 不拥有候选运行事实。 */ + CreatePlanningCandidateRequest: { + /** @description 目标规划项标识 */ + sectionKey: string; + /** + * @description 任务类型: + * generate - 生成新内容 + * supplement - 补全已有内容 + * organize - 整理已有内容 + * multi_option - 生成多组选项 + * @enum {string} + */ + taskType: "generate" | "supplement" | "organize" | "multi_option"; + /** @description 生成上下文,如已有规划内容、用户指令等 */ + context?: Record; + /** @description 幂等键 */ + commandId?: string; + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + }; + /** @description AI Orchestration owner 提供给 Content/Work 的规划候选投影摘要 */ + PlanningCandidateSummary: { + /** Format: uuid */ + id: string; + sectionKey: string; + /** @enum {string} */ + taskType?: "generate" | "supplement" | "organize" | "multi_option"; + /** @enum {string} */ + status: "pending" | "confirmed" | "discarded"; + revision?: number; + /** @description 质量评分 */ + qualityScore?: number; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + confirmedAt?: string; + }; + /** @description AI Orchestration owner 提供给 Content/Work 的规划候选详情投影 */ + PlanningCandidateDetail: { + /** Format: uuid */ + id: string; + sectionKey: string; + /** @enum {string} */ + taskType?: "generate" | "supplement" | "organize" | "multi_option"; + /** @enum {string} */ + status: "pending" | "confirmed" | "discarded"; + /** @description 候选内容(结构化 JSON) */ + content: Record; + revision: number; + /** @description 质量检查结果 */ + qualityResult?: { + score?: number; + passed?: boolean; + issues?: { + /** @enum {string} */ + severity?: "info" | "warning" | "critical"; + code?: string; + message?: string; + }[]; + }; + /** @description 与当前正式规划的差异 */ + diff?: { + hasChanges?: boolean; + summary?: string; + additions?: number; + deletions?: number; + modifications?: number; + }; + sourceSnapshot?: { + sourceType?: string; + sourceId?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + confirmedAt?: string; + }; + /** @description 确认规划候选请求 */ + ConfirmPlanningCandidateRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 目标规划 section 的当前 revision */ + expectedRevision: number; + /** @description MetaSchema 版本(涉及动态字段时必须) */ + expectedSchemaVersion?: number; + /** @description 投影版本(涉及动态字段时必须) */ + expectedProjectionVersion?: number; + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + /** @description 用户确认原因 */ + auditReason?: string; + }; + /** @description 候选确认结果 */ + PlanningCandidateDecisionResult: { + candidateId?: string; + /** @description 规划项新 revision */ + newRevision?: number; + sectionKey?: string; + auditLogId?: string; + }; + /** @description 丢弃规划候选请求 */ + DiscardPlanningCandidateRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 丢弃原因 */ + reason: string; + }; + /** @description 请求 AI Orchestration 执行文风检查的作品上下文引用 */ + CreateStyleCheckRequest: { + /** @description 幂等键 */ + commandId: string; + /** + * @description 检查范围,默认 full_work + * @enum {string} + */ + checkScope?: "full_work" | "selected_chapters" | "selected_blocks"; + /** @description 指定检查的章节或 Block ID(checkScope 非 full_work 时必填) */ + targetIds?: string[]; + /** @description 自定义文风规则(可选,不传则使用作品设定) */ + styleRules?: Record; + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + }; + /** @description AI Orchestration owner 提供给 Content/Work 的文风检查结果投影 */ + StyleCheckResult: { + /** Format: uuid */ + jobId: string; + /** @enum {string} */ + status: "queued" | "processing" | "completed" | "failed"; + /** @description 风险标记列表 */ + riskMarkers?: { + /** @enum {string} */ + markerType?: "consistency" | "tone_shift" | "pacing" | "vocabulary" | "repetition"; + /** @enum {string} */ + severity?: "info" | "warning" | "critical"; + location?: { + chapterId?: string; + blockId?: string; + position?: string; + }; + description?: string; + }[]; + summary?: { + overallScore?: number; + consistencyScore?: number; + checkedWordCount?: number; + markerCount?: number; + }; + /** @description 建议入口 */ + suggestions?: { + /** @enum {string} */ + suggestionType?: "rewrite" | "adjust" | "review"; + targetSectionKey?: string; + description?: string; + }[]; + /** Format: date-time */ + completedAt?: string; + }; + /** @description 创建导入任务请求 */ + CreateImportTaskRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 文件名 */ + fileName: string; + /** + * Format: int64 + * @description 文件大小(字节) + */ + fileSize: number; + /** @description 文件哈希值 */ + fileHash: string; + /** @description 文件 MIME 类型 */ + mimeType?: string; + /** + * @description 导入文件格式 + * @enum {string} + */ + format?: "txt" | "epub" | "docx" | "markdown"; + /** + * Format: uri + * @description 已上传文件的存储引用 + */ + uploadUrl?: string; + /** @description 来源快照 */ + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + }; + /** @description 导入任务详情 */ + ImportTaskDetail: { + /** Format: uuid */ + id: string; + /** Format: uuid */ + workId: string; + fileName?: string; + /** Format: int64 */ + fileSize?: number; + /** @enum {string} */ + format?: "txt" | "epub" | "docx" | "markdown"; + /** @enum {string} */ + status: "queued" | "processing" | "completed" | "failed"; + /** + * @description 文件扫描状态 + * @enum {string} + */ + scanStatus?: "pending" | "passed" | "blocked" | "failed"; + /** @description 处理进度百分比(0-100) */ + progress?: number; + /** @description 失败时的错误信息 */ + errorMessage?: string; + /** @description 失败阶段 */ + failedStage?: string; + /** @description 是否可重试 */ + retryable?: boolean; + /** @description 下一步建议动作 */ + nextActions?: string[]; + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + completedAt?: string; + }; + /** @description 基于 Content 导入上下文请求 AI Orchestration 创建全书解析任务;Content 不拥有 Parse Job 运行事实。 */ + CreateParseJobRequest: { + /** @description 幂等键 */ + commandId: string; + /** + * Format: uuid + * @description 关联的导入任务 ID + */ + importTaskId: string; + /** @description 解析配置 */ + parseConfig?: { + /** + * @description 章节检测模式 + * @enum {string} + */ + chapterDetectionMode?: "auto" | "manual_outline" | "hybrid"; + /** @description 语言提示 */ + languageHint?: string; + /** @description 自定义解析指令 */ + customInstructions?: string; + }; + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + }; + /** @description AI Orchestration owner 提供给 Content/Work 的解析任务投影 */ + ParseJobDetail: { + /** Format: uuid */ + id: string; + /** Format: uuid */ + workId: string; + /** Format: uuid */ + importTaskId?: string; + /** @enum {string} */ + status: "queued" | "processing" | "completed" | "failed"; + /** @description 处理进度百分比(0-100) */ + progress?: number; + /** @description 检测到的总章节数 */ + totalChapters?: number; + /** @description 已确认章节数 */ + confirmedChapters?: number; + /** @description 待审阅章节数 */ + pendingChapters?: number; + errorMessage?: string; + failedStage?: string; + retryable?: boolean; + nextActions?: string[]; + /** @description 解析配置版本 */ + parseConfigVersion?: number; + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + completedAt?: string; + }; + /** @description AI Orchestration owner 提供给 Content/Work 的章节解析结果投影 */ + ChapterParseResult: { + /** Format: uuid */ + id: string; + /** Format: uuid */ + jobId: string; + /** @description AI 检测到的章节标题 */ + title: string; + sortOrder?: number; + /** @description 内容预览(截取摘要,非全文) */ + contentPreview?: string; + wordCount?: number; + /** + * @description 审阅状态: + * pending_review - 待审阅 + * confirmed - 已确认 + * rejected - 已驳回 + * @enum {string} + */ + status: "pending_review" | "confirmed" | "rejected"; + revision: number; + qualityResult?: { + score?: number; + issues?: { + severity?: string; + code?: string; + message?: string; + }[]; + }; + }; + /** @description 章节解析结果投影确认请求;AI 运行事实仍归 AI Orchestration。 */ + ConfirmChapterParseResultRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 当前 parse result revision */ + expectedRevision: number; + }; + /** @description 章节解析结果投影驳回请求;AI 运行事实仍归 AI Orchestration。 */ + RejectChapterParseResultRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 驳回原因 */ + reason: string; + /** @description 当前 parse result revision */ + expectedRevision?: number; + }; + /** @description 批量确认章节解析结果投影请求;Content 只传递导入上下文和用户决策。 */ + BatchConfirmChaptersRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 待确认的 chapter parse result ID 列表 */ + resultIds: string[]; + }; + /** @description 批量确认章节结果 */ + BatchConfirmChaptersResult: { + /** @description 成功确认的章节 result ID 列表 */ + confirmedChapterResultIds?: string[]; + /** @description 生成的知识草稿 ID 列表 */ + createdDraftIds?: string[]; + /** @description 失败章节列表 */ + failedChapters?: { + /** Format: uuid */ + resultId?: string; + errorCode?: string; + errorMessage?: string; + }[]; + /** @description 跳过章节列表 */ + skippedChapters?: { + /** Format: uuid */ + resultId?: string; + reason?: string; + }[]; + /** @description 是否存在部分失败 */ + partialFailure?: boolean; + }; + /** @description 创建导出任务请求 */ + CreateExportTaskRequest: { + /** @description 幂等键 */ + commandId: string; + /** + * @description 导出格式 + * @enum {string} + */ + format: "txt" | "epub" | "docx"; + /** @description 指定导出章节 ID,空数组表示导出全部 */ + includeChapters?: string[]; + /** + * @description 是否包含元数据 + * @default true + */ + includeMetadata: boolean; + /** + * @description 是否包含规划数据 + * @default false + */ + includePlanning: boolean; + /** @description 来源快照 */ + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + }; + /** @description 导出任务详情 */ + ExportTaskDetail: { + /** Format: uuid */ + id: string; + /** Format: uuid */ + workId: string; + /** @enum {string} */ + format: "txt" | "epub" | "docx"; + /** @enum {string} */ + status: "queued" | "processing" | "completed" | "failed"; + /** @description 处理进度百分比(0-100) */ + progress?: number; + /** @description 完成后的下载凭证 ID */ + downloadCredentialId?: string; + /** + * Format: date-time + * @description 下载凭证过期时间 + */ + downloadExpiresAt?: string; + errorMessage?: string; + sourceSnapshot?: { + sourceType?: string; + sourceVersion?: number; + authorizationSnapshotId?: string; + }; + /** Format: date-time */ + createdAt: string; + /** Format: date-time */ + completedAt?: string; + }; + CommonResult: { + /** + * @description 业务状态码,0 表示成功 + * @example 0 + */ + code: number; + /** @description 响应数据,类型视具体接口而定 */ + data?: unknown; + /** + * @description 提示信息 + * @example success + */ + msg: string; + }; + PaginatedResult: { + /** + * @description 总记录数 + * @example 150 + */ + total: number; + /** + * @description 当前页码 + * @example 1 + */ + pageNo: number; + /** + * @description 每页条数 + * @example 20 + */ + pageSize: number; + /** @description 当前页数据列表 */ + list: unknown[]; + }; + ErrorResponse: { + /** + * @description 错误码格式: {system}-{module}-{category}-{sequence} + * 示例: MUSE-CONTENT-001-0001 + * @example MUSE-CONTENT-001-0001 + */ + code: string; + /** @description 人类可读的错误描述 */ + msg: string; + /** @description 详细错误信息(仅开发环境返回) */ + detail?: string; + }; + }; + responses: { + /** @description 请求参数有误 */ + BadRequest: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 未认证或 token 过期 */ + Unauthorized: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 无权限 */ + Forbidden: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源不存在 */ + NotFound: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + parameters: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + XApiVersion: "1"; + /** @description 页码,从 1 开始 */ + pageNo: number; + /** @description 每页条数,上限 100 */ + pageSize: number; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + listWorks: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 作品状态过滤 */ + status?: "draft" | "active" | "archived"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 作品分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["WorkSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createWork: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + title: string; + description?: string; + genre?: string; + /** Format: uri */ + coverImageUrl?: string; + }; + }; + }; + responses: { + /** @description 作品创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["Work"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getWork: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 作品详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["Work"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + updateWork: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + title?: string; + description?: string; + genre?: string; + /** Format: uri */ + coverImageUrl?: string; + /** @enum {string} */ + status?: "draft" | "active" | "archived"; + }; + }; + }; + responses: { + /** @description 更新成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + deleteWork: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 删除成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 404: components["responses"]["NotFound"]; + }; + }; + listChapters: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 章节列表(按 sortOrder 排序) */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["Chapter"][]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createChapter: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + title: string; + /** @description 插入位置,默认追加到末尾 */ + sortOrder?: number; + }; + }; + }; + responses: { + /** @description 创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["Chapter"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getChapter: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + chapterId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 章节详情(含 Block 列表) */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ChapterDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + updateChapter: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + chapterId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["UpdateChapterRequest"]; + }; + }; + responses: { + /** @description 更新成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + deleteChapter: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + chapterId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["DeleteChapterRequest"]; + }; + }; + responses: { + /** @description 删除成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + reorderChapters: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + chapterId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["ReorderChapterRequest"]; + }; + }; + responses: { + /** @description 排序更新成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + listBlocks: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + chapterId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Block 列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["Block"][]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createBlock: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + chapterId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateBlockRequest"]; + }; + }; + responses: { + /** @description 创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["Block"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getBlock: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + blockId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Block 详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["Block"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + saveBlock: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + blockId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["SaveBlockRequest"]; + }; + }; + responses: { + /** @description 保存成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @description 保存后的新版本号 */ + newVersion?: number; + }; + }; + }; + }; + /** @description 版本冲突,需客户端处理 */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + deleteBlock: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + blockId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["DeleteBlockRequest"]; + }; + }; + responses: { + /** @description 删除成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + splitBlock: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + blockId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["SplitBlockRequest"]; + }; + }; + responses: { + /** @description 分割成功,返回两个新 Block */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + mergeBlocks: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + /** @description 与下一个 Block 合并 */ + blockId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["MergeBlockRequest"]; + }; + }; + responses: { + /** @description 合并成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + exportWork: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @enum {string} */ + format: "txt" | "epub" | "docx"; + /** @description 指定导出章节,空数组表示导出全部 */ + includeChapters?: string[]; + }; + }; + }; + responses: { + /** @description 导出任务已创建,返回任务 ID 供轮询 */ + 200: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + /** @description 导出文件二进制流(小文件直接返回) */ + 202: { + headers: { + [name: string]: unknown; + }; + content?: never; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListWorks: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 作品状态过滤 */ + status?: "draft" | "active" | "archived"; + /** @description 标题关键词搜索 */ + keyword?: string; + /** @description 是否只返回有异常标记的作品 */ + riskFlag?: boolean; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 作品列表与治理摘要 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AdminWorkSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminGetWork: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 作品元信息、章节摘要、异常摘要 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AdminWorkDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListChapters: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 章节列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AdminChapterSummary"][]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListImportTasks: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 任务状态过滤 */ + status?: "queued" | "processing" | "completed" | "failed"; + /** @description 按作品过滤 */ + workId?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 导入任务列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["ImportTaskSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminListExportTasks: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 任务状态过滤 */ + status?: "queued" | "processing" | "completed" | "failed"; + /** @description 按作品过滤 */ + workId?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 导出任务列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["ExportTaskSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminRiskAction: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["RiskActionRequest"]; + }; + }; + responses: { + /** @description 治理动作执行成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["RiskActionResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getBlockSourceAttribution: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + blockId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Block 来源归因信息 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["SourceAttribution"]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + mergeBlockSuggestion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + blockId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["MergeBlockSuggestionRequest"]; + }; + }; + responses: { + /** @description 候选已写入 Canonical Block */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MergeBlockSuggestionResult"]; + }; + }; + }; + /** @description 目标 Block revision、候选版本、来源状态或授权快照已变化 */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + listMetaProjections: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 作品维度 MetaSchema 投影列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaProjectionSummary"][]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getMetaProjection: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + /** @description 投影标识,如 setting、worldview、character 等 */ + projectionKey: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 投影详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaProjectionDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + validateDynamicFields: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["DynamicFieldValidationRequest"]; + }; + }; + responses: { + /** @description 校验结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["DynamicFieldValidationResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getPlanning: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 作品规划结构 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PlanningStructure"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + savePlanningItem: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + /** @description 规划项标识,如 setting、worldview、character、plot-beat 等 */ + sectionKey: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["SavePlanningItemRequest"]; + }; + }; + responses: { + /** @description 保存成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PlanningItemSaveResult"]; + }; + }; + }; + /** @description 版本冲突或 Schema/投影过期 */ + 409: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; + listPlanningCandidates: { + parameters: { + query?: { + /** @description 候选状态过滤 */ + status?: "pending" | "confirmed" | "discarded"; + /** @description 按规划项过滤 */ + sectionKey?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 规划候选列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PlanningCandidateSummary"][]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createPlanningCandidate: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreatePlanningCandidateRequest"]; + }; + }; + responses: { + /** @description 规划候选任务已创建 */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @description 异步任务 ID,供轮询 */ + jobId?: string; + /** @enum {string} */ + status?: "queued" | "processing"; + /** @description 轮询地址 */ + pollUrl?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getPlanningCandidate: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + candidateId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 规划候选详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PlanningCandidateDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + confirmPlanningCandidate: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + candidateId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["ConfirmPlanningCandidateRequest"]; + }; + }; + responses: { + /** @description 确认成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PlanningCandidateDecisionResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + discardPlanningCandidate: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + candidateId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["DiscardPlanningCandidateRequest"]; + }; + }; + responses: { + /** @description 丢弃成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createStyleCheck: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateStyleCheckRequest"]; + }; + }; + responses: { + /** @description 文风检查任务已创建 */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @description 异步任务 ID */ + jobId?: string; + /** @enum {string} */ + status?: "queued" | "processing"; + pollUrl?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getStyleCheckResult: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + jobId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 文风检查结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["StyleCheckResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createImportTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateImportTaskRequest"]; + }; + }; + responses: { + /** @description 导入任务已创建 */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ImportTaskDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getImportTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + taskId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 导入任务详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ImportTaskDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createParseJob: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateParseJobRequest"]; + }; + }; + responses: { + /** @description AI 解析任务已创建 */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ParseJobDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getParseJob: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + jobId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description AI 解析任务详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ParseJobDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + retryParseJob: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + jobId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 指定重试的失败阶段,不传则重试整个任务 */ + retryStage?: string; + }; + }; + }; + responses: { + /** @description 重试已发起 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + jobId?: string; + /** @enum {string} */ + status?: "queued" | "processing"; + pollUrl?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + listParseJobChapters: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + jobId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 章节解析结果列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ChapterParseResult"][]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + confirmChapterParseResult: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + resultId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["ConfirmChapterParseResultRequest"]; + }; + }; + responses: { + /** @description 确认成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @description 生成的知识草稿 ID */ + draftId?: string; + /** @enum {string} */ + status?: "confirmed" | "draft_created"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + rejectChapterParseResult: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + resultId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["RejectChapterParseResultRequest"]; + }; + }; + responses: { + /** @description 驳回成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + batchConfirmChapters: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + jobId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["BatchConfirmChaptersRequest"]; + }; + }; + responses: { + /** @description 批量确认结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["BatchConfirmChaptersResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createExportTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["CreateExportTaskRequest"]; + }; + }; + responses: { + /** @description 导出任务已创建 */ + 202: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ExportTaskDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getExportTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + taskId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 导出任务详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ExportTaskDetail"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + downloadExportPackage: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 下载凭证 ID */ + credentialId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 导出文件二进制流 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/octet-stream": string; + }; + }; + 404: components["responses"]["NotFound"]; + /** @description 下载凭证已过期或已消费 */ + 410: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + }; +} diff --git a/muse-admin/apps/web-antd/src/api/types/index.ts b/muse-admin/apps/web-antd/src/api/types/index.ts new file mode 100644 index 00000000..94b3d59d --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/types/index.ts @@ -0,0 +1,11 @@ +// Muse API TypeScript 类型包入口 +// 从 OpenAPI 3.0 契约自动生成,请勿手动编辑 +// 生成命令: npx openapi-typescript --output + +export type * as Base from './base'; +export type * as Content from './content'; +export type * as AI from './ai'; +export type * as Knowledge from './knowledge'; +export type * as Market from './market'; +export type * as Account from './account'; +export type * as Meta from './meta'; diff --git a/muse-admin/apps/web-antd/src/api/types/knowledge.ts b/muse-admin/apps/web-antd/src/api/types/knowledge.ts new file mode 100644 index 00000000..6e9d69d6 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/types/knowledge.ts @@ -0,0 +1,4061 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export interface paths { + "/admin-api/muse/knowledge/global-kbs": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 全局知识库列表 */ + get: operations["listGlobalKnowledgeBases"]; + put?: never; + /** 创建全局知识库 */ + post: operations["createGlobalKnowledgeBase"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 全局知识库详情 + * @description 返回当前版本、授权策略、来源状态和处理摘要 + */ + get: operations["getGlobalKnowledgeBase"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + /** + * 更新全局知识库 + * @description 更新名称、说明、分类、可见范围和停用原因 + */ + patch: operations["updateGlobalKnowledgeBase"]; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/documents": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 全局知识库资料列表 + * @description 返回资料列表、处理状态、版本和来源摘要 + */ + get: operations["listGlobalKBDocuments"]; + put?: never; + /** + * 上传或登记全局知识库资料 + * @description 上传文件或登记外链资料,返回 documentId 和处理任务 + */ + post: operations["uploadGlobalKBDocument"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/documents/{documentId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 全局知识库资料详情 + * @description 返回资料详情、版本、解析状态和索引状态 + */ + get: operations["getGlobalKBDocument"]; + put?: never; + post?: never; + /** + * 停用全局知识库资料 + * @description 停用资料,触发来源事件和索引刷新 + */ + delete: operations["deleteGlobalKBDocument"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/documents/{documentId}/versions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 新增全局知识库资料版本 + * @description 上传新版本文件,触发处理任务 + */ + post: operations["createGlobalKBDocumentVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/versions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 全局知识库版本列表 + * @description 返回版本列表和发布摘要 + */ + get: operations["listGlobalKBVersions"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/versions/{version}/activate": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 激活全局知识库版本 + * @description 激活指定版本,必须带 commandId 和影响预览 + */ + post: operations["activateGlobalKBVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/access-policies": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 全局知识库授权策略列表 + * @description 返回授权策略列表和 active 摘要 + */ + get: operations["listGlobalKBAccessPolicies"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/access-policies/drafts": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 保存全局知识库授权策略草稿 */ + post: operations["saveGlobalKBAccessPolicyDraft"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/access-policies/drafts/{draftId}/publish": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 发布全局知识库授权策略 + * @description 发布授权策略,必须带 commandId 和影响预览 + */ + post: operations["publishGlobalKBAccessPolicy"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/enable": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 启用全局知识库 */ + post: operations["enableGlobalKnowledgeBase"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/disable": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 停用全局知识库 + * @description 停用全局知识库,触发来源事件 + */ + post: operations["disableGlobalKnowledgeBase"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/impact-preview": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 全局知识库影响预览 + * @description 返回授权、绑定、检索、导出和运行任务影响 + */ + post: operations["previewGlobalKBImpact"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/reindex": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 重建全局知识库索引 + * @description 重建索引,返回处理任务 + */ + post: operations["reindexGlobalKnowledgeBase"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/processing-tasks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 全局知识库资料处理任务状态 + * @description 查询资料处理、索引和投影任务状态 + */ + get: operations["listGlobalKBProcessingTasks"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/global-kbs/{kbId}/source-events": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 触发全局知识库来源事件 + * @description 传播 SourceEventType、SourceStatus、SourceActionPolicy 和原因归因 + */ + post: operations["triggerGlobalKBSourceEvent"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/source-bindings": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询来源绑定和状态 */ + get: operations["listSourceBindings"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/drafts": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询知识草稿治理摘要 */ + get: operations["listKnowledgeDraftsGovernance"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/knowledge/projection-tasks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 查询知识投影和索引任务 */ + get: operations["listProjectionTasks"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/entities": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 获取作品知识实体列表 */ + get: operations["listEntities"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/entities/{entityId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 获取知识实体详情 + * @description 返回实体详情(含关联关系和来源引用) + */ + get: operations["getEntity"]; + /** 更新知识实体 */ + put: operations["updateEntity"]; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/entities/{entityId}/relations": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 获取实体关联关系 */ + get: operations["listRelations"]; + put?: never; + /** 创建知识关系 */ + post: operations["createRelation"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/graph": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 获取知识图谱数据 + * @description 返回节点和边的 JSON,用于前端可视化渲染 + */ + get: operations["getKnowledgeGraph"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 用户知识库和已安装知识库 */ + get: operations["listKnowledgeBases"]; + put?: never; + /** 创建用户知识库 */ + post: operations["createKnowledgeBase"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 用户知识库详情 + * @description 返回资料摘要、版本、来源状态和处理状态 + */ + get: operations["getKnowledgeBase"]; + put?: never; + post?: never; + /** + * 删除用户知识库 + * @description 删除用户知识库,按状态进入软删除或异步清理 + */ + delete: operations["deleteKnowledgeBase"]; + options?: never; + head?: never; + /** 更新用户知识库基础信息 */ + patch: operations["updateKnowledgeBase"]; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/disable": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 停用用户知识库 + * @description 停用用户知识库,阻断新绑定和新检索 + */ + post: operations["disableKnowledgeBase"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/restore": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 恢复用户知识库 + * @description 恢复可恢复的用户知识库 + */ + post: operations["restoreKnowledgeBase"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/documents": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 用户知识库资料列表 + * @description 返回资料列表、版本、处理状态和来源摘要 + */ + get: operations["listKBDocuments"]; + put?: never; + /** + * 上传用户知识库资料 + * @description 上传资料,返回 documentId 和处理任务 + */ + post: operations["uploadKBDocument"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/documents/{documentId}/versions": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 用户知识库资料版本列表 */ + get: operations["listKBDocumentVersions"]; + put?: never; + /** + * 上传用户知识库资料新版本 + * @description 上传新版本文件,触发处理任务 + */ + post: operations["createKBDocumentVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/documents/{documentId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** + * 删除或停用用户知识库资料 + * @description 删除或停用资料,触发来源事件 + */ + delete: operations["deleteKBDocument"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/processing-tasks/{taskId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询用户知识库资料处理任务 + * @description 查询资料处理、解析、切分、索引或投影任务 + */ + get: operations["getKBProcessingTask"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/reindex": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 重建用户知识库索引 + * @description 重建索引,返回任务 + */ + post: operations["reindexKnowledgeBase"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/publish-prechecks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 生成源侧可发布性摘要 + * @description 只在 Knowledge owner 内生成知识库源侧可发布性摘要,返回 publishReadinessId 或阻断原因。 + * 该接口不创建 Market 发布申请,不产生审核结论;实际 submit/review 必须在 Market 模块完成。 + */ + post: operations["createKBPublishReadiness"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/publish-snapshots": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 生成源侧发布快照 + * @description 固化知识库版本、授权、来源、处理状态和可发布性摘要,形成给 Market 发布草稿使用的源侧快照。 + * 该接口不提交 Market 审核。 + */ + post: operations["createKBPublishSnapshot"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/publish-readiness": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 生成 Market 发布交接材料 + * @description 消费源侧可发布性摘要和发布快照,生成 Market 发布草稿可引用的交接材料。 + * 不创建 Market 发布申请、不进入审核队列;实际 submit/review 由 Market API 负责。 + */ + post: operations["createKBMarketPublishReadiness"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-bases/{kbId}/export-tasks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 创建知识库导出任务 + * @description 创建知识库导出任务,需要预检和脱敏确认 + */ + post: operations["createKBExportTask"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/installed-knowledge-bases": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 已安装知识库列表 + * @description 返回已安装知识库列表、授权、来源状态和可绑定范围 + */ + get: operations["listInstalledKnowledgeBases"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/installed-knowledge-bases/{installId}/disable": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 停用已安装知识库 */ + post: operations["disableInstalledKnowledgeBase"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/installed-knowledge-bases/{installId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** + * 删除已安装知识库记录 + * @description 删除已安装知识库记录,不删除来源市场资产 + */ + delete: operations["deleteInstalledKnowledgeBase"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/installed-knowledge-bases/{installId}/restore": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 恢复已安装知识库 */ + post: operations["restoreInstalledKnowledgeBase"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/local-knowledge": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 作品 Local KB + * @description 查询作品局域知识库,属于单作品正式事实 + */ + get: operations["getLocalKnowledge"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/knowledge-drafts": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 待确认知识草稿 + * @description 查询作品待确认的知识草稿列表 + */ + get: operations["listKnowledgeDrafts"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-drafts/{draftId}/confirm": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 确认知识草稿 + * @description 确认知识草稿,必须重新校验来源状态、授权快照和风险标记 + */ + post: operations["confirmKnowledgeDraft"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-drafts/{draftId}/ignore": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 忽略知识草稿 */ + post: operations["ignoreKnowledgeDraft"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/knowledge-drafts/{draftId}/recheck": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 重验知识草稿来源 + * @description 触发来源重验任务,不直接恢复绑定或确认 + */ + post: operations["recheckKnowledgeDraft"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/knowledge-bindings/prechecks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 目标 owner 绑定预检 + * @description 消费市场 handoff、来源授权摘要、来源版本、来源状态和授权快照,返回 kbBindPrecheckId。 + * Knowledge 在这里执行目标 owner 预检;不会信任后续 bind 请求重复传入的可变来源事实。 + */ + post: operations["createKnowledgeBindingPrecheck"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/knowledge-bindings": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 绑定用户/市场知识库 + * @description 只消费 kbBindPrecheckId、commandId 和 expectedWorkRevision 完成绑定。 + * sourceType/sourceId/sourceVersion/authorizationSnapshotId/purposes 等来源事实必须来自服务端预检快照, + * 不在 bind 请求体中重复信任前端可变事实。 + */ + post: operations["createKnowledgeBinding"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/works/{workId}/knowledge-bindings/{bindingId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + post?: never; + /** + * 解绑作品知识来源 + * @description 解绑知识来源,后续生成不再使用该来源 + */ + delete: operations["deleteKnowledgeBinding"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: { + CommonResult: { + /** + * @description 业务状态码,0 表示成功 + * @example 0 + */ + code: number; + /** @description 响应数据,类型视具体接口而定 */ + data?: unknown; + /** + * @description 提示信息 + * @example success + */ + msg: string; + }; + PaginatedResult: { + /** + * @description 总记录数 + * @example 150 + */ + total: number; + /** + * @description 当前页码 + * @example 1 + */ + pageNo: number; + /** + * @description 每页条数 + * @example 20 + */ + pageSize: number; + /** @description 当前页数据列表 */ + list: unknown[]; + }; + ErrorResponse: { + /** + * @description 错误码格式: {system}-{module}-{category}-{sequence} + * 示例: MUSE-CONTENT-001-0001 + * @example MUSE-CONTENT-001-0001 + */ + code: string; + /** @description 人类可读的错误描述 */ + msg: string; + /** @description 详细错误信息(仅开发环境返回) */ + detail?: string; + }; + }; + responses: { + /** @description 请求参数有误 */ + BadRequest: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 未认证或 token 过期 */ + Unauthorized: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 无权限 */ + Forbidden: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源不存在 */ + NotFound: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + parameters: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + XApiVersion: "1"; + /** @description 页码,从 1 开始 */ + pageNo: number; + /** @description 每页条数,上限 100 */ + pageSize: number; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + listGlobalKnowledgeBases: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 搜索关键词 */ + keyword?: string; + /** @description 按状态筛选 */ + status?: "active" | "disabled" | "processing" | "failed"; + /** @description 按分类筛选 */ + category?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 全局知识库分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + /** + * @description list 元素为 GlobalKBSummary: + * - kbId: string (知识库 ID) + * - name: string (名称) + * - description: string (说明) + * - category: string (分类) + * - currentVersion: integer (当前激活版本) + * - status: string (active/disabled/processing/failed) + * - activePolicyVersion: integer (当前授权策略版本) + * - documentCount: integer (资料数量) + * - bindingCount: integer (绑定作品数量) + * - createdAt: date-time + * - updatedAt: date-time + */ + data?: components["schemas"]["PaginatedResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createGlobalKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 知识库名称 */ + name: string; + /** @description 知识库说明 */ + description?: string; + /** @description 分类标签 */ + category?: string; + /** + * @description 可见范围 + * @enum {string} + */ + visibilityScope?: "all" | "role_based" | "custom"; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: uuid */ + kbId?: string; + /** @enum {string} */ + status?: "draft"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getGlobalKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 全局知识库详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: uuid */ + kbId?: string; + name?: string; + description?: string; + category?: string; + visibilityScope?: string; + currentVersion?: number; + /** @enum {string} */ + status?: "active" | "disabled" | "processing" | "failed"; + activePolicyVersion?: number; + documentCount?: number; + bindingCount?: number; + processingSummary?: { + searchableCount?: number; + generativeCount?: number; + failedCount?: number; + processingCount?: number; + }; + /** Format: date-time */ + createdAt?: string; + /** Format: date-time */ + updatedAt?: string; + }; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + updateGlobalKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + name?: string; + description?: string; + category?: string; + /** @enum {string} */ + visibilityScope?: "all" | "role_based" | "custom"; + /** @description 停用时必填原因 */ + disableReason?: string; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 更新成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + kbId?: string; + /** Format: date-time */ + updatedAt?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 404: components["responses"]["NotFound"]; + }; + }; + listGlobalKBDocuments: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按处理状态筛选 */ + processingStatus?: "pending_scan" | "scan_blocked" | "pending_process" | "processing" | "searchable" | "generative" | "failed" | "deleting"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 资料分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + /** + * @description list 元素为 DocumentSummary: + * - documentId: string + * - name: string + * - type: string (file/entry/link) + * - size: integer (字节数) + * - version: integer + * - processingStatus: string + * - scanStatus: string + * - isSearchable: boolean + * - isGenerative: boolean + * - failureReason: string + * - updatedAt: date-time + */ + data?: components["schemas"]["PaginatedResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + uploadGlobalKBDocument: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "multipart/form-data": { + /** + * Format: binary + * @description 上传文件(与 entryContent/linkUrl 三选一) + */ + file?: string; + /** @description 手写条目内容 */ + entryContent?: string; + /** + * Format: uri + * @description 外链资料 URL。服务端必须执行 SSRF 防护:仅允许配置 allowlist 内的域名或协议, + * 拦截私网/环回/链路本地 IP 和 DNS 重绑定,使用隔离抓取环境下载, + * 对抓取文件做类型校验和恶意文件扫描,并以异步处理状态返回扫描、解析和索引结果。 + */ + linkUrl?: string; + /** @description 来源说明 */ + sourceDescription?: string; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 上传成功,进入待扫描 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: uuid */ + documentId?: string; + scanTaskId?: string; + /** @enum {string} */ + processingStatus?: "pending_scan"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + getGlobalKBDocument: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + documentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 资料详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + documentId?: string; + name?: string; + type?: string; + size?: number; + currentVersion?: number; + scanStatus?: string; + processingStatus?: string; + isSearchable?: boolean; + isGenerative?: boolean; + parseStatus?: string; + indexStatus?: string; + failureReason?: string; + versions?: { + version?: number; + /** Format: date-time */ + createdAt?: string; + processingStatus?: string; + }[]; + /** Format: date-time */ + updatedAt?: string; + }; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + deleteGlobalKBDocument: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + documentId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 停用原因 */ + reason?: string; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 停用成功,资料进入删除同步 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + sourceEventId?: string; + affectedBindings?: number; + }; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + createGlobalKBDocumentVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + documentId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "multipart/form-data": { + /** Format: binary */ + file?: string; + sourceDescription?: string; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 新版本创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + documentId?: string; + newVersion?: number; + processingTaskId?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + listGlobalKBVersions: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 版本列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + currentActiveVersion?: number; + versions?: { + version?: number; + isActive?: boolean; + documentCount?: number; + searchableCount?: number; + generativeCount?: number; + changeSummary?: string; + /** Format: date-time */ + activatedAt?: string; + /** Format: date-time */ + createdAt?: string; + }[]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + activateGlobalKBVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + version: number; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 激活原因 */ + reason: string; + /** @description 影响预览引用 ID */ + impactPreviewReference?: string; + }; + }; + }; + responses: { + /** @description 激活成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + activeVersion?: number; + sourceEventId?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + listGlobalKBAccessPolicies: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 授权策略列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + activePolicyVersion?: number; + policies?: { + policyId?: string; + version?: number; + isActive?: boolean; + /** @description 授权范围(all_users/role_based/custom) */ + scope?: string; + canSearch?: boolean; + canGenerate?: boolean; + canExport?: boolean; + canCopy?: boolean; + /** Format: date-time */ + expiresAt?: string; + /** Format: date-time */ + publishedAt?: string; + /** Format: date-time */ + createdAt?: string; + }[]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + saveGlobalKBAccessPolicyDraft: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 授权范围 */ + scope: string; + /** @description 角色列表(scope=role_based 时必填) */ + allowedRoles?: string[]; + /** @default true */ + canSearch?: boolean; + /** @default false */ + canGenerate?: boolean; + /** @default false */ + canExport?: boolean; + /** @default false */ + canCopy?: boolean; + /** @description 外发范围限制 */ + externalScope?: string; + /** + * Format: date-time + * @description 过期时间 + */ + expiresAt?: string; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 草稿保存成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + draftId?: string; + draftVersion?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + publishGlobalKBAccessPolicy: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + draftId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 发布原因 */ + reason: string; + /** @description 影响预览引用 ID */ + impactPreviewReference?: string; + }; + }; + }; + responses: { + /** @description 发布成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + activePolicyVersion?: number; + sourceEventId?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + enableGlobalKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + commandId: string; + reason: string; + }; + }; + }; + responses: { + /** @description 启用成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @enum {string} */ + status?: "active"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + disableGlobalKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + commandId: string; + /** @description 停用原因 */ + reason: string; + }; + }; + }; + responses: { + /** @description 停用成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @enum {string} */ + status?: "disabled"; + sourceEventId?: string; + affectedBindings?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + previewGlobalKBImpact: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * @description 预览的操作类型 + * @enum {string} + */ + actionType: "enable" | "disable" | "version_activate" | "policy_publish" | "document_delete"; + /** @description 目标版本(version_activate 时必填) */ + targetVersion?: number; + }; + }; + }; + responses: { + /** @description 影响预览结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @description 影响预览引用 ID,用于后续命令 */ + impactId?: string; + affectedBindings?: number; + affectedInstalls?: number; + affectedWorks?: number; + runningTasks?: number; + riskSummary?: string; + /** Format: date-time */ + expiresAt?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + reindexGlobalKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + commandId: string; + /** + * @description 重建范围 + * @default full + * @enum {string} + */ + scope?: "full" | "incremental" | "failed_only"; + }; + }; + }; + responses: { + /** @description 重建索引任务已创建 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + jobId?: string; + /** @enum {string} */ + status?: "queued"; + pollUrl?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + listGlobalKBProcessingTasks: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按任务状态筛选 */ + status?: "queued" | "scanning" | "cleaning" | "parsing" | "indexing" | "completed" | "failed" | "cancelling"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 处理任务分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + /** + * @description list 元素为 ProcessingTaskSummary: + * - taskId: string + * - taskType: string (scan/clean/parse/index/export) + * - status: string + * - stage: string + * - documentCount: integer + * - failedCount: integer + * - startedAt: date-time + * - updatedAt: date-time + * - failureReason: string + */ + data?: components["schemas"]["PaginatedResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + triggerGlobalKBSourceEvent: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + commandId: string; + /** @enum {string} */ + eventType: "status_changed" | "version_changed" | "policy_changed" | "document_deleted" | "kb_disabled" | "kb_enabled"; + reason: string; + targetVersion?: number; + /** @enum {string} */ + actionPolicy?: "allowed" | "read_only" | "blocked" | "needs_recheck"; + }; + }; + }; + responses: { + /** @description 来源事件已触发 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + eventId?: string; + affectedTargets?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + listSourceBindings: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 来源类型 */ + sourceType?: "global_kb" | "market_kb" | "user_kb"; + /** @description 来源状态 */ + sourceStatus?: "active" | "stale" | "revoked" | "recalled" | "delisted" | "blocked" | "owner_missing" | "unauthorized"; + /** @description 目标 owner */ + targetOwner?: "content" | "knowledge" | "ai" | "market" | "account"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 来源绑定分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + /** + * @description list 元素为 SourceBindingSummary: + * - bindingId: string + * - sourceType: string + * - sourceId: string + * - sourceVersion: integer + * - sourceStatus: string + * - actionPolicy: string + * - targetOwner: string + * - targetId: string + * - affectedWorkCount: integer + * - updatedAt: date-time + */ + data?: components["schemas"]["PaginatedResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + listKnowledgeDraftsGovernance: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + status?: "pending" | "confirmed" | "ignored" | "conflicted" | "failed"; + sourceType?: "extraction" | "import" | "external"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 知识草稿治理摘要分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + /** + * @description list 元素为 KnowledgeDraftGovernanceSummary: + * - draftId: string + * - workId: string + * - workTitle: string + * - entityType: string + * - sourceType: string + * - status: string + * - conflictCount: integer + * - createdAt: date-time + * - updatedAt: date-time + */ + data?: components["schemas"]["PaginatedResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + listProjectionTasks: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + status?: "queued" | "running" | "completed" | "failed"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 投影和索引任务分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + /** + * @description list 元素为 ProjectionTaskSummary: + * - taskId: string + * - taskType: string + * - status: string + * - sourceKbId: string + * - sourceKbName: string + * - affectedProjectionCount: integer + * - startedAt: date-time + * - completedAt: date-time + * - failureReason: string + */ + data?: components["schemas"]["PaginatedResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + listEntities: { + parameters: { + query?: { + status?: "confirmed" | "draft" | "conflicted"; + type?: "character" | "location" | "event" | "item" | "concept" | "note"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 实体列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: uuid */ + entityId?: string; + name?: string; + /** @enum {string} */ + type?: "character" | "location" | "event" | "item" | "concept" | "note"; + /** @enum {string} */ + status?: "confirmed" | "draft" | "conflicted"; + description?: string; + /** @description 来源引用 */ + sourceRef?: string; + /** Format: date-time */ + createdAt?: string; + /** Format: date-time */ + updatedAt?: string; + }[]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + getEntity: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + entityId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 实体详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: uuid */ + entityId?: string; + name?: string; + type?: string; + status?: string; + description?: string; + /** @description 自定义属性键值对 */ + attributes?: { + [key: string]: unknown; + }; + sourceRefs?: { + sourceType?: string; + sourceId?: string; + sourceVersion?: number; + /** Format: float */ + confidence?: number; + }[]; + relations?: { + relationId?: string; + targetEntityId?: string; + targetEntityName?: string; + relationType?: string; + description?: string; + }[]; + /** Format: date-time */ + createdAt?: string; + /** Format: date-time */ + updatedAt?: string; + }; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + updateEntity: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + entityId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + name?: string; + description?: string; + /** @description 自定义属性键值对 */ + attributes?: { + [key: string]: unknown; + }; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 更新成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + entityId?: string; + /** Format: date-time */ + updatedAt?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 404: components["responses"]["NotFound"]; + }; + }; + listRelations: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + entityId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 关系列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + relationId?: string; + sourceEntityId?: string; + targetEntityId?: string; + targetEntityName?: string; + relationType?: string; + description?: string; + }[]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createRelation: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 源实体 */ + entityId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** Format: uuid */ + targetEntityId: string; + /** @example knows */ + relationType: string; + description?: string; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + relationId?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + getKnowledgeGraph: { + parameters: { + query?: { + /** @description 图谱展开深度 */ + depth?: number; + /** @description 按实体类型筛选 */ + entityType?: "character" | "location" | "event" | "item" | "concept" | "note"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 图谱数据(nodes + edges) */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + nodes?: { + id?: string; + name?: string; + type?: string; + status?: string; + }[]; + edges?: { + id?: string; + source?: string; + target?: string; + relationType?: string; + }[]; + }; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + listKnowledgeBases: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 搜索关键词 */ + keyword?: string; + /** @description 按来源筛选 */ + source?: "user" | "installed" | "account_available" | "global"; + /** @description 按处理状态筛选 */ + processingStatus?: "draft" | "processing" | "searchable" | "generative" | "partial_failed" | "disabled" | "authorization_expired" | "delisted" | "deleting"; + /** @description 按授权状态筛选 */ + authorizationStatus?: "valid" | "expired" | "revoked"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 知识库分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + /** + * @description list 元素为 KnowledgeBaseSummary: + * - kbId: string + * - name: string + * - source: string (user/installed/account_available/global) + * - type: string + * - currentVersion: integer + * - processingStatus: string + * - authorizationStatus: string + * - isEditable: boolean + * - bindableWorkCount: integer + * - recentHitCount: integer + * - riskSummary: string + * - createdAt: date-time + * - updatedAt: date-time + */ + data?: components["schemas"]["PaginatedResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 知识库名称 */ + name: string; + /** @description 知识库说明 */ + description?: string; + /** @description 模板 ID(从模板创建时) */ + templateId?: string; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: uuid */ + kbId?: string; + /** @enum {string} */ + status?: "draft"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + getKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 知识库详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + kbId?: string; + name?: string; + description?: string; + source?: string; + ownership?: string; + currentVersion?: number; + processingStatus?: string; + authorizationStatus?: string; + isEditable?: boolean; + documentCount?: number; + bindableWorkCount?: number; + recentHitCount?: number; + riskSummary?: string; + publishStatus?: string; + processingSummary?: { + searchableCount?: number; + generativeCount?: number; + failedCount?: number; + processingCount?: number; + }; + licenseSummary?: { + canSearch?: boolean; + canGenerate?: boolean; + canExport?: boolean; + canCopy?: boolean; + /** Format: date-time */ + expiresAt?: string; + }; + /** Format: date-time */ + createdAt?: string; + /** Format: date-time */ + updatedAt?: string; + }; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + deleteKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 用户已确认影响范围 */ + impactConfirmed: boolean; + /** @description 用户已确认留存规则 */ + retentionConfirmed?: boolean; + }; + }; + }; + responses: { + /** @description 删除流程已启动 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @enum {string} */ + status?: "deleting"; + /** Format: date-time */ + cancellableUntil?: string; + affectedBindings?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + updateKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + name?: string; + description?: string; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 更新成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + kbId?: string; + /** Format: date-time */ + updatedAt?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + disableKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 用户已确认影响范围 */ + impactConfirmed: boolean; + }; + }; + }; + responses: { + /** @description 停用成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @enum {string} */ + status?: "disabled"; + affectedBindings?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + restoreKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 恢复成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @enum {string} */ + status?: "active" | "searchable" | "generative"; + reindexRequired?: boolean; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + listKBDocuments: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按处理状态筛选 */ + processingStatus?: "pending_scan" | "scan_blocked" | "pending_process" | "processing" | "searchable" | "generative" | "failed" | "deleting"; + /** @description 按资料类型筛选 */ + type?: "file" | "entry" | "link"; + /** @description 搜索关键词 */ + keyword?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 资料分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + /** + * @description list 元素为 DocumentSummary: + * - documentId: string + * - name: string + * - type: string (file/entry/link) + * - size: integer + * - sourceDescription: string + * - currentVersion: integer + * - scanStatus: string + * - processingStatus: string + * - isSearchable: boolean + * - isGenerative: boolean + * - failureReason: string + * - riskSummary: string + * - updatedAt: date-time + */ + data?: components["schemas"]["PaginatedResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + uploadKBDocument: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "multipart/form-data": { + /** + * Format: binary + * @description 上传文件 + */ + file?: string; + /** @description 手写条目内容 */ + entryContent?: string; + /** + * Format: uri + * @description 外链资料 URL。服务端必须执行 SSRF 防护:仅允许配置 allowlist 内的域名或协议, + * 拦截私网/环回/链路本地 IP 和 DNS 重绑定,使用隔离抓取环境下载, + * 对抓取文件做类型校验和恶意文件扫描,并以异步处理状态返回扫描、解析和索引结果。 + */ + linkUrl?: string; + /** @description 来源说明 */ + sourceDescription?: string; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 上传成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: uuid */ + documentId?: string; + scanTaskId?: string; + /** @enum {string} */ + processingStatus?: "pending_scan"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + listKBDocumentVersions: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + documentId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 资料版本列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + version?: number; + sourceDescription?: string; + scanStatus?: string; + processingStatus?: string; + /** Format: date-time */ + createdAt?: string; + }[]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + createKBDocumentVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + documentId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "multipart/form-data": { + /** Format: binary */ + file?: string; + sourceDescription?: string; + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 新版本创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + documentId?: string; + newVersion?: number; + processingTaskId?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + deleteKBDocument: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + documentId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 用户已确认影响范围 */ + impactConfirmed?: boolean; + }; + }; + }; + responses: { + /** @description 删除成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + sourceEventId?: string; + affectedBindings?: number; + }; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + getKBProcessingTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + taskId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 处理任务详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + taskId?: string; + taskType?: string; + /** @enum {string} */ + status?: "queued" | "scanning" | "cleaning" | "parsing" | "indexing" | "completed" | "failed" | "cancelling"; + stage?: string; + /** + * Format: float + * @description 进度百分比 0-100 + */ + progress?: number; + documentCount?: number; + failedCount?: number; + failureReason?: string; + retryable?: boolean; + nextActions?: string[]; + /** Format: date-time */ + startedAt?: string; + /** Format: date-time */ + updatedAt?: string; + }; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + reindexKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** + * @description 重建范围 + * @default full + * @enum {string} + */ + scope?: "full" | "incremental" | "failed_only"; + }; + }; + }; + responses: { + /** @description 重建索引任务已创建 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + jobId?: string; + /** @enum {string} */ + status?: "queued"; + pollUrl?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + createKBPublishReadiness: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 待发布的知识库版本 */ + version: number; + }; + }; + }; + responses: { + /** @description 预检结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @description 源侧可发布性摘要 ID,用于生成发布快照 */ + publishReadinessId?: string; + blocked?: boolean; + blockedReasons?: string[]; + warnings?: string[]; + rightsStatus?: string; + privacyStatus?: string; + processingStatus?: string; + /** Format: date-time */ + expiresAt?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + createKBPublishSnapshot: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 知识库版本 */ + version: number; + /** @description 源侧可发布性摘要 ID */ + publishReadinessId: string; + }; + }; + }; + responses: { + /** @description 发布快照创建成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + snapshotId?: string; + version?: number; + packageHash?: string; + /** Format: date-time */ + expiresAt?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + createKBMarketPublishReadiness: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 源侧可发布性摘要 ID */ + publishReadinessId: string; + /** @description 发布快照 ID */ + snapshotId: string; + /** @description 权利声明 */ + rightsDeclaration?: string; + /** @description 许可范围 */ + licenseScope?: Record; + /** @description 禁止用途 */ + prohibitedUses?: string[]; + }; + }; + }; + responses: { + /** @description 发布交接材料已生成 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + readinessPackageId?: string; + /** @enum {string} */ + status?: "ready_for_market_submission"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + createKBExportTask: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + kbId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 导出预检 ID */ + kbExportCheckId: string; + /** + * @description 导出格式 + * @default zip + * @enum {string} + */ + format?: "json" | "markdown" | "zip"; + /** + * @description 导出范围 + * @default full + * @enum {string} + */ + scope?: "full" | "metadata_only" | "documents_only"; + /** @description 用户已确认脱敏规则 */ + desensitizationConfirmed?: boolean; + }; + }; + }; + responses: { + /** @description 导出任务已创建 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + jobId?: string; + /** @enum {string} */ + status?: "queued"; + pollUrl?: string; + /** Format: date-time */ + downloadExpiresAt?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + listInstalledKnowledgeBases: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按安装状态筛选 */ + status?: "installed" | "disabled" | "authorization_expired" | "delisted" | "upgrade_available"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 已安装知识库分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + /** + * @description list 元素为 InstalledKBSummary: + * - installId: string + * - kbId: string + * - name: string + * - publisher: string + * - currentVersion: integer + * - latestVersion: integer + * - upgradeAvailable: boolean + * - isVersionPinned: boolean + * - status: string + * - licenseSummary: object + * - canSearch: boolean + * - canGenerate: boolean + * - expiresAt: date-time + * - updatedAt: date-time + */ + data?: components["schemas"]["PaginatedResult"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + disableInstalledKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + installId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 停用成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @enum {string} */ + status?: "disabled"; + affectedWorkBindings?: number; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + deleteInstalledKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + installId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 用户已确认影响范围 */ + impactConfirmed?: boolean; + }; + }; + }; + responses: { + /** @description 删除成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + affectedWorkBindings?: number; + }; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + restoreInstalledKnowledgeBase: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + installId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 恢复成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @enum {string} */ + status?: "installed"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + getLocalKnowledge: { + parameters: { + query?: { + /** @description 按实体类型筛选 */ + entityType?: "character" | "location" | "event" | "item" | "concept" | "note"; + /** @description 搜索关键词 */ + keyword?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 作品局域知识库 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + workId?: string; + entityCount?: number; + entities?: { + entityId?: string; + name?: string; + type?: string; + /** @enum {string} */ + status?: "confirmed" | "draft" | "conflicted"; + description?: string; + sourceRef?: string; + /** Format: date-time */ + updatedAt?: string; + }[]; + sourceBindings?: { + bindingId?: string; + sourceType?: string; + sourceId?: string; + sourceName?: string; + sourceStatus?: string; + purposes?: string[]; + }[]; + }; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + listKnowledgeDrafts: { + parameters: { + query?: { + status?: "pending" | "confirmed" | "ignored" | "conflicted"; + entityType?: "character" | "location" | "event" | "item" | "concept" | "note"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 知识草稿列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** Format: uuid */ + draftId?: string; + entityType?: string; + name?: string; + description?: string; + /** @enum {string} */ + status?: "pending" | "confirmed" | "ignored" | "conflicted"; + sourceType?: string; + sourceRef?: string; + /** Format: float */ + confidence?: number; + conflictSummary?: string; + /** Format: date-time */ + createdAt?: string; + }[]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + confirmKnowledgeDraft: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + draftId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 草稿版本乐观锁,必须与服务端当前 draft revision 匹配 */ + expectedDraftRevision: number; + /** @description 草稿生成时的来源快照 ID,用于防 stale 校验 */ + sourceSnapshotId: string; + /** @description 草稿生成时的授权快照 ID,用于重新校验外发、生成和导出权限 */ + authorizationSnapshotId: string; + /** + * @description 确认模式 + * @enum {string} + */ + confirmMode: "single" | "batch"; + /** + * @description 用户确认决策类型 + * @enum {string} + */ + decisionType: "accept" | "accept_with_overrides" | "resolve_conflict"; + /** @description 风险确认信息;存在风险标记时必须由服务端校验为 true */ + riskAcknowledgement: { + /** @description 用户是否已确认风险提示 */ + acknowledged: boolean; + /** @description 已确认的风险码列表 */ + acknowledgedRiskCodes?: string[]; + }; + /** @description 手动修正的属性值 */ + overrides?: { + [key: string]: unknown; + }; + }; + }; + }; + responses: { + /** @description 确认成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + draftId?: string; + entityId?: string; + /** @enum {string} */ + status?: "confirmed"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + ignoreKnowledgeDraft: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + draftId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 忽略原因 */ + reason?: string; + }; + }; + }; + responses: { + /** @description 已忽略 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + draftId?: string; + /** @enum {string} */ + status?: "ignored"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + recheckKnowledgeDraft: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + draftId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + }; + }; + }; + responses: { + /** @description 重验任务已创建 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + jobId?: string; + /** @enum {string} */ + status?: "queued"; + pollUrl?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + createKnowledgeBindingPrecheck: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** + * @description 来源类型 + * @enum {string} + */ + sourceType: "user_kb" | "market_kb" | "global_kb"; + /** @description 来源知识库 ID */ + sourceId: string; + /** @description 来源版本 */ + sourceVersion: number; + /** + * @description 来源状态快照;不能用 needs_recheck 表达重验,重验原因由 actionPolicy 返回 + * @enum {string} + */ + sourceStatus: "available" | "authorization_expired" | "source_delisted" | "source_recalled" | "source_revoked" | "unavailable"; + /** @description 市场 handoff token(市场知识库时必填) */ + handoffToken?: string; + /** @description Market 生成的来源侧授权摘要 ID */ + authorizationSummaryId: string; + /** @description 授权快照 ID */ + authorizationSnapshotId: string; + /** @description 请求的用途 */ + purposes?: ("search" | "generate" | "check" | "export")[]; + }; + }; + }; + responses: { + /** @description 预检结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + /** @description 绑定预检 ID,用于后续绑定 */ + kbBindPrecheckId?: string; + allowedPurposes?: string[]; + blockedPurposes?: string[]; + conflictStrategy?: string; + blockedReasons?: string[]; + sourceStatus?: string; + actionPolicy?: { + /** @enum {string} */ + searchPolicy?: "allowed" | "blocked"; + /** @enum {string} */ + generationPolicy?: "allowed" | "blocked"; + /** @enum {string} */ + exportPolicy?: "allowed" | "blocked"; + /** @description 需要重验的原因列表,不把 needs_recheck 写入 SourceStatus */ + recheckReasons?: string[]; + }; + /** Format: date-time */ + expiresAt?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + createKnowledgeBinding: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 绑定预检 ID */ + kbBindPrecheckId: string; + /** @description 目标作品 revision 乐观锁,避免绑定写入过期作品状态 */ + expectedWorkRevision: number; + }; + }; + }; + responses: { + /** @description 绑定成功 */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + bindingId?: string; + sourceType?: string; + sourceId?: string; + sourceVersion?: number; + purposes?: string[]; + authorizationSnapshotId?: string; + /** Format: date-time */ + createdAt?: string; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + }; + }; + deleteKnowledgeBinding: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + workId: string; + bindingId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 幂等键 */ + commandId: string; + /** @description 用户已确认影响范围 */ + impactConfirmed?: boolean; + }; + }; + }; + responses: { + /** @description 解绑成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: { + bindingId?: string; + /** @enum {string} */ + status?: "unbound"; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 404: components["responses"]["NotFound"]; + }; + }; +} diff --git a/muse-admin/apps/web-antd/src/api/types/market.ts b/muse-admin/apps/web-antd/src/api/types/market.ts new file mode 100644 index 00000000..76df044c --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/types/market.ts @@ -0,0 +1,2970 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export interface paths { + "/app-api/muse/marketplace/assets": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 市场资产列表 + * @description 搜索和筛选市场资产。支持按资产类型、分类、关键词和排序方式查询。 + * 未登录用户只能浏览公开摘要;登录后按账户授权、地区和合规状态展示可见资产。 + */ + get: operations["listMarketplaceAssets"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/categories": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 分类曝光、推荐位、排序和可见性摘要 + * @description 获取市场分类树、专题、推荐位和发布者可见曝光摘要。 + * 发布者只能查看自己资产的脱敏曝光聚合,不看全站策略或其他资产精确数据。 + */ + get: operations["listMarketplaceCategories"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/recommendations": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 个性化推荐资产列表 + * @description 基于用户上下文返回个性化推荐资产。支持指定推荐场景、参考资产和关联作品。 + * 推荐加载失败时不阻断主列表渲染。 + */ + get: operations["listMarketplaceRecommendations"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/assets/{assetId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 资产详情 + * @description 获取单个市场资产的能力、来源、版本、许可、限制、治理状态和当前用户可用动作。 + * 按资产类型(作品/智能体/知识库)展示不同可信信息面板。 + */ + get: operations["getMarketplaceAsset"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/assets/{assetId}/favorite": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 收藏资产 + * @description 收藏市场资产,需登录。收藏不影响授权或安装状态。 + */ + post: operations["favoriteAsset"]; + /** + * 取消收藏 + * @description 取消已收藏的市场资产。 + */ + delete: operations["unfavoriteAsset"]; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/assets/{assetId}/purchase": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 购买或获取授权 + * @description 在确认许可、权益和限制后获取资产使用权。获取只产生授权记录, + * 不等于安装、绑定或写作品事实。需携带幂等键防止重复提交。 + */ + post: operations["purchaseAsset"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/assets/{assetId}/install": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 安装智能体或知识库 + * @description 把已授权的智能体或知识库安装到账户可用列表。安装只表示资产进入账户可用资产列表, + * 不等于作品关联或绑定。作品资产不走安装流程。需携带幂等键。 + */ + post: operations["installMarketplaceAsset"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/assets/{assetId}/bind-precheck": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 创建来源侧授权摘要和 handoff 准备 + * @description 在安装后发起绑定预检,生成来源侧授权摘要(如智能体槽位兼容声明、知识库用途与外发范围、 + * 作品资产许可快照)。结果只作为 source authorization summary 和 handoff 准备信息, + * 供目标 owner 后续自行创建自己的预检。市场不生成任何目标 owner 预检 ID, + * 也不写入目标 owner 空间。 + */ + post: operations["createBindPrecheck"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/handoffs": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 创建市场 handoff + * @description 创建跨空间 handoff token,携带来源授权摘要和授权快照跳转到目标 owner 空间。 + * 目标空间必须基于 handoffToken、authorizationSummaryId 和授权快照自行执行 owner 预检和确认。 + * 市场只生成跳转授权,不替换绑定、不解绑、不降权、不改作品事实。 + */ + post: operations["createMarketplaceHandoff"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/handoffs/{handoffToken}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查询 handoff 状态 + * @description 只读查询 handoff token 的当前状态,不消费 token、不创建 session、不改变 handoff 状态。 + * 用于轮询确认目标 owner 是否已完成处理;目标 owner 的 token 消费和预检由目标 owner 接口完成。 + */ + get: operations["getHandoffStatus"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/handoffs/{handoffToken}/cancel": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 取消市场 handoff + * @description 取消未完成的 handoff。取消后 token 失效,目标空间无法继续消费。 + * 已被目标 owner 确认的 handoff 不可取消。 + */ + post: operations["cancelHandoff"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/publish-drafts": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 保存发布草稿 + * @description 保存发布材料草稿。保存不提交审核、不上架。发布者可反复编辑保存。 + * 作品资产 02C owner 未闭合前只能保存为"仅阅读/收藏/授权记录"草稿。 + */ + post: operations["savePublishDraft"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/publish-drafts/{draftId}/checks": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 发布检查 + * @description 运行发布检查,验证权利、隐私、密钥、许可完整性和敏感内容。 + * 检查通过只表示可提交审核,不直接上架。检查结果有有效期, + * 过期或草稿变化后需重新检查。提交发布申请必须消费未过期的检查结果。 + */ + post: operations["runPublishCheck"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/publish-requests": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 提交发布申请 + * @description 将发布检查通过的草稿提交审核。必须原子消费未过期且匹配资产版本、草稿版本和材料 + * hash 的发布检查结果。提交后进入审核队列,审核结论由管理端产生。 + */ + post: operations["submitPublishRequest"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/publish-requests/{requestId}/withdraw": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 撤回发布申请 + * @description 撤回未审核的发布申请。撤回后草稿保留,不影响已有上架版本。 + * 已审核终态的申请不可撤回。 + */ + post: operations["withdrawPublishRequest"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/my-publish-records": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 我的发布记录 + * @description 查询当前用户作为发布者的所有发布记录,包括草稿、已提交、审核中、 + * 已上架、已下架和召回中的资产及状态。 + */ + get: operations["listMyPublishRecords"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/assets/{assetId}/governance-impact": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 查看下架/召回影响 + * @description 查看资产治理结果对当前用户授权、安装、绑定、运行中任务、Shadow 候选、 + * 知识草稿和导出限制的影响范围。发布者看完整结果;使用者只看自身影响。 + */ + get: operations["getGovernanceImpact"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/appeals": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 提交申诉 + * @description 对审核驳回、下架、召回或撤权提出申诉。申诉只提交给管理员控制台处理。 + * 需在申诉期限内提交,且申诉人须与治理结果有关联。 + */ + post: operations["submitAppeal"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/appeals/{appealId}/supplements": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 补充申诉材料 + * @description 按管理员要求补充申诉证据。补充后申诉状态更新为"已补充"。 + * 已关闭的申诉不可补充。材料脱敏后提交,禁止上传密钥和无关正文全文。 + */ + post: operations["supplementAppeal"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/app-api/muse/marketplace/appeals/{appealId}/withdraw": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 撤回申诉 + * @description 撤回未终态的申诉或影响反馈。撤回不改变已生效的治理结果,不删除已提交材料 + * (法律/合规/审计留存由 02B 决定)。 + */ + post: operations["withdrawAppeal"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/assets": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 市场资产列表 + * @description 管理员查看所有市场资产和治理摘要。支持按资产类型、上架状态、发布者和治理状态筛选。 + * 不展示用户私有副本正文。 + */ + get: operations["adminListMarketAssets"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/assets/{assetId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 市场资产详情、版本、授权、安装、治理和来源摘要 + * @description 管理员查看单个资产的完整治理信息,包括版本历史、授权范围、安装绑定数量、 + * 申诉记录、治理历史和来源引用摘要。不展示用户私有副本正文。 + */ + get: operations["adminGetMarketAsset"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/assets/{assetId}/governance-impact": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 治理影响预览 + * @description 管理员在下架、召回或撤权前预览影响范围,包括受影响的授权、安装、绑定、 + * 运行中任务、Shadow 候选、知识草稿和导出限制。预览结果可关联到后续处置操作。 + */ + post: operations["adminPreviewGovernanceImpact"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/assets/{assetId}/delist": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 下架 + * @description 下架市场资产,停止新获取、新安装或新绑定。下架后已授权用户可按治理结果 + * 保留旧授权或停用安装。需要市场治理权限和影响预览。 + */ + post: operations["adminDelistAsset"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/assets/{assetId}/recall": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 召回 + * @description 追溯召回市场资产,阻断后续生成使用、标记来源不可用。召回需要合规管理员权限和双人控制。 + * 召回后运行中任务需重验或取消,Shadow 候选和知识草稿标记来源已失效。 + * 已确认作品事实保留来源异常标记,不自动回滚。 + */ + post: operations["adminRecallAsset"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/publish-requests": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 发布申请列表 + * @description 管理员查看待审核的发布申请队列。支持按资产类型、审核状态、风险标签和发布者筛选。 + * 市场审核是发布硬门槛,不能降级成简单开关。 + */ + get: operations["adminListPublishRequests"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/publish-requests/{requestId}/approve": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 审核通过 + * @description 审核通过发布申请,资产进入上架状态。通过需确认审核材料完整, + * 审核理由和证据将被记录。通知发布者审核通过。 + */ + post: operations["adminApprovePublishRequest"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/publish-requests/{requestId}/reject": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 审核拒绝 + * @description 驳回发布申请,资产不进入上架状态。必须提供驳回理由。 + * 发布者可对驳回结果提出申诉。 + */ + post: operations["adminRejectPublishRequest"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/appeals": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 申诉列表 + * @description 管理员查看所有申诉列表。支持按申诉人、资产、申诉状态和处理人筛选。 + */ + get: operations["adminListAppeals"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/appeals/{appealId}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 申诉详情 + * @description 管理员查看申诉详情,包括申诉材料、证据摘要、原治理结果、处理历史和补充材料记录。 + * 只看申诉材料和发布资产,不读取用户私有副本。 + */ + get: operations["adminGetAppeal"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/market/appeals/{appealId}/resolve": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** + * 处理申诉 + * @description 处理申诉,给出维持、恢复或关闭结论。恢复上架需重新预览影响范围。 + * 处理结论和证据将被记录。可能触发来源状态传播。 + */ + post: operations["adminResolveAppeal"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: { + /** @description 市场资产卡片(列表项) */ + MarketAssetCard: { + /** Format: uuid */ + assetId: string; + name: string; + /** + * @description 资产类型 + * @enum {string} + */ + assetType: "work" | "agent" | "knowledge_base"; + /** @description 发布者名称 */ + publisherName: string; + /** @description 当前版本号 */ + version: string; + /** @description 资产摘要 */ + summary?: string; + /** @description 许可摘要 */ + licenseSummary?: string; + /** + * @description 上架状态 + * @enum {string} + */ + listingStatus: "listed" | "delisted" | "recalled" | "not_listed"; + /** @description 当前用户是否已获取授权 */ + isAcquired?: boolean; + /** @description 当前用户是否已安装 */ + isInstalled?: boolean; + /** @description 当前用户是否已收藏 */ + isFavorite?: boolean; + /** Format: uri */ + coverImageUrl?: string; + /** @description 推荐理由(仅推荐位返回) */ + recommendationReason?: string; + /** @description 下架/召回提示文案 */ + governanceAlert?: string; + }; + /** @description 分类、推荐位和曝光摘要 */ + MarketplaceCategoriesResponse: { + categories?: components["schemas"]["MarketplaceCategory"][]; + topics?: components["schemas"]["MarketplaceTopic"][]; + recommendationSlots?: components["schemas"]["RecommendationSlot"][]; + exposureSummary?: components["schemas"]["PublisherExposureSummary"]; + }; + /** @description 市场分类 */ + MarketplaceCategory: { + /** Format: uuid */ + categoryId: string; + name: string; + description?: string; + sortOrder?: number; + /** @description 该分类下的资产数量 */ + assetCount?: number; + }; + /** @description 市场专题 */ + MarketplaceTopic: { + /** Format: uuid */ + topicId: string; + title: string; + description?: string; + assetIds?: string[]; + }; + /** @description 推荐位 */ + RecommendationSlot: { + slotId: string; + name: string; + description?: string; + assetIds?: string[]; + }; + /** @description 发布者曝光摘要(脱敏聚合) */ + PublisherExposureSummary: { + /** @description 总曝光次数区间(如 "1K-5K") */ + totalExposureRange?: string; + /** @description 总点击次数区间 */ + totalClickRange?: string; + /** @description 总获取次数区间 */ + totalAcquireRange?: string; + /** @description 下架屏蔽原因(如有) */ + blockedReason?: string; + }; + /** @description 市场资产详情 */ + MarketAssetDetail: { + /** Format: uuid */ + assetId: string; + name: string; + /** @enum {string} */ + assetType: "work" | "agent" | "knowledge_base"; + publisherName: string; + /** Format: uuid */ + publisherId?: string; + version: string; + /** Format: uuid */ + versionId?: string; + /** + * @description 上架生命周期状态 + * @enum {string} + */ + listingStatus: "listed" | "delisted" | "recalled" | "not_listed"; + /** Format: date-time */ + updatedAt?: string; + summary?: string; + description?: string; + licenseInfo: components["schemas"]["LicenseInfo"]; + /** Format: uri */ + coverImageUrl?: string; + tags?: string[]; + /** Format: uuid */ + categoryId?: string; + userActions?: components["schemas"]["AssetUserActions"]; + governanceStatus?: components["schemas"]["GovernanceStatus"]; + typeSpecificInfo?: components["schemas"]["TypeSpecificInfo"]; + }; + /** @description 许可信息 */ + LicenseInfo: { + /** @description 许可类型 */ + licenseType: string; + /** @description 允许用途 */ + allowedUses: string[]; + /** @description 禁止用途(如禁止再分发、禁止训练复用) */ + prohibitedUses: string[]; + /** @description 有效期说明 */ + validityPeriod?: string; + /** @description 价格或权益展示文案 */ + priceDisplay?: string; + /** @description 外部订单或授权引用 */ + externalOrderRef?: string; + }; + /** @description 当前用户对资产的可用动作 */ + AssetUserActions: { + /** @description 是否可获取授权 */ + canAcquire?: boolean; + /** @description 是否可安装(仅智能体/知识库) */ + canInstall?: boolean; + /** @description 是否可绑定到作品 */ + canBind?: boolean; + /** @description 是否可收藏 */ + canFavorite?: boolean; + actionPolicy?: components["schemas"]["AssetActionPolicy"]; + isAcquired?: boolean; + isInstalled?: boolean; + isFavorite?: boolean; + /** @description 不可用原因(如需登录、已下架、授权失效) */ + unavailableReason?: string; + }; + /** @description 治理状态。listingStatus 只表达上架生命周期,动作限制放入 actionPolicy。 */ + GovernanceStatus: { + /** @enum {string} */ + listingStatus?: "listed" | "delisted" | "recalled" | "not_listed"; + sourceStatus?: components["schemas"]["SourceStatus"]; + actionPolicy?: components["schemas"]["AssetActionPolicy"]; + delistReason?: string; + recallReason?: string; + /** @enum {string} */ + appealStatus?: "none" | "pending" | "reviewing" | "maintained" | "restored" | "closed"; + /** + * Format: date-time + * @description 申诉截止时间 + */ + appealDeadline?: string; + }; + /** + * @description 来源状态,只描述来源可用性;重验要求不得写成状态,必须放入 actionPolicy.recheckReasons。 + * @enum {string} + */ + SourceStatus: "available" | "authorization_expired" | "source_delisted" | "source_recalled" | "source_revoked" | "unavailable"; + /** @description 当前治理策略下的动作限制,不等同于 listingStatus、licenseStatus、installStatus 或 bindStatus。 */ + AssetActionPolicy: { + /** @enum {string} */ + acquirePolicy?: "allowed" | "stop_new_acquire"; + /** @enum {string} */ + installPolicy?: "allowed" | "stop_new_install"; + /** @enum {string} */ + bindPolicy?: "allowed" | "stop_new_bind"; + /** @enum {string} */ + generationPolicy?: "allowed" | "stop_generation"; + /** @description 需要目标 owner 重验的原因列表,例如 source_version_changed / authorization_snapshot_expired。 */ + recheckReasons?: string[]; + }; + /** @description 分型可信信息(按资产类型展示不同面板) */ + TypeSpecificInfo: { + workInfo?: components["schemas"]["WorkAssetInfo"]; + agentInfo?: components["schemas"]["AgentAssetInfo"]; + knowledgeBaseInfo?: components["schemas"]["KnowledgeBaseAssetInfo"]; + }; + /** @description 作品资产可信信息 */ + WorkAssetInfo: { + /** @description 可阅读范围 */ + readableScope?: string; + canFavorite?: boolean; + authorizationRecordAvailable?: boolean; + /** @description 正文/设定/片段的公开边界说明 */ + publicBoundary?: string; + /** @description 来源追踪摘要 */ + sourceTrackingSummary?: string; + /** @description 后续使用能力(模板化/参考写入/AI上下文)是否未开放及原因 */ + futureUseGateStatus?: string; + }; + /** @description 智能体资产可信信息 */ + AgentAssetInfo: { + /** @description 能力类别 */ + capabilityCategory?: string; + /** @description 开放槽位兼容性 */ + slotCompatibility?: string; + /** @description 输入输出合同摘要 */ + inputOutputContract?: string; + /** @description 可使用工具列表 */ + toolAuthorizations?: string[]; + /** @description 外发范围说明 */ + outboundScope?: string; + /** @description 是否含私有 Prompt 摘要 */ + containsPrivatePromptSummary?: boolean; + /** @description 试用限制说明 */ + trialLimitation?: string; + /** @description 不可替换系统保护节点说明 */ + cannotReplaceSystemProtection?: boolean; + }; + /** @description 知识库资产可信信息 */ + KnowledgeBaseAssetInfo: { + /** @description 资料范围摘要 */ + materialScopeSummary?: string; + /** @description 处理状态 */ + processingStatus?: string; + /** @description 是否可检索 */ + searchable?: boolean; + /** @description 是否可生成 */ + generatable?: boolean; + /** @description 是否允许进入模型上下文 */ + allowedInModelContext?: boolean; + /** @description 外发范围 */ + outboundScope?: string; + /** @description 是否支持版本固定 */ + versionPinningAvailable?: boolean; + /** @description 来源是否下架/撤权 */ + sourceDelistedOrRevoked?: boolean; + }; + /** @description 授权获取结果 */ + MarketLicenseResult: { + /** + * Format: uuid + * @description 授权记录 ID + */ + licenseId: string; + /** Format: uuid */ + assetId: string; + /** @enum {string} */ + status: "active" | "expired" | "revoked"; + /** @description 下一步操作提示(如"可前往安装") */ + nextStep?: string; + /** @description 授权快照摘要 */ + licenseSnapshot?: string; + }; + /** @description 安装结果 */ + MarketInstallResult: { + /** + * Format: uuid + * @description 安装记录 ID + */ + installationId: string; + /** Format: uuid */ + assetId: string; + /** Format: uuid */ + versionId?: string; + /** @enum {string} */ + status: "installed" | "disabled" | "upgradable"; + canUpgrade?: boolean; + /** @description 是否有可绑定目标 */ + canBindTarget?: boolean; + /** @description 可绑定目标摘要 */ + bindTargetSummary?: string; + }; + /** @description 来源侧授权摘要和 handoff 准备结果,不包含目标 owner 预检 ID。 */ + BindPrecheckResult: { + /** + * Format: uuid + * @description 来源侧授权摘要 ID,供目标 owner 预检消费 + */ + authorizationSummaryId: string; + /** + * Format: uuid + * @description 来源授权快照 ID + */ + authorizationSnapshotId: string; + /** Format: uuid */ + assetId: string; + /** @description 来源资产版本 */ + sourceVersion: number; + sourceStatus: components["schemas"]["SourceStatus"]; + /** @enum {string} */ + targetOwner: "agent" | "knowledge" | "content"; + /** @enum {string} */ + targetAction: "slot_bind" | "bind" | "asset_use"; + /** Format: uuid */ + targetWorkId?: string; + /** @description 授权快照摘要 */ + authorizationSnapshot?: string; + actionPolicy?: components["schemas"]["AssetActionPolicy"]; + /** @description 是否具备创建 handoff 的来源侧条件 */ + handoffReady: boolean; + /** @description 来源侧兼容性摘要;目标 owner 仍必须自行执行目标预检 */ + compatibilityResult?: string; + /** + * Format: date-time + * @description 预检过期时间 + */ + expiresAt: string; + }; + /** @description Handoff 创建结果 */ + HandoffCreateResult: { + /** @description 一次性 handoff token */ + handoffToken: string; + /** + * Format: uri + * @description 目标 owner 空间落地页 URL + */ + targetPage: string; + /** + * Format: uuid + * @description 关联的来源侧授权摘要 ID + */ + authorizationSummaryId?: string; + /** + * Format: uuid + * @description 关联的来源授权快照 ID + */ + authorizationSnapshotId?: string; + /** + * Format: date-time + * @description token 过期时间 + */ + expiresAt: string; + }; + /** @description Handoff 状态 */ + HandoffStatusResult: { + handoffToken: string; + /** @enum {string} */ + status: "pending" | "owner_precheck_created" | "completed" | "expired" | "cancelled"; + targetOwner?: string; + targetAction?: string; + /** Format: uuid */ + assetId?: string; + /** Format: uuid */ + targetWorkId?: string; + /** Format: uri */ + returnUrl?: string; + /** @description 目标 owner 确认结果摘要 */ + ownerConfirmResult?: string; + /** Format: date-time */ + expiresAt?: string; + }; + /** @description 发布草稿请求 */ + PublishDraftRequest: { + /** + * @description 资产类型 + * @enum {string} + */ + assetType: "work" | "agent" | "knowledge_base"; + /** + * Format: uuid + * @description 来源对象 ID(作品/智能体/知识库) + */ + sourceId: string; + /** @description 市场展示标题 */ + name: string; + /** @description 市场展示摘要 */ + summary?: string; + description?: string; + /** Format: uuid */ + categoryId?: string; + /** @description 许可类型 */ + licenseType?: string; + allowedUses?: string[]; + prohibitedUses?: string[]; + /** Format: uri */ + coverImageUrl?: string; + tags?: string[]; + /** @description 权利声明 */ + rightsDeclaration?: string; + /** @description 外部订单引用规则 */ + externalOrderRef?: string; + /** + * @description 作品资产发布模式。当前 gate 未完成,默认且唯一可直接开放的是 read_only_favorite_license;full/reference/context_use 必须经后续 owner gate 和市场审核显式放开。 + * @default read_only_favorite_license + * @enum {string} + */ + workAssetMode: "read_only_favorite_license" | "full" | "reference" | "context_use"; + }; + /** @description 发布草稿保存结果 */ + PublishDraftResult: { + /** Format: uuid */ + draftId: string; + /** @enum {string} */ + status: "draft" | "unchecked" | "check_failed" | "submittable"; + /** @description 缺失项列表 */ + missingItems: string[]; + }; + /** @description 发布检查结果 */ + PublishCheckResult: { + /** + * Format: uuid + * @description 检查结果 ID(提交审核时消费) + */ + marketPublishCheckId: string; + /** @enum {string} */ + status: "running" | "passed" | "failed" | "expired"; + /** @description 阻断项 */ + blockers?: components["schemas"]["PublishCheckItem"][]; + /** @description 警告项 */ + warnings?: components["schemas"]["PublishCheckItem"][]; + /** @description 检查通过是否可提交审核 */ + canSubmit: boolean; + /** + * Format: date-time + * @description 检查结果过期时间 + */ + expiresAt: string; + }; + /** @description 发布检查条目 */ + PublishCheckItem: { + /** + * @description 检查类别 + * @enum {string} + */ + category: "rights" | "privacy" | "key_exposure" | "copyright" | "license_completeness" | "sensitive_content" | "owner_precheck_lineage" | "processing_status" | "outbound_scope" | "redistribution_restriction"; + /** @description 检查信息 */ + message: string; + /** + * @description 严重性 + * @enum {string} + */ + severity?: "blocker" | "warning"; + }; + /** @description 发布申请提交结果 */ + PublishRequestResult: { + /** + * Format: uuid + * @description 发布申请 ID + */ + requestId: string; + /** + * @description 申请状态 + * @enum {string} + */ + status: "submitted" | "reviewing"; + }; + /** @description 发布记录条目 */ + PublishRecordItem: { + /** Format: uuid */ + assetId: string; + assetName: string; + /** @enum {string} */ + assetType: "work" | "agent" | "knowledge_base"; + version?: string; + /** @enum {string} */ + status: "draft" | "submitted" | "reviewing" | "needs_supplement" | "approved" | "rejected" | "listed" | "delisted" | "recalled"; + /** @description 下一步操作提示 */ + nextAction?: string; + governanceStatus?: string; + appealStatus?: string; + /** @description 曝光区间摘要 */ + exposureRange?: string; + }; + /** @description 治理影响范围 */ + GovernanceImpactResult: { + /** Format: uuid */ + assetId?: string; + governanceResult?: components["schemas"]["GovernanceResultSummary"]; + /** @description 受影响的授权记录 */ + affectedAuthorizations?: components["schemas"]["AffectedAuthorization"][]; + /** @description 受影响的安装记录 */ + affectedInstallations?: components["schemas"]["AffectedInstallation"][]; + /** @description 受影响的作品绑定 */ + affectedBindings?: components["schemas"]["AffectedBinding"][]; + /** @description 受影响的运行中任务 */ + affectedTasks?: components["schemas"]["AffectedTask"][]; + /** @description 受影响的 Shadow 候选和知识草稿 */ + affectedCandidates?: components["schemas"]["AffectedCandidate"][]; + /** @description 导出限制说明 */ + exportRestrictions?: string[]; + /** @description 建议动作 */ + suggestedActions?: string[]; + }; + /** @description 治理结果摘要 */ + GovernanceResultSummary: { + /** + * @description 结果类型 + * @enum {string} + */ + resultType?: "delist" | "recall" | "revoke" | "appeal"; + /** @description 原因摘要 */ + reason?: string; + /** + * Format: date-time + * @description 生效时间 + */ + effectiveAt?: string; + /** @description 影响范围说明 */ + scope?: string; + newAcquireStopped?: boolean; + newInstallStopped?: boolean; + newBindStopped?: boolean; + generationUseStopped?: boolean; + }; + AffectedAuthorization: { + /** Format: uuid */ + licenseId?: string; + /** @description 当前授权状态 */ + status?: string; + /** @description 影响说明 */ + impact?: string; + }; + AffectedInstallation: { + /** Format: uuid */ + installationId?: string; + status?: string; + impact?: string; + suggestedAction?: string; + }; + AffectedBinding: { + /** Format: uuid */ + bindingId?: string; + /** Format: uuid */ + workId?: string; + /** @description 脱敏作品名 */ + workName?: string; + bindingType?: string; + impact?: string; + }; + AffectedTask: { + /** Format: uuid */ + taskId?: string; + taskType?: string; + status?: string; + impact?: string; + }; + AffectedCandidate: { + /** Format: uuid */ + candidateId?: string; + /** @enum {string} */ + candidateType?: "shadow_candidate" | "knowledge_draft"; + impact?: string; + suggestedAction?: string; + }; + /** @description 申诉提交结果 */ + AppealSubmitResult: { + /** Format: uuid */ + appealId: string; + /** @enum {string} */ + status: "pending" | "reviewing"; + /** @description 预计处理周期 */ + processingDeadline: string; + /** @description 是否可补充材料 */ + supplementEntryAvailable?: boolean; + }; + /** @description 管理端资产列表摘要 */ + AdminMarketAssetSummary: { + /** Format: uuid */ + assetId: string; + name: string; + /** @enum {string} */ + assetType: "work" | "agent" | "knowledge_base"; + /** Format: uuid */ + publisherId?: string; + publisherName: string; + version?: string; + /** + * @description 上架生命周期状态;动作限制见 actionPolicy。 + * @enum {string} + */ + listingStatus: "not_listed" | "listed" | "delisted" | "recalled"; + actionPolicy?: components["schemas"]["AssetActionPolicy"]; + /** @enum {string} */ + reviewStatus: "pending" | "reviewing" | "needs_supplement" | "approved" | "rejected" | "compliance_blocked"; + /** @description 安装数量 */ + installCount?: number; + /** @description 绑定数量 */ + bindCount?: number; + /** @description 申诉数量 */ + appealCount?: number; + sourceStatus?: components["schemas"]["SourceStatus"]; + }; + /** @description 管理端资产治理详情 */ + AdminMarketAssetDetail: { + /** Format: uuid */ + assetId: string; + name: string; + /** @enum {string} */ + assetType: "work" | "agent" | "knowledge_base"; + /** Format: uuid */ + publisherId?: string; + publisherName?: string; + version?: string; + /** + * @description 上架生命周期状态;动作限制见 actionPolicy。 + * @enum {string} + */ + listingStatus: "not_listed" | "listed" | "delisted" | "recalled"; + actionPolicy?: components["schemas"]["AssetActionPolicy"]; + /** @enum {string} */ + reviewStatus: "pending" | "reviewing" | "needs_supplement" | "approved" | "rejected" | "compliance_blocked"; + licenseInfo?: components["schemas"]["LicenseInfo"]; + installCount?: number; + bindCount?: number; + affectedTaskCount?: number; + /** @description 来源引用摘要 */ + sourceReferenceSummary?: string; + sourceStatus?: components["schemas"]["SourceStatus"]; + governanceHistory?: components["schemas"]["AdminGovernanceHistoryItem"][]; + appeals?: components["schemas"]["AdminAppealSummary"][]; + }; + /** @description 治理历史条目 */ + AdminGovernanceHistoryItem: { + /** @description 治理动作(如 delist / recall / restore) */ + action?: string; + reason?: string; + /** Format: uuid */ + operatorId?: string; + /** Format: date-time */ + operatedAt?: string; + scope?: string; + }; + /** @description 管理端治理影响预览 */ + AdminGovernanceImpactPreview: { + /** + * Format: uuid + * @description 预览 ID(关联到后续下架/召回操作) + */ + previewId: string; + /** @enum {string} */ + actionType: "delist" | "recall" | "revoke_license" | "stop_generation"; + scope: string; + affectedCounts: components["schemas"]["AffectedCounts"]; + /** @description 来源引用摘要 */ + sourceReferenceSummary?: string; + /** @description 通知范围说明 */ + notificationScope?: string; + /** @description 可替代资产建议 */ + alternativeAssets?: string[]; + }; + /** @description 受影响数量聚合 */ + AffectedCounts: { + authorizationCount?: number; + installationCount?: number; + bindingCount?: number; + runningTaskCount?: number; + shadowCandidateCount?: number; + knowledgeDraftCount?: number; + }; + /** @description 管理端发布申请摘要 */ + AdminPublishRequestSummary: { + /** Format: uuid */ + requestId: string; + /** Format: uuid */ + assetId: string; + assetName: string; + /** @enum {string} */ + assetType: "work" | "agent" | "knowledge_base"; + /** Format: uuid */ + publisherId?: string; + publisherName?: string; + version?: string; + /** @enum {string} */ + status: "pending" | "reviewing" | "needs_supplement" | "approved" | "rejected" | "compliance_blocked"; + riskTags?: string[]; + /** Format: date-time */ + submittedAt?: string; + rightsDeclaration?: string; + /** @description 隐私/密钥检查结果 */ + privacyCheckResult?: string; + }; + /** @description 管理端申诉摘要 */ + AdminAppealSummary: { + /** Format: uuid */ + appealId: string; + /** @enum {string} */ + appealType: "review_rejection" | "delist" | "recall" | "license_revocation" | "usage_impact"; + /** @enum {string} */ + status: "pending" | "reviewing" | "supplementing" | "maintained" | "restored" | "closed"; + /** Format: uuid */ + appellantId?: string; + appellantName?: string; + /** Format: uuid */ + assetId: string; + assetName?: string; + /** Format: date-time */ + submittedAt?: string; + /** Format: uuid */ + processorId?: string; + }; + /** @description 管理端申诉详情 */ + AdminAppealDetail: { + /** Format: uuid */ + appealId: string; + /** @enum {string} */ + appealType: "review_rejection" | "delist" | "recall" | "license_revocation" | "usage_impact"; + /** @enum {string} */ + status: "pending" | "reviewing" | "supplementing" | "maintained" | "restored" | "closed"; + /** Format: uuid */ + appellantId?: string; + appellantName?: string; + /** Format: uuid */ + assetId: string; + assetName?: string; + assetVersion?: string; + /** @description 申诉理由 */ + reason: string; + /** @description 证据材料标识列表 */ + evidenceMaterials?: string[]; + /** @description 当前治理状态 */ + currentGovernanceStatus?: string; + /** @description 原审核/下架/召回结论 */ + originalResult?: string; + processingHistory?: components["schemas"]["AppealProcessingHistoryItem"][]; + supplementRecords?: components["schemas"]["AppealSupplementRecord"][]; + }; + /** @description 申诉处理历史条目 */ + AppealProcessingHistoryItem: { + action?: string; + /** Format: uuid */ + processorId?: string; + /** Format: date-time */ + processedAt?: string; + reason?: string; + }; + /** @description 申诉补充材料记录 */ + AppealSupplementRecord: { + /** Format: uuid */ + supplementId?: string; + /** Format: uuid */ + submittedBy?: string; + /** Format: date-time */ + submittedAt?: string; + description?: string; + attachmentIds?: string[]; + }; + CommonResult: { + /** + * @description 业务状态码,0 表示成功 + * @example 0 + */ + code: number; + /** @description 响应数据,类型视具体接口而定 */ + data?: unknown; + /** + * @description 提示信息 + * @example success + */ + msg: string; + }; + PaginatedResult: { + /** + * @description 总记录数 + * @example 150 + */ + total: number; + /** + * @description 当前页码 + * @example 1 + */ + pageNo: number; + /** + * @description 每页条数 + * @example 20 + */ + pageSize: number; + /** @description 当前页数据列表 */ + list: unknown[]; + }; + ErrorResponse: { + /** + * @description 错误码格式: {system}-{module}-{category}-{sequence} + * 示例: MUSE-CONTENT-001-0001 + * @example MUSE-CONTENT-001-0001 + */ + code: string; + /** @description 人类可读的错误描述 */ + msg: string; + /** @description 详细错误信息(仅开发环境返回) */ + detail?: string; + }; + }; + responses: { + /** @description 未认证或 token 过期 */ + Unauthorized: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源不存在 */ + NotFound: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源冲突 */ + Conflict: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 无权限 */ + Forbidden: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + parameters: { + /** @description 市场资产 ID */ + assetId: string; + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + XApiVersion: "1"; + /** @description 页码,从 1 开始 */ + pageNo: number; + /** @description 每页条数,上限 100 */ + pageSize: number; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + listMarketplaceAssets: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 排序方式 */ + sortBy?: "popular" | "newest" | "rating" | "relevance"; + /** @description 资产类型筛选 */ + assetType?: "work" | "agent" | "knowledge_base"; + /** @description 分类 ID 筛选 */ + category?: string; + /** @description 搜索关键词 */ + keyword?: string; + /** @description 许可类型筛选 */ + licenseType?: string; + /** @description 可用状态筛选(如 listed / delisted / recalled) */ + status?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 资产分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["MarketAssetCard"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + listMarketplaceCategories: { + parameters: { + query?: { + /** @description 是否包含发布者曝光摘要(仅发布者角色有效) */ + includeExposureSummary?: boolean; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 分类与推荐位信息 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MarketplaceCategoriesResponse"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + listMarketplaceRecommendations: { + parameters: { + query?: { + /** @description 推荐场景上下文(如首页、详情页相关、跨空间选择) */ + recommendationContext?: "home" | "detail_related" | "cross_space_select"; + /** @description 参考资产 ID(用于"相似资产"推荐) */ + referenceAssetId?: string; + /** @description 关联作品 ID(用于跨空间场景下按作品槽位推荐) */ + workId?: string; + /** @description 返回数量上限 */ + limit?: number; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 推荐资产列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MarketAssetCard"][]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + getMarketplaceAsset: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 资产详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MarketAssetDetail"]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + favoriteAsset: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 收藏成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + unfavoriteAsset: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 取消收藏成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + purchaseAsset: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 幂等键,前端生成 UUID + */ + commandId: string; + /** @description 许可类型选择 */ + licenseType?: string; + /** @description 外部订单或授权引用标识 */ + externalOrderRef?: string; + }; + }; + }; + responses: { + /** @description 授权获取成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MarketLicenseResult"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + installMarketplaceAsset: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 幂等键,前端生成 UUID + */ + commandId: string; + /** + * Format: uuid + * @description 指定安装的版本 ID(不指定则安装当前版本) + */ + versionId?: string; + /** + * @description 是否固定版本(固定后不随资产升级自动更新) + * @default false + */ + pinVersion?: boolean; + }; + }; + }; + responses: { + /** @description 安装成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MarketInstallResult"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + createBindPrecheck: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * @description 目标 owner 空间 + * @enum {string} + */ + targetOwner: "agent" | "knowledge" | "content"; + /** + * @description 目标动作 + * @enum {string} + */ + targetAction: "slot_bind" | "bind" | "asset_use"; + /** + * Format: uuid + * @description 目标作品 ID + */ + targetWorkId?: string; + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + }; + }; + }; + responses: { + /** @description 预检快照生成成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["BindPrecheckResult"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + createMarketplaceHandoff: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 来源资产 ID + */ + assetId: string; + /** + * @description 目标 owner 空间 + * @enum {string} + */ + targetOwner: "agent" | "knowledge" | "content"; + /** + * @description 目标动作 + * @enum {string} + */ + targetAction: "slot_bind" | "bind" | "asset_use" | "governance_handle"; + /** + * Format: uuid + * @description 目标作品 ID + */ + targetWorkId?: string; + /** + * Format: uuid + * @description 来源侧授权摘要 ID(来自 bind-precheck),不是目标 owner 预检 ID + */ + authorizationSummaryId?: string; + /** + * Format: uri + * @description 完成后返回市场的 URL + */ + returnUrl: string; + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + }; + }; + }; + responses: { + /** @description handoff 创建成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["HandoffCreateResult"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + getHandoffStatus: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description handoff token */ + handoffToken: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description handoff 状态 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["HandoffStatusResult"]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + cancelHandoff: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description handoff token */ + handoffToken: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + /** + * @description 期望当前 handoff 状态,避免盲取消已处理 token + * @enum {string} + */ + expectedStatus: "pending"; + /** @description 取消原因 */ + reason: string; + }; + }; + }; + responses: { + /** @description 取消成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 404: components["responses"]["NotFound"]; + 409: components["responses"]["Conflict"]; + }; + }; + savePublishDraft: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["PublishDraftRequest"]; + }; + }; + responses: { + /** @description 草稿保存成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PublishDraftResult"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + runPublishCheck: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + draftId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 发布检查完成 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PublishCheckResult"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + submitPublishRequest: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 发布草稿 ID + */ + draftId: string; + /** + * Format: uuid + * @description 发布检查结果 ID(消费检查快照) + */ + marketPublishCheckId: string; + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + }; + }; + }; + responses: { + /** @description 提交成功,进入审核中 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PublishRequestResult"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + withdrawPublishRequest: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + requestId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + /** + * @description 期望当前发布申请状态,避免盲撤回终态申请 + * @enum {string} + */ + expectedStatus: "submitted" | "reviewing" | "needs_supplement"; + /** @description 撤回原因 */ + reason: string; + }; + }; + }; + responses: { + /** @description 撤回成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + listMyPublishRecords: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 资产类型筛选 */ + assetType?: "work" | "agent" | "knowledge_base"; + /** @description 发布状态筛选 */ + status?: "draft" | "submitted" | "reviewing" | "needs_supplement" | "approved" | "rejected" | "listed" | "delisted" | "recalled"; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 发布记录分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["PublishRecordItem"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + }; + }; + getGovernanceImpact: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 治理影响范围 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["GovernanceImpactResult"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 404: components["responses"]["NotFound"]; + }; + }; + submitAppeal: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 申诉对象资产 ID + */ + assetId: string; + /** + * @description 申诉类型 + * @enum {string} + */ + appealType: "review_rejection" | "delist" | "recall" | "license_revocation" | "usage_impact"; + /** @description 申诉理由 */ + reason: string; + /** @description 证据材料标识列表 */ + evidenceMaterials?: string[]; + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + }; + }; + }; + responses: { + /** @description 申诉提交成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AppealSubmitResult"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + supplementAppeal: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + appealId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 补充说明 */ + description: string; + /** @description 附件标识列表 */ + attachmentIds?: string[]; + /** @description 是否已确认隐私处理 */ + privacyConfirmed?: boolean; + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + }; + }; + }; + responses: { + /** @description 补充材料提交成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + withdrawAppeal: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + appealId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** @description 撤回原因 */ + reason: string; + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + /** + * @description 期望当前申诉状态,避免盲撤回已终态申诉 + * @enum {string} + */ + expectedStatus: "pending" | "reviewing" | "supplementing"; + }; + }; + }; + responses: { + /** @description 撤回成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 409: components["responses"]["Conflict"]; + }; + }; + adminListMarketAssets: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 资产类型筛选 */ + assetType?: "work" | "agent" | "knowledge_base"; + /** @description 上架/治理状态筛选 */ + listingStatus?: "not_listed" | "listed" | "delisted" | "recalled"; + /** @description 动作策略筛选(治理限制,不等同于上架状态) */ + actionPolicy?: "normal" | "stop_new_acquire" | "stop_new_install" | "stop_new_bind" | "stop_generation"; + /** @description 发布者 ID */ + publisherId?: string; + /** @description 资产名称搜索 */ + keyword?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 管理端资产分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AdminMarketAssetSummary"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminGetMarketAsset: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 资产治理详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AdminMarketAssetDetail"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + }; + }; + adminPreviewGovernanceImpact: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + /** + * @description 拟执行的治理动作类型 + * @enum {string} + */ + actionType: "delist" | "recall" | "revoke_license" | "stop_generation"; + /** + * @description 治理范围 + * @enum {string} + */ + scope?: "stop_new_acquire" | "stop_new_install" | "stop_new_bind" | "stop_generation" | "full_recall"; + }; + }; + }; + responses: { + /** @description 影响预览结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AdminGovernanceImpactPreview"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminDelistAsset: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + /** + * @description 期望当前上架状态,避免盲下架 + * @enum {string} + */ + expectedStatus: "listed"; + /** + * Format: uuid + * @description 关联的治理影响预览 ID + */ + impactPreviewId: string; + /** @description 下架原因 */ + reason: string; + /** + * @description 下架范围 + * @enum {string} + */ + scope: "stop_new_acquire" | "stop_new_install" | "stop_new_bind" | "stop_generation" | "full_delist"; + }; + }; + }; + responses: { + /** @description 下架成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + }; + }; + adminRecallAsset: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 市场资产 ID */ + assetId: components["parameters"]["assetId"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + /** + * @description 期望当前治理状态,避免盲召回 + * @enum {string} + */ + expectedStatus: "listed" | "delisted"; + /** + * Format: uuid + * @description 关联的治理影响预览 ID + */ + impactPreviewId: string; + /** @description 召回原因 */ + reason: string; + /** @description 召回依据(法律/合规/安全) */ + basis: string; + /** + * @description 召回范围 + * @enum {string} + */ + scope: "stop_generation" | "full_recall"; + /** + * @description 是否启动法务保全限制(限制导出和复制) + * @default false + */ + exportPreservation?: boolean; + }; + }; + }; + responses: { + /** @description 召回成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + }; + }; + adminListPublishRequests: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 资产类型筛选 */ + assetType?: "work" | "agent" | "knowledge_base"; + /** @description 审核状态筛选 */ + status?: "pending" | "reviewing" | "needs_supplement" | "approved" | "rejected" | "compliance_blocked"; + /** @description 风险标签筛选 */ + riskTag?: string; + /** @description 发布者 ID */ + publisherId?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 发布申请分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AdminPublishRequestSummary"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminApprovePublishRequest: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + requestId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + /** + * @description 期望当前审核状态,避免盲通过 + * @enum {string} + */ + expectedStatus: "pending" | "reviewing" | "needs_supplement"; + /** + * Format: uuid + * @description 审核校验结果引用 ID + */ + validationResultId: string; + /** @description 审核通过说明 */ + note: string; + /** @description 审核证据标签 */ + evidenceTags?: string[]; + }; + }; + }; + responses: { + /** @description 审核通过,已上架 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + }; + }; + adminRejectPublishRequest: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + requestId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + /** + * @description 期望当前审核状态,避免盲驳回 + * @enum {string} + */ + expectedStatus: "pending" | "reviewing" | "needs_supplement"; + /** + * Format: uuid + * @description 审核校验结果引用 ID + */ + validationResultId: string; + /** @description 驳回理由 */ + reason: string; + /** @description 审核证据标签 */ + evidenceTags?: string[]; + /** + * @description 是否要求发布者补充材料后可重新提交 + * @default false + */ + requireSupplement?: boolean; + /** @description 需要补充的项目列表 */ + supplementItems?: string[]; + }; + }; + }; + responses: { + /** @description 审核驳回 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + }; + }; + adminListAppeals: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 申诉类型筛选 */ + appealType?: "review_rejection" | "delist" | "recall" | "license_revocation" | "usage_impact"; + /** @description 申诉状态筛选 */ + status?: "pending" | "reviewing" | "supplementing" | "maintained" | "restored" | "closed"; + /** @description 申诉人 ID */ + appellantId?: string; + /** @description 关联资产 ID */ + assetId?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 申诉分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["AdminAppealSummary"][]; + }; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + adminGetAppeal: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + appealId: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 申诉详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["AdminAppealDetail"]; + }; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 404: components["responses"]["NotFound"]; + }; + }; + adminResolveAppeal: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + appealId: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": { + /** + * Format: uuid + * @description 幂等键 + */ + commandId: string; + /** + * @description 期望当前申诉状态,避免盲处理 + * @enum {string} + */ + expectedStatus: "pending" | "reviewing" | "supplementing"; + /** + * @description 处理结论 + * @enum {string} + */ + resolution: "maintained" | "restored" | "partially_restored" | "closed"; + /** @description 处理理由 */ + reason: string; + /** @description 处理证据标签 */ + evidenceTags?: string[]; + /** + * Format: uuid + * @description 恢复时的关联影响预览 ID + */ + impactPreviewId: string; + /** + * @description 是否要求申诉人补充材料 + * @default false + */ + requireSupplement?: boolean; + /** @description 需要补充的项目列表 */ + supplementItems?: string[]; + }; + }; + }; + responses: { + /** @description 申诉处理完成 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"]; + }; + }; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + 409: components["responses"]["Conflict"]; + }; + }; +} diff --git a/muse-admin/apps/web-antd/src/api/types/meta.ts b/muse-admin/apps/web-antd/src/api/types/meta.ts new file mode 100644 index 00000000..3d146936 --- /dev/null +++ b/muse-admin/apps/web-antd/src/api/types/meta.ts @@ -0,0 +1,1560 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export interface paths { + "/admin-api/muse/governance/meta-schemas": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** MetaSchema 列表和版本摘要 */ + get: operations["listMetaSchemas"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/meta-schemas/{schemaKey}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** Schema 详情、当前 active 版本、灰度版本、字段继承和影响摘要 */ + get: operations["getMetaSchema"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/meta-schemas/{schemaKey}/versions/{version}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 指定版本详情、字段、校验规则、可见性策略和发布记录 */ + get: operations["getMetaSchemaVersion"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/meta-schemas/{schemaKey}/drafts": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 保存 MetaSchema 草稿,返回 draftVersion 和校验摘要 */ + post: operations["saveMetaSchemaDraft"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/meta-schemas/{schemaKey}/drafts/{draftVersion}/validate": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 校验字段类型、必填、枚举、引用、兼容性和保护节点边界 */ + post: operations["validateMetaSchemaDraft"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/meta-schemas/{schemaKey}/drafts/{draftVersion}/impact-preview": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 影响预览,返回作品、规划、知识投影、AI 上下文和导出影响 */ + post: operations["previewMetaSchemaDraftImpact"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/meta-schemas/{schemaKey}/drafts/{draftVersion}/publish": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 发布版本,必须带 commandId、理由、校验结果和影响预览引用 */ + post: operations["publishMetaSchemaDraft"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/meta-schemas/{schemaKey}/versions/{version}/activate": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 激活 MetaSchema 版本,支持全量或灰度范围 */ + post: operations["activateMetaSchemaVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/meta-schemas/{schemaKey}/versions/{version}/rollback": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 回滚到指定已发布版本,触发投影失效或重建任务 */ + post: operations["rollbackMetaSchemaVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/meta-schemas/{schemaKey}/versions/{version}/deprecate": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 废弃版本或字段,必须给出替代字段、保留期和迁移提示 */ + post: operations["deprecateMetaSchemaVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/meta-schemas/{schemaKey}/versions/{version}/gray-rules": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 设置或调整灰度规则,返回灰度范围和回滚入口 */ + post: operations["setMetaSchemaGrayRules"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/protection-nodes": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 保护节点注册表、权限点、不可替换原因和审计摘要 */ + get: operations["listProtectionNodes"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/protection-nodes/{nodeKey}": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** 保护节点详情、所属链路、Shadow→Canonical 边界和可观测指标 */ + get: operations["getProtectionNode"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/function-chains": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * 系统功能链路和开放槽位 + * @description 系统保护节点只读展示,不得被降级为用户可替换槽位;开放槽位只表示可替换的非保护节点。 + */ + get: operations["listFunctionChains"]; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/function-chains/{chainKey}/impact-preview": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 发布前影响预览 */ + post: operations["previewFunctionChainImpact"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; + "/admin-api/muse/governance/function-chains/{chainKey}/versions/{version}/activate": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + get?: never; + put?: never; + /** 激活功能链路版本 */ + post: operations["activateFunctionChainVersion"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; +} +export type webhooks = Record; +export interface components { + schemas: { + /** + * @description MetaField 可见性策略。 + * uiVisible=false 不代表不能进入 AI 上下文;aiContext=true 不代表用户可见; + * exportable=true 仍必须受 owner、授权、来源状态和导出许可约束。 + */ + MetaFieldVisibility: { + /** + * @description 是否进入用户可见投影 + * @default true + */ + uiVisible: boolean; + /** + * @description 是否允许进入 AI 上下文组装 + * @default true + */ + aiContext: boolean; + /** + * @description 用户端是否允许保存该动态字段 + * @default false + */ + userEditable: boolean; + /** + * @description 是否允许用户搜索或筛选 + * @default false + */ + userSearchable: boolean; + /** + * @description 是否可被导出预检纳入 + * @default false + */ + exportable: boolean; + }; + MetaField: { + /** @description 字段业务标识(英文) */ + fieldKey: string; + /** @description 显示名称 */ + displayName: string; + /** + * @description 字段类型 + * @enum {string} + */ + fieldType: "string" | "text" | "number" | "boolean" | "date" | "enum" | "relation" | "json"; + /** + * @description 作用域 + * @enum {string} + */ + scope?: "global" | "tenant" | "user" | "work"; + /** @description 默认值 */ + defaultValue?: unknown; + /** + * @description 是否必填 + * @default false + */ + required: boolean; + /** @description fieldType=enum 时的可选值 */ + enumValues?: string[]; + /** @description 校验规则(min/max/pattern 等) */ + validationRules?: Record; + visibility?: components["schemas"]["MetaFieldVisibility"]; + /** + * @description 字段是否已废弃 + * @default false + */ + deprecated: boolean; + deprecatedInfo?: components["schemas"]["FieldDeprecationInfo"]; + /** @description 字段继承来源 schemaKey(若为继承字段) */ + inheritedFrom?: string; + /** + * @description 该字段是否绑定保护节点边界 + * @default false + */ + protectionNodeBound: boolean; + }; + /** @description 字段废弃信息 */ + FieldDeprecationInfo: { + /** @description 替代字段标识 */ + replacementFieldKey?: string; + /** @description 保留期(如 6m / 1y) */ + retentionPeriod?: string; + /** @description 迁移提示 */ + migrationHint?: string; + }; + MetaSchemaSummary: { + /** @description Schema 业务标识 */ + schemaKey: string; + /** @description 显示名称 */ + displayName: string; + /** @enum {string} */ + scope: "global" | "tenant" | "user" | "work"; + /** @description 目标类型(work / chapter / block / agent / knowledge_base) */ + targetType?: string; + /** @description 当前激活版本号 */ + activeVersion: number; + /** @description 当前灰度版本号(若有) */ + grayVersion?: number; + /** @description 最新草稿版本号(若有) */ + draftVersion?: number; + /** @description 字段数量 */ + fieldCount?: number; + /** Format: date-time */ + updatedAt?: string; + }; + MetaSchemaDetail: { + schemaKey: string; + displayName: string; + description?: string; + /** @enum {string} */ + scope: "global" | "tenant" | "user" | "work"; + targetType?: string; + activeVersion: number; + /** Format: date-time */ + activeVersionPublishedAt?: string; + grayVersion?: number; + /** Format: date-time */ + grayVersionPublishedAt?: string; + grayRules?: components["schemas"]["GrayRulesSummary"]; + /** @description 当前 active 版本字段列表 */ + fields?: components["schemas"]["MetaField"][]; + /** @description 字段继承关系 */ + inheritedSchemas?: { + schemaKey?: string; + inheritedFieldCount?: number; + }[]; + impactSummary?: components["schemas"]["MetaSchemaImpactSummary"]; + /** Format: date-time */ + createdAt?: string; + /** Format: date-time */ + updatedAt?: string; + }; + /** @description 灰度规则摘要 */ + GrayRulesSummary: { + /** + * @description 灰度策略 + * @enum {string} + */ + strategy?: "tenant_whitelist" | "percentage" | "user_whitelist"; + /** @description 灰度范围描述 */ + scope?: string; + /** @description 回滚入口说明 */ + rollbackEntry?: string; + }; + /** @description 影响摘要(列表级别轻量信息) */ + MetaSchemaImpactSummary: { + /** @description 受影响作品数 */ + affectedWorkCount?: number; + /** @description 受影响投影数 */ + affectedProjectionCount?: number; + /** @description 受影响 AI 上下文引用数 */ + affectedAIContextCount?: number; + }; + MetaSchemaVersionDetail: { + schemaKey: string; + version: number; + /** @enum {string} */ + status: "draft" | "published" | "active" | "deprecated" | "archived"; + fields?: components["schemas"]["MetaField"][]; + fieldDiff?: components["schemas"]["MetaSchemaVersionDiff"]; + publishRecord?: components["schemas"]["MetaSchemaPublishRecord"]; + /** Format: date-time */ + publishedAt?: string; + /** @description 发布操作者 */ + publishedBy?: string; + /** Format: date-time */ + activatedAt?: string; + /** Format: date-time */ + deprecatedAt?: string; + /** Format: date-time */ + createdAt?: string; + }; + /** @description 与前一版本的字段差异 */ + MetaSchemaVersionDiff: { + /** @description 新增字段 fieldKey 列表 */ + addedFields?: string[]; + /** @description 删除字段 fieldKey 列表 */ + removedFields?: string[]; + /** @description 变更字段 fieldKey 列表 */ + modifiedFields?: string[]; + /** @description 废弃字段 fieldKey 列表 */ + deprecatedFields?: string[]; + }; + /** @description 发布审计记录 */ + MetaSchemaPublishRecord: { + commandId?: string; + reason?: string; + /** @description 关联校验结果 ID */ + validationResultId?: string; + /** @description 关联影响预览 ID */ + impactPreviewId?: string; + /** @description 发布时期望的当前版本 */ + expectedVersion?: number; + }; + MetaSchemaDraftRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 期望当前 active 版本,用于乐观锁 */ + expectedVersion?: number; + /** @description 显示名称 */ + displayName?: string; + description?: string; + /** @description 完整字段定义(全量替换) */ + fields?: components["schemas"]["MetaField"][]; + }; + MetaSchemaDraftResponse: { + /** @description 分配的草稿版本号 */ + draftVersion?: number; + validationSummary?: components["schemas"]["ValidationResult"]; + /** @description 当前激活版本号 */ + currentActiveVersion?: number; + }; + ValidationResult: { + /** @description 是否校验通过 */ + valid?: boolean; + /** @description 校验错误列表 */ + errors?: components["schemas"]["ValidationError"][]; + /** @description 校验警告列表 */ + warnings?: components["schemas"]["ValidationWarning"][]; + compatibilityResult?: components["schemas"]["CompatibilityResult"]; + }; + ValidationError: { + /** @description 错误码(如 FIELD_TYPE_INVALID / REQUIRED_FIELD_MISSING / ENUM_VALUE_EMPTY / REFERENCE_NOT_FOUND / PROTECTION_NODE_BOUNDARY_VIOLATION) */ + code: string; + message: string; + /** @description 关联字段标识 */ + fieldKey?: string; + detail?: string; + }; + ValidationWarning: { + /** @description 警告码(如 FIELD_DEPRECATED_STILL_USED / BREAKING_CHANGE_DETECTED) */ + code: string; + message: string; + fieldKey?: string; + detail?: string; + }; + /** @description 与前一版本兼容性分析 */ + CompatibilityResult: { + compatible?: boolean; + breakingChanges?: { + fieldKey?: string; + /** @enum {string} */ + changeType?: "type_changed" | "required_added" | "enum_removed" | "reference_changed" | "visibility_restricted"; + description?: string; + }[]; + protectionNodeBoundaryViolations?: { + fieldKey?: string; + nodeKey?: string; + violation?: string; + }[]; + }; + MetaSchemaImpactPreview: { + /** @description 影响预览记录 ID,供发布时引用 */ + impactPreviewId?: string; + schemaKey?: string; + draftVersion?: number; + workImpact?: components["schemas"]["WorkImpactSummary"]; + planningImpact?: components["schemas"]["PlanningImpactSummary"]; + knowledgeProjectionImpact?: components["schemas"]["KnowledgeProjectionImpactSummary"]; + aiContextImpact?: components["schemas"]["AIContextImpactSummary"]; + exportImpact?: components["schemas"]["ExportImpactSummary"]; + /** @description 受影响投影总数 */ + totalAffectedProjectionCount?: number; + }; + WorkImpactSummary: { + affectedWorkCount?: number; + affectedDynamicFieldWorkCount?: number; + worksWithDeprecatedFields?: number; + }; + PlanningImpactSummary: { + affectedPlanningSections?: number; + planningUsingDeprecatedFields?: number; + }; + KnowledgeProjectionImpactSummary: { + affectedProjections?: number; + projectionsNeedingRebuild?: number; + projectionsWithVisibilityChange?: number; + }; + AIContextImpactSummary: { + affectedAIContexts?: number; + contextsWithFieldRemoved?: number; + contextsWithVisibilityChange?: number; + }; + ExportImpactSummary: { + affectedExportPolicies?: number; + exportsWithFieldRemoved?: number; + exportsWithVisibilityChange?: number; + }; + MetaSchemaPublishRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 发布理由 */ + reason: string; + /** @description 期望当前版本,乐观锁 */ + expectedVersion: number; + /** @description 校验结果引用 ID */ + validationResultId: string; + /** @description 影响预览引用 ID */ + impactPreviewId: string; + /** + * @description 固定为 false;发布不得隐式激活,必须单独调用 activate 并携带 expectedActiveVersion、validationResultId 和 impactPreviewId。 + * @default false + */ + autoActivate: boolean; + }; + MetaSchemaPublishResponse: { + /** @description 发布后的版本号 */ + publishedVersion?: number; + /** + * @description 发布后状态 + * @enum {string} + */ + status?: "published"; + currentActiveVersion?: number; + /** @description 受影响投影数 */ + affectedProjectionCount?: number; + nextActions?: { + /** @enum {string} */ + action?: "activate" | "gray_release" | "impact_review"; + description?: string; + }[]; + }; + MetaSchemaActivateRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 激活理由 */ + reason: string; + /** + * @description 激活模式:全量或灰度 + * @default full + * @enum {string} + */ + activateMode: "full" | "gray"; + grayRules?: components["schemas"]["GrayRulesConfig"]; + /** @description 期望当前激活版本,乐观锁 */ + expectedActiveVersion: number; + /** @description 激活前校验结果引用 ID */ + validationResultId: string; + /** @description 激活影响预览引用 ID */ + impactPreviewId: string; + }; + /** @description 灰度规则配置 */ + GrayRulesConfig: { + /** + * @description 灰度策略 + * @enum {string} + */ + strategy?: "tenant_whitelist" | "percentage" | "user_whitelist"; + /** @description strategy=tenant_whitelist 时生效 */ + tenantWhitelist?: string[]; + /** @description strategy=percentage 时生效 */ + percentage?: number; + /** @description strategy=user_whitelist 时生效 */ + userWhitelist?: string[]; + }; + MetaSchemaActivateResponse: { + schemaKey?: string; + activatedVersion?: number; + /** @enum {string} */ + activateMode?: "full" | "gray"; + previousActiveVersion?: number; + affectedProjectionCount?: number; + /** @description 投影重建任务 ID(若有) */ + projectionRebuildJobId?: string; + }; + MetaSchemaRollbackRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 回滚理由 */ + reason: string; + /** @description 期望当前激活版本,乐观锁 */ + expectedActiveVersion: number; + /** @description 回滚前校验结果引用 ID */ + validationResultId: string; + /** @description 回滚影响预览引用 ID */ + impactPreviewId: string; + }; + MetaSchemaRollbackResponse: { + schemaKey?: string; + rolledBackToVersion?: number; + previousActiveVersion?: number; + affectedProjectionCount?: number; + /** @description 投影重建任务 ID */ + projectionRebuildJobId?: string; + /** @description 投影失效任务 ID */ + projectionInvalidateJobId?: string; + }; + MetaSchemaDeprecateRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 废弃理由 */ + reason: string; + /** @description 期望被废弃版本,乐观锁 */ + expectedVersion: number; + /** @description 废弃前校验结果引用 ID */ + validationResultId: string; + /** @description 废弃影响预览引用 ID */ + impactPreviewId: string; + deprecateFields?: { + fieldKey: string; + /** @description 替代字段标识 */ + replacementFieldKey?: string; + /** @description 保留期(如 6m / 1y) */ + retentionPeriod?: string; + /** @description 迁移提示 */ + migrationHint?: string; + }[]; + /** + * @description 是否废弃整个版本 + * @default false + */ + deprecateEntireVersion: boolean; + /** @description 替代版本号(废弃整个版本时必填) */ + replacementVersion?: number; + }; + MetaSchemaDeprecateResponse: { + schemaKey?: string; + version?: number; + /** @description 已废弃字段列表 */ + deprecatedFields?: string[]; + entireVersionDeprecated?: boolean; + affectedProjectionCount?: number; + nextActions?: { + /** @enum {string} */ + action?: "migrate_data" | "activate_replacement" | "review_impact"; + description?: string; + }[]; + }; + MetaSchemaGrayRulesRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 调整理由 */ + reason: string; + /** + * @description 操作类型:设置、调整或移除灰度规则 + * @default set + * @enum {string} + */ + action: "set" | "adjust" | "remove"; + grayRules?: components["schemas"]["GrayRulesConfig"]; + }; + MetaSchemaGrayRulesResponse: { + schemaKey?: string; + version?: number; + grayRules?: components["schemas"]["GrayRulesConfig"]; + /** @description 当前灰度影响范围描述 */ + affectedScope?: string; + /** @description 回滚入口 */ + rollbackEntry?: string; + }; + ProtectionNodeSummary: { + /** @description 保护节点业务标识 */ + nodeKey: string; + displayName: string; + /** + * @description 保护节点类型 + * @enum {string} + */ + nodeType: "input_output_compliance" | "chunking" | "rag_indexing" | "semantic_safety" | "static_check" | "quality_gate"; + /** @description 是否不可替换。保护节点不可被用户替换、覆盖或降级为开放槽位。 */ + irreplaceable: boolean; + /** @description 不可替换原因 */ + irreplaceableReason?: string; + /** @description 所属功能链路标识 */ + chainKey?: string; + /** @description 审计摘要 */ + auditSummary?: string; + }; + ProtectionNodeDetail: { + nodeKey: string; + displayName: string; + description?: string; + /** @enum {string} */ + nodeType: "input_output_compliance" | "chunking" | "rag_indexing" | "semantic_safety" | "static_check" | "quality_gate"; + /** @description 是否不可替换。服务端必须拒绝把保护节点降级为用户可替换槽位的草稿、发布或激活命令。 */ + irreplaceable: boolean; + irreplaceableReason?: string; + /** @description 权限要求 */ + permissionRequirement?: string; + /** @description 审计要求 */ + auditRequirement?: string; + /** @description Shadow→Canonical 边界说明 */ + shadowToCanonicalBoundary?: string; + /** @description 所属功能链路标识 */ + chainKey?: string; + chainDisplayName?: string; + /** @description 可观测指标 */ + observabilityMetrics?: { + metricName?: string; + metricValue?: string; + description?: string; + }[]; + /** Format: date-time */ + updatedAt?: string; + }; + FunctionChainSummary: { + /** @description 功能链路业务标识 */ + chainKey: string; + displayName: string; + description?: string; + activeVersion: number; + /** @description 开放槽位数 */ + openSlotCount?: number; + /** @description 保护节点数 */ + protectionNodeCount?: number; + /** Format: date-time */ + updatedAt?: string; + }; + FunctionChainImpactPreviewRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 预发布的目标版本号 */ + targetVersion?: number; + /** @description 期望当前激活版本,乐观锁 */ + expectedCurrentVersion?: number; + }; + FunctionChainImpactPreview: { + impactPreviewId?: string; + chainKey?: string; + targetVersion?: number; + /** @description 受影响的智能体槽位绑定数 */ + affectedAgentSlotBindings?: number; + /** @description 受影响的 AI 运行时任务数 */ + affectedAIRuntimeTasks?: number; + /** @description 保护节点变更数 */ + affectedProtectionNodeChanges?: number; + protectionNodeImpactDetails?: { + nodeKey?: string; + /** @enum {string} */ + changeType?: "added" | "removed" | "modified"; + impactDescription?: string; + }[]; + slotChanges?: { + slotKey?: string; + /** + * @description protection_boundary_violation 表示草稿试图把保护节点降级为开放槽位,激活时必须阻断。 + * @enum {string} + */ + changeType?: "added" | "removed" | "protection_upgraded" | "protection_boundary_violation"; + impactDescription?: string; + }[]; + }; + /** @description 激活功能链路版本。必须引用通过校验和影响预览的结果;若预览包含保护节点降级为开放槽位的边界违规,服务端必须拒绝激活。 */ + FunctionChainActivateRequest: { + /** @description 幂等键 */ + commandId: string; + /** @description 激活理由 */ + reason: string; + /** @description 影响预览引用 ID */ + impactPreviewId: string; + /** @description 激活前校验结果引用 ID */ + validationResultId: string; + /** @description 期望当前激活版本,乐观锁 */ + expectedActiveVersion: number; + }; + FunctionChainActivateResponse: { + chainKey?: string; + activatedVersion?: number; + previousActiveVersion?: number; + affectedSlotBindings?: number; + affectedRuntimeTasks?: number; + }; + CommonResult: { + /** + * @description 业务状态码,0 表示成功 + * @example 0 + */ + code: number; + /** @description 响应数据,类型视具体接口而定 */ + data?: unknown; + /** + * @description 提示信息 + * @example success + */ + msg: string; + }; + PaginatedResult: { + /** + * @description 总记录数 + * @example 150 + */ + total: number; + /** + * @description 当前页码 + * @example 1 + */ + pageNo: number; + /** + * @description 每页条数 + * @example 20 + */ + pageSize: number; + /** @description 当前页数据列表 */ + list: unknown[]; + }; + ErrorResponse: { + /** + * @description 错误码格式: {system}-{module}-{category}-{sequence} + * 示例: MUSE-CONTENT-001-0001 + * @example MUSE-CONTENT-001-0001 + */ + code: string; + /** @description 人类可读的错误描述 */ + msg: string; + /** @description 详细错误信息(仅开发环境返回) */ + detail?: string; + }; + }; + responses: { + /** @description 请求参数有误 */ + BadRequest: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 未认证或 token 过期 */ + Unauthorized: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 无权限 */ + Forbidden: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源不存在 */ + NotFound: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + /** @description 资源冲突 */ + Conflict: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["ErrorResponse"]; + }; + }; + }; + parameters: { + /** @description MetaSchema 业务标识 */ + schemaKey: string; + /** @description 版本号 */ + version: number; + /** @description 草稿版本号 */ + draftVersion: number; + /** @description 保护节点业务标识 */ + nodeKey: string; + /** @description 系统功能链路业务标识 */ + chainKey: string; + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + XApiVersion: "1"; + /** @description 页码,从 1 开始 */ + pageNo: number; + /** @description 每页条数,上限 100 */ + pageSize: number; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + listMetaSchemas: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按作用域筛选 */ + scope?: "global" | "tenant" | "user" | "work"; + /** @description 按目标类型筛选(work / chapter / block / agent / knowledge_base) */ + targetType?: string; + /** @description 按 schemaKey 或 displayName 模糊搜索 */ + keyword?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description MetaSchema 分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["MetaSchemaSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getMetaSchema: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description MetaSchema 业务标识 */ + schemaKey: components["parameters"]["schemaKey"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description MetaSchema 详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaSchemaDetail"]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + getMetaSchemaVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description MetaSchema 业务标识 */ + schemaKey: components["parameters"]["schemaKey"]; + /** @description 版本号 */ + version: components["parameters"]["version"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 版本详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaSchemaVersionDetail"]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + saveMetaSchemaDraft: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description MetaSchema 业务标识 */ + schemaKey: components["parameters"]["schemaKey"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["MetaSchemaDraftRequest"]; + }; + }; + responses: { + /** @description 草稿保存成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaSchemaDraftResponse"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 404: components["responses"]["NotFound"]; + }; + }; + validateMetaSchemaDraft: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description MetaSchema 业务标识 */ + schemaKey: components["parameters"]["schemaKey"]; + /** @description 草稿版本号 */ + draftVersion: components["parameters"]["draftVersion"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 校验结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ValidationResult"]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + previewMetaSchemaDraftImpact: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description MetaSchema 业务标识 */ + schemaKey: components["parameters"]["schemaKey"]; + /** @description 草稿版本号 */ + draftVersion: components["parameters"]["draftVersion"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 影响预览结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaSchemaImpactPreview"]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + publishMetaSchemaDraft: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description MetaSchema 业务标识 */ + schemaKey: components["parameters"]["schemaKey"]; + /** @description 草稿版本号 */ + draftVersion: components["parameters"]["draftVersion"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["MetaSchemaPublishRequest"]; + }; + }; + responses: { + /** @description 发布成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaSchemaPublishResponse"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 409: components["responses"]["Conflict"]; + }; + }; + activateMetaSchemaVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description MetaSchema 业务标识 */ + schemaKey: components["parameters"]["schemaKey"]; + /** @description 版本号 */ + version: components["parameters"]["version"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["MetaSchemaActivateRequest"]; + }; + }; + responses: { + /** @description 激活成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaSchemaActivateResponse"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 409: components["responses"]["Conflict"]; + }; + }; + rollbackMetaSchemaVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description MetaSchema 业务标识 */ + schemaKey: components["parameters"]["schemaKey"]; + /** @description 版本号 */ + version: components["parameters"]["version"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["MetaSchemaRollbackRequest"]; + }; + }; + responses: { + /** @description 回滚成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaSchemaRollbackResponse"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 409: components["responses"]["Conflict"]; + }; + }; + deprecateMetaSchemaVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description MetaSchema 业务标识 */ + schemaKey: components["parameters"]["schemaKey"]; + /** @description 版本号 */ + version: components["parameters"]["version"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["MetaSchemaDeprecateRequest"]; + }; + }; + responses: { + /** @description 废弃成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaSchemaDeprecateResponse"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 409: components["responses"]["Conflict"]; + }; + }; + setMetaSchemaGrayRules: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description MetaSchema 业务标识 */ + schemaKey: components["parameters"]["schemaKey"]; + /** @description 版本号 */ + version: components["parameters"]["version"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["MetaSchemaGrayRulesRequest"]; + }; + }; + responses: { + /** @description 灰度规则设置成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["MetaSchemaGrayRulesResponse"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 409: components["responses"]["Conflict"]; + }; + }; + listProtectionNodes: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + /** @description 按所属功能链路筛选 */ + chainKey?: string; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 保护节点注册表分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["ProtectionNodeSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + getProtectionNode: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 保护节点业务标识 */ + nodeKey: components["parameters"]["nodeKey"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 保护节点详情 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["ProtectionNodeDetail"]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + listFunctionChains: { + parameters: { + query?: { + /** @description 页码,从 1 开始 */ + pageNo?: components["parameters"]["pageNo"]; + /** @description 每页条数,上限 100 */ + pageSize?: components["parameters"]["pageSize"]; + }; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path?: never; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description 系统功能链路分页列表 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["PaginatedResult"] & { + list?: components["schemas"]["FunctionChainSummary"][]; + }; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 401: components["responses"]["Unauthorized"]; + 403: components["responses"]["Forbidden"]; + }; + }; + previewFunctionChainImpact: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 系统功能链路业务标识 */ + chainKey: components["parameters"]["chainKey"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["FunctionChainImpactPreviewRequest"]; + }; + }; + responses: { + /** @description 功能链路影响预览结果 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["FunctionChainImpactPreview"]; + }; + }; + }; + 404: components["responses"]["NotFound"]; + }; + }; + activateFunctionChainVersion: { + parameters: { + query?: never; + header: { + /** + * @description API 版本号,当前版本为 1。 + * 未传时网关可兼容最新稳定版本,但前端 SDK 和 API 客户端必须显式传递该 header。 + */ + "X-API-Version": components["parameters"]["XApiVersion"]; + }; + path: { + /** @description 系统功能链路业务标识 */ + chainKey: components["parameters"]["chainKey"]; + /** @description 版本号 */ + version: components["parameters"]["version"]; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["FunctionChainActivateRequest"]; + }; + }; + responses: { + /** @description 激活成功 */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["CommonResult"] & { + data?: components["schemas"]["FunctionChainActivateResponse"]; + }; + }; + }; + 400: components["responses"]["BadRequest"]; + 409: components["responses"]["Conflict"]; + }; + }; +} diff --git a/muse-admin/apps/web-antd/src/router/routes/modules/muse.ts b/muse-admin/apps/web-antd/src/router/routes/modules/muse.ts new file mode 100644 index 00000000..dd9a15d1 --- /dev/null +++ b/muse-admin/apps/web-antd/src/router/routes/modules/muse.ts @@ -0,0 +1,117 @@ +import type { RouteRecordRaw } from 'vue-router'; + +/** + * Muse 管理端业务路由 + * + * 这里仅注册管理端 surface。真实权限由后端菜单、页面权限和操作权限控制, + * 前端路由只负责把 Vben Admin 的页面组件接入导航。 + */ +const routes: RouteRecordRaw[] = [ + { + meta: { + icon: 'lucide:shield-check', + order: 20, + title: 'Muse 管理', + }, + name: 'MuseAdmin', + path: '/muse', + children: [ + { + component: () => + import('#/views/muse/governance/meta-schema/index.vue'), + meta: { + icon: 'lucide:braces', + title: '元结构定义', + }, + name: 'MuseMetaSchemaList', + path: 'governance/meta-schemas', + }, + { + component: () => + import('#/views/muse/governance/meta-schema/detail.vue'), + meta: { + activePath: '/muse/governance/meta-schemas', + hideInMenu: true, + title: '元结构编辑', + }, + name: 'MuseMetaSchemaDetail', + path: 'governance/meta-schemas/:schemaKey', + }, + { + component: () => + import('#/views/muse/governance/function-orch/index.vue'), + meta: { + icon: 'lucide:git-branch', + title: '功能编排', + }, + name: 'MuseFunctionOrchestration', + path: 'governance/function-orchestration', + }, + { + component: () => import('#/views/muse/ai/index.vue'), + meta: { + icon: 'lucide:bot', + title: 'AI 配置', + }, + name: 'MuseAiConfig', + path: 'ai', + }, + { + component: () => import('#/views/muse/knowledge/index.vue'), + meta: { + icon: 'lucide:library', + title: '全局知识库', + }, + name: 'MuseGlobalKnowledge', + path: 'knowledge', + }, + { + component: () => import('#/views/muse/market/index.vue'), + meta: { + icon: 'lucide:store', + title: '市场治理', + }, + name: 'MuseMarketGovernance', + path: 'market', + }, + { + component: () => import('#/views/muse/account/index.vue'), + meta: { + icon: 'lucide:users', + title: '用户与权限', + }, + name: 'MuseAccountGovernance', + path: 'account', + }, + { + component: () => import('#/views/muse/newapi/index.vue'), + meta: { + icon: 'lucide:activity', + title: 'New-API 与用量', + }, + name: 'MuseNewApiUsage', + path: 'new-api', + }, + { + component: () => import('#/views/muse/jobs/index.vue'), + meta: { + icon: 'lucide:timer', + title: '任务治理', + }, + name: 'MuseTaskOps', + path: 'jobs', + }, + { + component: () => import('#/views/muse/audit/index.vue'), + meta: { + icon: 'lucide:scroll-text', + title: '日志与审计', + }, + name: 'MuseAuditLog', + path: 'audit', + }, + ], + }, +]; + +export default routes; diff --git a/muse-admin/apps/web-antd/src/views/muse/account/index.vue b/muse-admin/apps/web-antd/src/views/muse/account/index.vue new file mode 100644 index 00000000..0fca57b4 --- /dev/null +++ b/muse-admin/apps/web-antd/src/views/muse/account/index.vue @@ -0,0 +1,844 @@ + + + diff --git a/muse-admin/apps/web-antd/src/views/muse/ai/__tests__/index.test.ts b/muse-admin/apps/web-antd/src/views/muse/ai/__tests__/index.test.ts new file mode 100644 index 00000000..7a9dc351 --- /dev/null +++ b/muse-admin/apps/web-antd/src/views/muse/ai/__tests__/index.test.ts @@ -0,0 +1,213 @@ +import { createApp, defineComponent, h, nextTick } from 'vue'; + +import { describe, expect, it, vi } from 'vitest'; + +const flushPromises = () => new Promise((resolve) => setTimeout(resolve, 0)); + +vi.mock('@vben/common-ui', () => ({ + Page: defineComponent({ + setup(_, { slots }) { + return () => h('div', { class: 'page-stub' }, slots.default?.()); + }, + }), +})); + +vi.mock('ant-design-vue', () => { + const renderDefaultSlot = (props?: Record) => + defineComponent({ + setup(_, { slots }) { + return () => h('div', props, slots.default?.()); + }, + }); + const Button = defineComponent({ + emits: ['click'], + props: ['disabled'], + setup(props, { attrs, slots, emit }) { + return () => + h( + 'button', + { + ...attrs, + disabled: props.disabled, + onClick: () => emit('click'), + }, + slots.default?.(), + ); + }, + }); + const Modal = defineComponent({ + props: ['open'], + setup(props, { slots }) { + return () => (props.open ? h('div', { class: 'modal-stub' }, slots.default?.()) : null); + }, + }); + const Tabs = renderDefaultSlot({ class: 'tabs-stub' }) as unknown as { + TabPane: ReturnType; + }; + Tabs.TabPane = renderDefaultSlot({ class: 'tab-pane-stub' }); + + return { + Alert: renderDefaultSlot(), + Badge: renderDefaultSlot(), + Button, + Card: renderDefaultSlot(), + Descriptions: renderDefaultSlot(), + Empty: renderDefaultSlot(), + Form: renderDefaultSlot(), + Input: renderDefaultSlot(), + Modal, + Progress: renderDefaultSlot(), + Select: renderDefaultSlot(), + Space: renderDefaultSlot(), + Table: renderDefaultSlot(), + Tabs, + Tag: renderDefaultSlot(), + Textarea: renderDefaultSlot(), + Tooltip: renderDefaultSlot(), + message: { + error: vi.fn(), + success: vi.fn(), + }, + }; +}); + +vi.mock('#/api/muse/ai', () => ({ + getAgentPageApi: vi.fn(async () => ({ + list: [ + { + activeVersion: 7, + agentId: 'agent-system', + name: '剧情规划系统智能体', + promptKey: 'plot.planner', + scope: 'system', + status: 'active', + updatedAt: '2026-05-24T00:00:00Z', + }, + { + activeVersion: 2, + agentId: 'agent-user', + name: '用户私有润色智能体', + promptKey: 'private.polish', + scope: 'user', + status: 'active', + updatedAt: '2026-05-24T00:00:00Z', + }, + ], + pageNo: 1, + pageSize: 20, + total: 2, + })), + getPromptPageApi: vi.fn(async () => ({ + list: [ + { + activeVersion: 3, + latestVersion: 4, + name: '剧情规划 Prompt', + promptKey: 'plot.planner', + updatedAt: '2026-05-24T00:00:00Z', + variableCount: 5, + }, + ], + pageNo: 1, + pageSize: 20, + total: 1, + })), + getQualityPolicyPageApi: vi.fn(async () => ({ + list: [ + { + activeVersion: 1, + dimensionCount: 3, + latestVersion: 2, + name: '候选交付质量门控', + policyKey: 'candidate.delivery', + updatedAt: '2026-05-24T00:00:00Z', + }, + ], + pageNo: 1, + pageSize: 20, + total: 1, + })), + getToolGrantPageApi: vi.fn(async () => ({ + list: [ + { + agentId: 'agent-system', + agentName: '剧情规划系统智能体', + approvedBy: 'security-facade', + budget: { maxCalls: 20, maxTokens: 8000, period: 'daily' }, + createdAt: '2026-05-24T00:00:00Z', + grantId: 'grant-1', + outboundPolicy: { + allowedDestinations: ['model-gateway'], + dataPolicy: 'redacted_user_content', + networkMode: 'internal_only', + }, + scope: { + crossWorkAllowed: false, + ownerType: 'system', + resourceRefs: [{ resourceId: 'global-kb', resourceType: 'knowledge_base' }], + scopeType: 'knowledge_base', + }, + securityApprovalId: 'SEC-20260524-001', + status: 'approved', + toolType: 'knowledge_retrieval', + }, + ], + pageNo: 1, + pageSize: 20, + total: 1, + })), +})); + +describe('muse ai config page', () => { + it('renders AI governance domains and blocks user private agent management', async () => { + const { container, unmount } = await mountPage(); + await flushPromises(); + + expect(container.textContent).toContain('Prompt 模板'); + expect(container.textContent).toContain('系统智能体'); + expect(container.textContent).toContain('质量门控'); + expect(container.textContent).toContain('Tool Grant'); + expect(container.textContent).toContain('已激活 v3'); + expect(container.textContent).toContain('可管理'); + expect(container.textContent).toContain('只读治理摘要'); + expect(container.textContent).not.toContain('编辑私有 Agent'); + + unmount(); + }); + + it('opens impact preview before risky quality policy operations', async () => { + const { container, unmount } = await mountPage(); + await flushPromises(); + + const button = container.querySelector( + '[data-test="quality-publish-preview"]', + ); + button?.click(); + await nextTick(); + + expect(container.textContent).toContain('影响预览'); + expect(container.textContent).toContain('操作原因'); + expect(container.textContent).toContain('审计回执字段'); + + unmount(); + }); +}); + +async function mountPage() { + const { default: AiConfigPage } = await import('../index.vue'); + const container = document.createElement('div'); + document.body.append(container); + + const app = createApp(AiConfigPage); + app.mount(container); + await flushPromises(); + await nextTick(); + + return { + container, + unmount: () => { + app.unmount(); + container.remove(); + }, + }; +} diff --git a/muse-admin/apps/web-antd/src/views/muse/ai/index.vue b/muse-admin/apps/web-antd/src/views/muse/ai/index.vue new file mode 100644 index 00000000..2f773a4e --- /dev/null +++ b/muse-admin/apps/web-antd/src/views/muse/ai/index.vue @@ -0,0 +1,1026 @@ + + +