@allbluecn/kernel 0.12.2 → 0.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +125 -104
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -165,11 +165,22 @@ interface HostedAiModel {
165
165
  provider: string;
166
166
  streaming: boolean;
167
167
  }
168
+ interface HostedProviderAccess {
169
+ provider: string;
170
+ baseUrl: string;
171
+ apiKey: string;
172
+ modelIds: string[];
173
+ expiresAt: string;
174
+ }
168
175
  interface HostedAiService {
169
176
  chatStream(params: HostedAiChatParams, signal?: AbortSignal): AsyncIterable<StreamChunk>;
170
177
  chat(params: HostedAiChatParams, signal?: AbortSignal): Promise<HostedAiChatResult>;
171
178
  getQuota(workspaceId: string): Promise<AiQuota>;
172
179
  listAvailableModels(): Promise<HostedAiModel[]>;
180
+ getHarnessProvider?(args: {
181
+ userId: string;
182
+ workspaceId: string;
183
+ }): Promise<HostedProviderAccess | null>;
173
184
  }
174
185
  //#endregion
175
186
  //#region src/pro-contract/sso.d.ts
@@ -231,6 +242,7 @@ interface PermissionsService {
231
242
  updateRole(roleId: string, updates: Partial<RoleDefinition>): Promise<void>;
232
243
  deleteRole(roleId: string): Promise<void>;
233
244
  checkPermission(userId: string, resource: string, action: string): Promise<PermissionLevel>;
245
+ checkWorkspacePermission?(userId: string, workspaceId: string, resource: string, action: string): Promise<PermissionLevel>;
234
246
  }
235
247
  //#endregion
236
248
  //#region src/pro-contract/license.d.ts
@@ -493,6 +505,109 @@ interface ProModule {
493
505
  readonly compliance: ComplianceService | null;
494
506
  }
495
507
  //#endregion
