@allbluecn/kernel 0.6.1 → 0.9.0

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.
package/dist/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { G as generateAssemblyFiles, J as resolvePluginOrder, K as parseProfileImports, U as dumpModules, W as generateAssemblyCode } from "./src-Bw3ZToQn.js";
2
+ import { $ as resolvePluginOrder, J as dumpModules, X as generateAssemblyFiles, Y as generateAssemblyCode, Z as parseProfileImports } from "./src-uNL2aozQ.js";
3
3
  import { parseArgs } from "node:util";
4
4
  import { pathToFileURL } from "node:url";
5
5
  import { dirname, relative, resolve } from "node:path";
@@ -0,0 +1,7 @@
1
+ //#region src/contract/infrastructure/crypto.d.ts
2
+ /** 格式:v1.<iv-b64url>.<cipher-b64url>.<tag-b64url> */
3
+ declare function encryptSecret(plain: string): string;
4
+ declare function decryptSecret(payload: string | null | undefined): string | null;
5
+ declare function maskSecret(plain: string): string;
6
+ //#endregion
7
+ export { decryptSecret, encryptSecret, maskSecret };
@@ -0,0 +1,40 @@
1
+ import { createCipheriv, createDecipheriv, pbkdf2Sync, randomBytes } from "node:crypto";
2
+ //#region src/contract/infrastructure/crypto.ts
3
+ const KDF_SALT = "allblue-email-crypto-v1";
4
+ const KDF_ITERATIONS = 1e5;
5
+ const KEY_BYTES = 32;
6
+ const ALGO = "aes-256-gcm";
7
+ const IV_BYTES = 12;
8
+ const VERSION = "v1";
9
+ let cachedKey = null;
10
+ function deriveKey() {
11
+ if (cachedKey) return cachedKey;
12
+ const secret = process.env.AUTH_SECRET ?? "dev-only-secret";
13
+ cachedKey = pbkdf2Sync(secret, KDF_SALT, KDF_ITERATIONS, KEY_BYTES, "sha256");
14
+ return cachedKey;
15
+ }
16
+ /** 格式:v1.<iv-b64url>.<cipher-b64url>.<tag-b64url> */
17
+ function encryptSecret(plain) {
18
+ const iv = randomBytes(IV_BYTES);
19
+ const cipher = createCipheriv(ALGO, deriveKey(), iv);
20
+ const enc = Buffer.concat([cipher.update(plain, "utf8"), cipher.final()]);
21
+ const tag = cipher.getAuthTag();
22
+ return `${VERSION}.${iv.toString("base64url")}.${enc.toString("base64url")}.${tag.toString("base64url")}`;
23
+ }
24
+ function decryptSecret(payload) {
25
+ if (!payload) return null;
26
+ try {
27
+ const [v, ivS, dataS, tagS] = payload.split(".");
28
+ if (v !== VERSION || !ivS || !dataS || !tagS) return null;
29
+ const decipher = createDecipheriv(ALGO, deriveKey(), Buffer.from(ivS, "base64url"));
30
+ decipher.setAuthTag(Buffer.from(tagS, "base64url"));
31
+ return Buffer.concat([decipher.update(Buffer.from(dataS, "base64url")), decipher.final()]).toString("utf8");
32
+ } catch {
33
+ return null;
34
+ }
35
+ }
36
+ function maskSecret(plain) {
37
+ return plain.length <= 4 ? "••••" : `••••${plain.slice(-4)}`;
38
+ }
39
+ //#endregion
40
+ export { decryptSecret, encryptSecret, maskSecret };
package/dist/index.d.ts CHANGED
@@ -620,8 +620,10 @@ declare const LOAD_MORE_STEP = 200;
620
620
  declare const DND_STICKY_THRESHOLD = 500;
621
621
  //#endregion
622
622
  //#region src/contract/modules/ai-providers/types.d.ts
623
- type AdapterKind = 'openai' | 'anthropic' | 'gemini' | 'groq' | 'grok' | 'openrouter' | 'ollama' | 'openai-compatible';
624
- type ProviderCategory = 'recommended' | 'popular' | 'local';
623
+ type AdapterKind = 'openai' | 'anthropic' | 'gemini' | 'groq' | 'grok' | 'openrouter' | 'ollama' | 'openai-compatible' | 'mistral' | 'bedrock' | 'byteplus' | 'fal' |
624
+ /** harness 型 provider(需沙箱上下文,不走 createProviderAdapter 普通路径) */
625
+ 'harness-claude-code' | 'harness-codex' | 'harness-acp' | 'harness-opencode';
626
+ type ProviderCategory = 'recommended' | 'popular' | 'local' | 'harness' | 'hosted';
625
627
  type ModelCapability = 'text' | 'vision' | 'tools' | 'reasoning' | 'audio';