508
+ //#region src/contract/modules/billing/feature-registry.d.ts
509
+ interface FeatureMeta {
510
+ /** oss = 开源免费;paid = 付费;enterprise = 企业版专属 */
511
+ tier: 'oss' | 'paid' | 'enterprise';
512
+ /** 该功能依赖的 proModule 服务名;null = 开源代码自带(仅权益门控) */
513
+ module: 'billing' | 'hostedAi' | 'sso' | 'audit' | 'permissions' | 'license' | 'versionHistory' | 'automation' | 'templates' | 'analytics' | 'globalSearch' | 'compliance' | null;
514
+ }
515
+ declare const FeatureRegistry: {
516
+ readonly byokAi: {
517
+ readonly tier: 'oss';
518
+ readonly module: null;
519
+ };
520
+ readonly hostedAi: {
521
+ readonly tier: 'paid';
522
+ readonly module: 'hostedAi';
523
+ };
524
+ readonly multiProvider: {
525
+ readonly tier: 'paid';
526
+ readonly module: null;
527
+ };
528
+ readonly largePageSize: {
529
+ readonly tier: 'paid';
530
+ readonly module: null;
531
+ };
532
+ readonly versionHistory: {
533
+ readonly tier: 'paid';
534
+ readonly module: 'versionHistory';
535
+ };
536
+ readonly automation: {
537
+ readonly tier: 'paid';
538
+ readonly module: 'automation';
539
+ };
540
+ readonly templates: {
541
+ readonly tier: 'paid';
542
+ readonly module: 'templates';
543
+ };
544
+ readonly globalSearch: {
545
+ readonly tier: 'paid';
546
+ readonly module: 'globalSearch';
547
+ };
548
+ readonly analytics: {
549
+ readonly tier: 'enterprise';
550
+ readonly module: 'analytics';
551
+ };
552
+ readonly sso: {
553
+ readonly tier: 'enterprise';
554
+ readonly module: 'sso';
555
+ };
556
+ readonly audit: {
557
+ readonly tier: 'enterprise';
558
+ readonly module: 'audit';
559
+ };
560
+ readonly advancedPermissions: {
561
+ readonly tier: 'enterprise';
562
+ readonly module: 'permissions';
563
+ };
564
+ readonly compliance: {
565
+ readonly tier: 'enterprise';
566
+ readonly module: 'compliance';
567
+ };
568
+ readonly customAgents: {
569
+ readonly tier: 'paid';
570
+ readonly module: null;
571
+ };
572
+ /** 沙箱执行(P3)。module 为 null:沙箱是开源代码自带的平台能力,仅权益门控。
573
+ * 2026-11-07 用户裁决下放免费(harness TanStack AI 原生化 Phase 0):tier 'oss'
574
+ * 免订阅直接放行(testGeneration 同款口径),OSS_BASE_FEATURES 同步收录供客户端
575
+ * 权益快照。desktop 部署无订阅体系,走 requireFeature 内的点式直放分支(幂等)。
576
+ * 恢复 Pro 化 = tier 回 'paid' + 移出 OSS_BASE_FEATURES + seed 限额回 0。 */
577
+ readonly sandboxExecution: {
578
+ readonly tier: 'oss';
579
+ readonly module: null;
580
+ };
581
+ /** 媒体生成(P4c)。module 为 null:媒体生成是开源代码自带的平台能力(TanStack AI adapter 调用),
582
+ * 仅权益门控。2026-11-07 用户裁决下放免费(harness Phase 0):tier 'oss' 免订阅直接放行,
583
+ * OSS_BASE_FEATURES 同步收录。desktop BYOK 场景原点式豁免分支保留(幂等)。 */
584
+ readonly mediaGeneration: {
585
+ readonly tier: 'oss';
586
+ readonly module: null;
587
+ };
588
+ /** BUG 自动 AI 修复(P4)。module 为 null:入队是开源代码自带的平台能力(webhook + MCP 工具链),
589
+ * 本期全开源不设 requireFeature 门槛——仅入注册表防 CI check-feature-keys.ts 漂移(规格 §14.5)。 */
590
+ readonly bugAutoFix: {
591
+ readonly tier: 'paid';
592
+ readonly module: null;
593
+ };
594
+ /** AI 生成测试用例(testcase 模块 P3,规格 §12)。module 为 null:生成编排是开源代码自带的
595
+ * BYOK 平台能力(runChatAsAgent 消费用户自配 Key)。2026-10-10 起下放免费:tier 'oss'
596
+ * 免订阅直接放行(byokAi 同款口径),OSS_BASE_FEATURES 同步收录供客户端权益快照。
597
+ * desktop BYOK 场景原点式豁免分支保留(幂等)。 */
598
+ readonly testGeneration: {
599
+ readonly tier: 'oss';
600
+ readonly module: null;
601
+ };
602
+ };
603
+ type FeatureKey = keyof typeof FeatureRegistry;
604
+ declare const FEATURE_KEYS: FeatureKey[];
605
+ /** OSS 部署(billing 模块缺失)的基础白名单——唯一允许「无订阅即放行」的集合。
606
+ * testGeneration 虽有 tier 'oss'(requireFeature 直放),客户端权益快照走本集合构建
607
+ * features map,故须显式收录,否则 UI 入口(useFeature)仍判 locked。 */
608
+ declare const OSS_BASE_FEATURES: readonly FeatureKey[];
609
+ declare function isOssFeature(key: FeatureKey): boolean;
610
+ //#endregion
496
611
  //#region src/contributions.d.ts
497
612
  type Middleware = unknown;