626
628
  interface AiModelMeta {
627
629
  /** 模型 ID(传给 adapter 的 model 字符串) */
@@ -676,6 +678,9 @@ interface AiProviderRow extends AiProviderMeta {
676
678
  createdAt: string;
677
679
  updatedAt: string;
678
680
  }
681
+ /** 模型来源模式:平台托管 / 本地 Agent / 使用自己的 Key */
682
+ type AiSourceMode = 'hosted' | 'local-agent' | 'byok';
683
+ declare const AI_SOURCE_MODES: readonly ['hosted', 'local-agent', 'byok'];
679
684
  /** 卡片角标的预设颜色(按文案匹配),admin 也可自由输入文案 */
680
685
  declare const PROVIDER_BADGE_STYLES: Record<string, string>;
681
686
  //#endregion
@@ -714,6 +719,44 @@ declare const LOBE_ICON_MAP: Record<string, string>;
714
719
  /** 10 个最受欢迎 AI 服务商的种子数据,admin 可在其基础上增删改 */
715
720
  declare const SEED_AI_PROVIDERS: AiProviderMeta[];
716
721
  //#endregion
722
+ //#region src/contract/modules/ai-prompts/types.d.ts
723
+ interface SystemPromptSectionDTO {
724
+ id: string;
725
+ order: number;
726
+ template: string;
727
+ }
728
+ interface PromptVariableDefDTO {
729
+ name: string;
730
+ description: string;
731
+ }
732
+ interface SystemPromptTemplateDTO {
733
+ id: string;
734
+ key: string;
735
+ name: string;
736
+ description: string | null;
737
+ sections: SystemPromptSectionDTO[];
738
+ variables: PromptVariableDefDTO[];
739
+ version: number;
740
+ isActive: boolean;
741
+ isProtected: boolean;
742
+ updatedAt: string;
743
+ }
744
+ interface SystemPromptVersionDTO {
745
+ id: string;
746
+ version: number;
747
+ sections: SystemPromptSectionDTO[];
748
+ note: string | null;
749
+ createdBy: string | null;
750
+ createdAt: string;
751
+ }
752
+ //#endregion
753
+ //#region src/contract/modules/ai-prompts/interpolate.d.ts
754
+ declare class UnknownPromptVariableError extends Error {
755
+ readonly variable: string;
756
+ constructor(variable: string);
757
+ }
758
+ declare function interpolateTemplate(template: string, vars: Record<string, string>): string;
759
+ //#endregion
717
760
  //#region src/contract/modules/dependencies/index.d.ts
718
761
  /** 依赖分类 */
719
762
  type DependencyCategory = 'framework' | 'ui' | 'editor' | 'ai' | 'state' | 'auth' | 'tool' | 'other';
@@ -1007,6 +1050,19 @@ declare const FeatureRegistry: {
1007
1050
  readonly tier: 'paid';
1008
1051
  readonly module: null;
1009
1052
  };
1053
+ /** 沙箱执行(P3)。module 为 null:沙箱是开源代码自带的平台能力,仅权益门控——
1054
+ * 因此 OSS 部署得到的是 FeatureForbiddenError 而非 FeatureUnavailableError。
1055
+ * desktop 部署无订阅体系,走 requireFeature 内的点式直放分支。 */
1056
+ readonly sandboxExecution: {
1057
+ readonly tier: 'paid';
1058
+ readonly module: null;
1059
+ };
1060
+ /** 媒体生成(P4c)。module 为 null:媒体生成是开源代码自带的平台能力(TanStack AI adapter 调用),
1061
+ * 仅权益门控。OSS 部署得到 FeatureForbiddenError,desktop BYOK 场景豁免。 */
1062
+ readonly mediaGeneration: {
1063
+ readonly tier: 'paid';
1064
+ readonly module: null;
1065
+ };
1010
1066
  };
1011
1067
  type FeatureKey = keyof typeof FeatureRegistry;
1012
1068
  declare const FEATURE_KEYS: FeatureKey[];
@@ -1026,7 +1082,9 @@ declare const PlanFeaturesSchema: z.ZodRecord<z.ZodEnum<{
1026
1082
  globalSearch: "globalSearch";
1027
1083
  hostedAi: "hostedAi";
1028
1084
  largePageSize: "largePageSize";
1085
+ mediaGeneration: "mediaGeneration";
1029
1086
  multiProvider: "multiProvider";
1087
+ sandboxExecution: "sandboxExecution";
1030
1088
  sso: "sso";
1031
1089
  templates: "templates";
1032
1090
  versionHistory: "versionHistory";
@@ -1081,6 +1139,30 @@ declare const ResourceRegistry: {
1081
1139
  readonly purchasable: false;
1082
1140
  readonly step: 1;
1083
1141
  };
1142
+ /** 沙箱执行时长配额(P3)。按 AiUsageLog.activity='sandbox' 的 durationMs 汇总,
1143
+ * 分钟粒度向上取整;null 限额 = 不限量。purchasable false:不可加购,只能升档。 */
1144
+ readonly sandboxMinutesMonthly: {
1145
+ readonly tier: 'paid';
1146
+ readonly unit: 'minutes/month';
1147
+ readonly purchasable: false;
1148
+ readonly step: 1;
1149
+ };
1150
+ /** 媒体生成次数配额(P4c)。按 AiUsageLog.activity IN (image, video, speech, transcription) 本月 count 汇总;
1151
+ * null 限额 = 不限量。purchasable false:不可加购,只能升档。 */
1152
+ readonly mediaGenerationsMonthly: {
1153
+ readonly tier: 'paid';
1154
+ readonly unit: 'generations/month';
1155
+ readonly purchasable: false;
1156
+ readonly step: 1;
1157
+ };
1158
+ /** 画廊存储配额(P4c)。按 GenerationRun.artifacts 持久化的 blob size 汇总(MB);
1159
+ * null 限额 = 不限量。purchasable false:不可加购,只能升档。 */
1160
+ readonly galleryStorageMb: {
1161
+ readonly tier: 'paid';
1162
+ readonly unit: 'MB';
1163
+ readonly purchasable: false;
1164
+ readonly step: 1;
1165
+ };
1084
1166
  };
1085
1167
  type ResourceKey = keyof typeof ResourceRegistry;
1086
1168
  declare const RESOURCE_KEYS: ResourceKey[];
@@ -1126,8 +1208,11 @@ interface NotificationListResult {
1126
1208
  }
1127
1209
  /** 每类别投递频率(off = 关闭;旧版布尔值在读取时经 normalizeCategoryFrequencies 迁移) */
1128
1210
  type CategoryFrequencies = Record<NotificationCategory, NotificationFrequency>;