498
613
  type PluginRouteContext = {
@@ -527,6 +642,14 @@ type ProServiceMap = Partial<Record<ProFeature, unknown>>;
527
642
  interface PrismaContribution {
528
643
  models: string[];
529
644
  }
645
+ interface HarnessContribution {
646
+ id: string;
647
+ factory: string;
648
+ config: Record<string, unknown>;
649
+ requiredServices: ProFeature[];
650
+ entitlements: FeatureKey[];
651
+ deployments: Array<'saas' | 'desktop'>;
652
+ }
530
653
  interface PluginContributions {
531
654
  routes?: RouteContribution[];
532
655
  serverMiddleware?: Middleware[];
@@ -536,6 +659,7 @@ interface PluginContributions {
536
659
  aiTools?: unknown[];
537
660
  prisma?: PrismaContribution;
538
661
  services?: ProServiceMap;
662
+ harness?: HarnessContribution[];
539
663
  }
540
664
  //#endregion
541
665
  //#region src/types.d.ts
@@ -1047,109 +1171,6 @@ type AvatarPart = "face" | "eyes" | "eyebrows" | "mouth" | "nose" | "glasses" |
1047
1171
  type AvatarConfig = Record<AvatarPart, number>;
1048
1172
  type ShapeType = "circle" | "rounded" | "square";
1049
1173
  //#endregion
1050
- //#region src/contract/modules/billing/feature-registry.d.ts
1051
- interface FeatureMeta {
1052
- /** oss = 开源免费;paid = 付费;enterprise = 企业版专属 */
1053
- tier: 'oss' | 'paid' | 'enterprise';
1054
- /** 该功能依赖的 proModule 服务名;null = 开源代码自带(仅权益门控) */
1055
- module: 'billing' | 'hostedAi' | 'sso' | 'audit' | 'permissions' | 'license' | 'versionHistory' | 'automation' | 'templates' | 'analytics' | 'globalSearch' | 'compliance' | null;
1056
- }
1057
- declare const FeatureRegistry: {
1058
- readonly byokAi: {
1059
- readonly tier: 'oss';
1060
- readonly module: null;
1061
- };
1062
- readonly hostedAi: {
1063
- readonly tier: 'paid';
1064
- readonly module: 'hostedAi';
1065
- };
1066
- readonly multiProvider: {
1067
- readonly tier: 'paid';
1068
- readonly module: null;
1069
- };
1070
- readonly largePageSize: {
1071
- readonly tier: 'paid';
1072
- readonly module: null;
1073
- };
1074
- readonly versionHistory: {
1075
- readonly tier: 'paid';
1076
- readonly module: 'versionHistory';
1077
- };
1078
- readonly automation: {
1079
- readonly tier: 'paid';
1080
- readonly module: 'automation';
1081
- };
1082
- readonly templates: {
1083
- readonly tier: 'paid';
1084
- readonly module: 'templates';
1085
- };
1086
- readonly globalSearch: {
1087
- readonly tier: 'paid';
1088
- readonly module: 'globalSearch';
1089
- };
1090
- readonly analytics: {
1091
- readonly tier: 'enterprise';
1092
- readonly module: 'analytics';
1093
- };
1094
- readonly sso: {
1095
- readonly tier: 'enterprise';
1096
- readonly module: 'sso';
1097
- };
1098
- readonly audit: {
1099
- readonly tier: 'enterprise';
1100
- readonly module: 'audit';
1101
- };
1102
- readonly advancedPermissions: {
1103
- readonly tier: 'enterprise';
1104
- readonly module: 'permissions';
1105
- };
1106
- readonly compliance: {
1107
- readonly tier: 'enterprise';
1108
- readonly module: 'compliance';
1109
- };
1110
- readonly customAgents: {
1111
- readonly tier: 'paid';
1112
- readonly module: null;
1113
- };
1114
- /** 沙箱执行(P3)。module 为 null:沙箱是开源代码自带的平台能力,仅权益门控。
1115
- * 2026-11-07 用户裁决下放免费(harness TanStack AI 原生化 Phase 0):tier 'oss'
1116
- * 免订阅直接放行(testGeneration 同款口径),OSS_BASE_FEATURES 同步收录供客户端
1117
- * 权益快照。desktop 部署无订阅体系,走 requireFeature 内的点式直放分支(幂等)。
1118
- * 恢复 Pro 化 = tier 回 'paid' + 移出 OSS_BASE_FEATURES + seed 限额回 0。 */
1119
- readonly sandboxExecution: {
1120
- readonly tier: 'oss';
1121
- readonly module: null;
1122
- };
1123
- /** 媒体生成(P4c)。module 为 null:媒体生成是开源代码自带的平台能力(TanStack AI adapter 调用),
1124
- * 仅权益门控。2026-11-07 用户裁决下放免费(harness Phase 0):tier 'oss' 免订阅直接放行,
1125
- * OSS_BASE_FEATURES 同步收录。desktop BYOK 场景原点式豁免分支保留(幂等)。 */
1126
- readonly mediaGeneration: {
1127
- readonly tier: 'oss';
1128
- readonly module: null;
1129
- };
1130
- /** BUG 自动 AI 修复(P4)。module 为 null:入队是开源代码自带的平台能力(webhook + MCP 工具链),
1131
- * 本期全开源不设 requireFeature 门槛——仅入注册表防 CI check-feature-keys.ts 漂移(规格 §14.5)。 */
1132
- readonly bugAutoFix: {
1133
- readonly tier: 'paid';
1134
- readonly module: null;
1135
- };
1136
- /** AI 生成测试用例(testcase 模块 P3,规格 §12)。module 为 null:生成编排是开源代码自带的
1137
- * BYOK 平台能力(runChatAsAgent 消费用户自配 Key)。2026-10-10 起下放免费:tier 'oss'
1138
- * 免订阅直接放行(byokAi 同款口径),OSS_BASE_FEATURES 同步收录供客户端权益快照。
1139
- * desktop BYOK 场景原点式豁免分支保留(幂等)。 */
1140
- readonly testGeneration: {
1141
- readonly tier: 'oss';
1142
- readonly module: null;
1143
- };
1144
- };
1145
- type FeatureKey = keyof typeof FeatureRegistry;
1146
- declare const FEATURE_KEYS: FeatureKey[];
1147
- /** OSS 部署(billing 模块缺失)的基础白名单——唯一允许「无订阅即放行」的集合。
1148
- * testGeneration 虽有 tier 'oss'(requireFeature 直放),客户端权益快照走本集合构建
1149
- * features map,故须显式收录,否则 UI 入口(useFeature)仍判 locked。 */
1150
- declare const OSS_BASE_FEATURES: readonly FeatureKey[];
1151
- declare function isOssFeature(key: FeatureKey): boolean;
1152
- //#endregion
1153
1174
  //#region src/contract/modules/billing/plan-features-schema.d.ts
1154
1175
  declare const PlanFeaturesSchema: z.ZodRecord<z.ZodEnum<{
1155
1176
  advancedPermissions: "advancedPermissions";
@@ -1488,4 +1509,4 @@ declare const ICON_MAP: Record<string, ComponentType<{
1488
1509
  className?: string;
1489
1510
  }>>;
1490
1511
  //#endregion
1491
- export { ADAPTER_KINDS, ADAPTER_KIND_VALUES, type AICommandContext, type AICommandDef, type AICommandHandler, type AICommandResult, AI_SOURCE_MODES, type ActivationResult, AdapterKind, type AiAdapter, AiModelMeta, AiProviderMeta, AiProviderRow, type AiQuota, AiSourceMode, type AllBlueModule, type AnalyticsQuery, type AnalyticsResult, type AnalyticsService, type AssembleInput, type AssemblyFiles, type AuditLogEntry, type AuditQuery, type AuditService, type AutomationRule, type AutomationService, type AvatarConfig, type AvatarPart, type BillingService, BillingUnavailableError, type CLIAgentInfo, type CanvasElement, CategoryEmailFlags, CategoryFrequencies, type CheckoutParams, type ComplianceJobSummary, type ComplianceService, type ComponentCategory, type ComponentSource, type CustomDashboard, DEFAULT_CATEGORIES, DEFAULT_EMAIL_CATEGORIES, DEFAULT_WATCHED_DEPENDENCIES, DEPENDENCY_CATEGORIES, DEPENDENCY_PRIORITIES, DEVICE_SIZES, DND_STICKY_THRESHOLD, DependencyCategory, DependencyPriority, DependencySeed, DependencyUsage, type Design, type DesignDetail, type DesignVersionFull, type DesignVersionWithPages, type DesignVersionWithSemver, type DeveloperLogEntry, type DeviceType, type DocumentTemplate, type DocumentVersion, type EditableFieldType, type EditablePropField, type EntityDef, type EntityUpdateEvent, FEATURE_KEYS, type FeatureContribution, type FeatureKey, type FeatureMeta, FeatureRegistry, type SearchResult as GlobalSearchResult, type GlobalSearchService, type HostSession, type HostedAiChatParams, type HostedAiChatResult, HostedAiError, type HostedAiModel, type HostedAiService, ICON_MAP, type InvoiceInfo, LOAD_MORE_STEP, LOBE_ICON_MAP, type LicenseInfo, type LicenseIssueParams, type LicenseIssueResult, type LicenseService, type LicenseStatus, MODEL_CAPABILITY_OPTIONS, MODEL_TABS, type Middleware, ModelCapability, ModelTab, NOTIFICATION_CATEGORIES, NOTIFICATION_FREQUENCIES, NotificationCategory, NotificationFrequency, NotificationItem, NotificationListResult, NotificationPreferences, NotificationSsePayload, NotificationSseValue, OSS_BASE_FEATURES, type OutlineNode, PROMPT_DEFINITIONS, PROVIDER_BADGE_STYLES, PROVIDER_CATEGORIES, PROVIDER_CATEGORY_VALUES, PRO_FEATURES, type ParsedUA, type PermissionLevel, type PermissionsService, type PlanFeatures, PlanFeaturesSchema, type PlanInfo, type PluginContributions, type PluginDefinition, type PluginRouteContext, type PortalSessionParams, type PrismaContribution, type PrismaSeam, type ProEdition, type ProFeature, type ProModule, type ProServiceMap, type ProfileDefinition, PromptDefinition, PromptSection, PromptVariableDef, PromptVariableDefDTO, type PrototypeComponentConfig, ProviderCategory, type QueryFactoryMap, RESOURCE_KEYS, type RealtimeTransport, type RefDisplay, type Reference, type ReferenceDisplayFn, type ResizeDirection, type ResizeMode, type ResolveResult, type ResolvedRef, type ResourceKey, type ResourceMeta, ResourceRegistry, type ResourceSnapshot, type ResourceSnapshots, type RoleDefinition, type RouteContribution, SEED_AI_PROVIDERS, type SearchParams, type SearchResult$1 as SearchResult, type SeatCheckResult, type SeatUpdateParams, SeatsExceededError, type ServerSeam, type SettingsTabContribution, type ShapeType, type SsoProvider, type SsoService, type SubscriptionInfo, SyncDependencyResult, SystemPromptSectionDTO, SystemPromptTemplateDTO, SystemPromptVersionDTO, TIPTAP_ACTION_INSTRUCTIONS, type TemplatesService, ThirdPartyDependencyRow, type UiSlotContributions, UnknownPromptVariableError, UnreadSnapshotPayload, UpdateDependencyInput, VIRTUALIZE_THRESHOLD, type VersionHistoryService, VersionStatus, WebhookSignatureError, definePlugin, defineProfile, dumpModules, formatParsedUA, generateAssemblyCode, generateAssemblyFiles, getClientIp, getPromptDefinition, getServerSeam, interpolateTemplate, isInDndWindow, isOssFeature, isResourceDefined, listPromptDefinitions, moduleRegistry, normalizeCategoryFrequencies, normalizeEmailCategories, parseProfileImports, parseUserAgent, promptDefinitionKeys, registerPrismaSeam, registerServerSeam, resolveImportSpecifiers, resolveIpLocation, resolvePluginOrder };
1512
+ export { ADAPTER_KINDS, ADAPTER_KIND_VALUES, type AICommandContext, type AICommandDef, type AICommandHandler, type AICommandResult, AI_SOURCE_MODES, type ActivationResult, AdapterKind, type AiAdapter, AiModelMeta, AiProviderMeta, AiProviderRow, type AiQuota, AiSourceMode, type AllBlueModule, type AnalyticsQuery, type AnalyticsResult, type AnalyticsService, type AssembleInput, type AssemblyFiles, type AuditLogEntry, type AuditQuery, type AuditService, type AutomationRule, type AutomationService, type AvatarConfig, type AvatarPart, type BillingService, BillingUnavailableError, type CLIAgentInfo, type CanvasElement, CategoryEmailFlags, CategoryFrequencies, type CheckoutParams, type ComplianceJobSummary, type ComplianceService, type ComponentCategory, type ComponentSource, type CustomDashboard, DEFAULT_CATEGORIES, DEFAULT_EMAIL_CATEGORIES, DEFAULT_WATCHED_DEPENDENCIES, DEPENDENCY_CATEGORIES, DEPENDENCY_PRIORITIES, DEVICE_SIZES, DND_STICKY_THRESHOLD, DependencyCategory, DependencyPriority, DependencySeed, DependencyUsage, type Design, type DesignDetail, type DesignVersionFull, type DesignVersionWithPages, type DesignVersionWithSemver, type DeveloperLogEntry, type DeviceType, type DocumentTemplate, type DocumentVersion, type EditableFieldType, type EditablePropField, type EntityDef, type EntityUpdateEvent, FEATURE_KEYS, type FeatureContribution, type FeatureKey, type FeatureMeta, FeatureRegistry, type SearchResult as GlobalSearchResult, type GlobalSearchService, type HarnessContribution, type HostSession, type HostedAiChatParams, type HostedAiChatResult, HostedAiError, type HostedAiModel, type HostedAiService, type HostedProviderAccess, ICON_MAP, type InvoiceInfo, LOAD_MORE_STEP, LOBE_ICON_MAP, type LicenseInfo, type LicenseIssueParams, type LicenseIssueResult, type LicenseService, type LicenseStatus, MODEL_CAPABILITY_OPTIONS, MODEL_TABS, type Middleware, ModelCapability, ModelTab, NOTIFICATION_CATEGORIES, NOTIFICATION_FREQUENCIES, NotificationCategory, NotificationFrequency, NotificationItem, NotificationListResult, NotificationPreferences, NotificationSsePayload, NotificationSseValue, OSS_BASE_FEATURES, type OutlineNode, PROMPT_DEFINITIONS, PROVIDER_BADGE_STYLES, PROVIDER_CATEGORIES, PROVIDER_CATEGORY_VALUES, PRO_FEATURES, type ParsedUA, type PermissionLevel, type PermissionsService, type PlanFeatures, PlanFeaturesSchema, type PlanInfo, type PluginContributions, type PluginDefinition, type PluginRouteContext, type PortalSessionParams, type PrismaContribution, type PrismaSeam, type ProEdition, type ProFeature, type ProModule, type ProServiceMap, type ProfileDefinition, PromptDefinition, PromptSection, PromptVariableDef, PromptVariableDefDTO, type PrototypeComponentConfig, ProviderCategory, type QueryFactoryMap, RESOURCE_KEYS, type RealtimeTransport, type RefDisplay, type Reference, type ReferenceDisplayFn, type ResizeDirection, type ResizeMode, type ResolveResult, type ResolvedRef, type ResourceKey, type ResourceMeta, ResourceRegistry, type ResourceSnapshot, type ResourceSnapshots, type RoleDefinition, type RouteContribution, SEED_AI_PROVIDERS, type SearchParams, type SearchResult$1 as SearchResult, type SeatCheckResult, type SeatUpdateParams, SeatsExceededError, type ServerSeam, type SettingsTabContribution, type ShapeType, type SsoProvider, type SsoService, type SubscriptionInfo, SyncDependencyResult, SystemPromptSectionDTO, SystemPromptTemplateDTO, SystemPromptVersionDTO, TIPTAP_ACTION_INSTRUCTIONS, type TemplatesService, ThirdPartyDependencyRow, type UiSlotContributions, UnknownPromptVariableError, UnreadSnapshotPayload, UpdateDependencyInput, VIRTUALIZE_THRESHOLD, type VersionHistoryService, VersionStatus, WebhookSignatureError, definePlugin, defineProfile, dumpModules, formatParsedUA, generateAssemblyCode, generateAssemblyFiles, getClientIp, getPromptDefinition, getServerSeam, interpolateTemplate, isInDndWindow, isOssFeature, isResourceDefined, listPromptDefinitions, moduleRegistry, normalizeCategoryFrequencies, normalizeEmailCategories, parseProfileImports, parseUserAgent, promptDefinitionKeys, registerPrismaSeam, registerServerSeam, resolveImportSpecifiers, resolveIpLocation, resolvePluginOrder };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allbluecn/kernel",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "description": "AllBlue 插件协议:类型定义 + 构建期装配器(零运行时)",