1211
+ /** 每类别邮件渠道开关(站内频率独立;镜像仅 realtime 频率送达) */
1212
+ type CategoryEmailFlags = Record<NotificationCategory, boolean>;
1129
1213
  interface NotificationPreferences {
1130
1214
  categories: CategoryFrequencies;
1215
+ emailCategories: CategoryEmailFlags;
1131
1216
  dndEnabled: boolean;
1132
1217
  dndStart: string;
1133
1218
  dndEnd: string;
@@ -1145,12 +1230,19 @@ type NotificationSseValue = NotificationSsePayload | UnreadSnapshotPayload;
1145
1230
  //#endregion
1146
1231
  //#region src/contract/modules/notifications/index.d.ts
1147
1232
  declare const DEFAULT_CATEGORIES: CategoryFrequencies;
1233
+ declare const DEFAULT_EMAIL_CATEGORIES: CategoryEmailFlags;
1148
1234
  /**
1149
1235
  * 归一化存储中的 categories 字段。
1150
1236
  * 存量数据为旧版布尔记录(true/false),读取时迁移为 frequency:
1151
1237
  * true → realtime,false → off;未知值回退默认 realtime。
1152
1238
  */
1153
1239
  declare function normalizeCategoryFrequencies(raw: unknown): CategoryFrequencies;
1240
+ /**
1241
+ * 归一化存储中的 emailCategories 字段。
1242
+ * 旧用户数据缺失该字段(undefined / null)返回全默认;
1243
+ * 部分缺失(只有部分 key)或缺失值非布尔(类型错误)时,该 key 用默认值。
1244
+ */
1245
+ declare function normalizeEmailCategories(raw: unknown): CategoryEmailFlags;
1154
1246
  declare function isInDndWindow(prefs: Pick<NotificationPreferences, 'dndEnabled' | 'dndStart' | 'dndEnd'>, now: string): boolean;
1155
1247
  //#endregion
1156
1248
  //#region src/contract/modules/registry.d.ts
@@ -1277,4 +1369,4 @@ declare const ICON_MAP: Record<string, React.ComponentType<{
1277
1369
  className?: string;
1278
1370
  }>>;
1279
1371
  //#endregion
1280
- export { ADAPTER_KINDS, ADAPTER_KIND_VALUES, type AICommandContext, type AICommandDef, type AICommandHandler, type AICommandResult, type ActivationResult, AdapterKind, type AiAdapter, AiModelMeta, AiProviderMeta, AiProviderRow, type AiQuota, 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, CategoryFrequencies, type CheckoutParams, type ComplianceJobSummary, type ComplianceService, type ComponentCategory, type ComponentSource, type CustomDashboard, DEFAULT_CATEGORIES, DEFAULT_WATCHED_DEPENDENCIES, DEPENDENCY_CATEGORIES, DEPENDENCY_PRIORITIES, DEVICE_SIZES, DND_STICKY_THRESHOLD, DependencyCategory, DependencyPriority, DependencySeed, DependencyUsage, 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 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, type PRD, type PRDDetail, type PRDVersionWithPages, type PRDVersionWithSemver, PROVIDER_BADGE_STYLES, PROVIDER_CATEGORIES, PROVIDER_CATEGORY_VALUES, 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, 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, type SeatCheckResult, SeatsExceededError, type ServerSeam, type SettingsTabContribution, type ShapeType, type SsoProvider, type SsoService, type SubscriptionInfo, SyncDependencyResult, type TemplatesService, ThirdPartyDependencyRow, type UiSlotContributions, UnreadSnapshotPayload, UpdateDependencyInput, VIRTUALIZE_THRESHOLD, type VersionHistoryService, VersionStatus, WebhookSignatureError, definePlugin, defineProfile, dumpModules, formatParsedUA, generateAssemblyCode, generateAssemblyFiles, getClientIp, getServerSeam, isInDndWindow, isOssFeature, isResourceDefined, moduleRegistry, normalizeCategoryFrequencies, parseProfileImports, parseUserAgent, registerPrismaSeam, registerServerSeam, resolveImportSpecifiers, resolveIpLocation, resolvePluginOrder };
1372
+ 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 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 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, type PRD, type PRDDetail, type PRDVersionWithPages, type PRDVersionWithSemver, PROVIDER_BADGE_STYLES, PROVIDER_CATEGORIES, PROVIDER_CATEGORY_VALUES, 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, 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, type SeatCheckResult, SeatsExceededError, type ServerSeam, type SettingsTabContribution, type ShapeType, type SsoProvider, type SsoService, type SubscriptionInfo, SyncDependencyResult, SystemPromptSectionDTO, SystemPromptTemplateDTO, SystemPromptVersionDTO, type TemplatesService, ThirdPartyDependencyRow, type UiSlotContributions, UnknownPromptVariableError, UnreadSnapshotPayload, UpdateDependencyInput, VIRTUALIZE_THRESHOLD, type VersionHistoryService, VersionStatus, WebhookSignatureError, definePlugin, defineProfile, dumpModules, formatParsedUA, generateAssemblyCode, generateAssemblyFiles, getClientIp, getServerSeam, interpolateTemplate, isInDndWindow, isOssFeature, isResourceDefined, moduleRegistry, normalizeCategoryFrequencies, normalizeEmailCategories, parseProfileImports, parseUserAgent, registerPrismaSeam, registerServerSeam, resolveImportSpecifiers, resolveIpLocation, resolvePluginOrder };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as PROVIDER_CATEGORIES, B as BillingUnavailableError, C as DEPENDENCY_PRIORITIES, D as LOBE_ICON_MAP, E as ADAPTER_KIND_VALUES, F as VIRTUALIZE_THRESHOLD, G as generateAssemblyFiles, H as WebhookSignatureError, I as getServerSeam, J as resolvePluginOrder, K as parseProfileImports, L as registerPrismaSeam, M as PROVIDER_BADGE_STYLES, N as DND_STICKY_THRESHOLD, O as MODEL_CAPABILITY_OPTIONS, P as LOAD_MORE_STEP, R as registerServerSeam, S as DEPENDENCY_CATEGORIES, T as ADAPTER_KINDS, U as dumpModules, V as SeatsExceededError, W as generateAssemblyCode, X as definePlugin, Y as defineProfile, _ as formatParsedUA, a as isInDndWindow, b as resolveIpLocation, c as NOTIFICATION_FREQUENCIES, d as isResourceDefined, f as PlanFeaturesSchema, g as isOssFeature, h as OSS_BASE_FEATURES, i as DEFAULT_CATEGORIES, j as PROVIDER_CATEGORY_VALUES, k as MODEL_TABS, l as RESOURCE_KEYS, m as FeatureRegistry, n as DEVICE_SIZES, o as normalizeCategoryFrequencies, p as FEATURE_KEYS, q as resolveImportSpecifiers, r as moduleRegistry, s as NOTIFICATION_CATEGORIES, t as ICON_MAP, u as ResourceRegistry, v as parseUserAgent, w as SEED_AI_PROVIDERS, x as DEFAULT_WATCHED_DEPENDENCIES, y as getClientIp, z as HostedAiError } from "./src-Bw3ZToQn.js";
2
- export { ADAPTER_KINDS, ADAPTER_KIND_VALUES, BillingUnavailableError, DEFAULT_CATEGORIES, DEFAULT_WATCHED_DEPENDENCIES, DEPENDENCY_CATEGORIES, DEPENDENCY_PRIORITIES, DEVICE_SIZES, DND_STICKY_THRESHOLD, FEATURE_KEYS, FeatureRegistry, HostedAiError, ICON_MAP, LOAD_MORE_STEP, LOBE_ICON_MAP, MODEL_CAPABILITY_OPTIONS, MODEL_TABS, NOTIFICATION_CATEGORIES, NOTIFICATION_FREQUENCIES, OSS_BASE_FEATURES, PROVIDER_BADGE_STYLES, PROVIDER_CATEGORIES, PROVIDER_CATEGORY_VALUES, PlanFeaturesSchema, RESOURCE_KEYS, ResourceRegistry, SEED_AI_PROVIDERS, SeatsExceededError, VIRTUALIZE_THRESHOLD, WebhookSignatureError, definePlugin, defineProfile, dumpModules, formatParsedUA, generateAssemblyCode, generateAssemblyFiles, getClientIp, getServerSeam, isInDndWindow, isOssFeature, isResourceDefined, moduleRegistry, normalizeCategoryFrequencies, parseProfileImports, parseUserAgent, registerPrismaSeam, registerServerSeam, resolveImportSpecifiers, resolveIpLocation, resolvePluginOrder };
1
+ import { $ as resolvePluginOrder, A as ADAPTER_KIND_VALUES, B as VIRTUALIZE_THRESHOLD, C as DEFAULT_WATCHED_DEPENDENCIES, D as interpolateTemplate, E as UnknownPromptVariableError, F as PROVIDER_CATEGORY_VALUES, G as BillingUnavailableError, H as registerPrismaSeam, I as AI_SOURCE_MODES, J as dumpModules, K as SeatsExceededError, L as PROVIDER_BADGE_STYLES, M as MODEL_CAPABILITY_OPTIONS, N as MODEL_TABS, O as SEED_AI_PROVIDERS, P as PROVIDER_CATEGORIES, Q as resolveImportSpecifiers, R as DND_STICKY_THRESHOLD, S as resolveIpLocation, T as DEPENDENCY_PRIORITIES, U as registerServerSeam, V as getServerSeam, W as HostedAiError, X as generateAssemblyFiles, Y as generateAssemblyCode, Z as parseProfileImports, _ as OSS_BASE_FEATURES, a as DEFAULT_EMAIL_CATEGORIES, b as parseUserAgent, c as normalizeEmailCategories, d as RESOURCE_KEYS, et as defineProfile, f as ResourceRegistry, g as FeatureRegistry, h as FEATURE_KEYS, i as DEFAULT_CATEGORIES, j as LOBE_ICON_MAP, k as ADAPTER_KINDS, l as NOTIFICATION_CATEGORIES, m as PlanFeaturesSchema, n as DEVICE_SIZES, o as isInDndWindow, p as isResourceDefined, q as WebhookSignatureError, r as moduleRegistry, s as normalizeCategoryFrequencies, t as ICON_MAP, tt as definePlugin, u as NOTIFICATION_FREQUENCIES, v as isOssFeature, w as DEPENDENCY_CATEGORIES, x as getClientIp, y as formatParsedUA, z as LOAD_MORE_STEP } from "./src-uNL2aozQ.js";
2
+ export { ADAPTER_KINDS, ADAPTER_KIND_VALUES, AI_SOURCE_MODES, BillingUnavailableError, DEFAULT_CATEGORIES, DEFAULT_EMAIL_CATEGORIES, DEFAULT_WATCHED_DEPENDENCIES, DEPENDENCY_CATEGORIES, DEPENDENCY_PRIORITIES, DEVICE_SIZES, DND_STICKY_THRESHOLD, FEATURE_KEYS, FeatureRegistry, HostedAiError, ICON_MAP, LOAD_MORE_STEP, LOBE_ICON_MAP, MODEL_CAPABILITY_OPTIONS, MODEL_TABS, NOTIFICATION_CATEGORIES, NOTIFICATION_FREQUENCIES, OSS_BASE_FEATURES, PROVIDER_BADGE_STYLES, PROVIDER_CATEGORIES, PROVIDER_CATEGORY_VALUES, PlanFeaturesSchema, RESOURCE_KEYS, ResourceRegistry, SEED_AI_PROVIDERS, SeatsExceededError, UnknownPromptVariableError, VIRTUALIZE_THRESHOLD, WebhookSignatureError, definePlugin, defineProfile, dumpModules, formatParsedUA, generateAssemblyCode, generateAssemblyFiles, getClientIp, getServerSeam, interpolateTemplate, isInDndWindow, isOssFeature, isResourceDefined, moduleRegistry, normalizeCategoryFrequencies, normalizeEmailCategories, parseProfileImports, parseUserAgent, registerPrismaSeam, registerServerSeam, resolveImportSpecifiers, resolveIpLocation, resolvePluginOrder };
@@ -323,12 +323,18 @@ const LOAD_MORE_STEP = 200;
323
323
  const DND_STICKY_THRESHOLD = 500;
324
324
  //#endregion
325
325
  //#region src/contract/modules/ai-providers/types.ts
326
+ const AI_SOURCE_MODES = [
327
+ "hosted",
328
+ "local-agent",
329
+ "byok"
330
+ ];
326
331
  /** 卡片角标的预设颜色(按文案匹配),admin 也可自由输入文案 */
327
332
  const PROVIDER_BADGE_STYLES = {
328
333
  推荐: "bg-primary/10 text-primary border-primary/30",
329
334
  热门: "bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/30",
330
335
  NEW: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/30",
331
- 本地: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/30"
336
+ 本地: "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/30",
337
+ 免费: "bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/30"
332
338
  };
333
339
  //#endregion
334
340
  //#region src/contract/modules/ai-providers/constants.ts
@@ -372,6 +378,26 @@ const ADAPTER_KINDS = [
372
378
  value: "openai-compatible",
373
379
  label: "OpenAI 兼容",
374
380
  description: "DeepSeek/Moonshot/Mistral 等兼容协议"
381
+ },
382
+ {
383
+ value: "mistral",
384
+ label: "Mistral 官方",
385
+ description: "Mistral 自有协议,含 Magistral 推理模型"
386
+ },
387
+ {
388
+ value: "bedrock",
389
+ label: "Amazon Bedrock",
390
+ description: "AWS Bedrock Converse,支持 Bearer Key 与 SigV4"
391
+ },
392
+ {
393
+ value: "byteplus",
394
+ label: "BytePlus ModelArk",
395
+ description: "字节跳动 ModelArk,含 Seed LLM / Seedance / Seedream / Seed Speech"
396
+ },
397
+ {
398
+ value: "fal",
399
+ label: "fal.ai",
400
+ description: "fal.ai 聚合平台,image / video / audio / speech"
375
401
  }
376
402
  ];
377
403
  const PROVIDER_CATEGORIES = [
@@ -451,10 +477,15 @@ const LOBE_ICON_MAP = {
451
477
  xai: "XAI",
452
478
  openrouter: "OpenRouter",
453
479
  mistral: "Mistral",
480
+ bedrock: "Bedrock",
481
+ byteplus: "Volcengine",
454
482
  ollama: "Ollama",
455
483
  moonshot: "Moonshot",
456
484
  sensenova: "SenseNova",
457
- agnes: "AgnesAI"
485
+ agnes: "AgnesAI",
486
+ "harness-claude-code": "ClaudeCode",
487
+ "harness-codex": "Codex",
488
+ "harness-opencode": "OpenCode"
458
489
  };
459
490
  //#endregion
460
491
  //#region src/contract/modules/ai-providers/seed-data.ts
@@ -768,33 +799,233 @@ const SEED_AI_PROVIDERS = [
768
799
  providerId: "mistral",
769
800
  displayName: "Mistral AI",
770
801
  brandName: "Mistral",
771
- description: "欧洲开源大模型,擅长多语言与代码",
802
+ description: "欧洲开源大模型,擅长多语言与代码,Magistral 支持推理链路",
772
803
  category: "popular",
773
804
  iconSlug: "mistralai",
774
805
  brandColor: "#FF7000",
775
806
  badge: "热门",
776
- adapterKind: "openai-compatible",
807
+ adapterKind: "mistral",
777
808
  defaultBaseUrl: "https://api.mistral.ai/v1",
778
809
  keyUrl: "https://console.mistral.ai/api-keys",
779
810
  docsUrl: "https://docs.mistral.ai",
780
811
  keyPlaceholder: "...",
781
- models: [{
782
- id: "mistral-large-latest",
783
- displayName: "Mistral Large",
784
- contextWindow: 128e3,
785
- capabilities: [
786
- "text",
787
- "vision",
788
- "tools"
789
- ],
790
- defaultEnabled: true
791
- }, {
792
- id: "mistral-small-latest",
793
- displayName: "Mistral Small",
794
- contextWindow: 32e3,
795
- capabilities: ["text", "tools"],
796
- defaultEnabled: true
797
- }]
812
+ models: [
813
+ {
814
+ id: "mistral-large-latest",
815
+ displayName: "Mistral Large",
816
+ contextWindow: 128e3,
817
+ capabilities: [
818
+ "text",
819
+ "vision",
820
+ "tools"
821
+ ],
822
+ defaultEnabled: true
823
+ },
824
+ {
825
+ id: "mistral-small-latest",
826
+ displayName: "Mistral Small",
827
+ contextWindow: 32e3,
828
+ capabilities: ["text", "tools"],
829
+ defaultEnabled: true
830
+ },
831
+ {
832
+ id: "codestral-latest",
833
+ displayName: "Codestral",
834
+ contextWindow: 256e3,
835
+ capabilities: ["text", "tools"]
836
+ },
837
+ {
838
+ id: "pixtral-large-latest",
839
+ displayName: "Pixtral Large",
840
+ contextWindow: 128e3,
841
+ capabilities: [
842
+ "text",
843
+ "vision",
844
+ "tools"
845
+ ]
846
+ },
847
+ {
848
+ id: "magistral-medium-latest",
849
+ displayName: "Magistral Medium",
850
+ contextWindow: 128e3,
851
+ capabilities: [
852
+ "text",
853
+ "reasoning",
854
+ "tools"
855
+ ]
856
+ }
857
+ ]
858
+ },
859
+ {
860
+ providerId: "byteplus",
861
+ displayName: "BytePlus ModelArk",
862
+ brandName: "BytePlus",
863
+ description: "字节跳动 ModelArk,含 Seed LLM 大模型、Seedream 图像、Seedance 视频、Seed Speech 语音",
864
+ category: "popular",
865
+ iconSlug: "volcengine",
866
+ brandColor: "#FF4500",
867
+ badge: "热门",
868
+ adapterKind: "byteplus",
869
+ defaultBaseUrl: "https://ark.cn-beijing.volces.com/api/v3",
870
+ keyUrl: "https://console.volcengine.com/ark",
871
+ docsUrl: "https://www.volcengine.com/docs/82379",
872
+ keyPlaceholder: "ark-...",
873
+ models: [
874
+ {
875
+ id: "dola-seed-2-1-turbo-260628",
876
+ displayName: "Dola Seed 2.1 Turbo",
877
+ contextWindow: 2e5,
878
+ capabilities: [
879
+ "text",
880
+ "vision",
881
+ "tools",
882
+ "reasoning"
883
+ ],
884
+ defaultEnabled: true
885
+ },
886
+ {
887
+ id: "seed-2-0-pro-260328",
888
+ displayName: "Seed 2.0 Pro",
889
+ contextWindow: 2e5,
890
+ capabilities: [
891
+ "text",
892
+ "vision",
893
+ "tools",
894
+ "reasoning"
895
+ ],
896
+ defaultEnabled: true
897
+ },
898
+ {
899
+ id: "seed-2-0-lite-260428",
900
+ displayName: "Seed 2.0 Lite",
901
+ contextWindow: 2e5,
902
+ capabilities: [
903
+ "text",
904
+ "vision",
905
+ "tools",
906
+ "reasoning"
907
+ ]
908
+ },
909
+ {
910
+ id: "seed-2-0-mini-260428",
911
+ displayName: "Seed 2.0 Mini",
912
+ contextWindow: 2e5,
913
+ capabilities: [
914
+ "text",
915
+ "vision",
916
+ "tools",
917
+ "reasoning"
918
+ ]
919
+ },
920
+ {
921
+ id: "seed-2-0-code-preview-260328",
922
+ displayName: "Seed 2.0 Code Preview",
923
+ contextWindow: 2e5,
924
+ capabilities: ["text", "tools"]
925
+ },
926
+ {
927
+ id: "glm-5-2-260617",
928
+ displayName: "GLM 5.2",
929
+ contextWindow: 2e5,
930
+ capabilities: ["text", "tools"]
931
+ },
932
+ {
933
+ id: "deepseek-v4-pro-260425",
934
+ displayName: "DeepSeek V4 Pro",
935
+ contextWindow: 2e5,
936
+ capabilities: ["text", "tools"]
937
+ },
938
+ {
939
+ id: "seedream-5-0-260128",
940
+ displayName: "Seedream 5.0",
941
+ contextWindow: 4e3,
942
+ capabilities: ["text"]
943
+ },
944
+ {
945
+ id: "seedream-4-5-251128",
946
+ displayName: "Seedream 4.5",
947
+ contextWindow: 4e3,
948
+ capabilities: ["text"]
949
+ },
950
+ {
951
+ id: "seedance-1-5-pro-251215",
952
+ displayName: "Seedance 1.5 Pro",
953
+ contextWindow: 4e3,
954
+ capabilities: ["text"]
955
+ },
956
+ {
957
+ id: "seed-audio-1.0",
958
+ displayName: "Seed Audio 1.0",
959
+ contextWindow: 4e3,
960
+ capabilities: ["audio"]
961
+ },
962
+ {
963
+ id: "seed-asr",
964
+ displayName: "Seed ASR",
965
+ contextWindow: 4e3,
966
+ capabilities: ["audio"]
967
+ }
968
+ ]
969
+ },
970
+ {
971
+ providerId: "bedrock",
972
+ displayName: "Amazon Bedrock",
973
+ brandName: "Bedrock",
974
+ description: "AWS 托管多模型网关,支持 Bedrock Bearer Key 或 SigV4 凭据链",
975
+ category: "popular",
976
+ iconSlug: "aws",
977
+ brandColor: "#FF9900",
978
+ badge: "热门",
979
+ adapterKind: "bedrock",
980
+ keyUrl: "https://console.aws.amazon.com/bedrock",
981
+ docsUrl: "https://docs.aws.amazon.com/bedrock",
982
+ keyPlaceholder: "AKIA...",
983
+ models: [
984
+ {
985
+ id: "us.anthropic.claude-sonnet-4-5-20250929-v1:0",
986
+ displayName: "Claude Sonnet 4.5",
987
+ contextWindow: 2e5,
988
+ capabilities: [
989
+ "text",
990
+ "vision",
991
+ "tools",
992
+ "reasoning"
993
+ ],
994
+ defaultEnabled: true
995
+ },
996
+ {
997
+ id: "us.anthropic.claude-haiku-4-5-20251001-v1:0",
998
+ displayName: "Claude Haiku 4.5",
999
+ contextWindow: 2e5,
1000
+ capabilities: [
1001
+ "text",
1002
+ "vision",
1003
+ "tools"
1004
+ ]
1005
+ },
1006
+ {
1007
+ id: "us.amazon.nova-pro-v1:0",
1008
+ displayName: "Nova Pro",
1009
+ contextWindow: 3e5,
1010
+ capabilities: [
1011
+ "text",
1012
+ "vision",
1013
+ "tools",
1014
+ "reasoning"
1015
+ ],
1016
+ defaultEnabled: true
1017
+ },
1018
+ {
1019
+ id: "us.amazon.nova-lite-v1:0",
1020
+ displayName: "Nova Lite",
1021
+ contextWindow: 3e5,
1022
+ capabilities: [
1023
+ "text",
1024
+ "vision",
1025
+ "tools"
1026
+ ]
1027
+ }
1028
+ ]
798
1029
  },
799
1030
  {
800
1031
  providerId: "moonshot",
@@ -832,7 +1063,7 @@ const SEED_AI_PROVIDERS = [
832
1063
  category: "popular",
833
1064
  iconSlug: "sensenova",
834
1065
  brandColor: "#6B4EFF",
835
- badge: "热门",
1066
+ badge: "免费",
836
1067
  adapterKind: "openai-compatible",
837
1068
  defaultBaseUrl: "https://token.sensenova.cn/v1",
838
1069
  keyUrl: "https://platform.sensenova.cn/console/keys",
@@ -876,7 +1107,7 @@ const SEED_AI_PROVIDERS = [
876
1107
  category: "popular",
877
1108
  iconSlug: "agnesai",
878
1109
  brandColor: "#7C3AED",
879
- badge: "NEW",
1110
+ badge: "免费",
880
1111
  adapterKind: "openai-compatible",
881
1112
  defaultBaseUrl: "https://apihub.agnes-ai.com/v1",
882
1113
  keyUrl: "https://agnes-ai.com/api-keys",
@@ -955,9 +1186,127 @@ const SEED_AI_PROVIDERS = [
955
1186
  capabilities: ["text", "reasoning"]
956
1187
  }
957
1188
  ]
1189
+ },
1190
+ {
1191
+ providerId: "harness-claude-code",
1192
+ displayName: "Claude Code(沙箱)",
1193
+ brandName: "Claude Code",
1194
+ description: "Anthropic Claude Code 命令行助手,在沙箱内自主运行,适合代码任务委派",
1195
+ category: "harness",
1196
+ iconSlug: "claude",
1197
+ brandColor: "#7C3AED",
1198
+ badge: "沙箱",
1199
+ adapterKind: "harness-claude-code",
1200
+ isLocal: false,
1201
+ models: [{
1202
+ id: "claude-sonnet-4-6",
1203
+ displayName: "Claude Sonnet 4.6",
1204
+ contextWindow: 2e5,
1205
+ capabilities: [
1206
+ "text",
1207
+ "tools",
1208
+ "reasoning"
1209
+ ],
1210
+ defaultEnabled: true
1211
+ }, {
1212
+ id: "claude-opus-4-8",
1213
+ displayName: "Claude Opus 4.8",
1214
+ contextWindow: 2e5,
1215
+ capabilities: [
1216
+ "text",
1217
+ "tools",
1218
+ "reasoning"
1219
+ ]
1220
+ }]
1221
+ },
1222
+ {
1223
+ providerId: "harness-codex",
1224
+ displayName: "Codex(沙箱)",
1225
+ brandName: "Codex",
1226
+ description: "OpenAI Codex 命令行助手,在沙箱内执行代码任务",
1227
+ category: "harness",
1228
+ iconSlug: "openai",
1229
+ brandColor: "#10A37F",
1230
+ badge: "沙箱",
1231
+ adapterKind: "harness-codex",
1232
+ isLocal: false,
1233
+ models: [{
1234
+ id: "gpt-5.1",
1235
+ displayName: "GPT-5.1",
1236
+ contextWindow: 1e6,
1237
+ capabilities: ["text", "tools"],
1238
+ defaultEnabled: true
1239
+ }, {
1240
+ id: "gpt-5.1-codex",
1241
+ displayName: "GPT-5.1 Codex",
1242
+ contextWindow: 1e6,
1243
+ capabilities: ["text", "tools"]
1244
+ }]
1245
+ },
1246
+ {
1247
+ providerId: "harness-acp",
1248
+ displayName: "ACP Harness(沙箱)",
1249
+ brandName: "ACP",
1250
+ description: "Agent Communication Protocol 通用 harness,支持任意 ACP 兼容服务端",
1251
+ category: "harness",
1252
+ iconSlug: "acp",
1253
+ brandColor: "#0EA5E9",
1254
+ badge: "沙箱",
1255
+ adapterKind: "harness-acp",
1256
+ isLocal: false,
1257
+ models: [{
1258
+ id: "acp-default",
1259
+ displayName: "ACP Default",
1260
+ contextWindow: 2e5,
1261
+ capabilities: ["text", "tools"],
1262
+ defaultEnabled: true
1263
+ }]
1264
+ },
1265
+ {
1266
+ providerId: "harness-opencode",
1267
+ displayName: "OpenCode(沙箱)",
1268
+ brandName: "OpenCode",
1269
+ description: "OpenCode 命令行助手,支持多 provider 路由,在沙箱内自主运行",
1270
+ category: "harness",
1271
+ iconSlug: "opencode",
1272
+ brandColor: "#6366F1",
1273
+ badge: "沙箱",
1274
+ adapterKind: "harness-opencode",
1275
+ isLocal: false,
1276
+ models: [{
1277
+ id: "anthropic/claude-sonnet-4-5",
1278
+ displayName: "Claude Sonnet 4.5",
1279
+ contextWindow: 2e5,
1280
+ capabilities: ["text", "tools"],
1281
+ defaultEnabled: true
1282
+ }, {
1283
+ id: "openai/gpt-5.1",
1284
+ displayName: "GPT-5.1",
1285
+ contextWindow: 1e6,
1286
+ capabilities: ["text", "tools"]
1287
+ }]
958
1288
  }
959
1289
  ];
960
1290
  //#endregion
1291
+ //#region src/contract/modules/ai-prompts/interpolate.ts
1292
+ var UnknownPromptVariableError = class extends Error {
1293
+ variable;
1294
+ constructor(variable) {
1295
+ super(`Unknown prompt variable "${variable}"`);
1296
+ this.name = "UnknownPromptVariableError";
1297
+ this.variable = variable;
1298
+ }
1299
+ };
1300
+ const TEMPLATE_VAR_RE = /\{\{\s*([^{}]+?)\s*\}\}/g;
1301
+ const VALID_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
1302
+ function interpolateTemplate(template, vars) {
1303
+ return template.replace(TEMPLATE_VAR_RE, (_match, rawName) => {
1304
+ const name = rawName.trim();
1305
+ if (!VALID_VAR_NAME_RE.test(name) || !(name in vars)) throw new UnknownPromptVariableError(name);
1306
+ return vars[name];
1307
+ });
1308
+ }
1309
+ //#endregion
961
1310
  //#region src/contract/modules/dependencies/index.ts
962
1311
  /** 依赖分类元信息 */
963
1312
  const DEPENDENCY_CATEGORIES = [
@@ -1463,6 +1812,19 @@ const FeatureRegistry = {
1463
1812
  customAgents: {
1464
1813
  tier: "paid",
1465
1814
  module: null
1815
+ },
1816
+ /** 沙箱执行(P3)。module 为 null:沙箱是开源代码自带的平台能力,仅权益门控——
1817
+ * 因此 OSS 部署得到的是 FeatureForbiddenError 而非 FeatureUnavailableError。
1818
+ * desktop 部署无订阅体系,走 requireFeature 内的点式直放分支。 */
1819
+ sandboxExecution: {
1820
+ tier: "paid",
1821
+ module: null
1822
+ },
1823
+ /** 媒体生成(P4c)。module 为 null:媒体生成是开源代码自带的平台能力(TanStack AI adapter 调用),
1824
+ * 仅权益门控。OSS 部署得到 FeatureForbiddenError,desktop BYOK 场景豁免。 */
1825
+ mediaGeneration: {
1826
+ tier: "paid",
1827
+ module: null
1466
1828
  }
1467
1829
  };
1468
1830
  const FEATURE_KEYS = Object.keys(FeatureRegistry);
@@ -1514,6 +1876,30 @@ const ResourceRegistry = {
1514
1876
  unit: "workspaces",
1515
1877
  purchasable: false,
1516
1878
  step: 1
1879
+ },
1880
+ /** 沙箱执行时长配额(P3)。按 AiUsageLog.activity='sandbox' 的 durationMs 汇总,
1881
+ * 分钟粒度向上取整;null 限额 = 不限量。purchasable false:不可加购,只能升档。 */
1882
+ sandboxMinutesMonthly: {
1883
+ tier: "paid",
1884
+ unit: "minutes/month",
1885
+ purchasable: false,
1886
+ step: 1
1887
+ },
1888
+ /** 媒体生成次数配额(P4c)。按 AiUsageLog.activity IN (image, video, speech, transcription) 本月 count 汇总;
1889
+ * null 限额 = 不限量。purchasable false:不可加购,只能升档。 */
1890
+ mediaGenerationsMonthly: {
1891
+ tier: "paid",
1892
+ unit: "generations/month",
1893
+ purchasable: false,
1894
+ step: 1
1895
+ },
1896
+ /** 画廊存储配额(P4c)。按 GenerationRun.artifacts 持久化的 blob size 汇总(MB);
1897
+ * null 限额 = 不限量。purchasable false:不可加购,只能升档。 */
1898
+ galleryStorageMb: {
1899
+ tier: "paid",
1900
+ unit: "MB",
1901
+ purchasable: false,
1902
+ step: 1
1517
1903
  }
1518
1904
  };
1519
1905
  const RESOURCE_KEYS = Object.keys(ResourceRegistry);
@@ -1544,6 +1930,13 @@ const DEFAULT_CATEGORIES = {
1544
1930
  billing: "realtime",
1545
1931
  security: "realtime"
1546
1932
  };
1933
+ const DEFAULT_EMAIL_CATEGORIES = {
1934
+ team: false,
1935
+ collaboration: false,
1936
+ system: false,
1937
+ billing: false,
1938
+ security: false
1939
+ };
1547
1940
  /**
1548
1941
  * 归一化存储中的 categories 字段。
1549
1942
  * 存量数据为旧版布尔记录(true/false),读取时迁移为 frequency:
@@ -1562,6 +1955,21 @@ function normalizeCategoryFrequencies(raw) {
1562
1955
  }
1563
1956
  return result;
1564
1957
  }
1958
+ /**
1959
+ * 归一化存储中的 emailCategories 字段。
1960
+ * 旧用户数据缺失该字段(undefined / null)返回全默认;
1961
+ * 部分缺失(只有部分 key)或缺失值非布尔(类型错误)时,该 key 用默认值。
1962
+ */
1963
+ function normalizeEmailCategories(raw) {
1964
+ const result = { ...DEFAULT_EMAIL_CATEGORIES };
1965
+ if (!raw || typeof raw !== "object") return result;
1966
+ const record = raw;
1967
+ for (const c of NOTIFICATION_CATEGORIES) {
1968
+ const v = record[c];
1969
+ if (typeof v === "boolean") result[c] = v;
1970
+ }
1971
+ return result;
1972
+ }
1565
1973
  function isInDndWindow(prefs, now) {
1566
1974
  if (!prefs.dndEnabled) return false;
1567
1975
  const [sh, sm] = prefs.dndStart.split(":").map(Number);
@@ -1642,4 +2050,4 @@ const ICON_MAP = {
1642
2050
  music4: Music4
1643
2051
  };
1644
2052
  //#endregion
1645
- export { PROVIDER_CATEGORIES as A, BillingUnavailableError as B, DEPENDENCY_PRIORITIES as C, LOBE_ICON_MAP as D, ADAPTER_KIND_VALUES as E, VIRTUALIZE_THRESHOLD as F, generateAssemblyFiles as G, WebhookSignatureError as H, getServerSeam as I, resolvePluginOrder as J, parseProfileImports as K, registerPrismaSeam as L, PROVIDER_BADGE_STYLES as M, DND_STICKY_THRESHOLD as N, MODEL_CAPABILITY_OPTIONS as O, LOAD_MORE_STEP as P, registerServerSeam as R, DEPENDENCY_CATEGORIES as S, ADAPTER_KINDS as T, dumpModules as U, SeatsExceededError as V, generateAssemblyCode as W, definePlugin as X, defineProfile as Y, formatParsedUA as _, isInDndWindow as a, resolveIpLocation as b, NOTIFICATION_FREQUENCIES as c, isResourceDefined as d, PlanFeaturesSchema as f, isOssFeature as g, OSS_BASE_FEATURES as h, DEFAULT_CATEGORIES as i, PROVIDER_CATEGORY_VALUES as j, MODEL_TABS as k, RESOURCE_KEYS as l, FeatureRegistry as m, DEVICE_SIZES as n, normalizeCategoryFrequencies as o, FEATURE_KEYS as p, resolveImportSpecifiers as q, moduleRegistry as r, NOTIFICATION_CATEGORIES as s, ICON_MAP as t, ResourceRegistry as u, parseUserAgent as v, SEED_AI_PROVIDERS as w, DEFAULT_WATCHED_DEPENDENCIES as x, getClientIp as y, HostedAiError as z };
2053
+ export { resolvePluginOrder as $, ADAPTER_KIND_VALUES as A, VIRTUALIZE_THRESHOLD as B, DEFAULT_WATCHED_DEPENDENCIES as C, interpolateTemplate as D, UnknownPromptVariableError as E, PROVIDER_CATEGORY_VALUES as F, BillingUnavailableError as G, registerPrismaSeam as H, AI_SOURCE_MODES as I, dumpModules as J, SeatsExceededError as K, PROVIDER_BADGE_STYLES as L, MODEL_CAPABILITY_OPTIONS as M, MODEL_TABS as N, SEED_AI_PROVIDERS as O, PROVIDER_CATEGORIES as P, resolveImportSpecifiers as Q, DND_STICKY_THRESHOLD as R, resolveIpLocation as S, DEPENDENCY_PRIORITIES as T, registerServerSeam as U, getServerSeam as V, HostedAiError as W, generateAssemblyFiles as X, generateAssemblyCode as Y, parseProfileImports as Z, OSS_BASE_FEATURES as _, DEFAULT_EMAIL_CATEGORIES as a, parseUserAgent as b, normalizeEmailCategories as c, RESOURCE_KEYS as d, defineProfile as et, ResourceRegistry as f, FeatureRegistry as g, FEATURE_KEYS as h, DEFAULT_CATEGORIES as i, LOBE_ICON_MAP as j, ADAPTER_KINDS as k, NOTIFICATION_CATEGORIES as l, PlanFeaturesSchema as m, DEVICE_SIZES as n, isInDndWindow as o, isResourceDefined as p, WebhookSignatureError as q, moduleRegistry as r, normalizeCategoryFrequencies as s, ICON_MAP as t, definePlugin as tt, NOTIFICATION_FREQUENCIES as u, isOssFeature as v, DEPENDENCY_CATEGORIES as w, getClientIp as x, formatParsedUA as y, LOAD_MORE_STEP as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allbluecn/kernel",
3
- "version": "0.6.1",
3
+ "version": "0.9.0",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "description": "AllBlue 插件协议:类型定义 + 构建期装配器(零运行时)",
@@ -26,6 +26,10 @@
26
26
  "./modules/notifications": {
27
27
  "types": "./dist/contract/modules/notifications.d.ts",
28
28
  "default": "./dist/contract/modules/notifications.js"
29
+ },
30
+ "./crypto": {
31
+ "types": "./dist/contract/infrastructure/crypto.d.ts",
32
+ "default": "./dist/contract/infrastructure/crypto.js"
29
33
  }
30
34
  },
31
35
  "bin": {
@@ -35,10 +39,10 @@
35
39
  "dist"
36
40
  ],
37
41
  "peerDependencies": {
38
- "@tanstack/ai": "^0.43.0 || ^0.47.0 || ^0.52.0",
42
+ "@tanstack/ai": "^0.43.0 || ^0.47.0 || ^0.52.0 || ^0.54.0",
39
43
  "@tanstack/react-start": "^1.168.49",
40
44
  "react": "^19",
41
- "lucide-react": "^1.43.0",
45
+ "lucide-react": "^1.47.0",
42
46
  "zod": "^3.25 || ^4",
43
47
  "@tanstack/react-router": "^1.168.0"
44
48
  },
@@ -48,7 +52,7 @@
48
52
  "@tanstack/react-start": "^1.168.49",
49
53
  "@types/node": "^24.13.3",
50
54
  "@types/react": "^19",
51
- "lucide-react": "^1.43.0",
55
+ "lucide-react": "^1.47.0",
52
56
  "react": "^19",
53
57
  "tsdown": "^0.22.0",
54
58
  "typescript": "^7",