@allbluecn/kernel 0.10.1 → 0.10.2

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 { $ as dumpModules, at as resolvePluginOrder, et as generateAssemblyCode, rt as parseProfileImports, tt as generateAssemblyFiles } from "./src-Bo9e8qon.js";
2
+ import { $ as dumpModules, et as generateAssemblyCode, it as parseProfileImports, ot as resolvePluginOrder, rt as extractPluginLocalNames, tt as generateAssemblyFiles } from "./src-CyBj_lD7.js";
3
3
  import { parseArgs } from "node:util";
4
4
  import { pathToFileURL } from "node:url";
5
5
  import { dirname, relative, resolve } from "node:path";
@@ -86,69 +86,6 @@ async function main() {
86
86
  return;
87
87
  }
88
88
  }
89
- const IDENTIFIER_RE = /^[A-Za-z_$][\w$]*$/;
90
- /**
91
- * 从 profile 源码中提取 plugins 数组元素的 default import 标识符。
92
- *
93
- * 用括号配平扫描替代正则(旧正则 `[^\]]*` 无法处理元素内嵌套数组/对象、
94
- * 注释、含 `]` 的字面量),支持任意嵌套与跨行写法;字符串与注释内容跳过。
95
- * 非纯标识符元素(spread、变量引用、成员访问)无法对应 default import,
96
- * 收集时跳过并告警——错误在装配早期显式暴露,而非延后到
97
- * resolveImportSpecifiers 以「找不到标识符」的失真信息报错。
98
- */
99
- function extractPluginLocalNames(source) {
100
- const start = source.search(/plugins\s*:\s*\[/);
101
- if (start === -1) {
102
- console.warn("未能从 profile 源码解析 plugins 数组(约定写法:plugins: [pluginA, pluginB]),按空数组处理");
103
- return [];
104
- }
105
- const arrayStart = source.indexOf("[", start);
106
- let depth = 0;
107
- let inString = null;
108
- const names = [];
109
- let current = "";
110
- for (let i = arrayStart; i < source.length; i++) {
111
- const ch = source[i];
112
- if (inString) {
113
- if (ch === "\\") i++;
114
- else if (ch === inString) inString = null;
115
- continue;
116
- }
117
- if (ch === "\"" || ch === "'" || ch === "`") {
118
- inString = ch;
119
- continue;
120
- }
121
- if (ch === "/" && source[i + 1] === "/") {
122
- while (i < source.length && source[i] !== "\n") i++;
123
- continue;
124
- }
125
- if (ch === "/" && source[i + 1] === "*") {
126
- i = source.indexOf("*/", i + 2);
127
- if (i === -1) break;
128
- i++;
129
- continue;
130
- }
131
- if (ch === "[" || ch === "{" || ch === "(") depth++;
132
- if (ch === "]" || ch === "}" || ch === ")") {
133
- depth--;
134
- if (depth === 0) break;
135
- }
136
- if (ch === "," && depth === 1) {
137
- addName(names, current);
138
- current = "";
139
- continue;
140
- }
141
- current += depth >= 1 ? ch : "";
142
- }
143
- addName(names, current);
144
- return names;
145
- }
146
- function addName(names, raw) {
147
- const entry = raw.trim();
148
- if (!entry) return;
149
- if (IDENTIFIER_RE.test(entry)) names.push(entry);
150
- else console.warn(`plugins 数组元素 ${JSON.stringify(entry)} 不是标识符(不支持 spread / 变量引用 / 表达式),已跳过`);
151
- }
152
89
  async function writeAssemblyFiles(appDir, assembly) {
153
90
  const { writeFile, readFile, unlink, mkdir } = await import("node:fs/promises");
154
91
  const { join } = await import("node:path");
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as dumpModules, A as promptDefinitionKeys, B as PROVIDER_CATEGORY_VALUES, C as DEFAULT_WATCHED_DEPENDENCIES, D as TIPTAP_ACTION_INSTRUCTIONS, E as PROMPT_DEFINITIONS, F as ADAPTER_KIND_VALUES, G as VIRTUALIZE_THRESHOLD, H as PROVIDER_BADGE_STYLES, I as LOBE_ICON_MAP, J as registerServerSeam, K as getServerSeam, L as MODEL_CAPABILITY_OPTIONS, M as interpolateTemplate, N as SEED_AI_PROVIDERS, O as getPromptDefinition, P as ADAPTER_KINDS, Q as WebhookSignatureError, R as MODEL_TABS, S as resolveIpLocation, T as DEPENDENCY_PRIORITIES, U as DND_STICKY_THRESHOLD, V as AI_SOURCE_MODES, W as LOAD_MORE_STEP, X as BillingUnavailableError, Y as HostedAiError, Z as SeatsExceededError, _ as OSS_BASE_FEATURES, a as DEFAULT_EMAIL_CATEGORIES, at as resolvePluginOrder, b as parseUserAgent, c as normalizeEmailCategories, d as RESOURCE_KEYS, et as generateAssemblyCode, f as ResourceRegistry, g as FeatureRegistry, h as FEATURE_KEYS, i as DEFAULT_CATEGORIES, it as resolveImportSpecifiers, j as UnknownPromptVariableError, k as listPromptDefinitions, l as NOTIFICATION_CATEGORIES, m as PlanFeaturesSchema, n as DEVICE_SIZES, nt as PRO_FEATURES, o as isInDndWindow, ot as defineProfile, p as isResourceDefined, q as registerPrismaSeam, r as moduleRegistry, rt as parseProfileImports, s as normalizeCategoryFrequencies, st as definePlugin, t as ICON_MAP, tt as generateAssemblyFiles, u as NOTIFICATION_FREQUENCIES, v as isOssFeature, w as DEPENDENCY_CATEGORIES, x as getClientIp, y as formatParsedUA, z as PROVIDER_CATEGORIES } from "./src-Bo9e8qon.js";
1
+ import { $ as dumpModules, A as promptDefinitionKeys, B as PROVIDER_CATEGORY_VALUES, C as DEFAULT_WATCHED_DEPENDENCIES, D as TIPTAP_ACTION_INSTRUCTIONS, E as PROMPT_DEFINITIONS, F as ADAPTER_KIND_VALUES, G as VIRTUALIZE_THRESHOLD, H as PROVIDER_BADGE_STYLES, I as LOBE_ICON_MAP, J as registerServerSeam, K as getServerSeam, L as MODEL_CAPABILITY_OPTIONS, M as interpolateTemplate, N as SEED_AI_PROVIDERS, O as getPromptDefinition, P as ADAPTER_KINDS, Q as WebhookSignatureError, R as MODEL_TABS, S as resolveIpLocation, T as DEPENDENCY_PRIORITIES, U as DND_STICKY_THRESHOLD, V as AI_SOURCE_MODES, W as LOAD_MORE_STEP, X as BillingUnavailableError, Y as HostedAiError, Z as SeatsExceededError, _ as OSS_BASE_FEATURES, a as DEFAULT_EMAIL_CATEGORIES, at as resolveImportSpecifiers, b as parseUserAgent, c as normalizeEmailCategories, ct as definePlugin, d as RESOURCE_KEYS, et as generateAssemblyCode, f as ResourceRegistry, g as FeatureRegistry, h as FEATURE_KEYS, i as DEFAULT_CATEGORIES, it as parseProfileImports, j as UnknownPromptVariableError, k as listPromptDefinitions, l as NOTIFICATION_CATEGORIES, m as PlanFeaturesSchema, n as DEVICE_SIZES, nt as PRO_FEATURES, o as isInDndWindow, ot as resolvePluginOrder, p as isResourceDefined, q as registerPrismaSeam, r as moduleRegistry, s as normalizeCategoryFrequencies, st as defineProfile, t as ICON_MAP, tt as generateAssemblyFiles, u as NOTIFICATION_FREQUENCIES, v as isOssFeature, w as DEPENDENCY_CATEGORIES, x as getClientIp, y as formatParsedUA, z as PROVIDER_CATEGORIES } from "./src-CyBj_lD7.js";
2
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, PROMPT_DEFINITIONS, PROVIDER_BADGE_STYLES, PROVIDER_CATEGORIES, PROVIDER_CATEGORY_VALUES, PRO_FEATURES, PlanFeaturesSchema, RESOURCE_KEYS, ResourceRegistry, SEED_AI_PROVIDERS, SeatsExceededError, TIPTAP_ACTION_INSTRUCTIONS, UnknownPromptVariableError, VIRTUALIZE_THRESHOLD, 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 };
@@ -86,6 +86,68 @@ function findCyclePath(cyclicIds, byId) {
86
86
  }
87
87
  //#endregion
88
88
  //#region src/assemble-input.ts
89
+ const IDENTIFIER_RE = /^[A-Za-z_$][\w$]*$/;
90
+ /**
91
+ * 从 profile 源码的 `plugins: [...]` 数组提取本地标识符(按声明顺序)。
92
+ *
93
+ * 2026-10-28 修复:原实现把数组开括号也算作元素内容,首项被解析成
94
+ * `"[\n pluginA"` 而整体跳过 —— 空 plugins(OSS profile)时只打一条
95
+ * warning 无人注意,非空 plugins(Pro saas profile)直接装配失败。
96
+ * 现从开括号后一位开始扫描,并支持行/块注释与嵌套括号。
97
+ */
98
+ function extractPluginLocalNames(source) {
99
+ const start = source.search(/plugins\s*:\s*\[/);
100
+ if (start === -1) {
101
+ console.warn("未能从 profile 源码解析 plugins 数组(约定写法:plugins: [pluginA, pluginB]),按空数组处理");
102
+ return [];
103
+ }
104
+ const arrayStart = source.indexOf("[", start);
105
+ let depth = 0;
106
+ let inString = null;
107
+ const names = [];
108
+ let current = "";
109
+ for (let i = arrayStart + 1; i < source.length; i++) {
110
+ const ch = source[i];
111
+ if (inString) {
112
+ if (ch === "\\") i++;
113
+ else if (ch === inString) inString = null;
114
+ continue;
115
+ }
116
+ if (ch === "\"" || ch === "'" || ch === "`") {
117
+ inString = ch;
118
+ continue;
119
+ }
120
+ if (ch === "/" && source[i + 1] === "/") {
121
+ while (i < source.length && source[i] !== "\n") i++;
122
+ continue;
123
+ }
124
+ if (ch === "/" && source[i + 1] === "*") {
125
+ i = source.indexOf("*/", i + 2);
126
+ if (i === -1) break;
127
+ i++;
128
+ continue;
129
+ }
130
+ if (ch === "[" || ch === "{" || ch === "(") depth++;
131
+ if (ch === "]" || ch === "}" || ch === ")") {
132
+ if (depth === 0) break;
133
+ depth--;
134
+ }
135
+ if (ch === "," && depth === 0) {
136
+ addPluginLocalName(names, current);
137
+ current = "";
138
+ continue;
139
+ }
140
+ current += ch;
141
+ }
142
+ addPluginLocalName(names, current);
143
+ return names;
144
+ }
145
+ function addPluginLocalName(names, raw) {
146
+ const entry = raw.trim();
147
+ if (!entry) return;
148
+ if (IDENTIFIER_RE.test(entry)) names.push(entry);
149
+ else console.warn(`plugins 数组元素 ${JSON.stringify(entry)} 不是标识符(不支持 spread / 变量引用 / 表达式),已跳过`);
150
+ }
89
151
  function parseProfileImports(source) {
90
152
  const map = /* @__PURE__ */ new Map();
91
153
  const re = /import\s+([A-Za-z_$][\w$]*)\s+from\s+['"]([^'"]+)['"]/g;
@@ -2865,4 +2927,4 @@ const ICON_MAP = {
2865
2927
  music4: Music4
2866
2928
  };
2867
2929
  //#endregion
2868
- export { dumpModules as $, promptDefinitionKeys as A, PROVIDER_CATEGORY_VALUES as B, DEFAULT_WATCHED_DEPENDENCIES as C, TIPTAP_ACTION_INSTRUCTIONS as D, PROMPT_DEFINITIONS as E, ADAPTER_KIND_VALUES as F, VIRTUALIZE_THRESHOLD as G, PROVIDER_BADGE_STYLES as H, LOBE_ICON_MAP as I, registerServerSeam as J, getServerSeam as K, MODEL_CAPABILITY_OPTIONS as L, interpolateTemplate as M, SEED_AI_PROVIDERS as N, getPromptDefinition as O, ADAPTER_KINDS as P, WebhookSignatureError as Q, MODEL_TABS as R, resolveIpLocation as S, DEPENDENCY_PRIORITIES as T, DND_STICKY_THRESHOLD as U, AI_SOURCE_MODES as V, LOAD_MORE_STEP as W, BillingUnavailableError as X, HostedAiError as Y, SeatsExceededError as Z, OSS_BASE_FEATURES as _, DEFAULT_EMAIL_CATEGORIES as a, resolvePluginOrder as at, parseUserAgent as b, normalizeEmailCategories as c, RESOURCE_KEYS as d, generateAssemblyCode as et, ResourceRegistry as f, FeatureRegistry as g, FEATURE_KEYS as h, DEFAULT_CATEGORIES as i, resolveImportSpecifiers as it, UnknownPromptVariableError as j, listPromptDefinitions as k, NOTIFICATION_CATEGORIES as l, PlanFeaturesSchema as m, DEVICE_SIZES as n, PRO_FEATURES as nt, isInDndWindow as o, defineProfile as ot, isResourceDefined as p, registerPrismaSeam as q, moduleRegistry as r, parseProfileImports as rt, normalizeCategoryFrequencies as s, definePlugin as st, ICON_MAP as t, generateAssemblyFiles as tt, NOTIFICATION_FREQUENCIES as u, isOssFeature as v, DEPENDENCY_CATEGORIES as w, getClientIp as x, formatParsedUA as y, PROVIDER_CATEGORIES as z };
2930
+ export { dumpModules as $, promptDefinitionKeys as A, PROVIDER_CATEGORY_VALUES as B, DEFAULT_WATCHED_DEPENDENCIES as C, TIPTAP_ACTION_INSTRUCTIONS as D, PROMPT_DEFINITIONS as E, ADAPTER_KIND_VALUES as F, VIRTUALIZE_THRESHOLD as G, PROVIDER_BADGE_STYLES as H, LOBE_ICON_MAP as I, registerServerSeam as J, getServerSeam as K, MODEL_CAPABILITY_OPTIONS as L, interpolateTemplate as M, SEED_AI_PROVIDERS as N, getPromptDefinition as O, ADAPTER_KINDS as P, WebhookSignatureError as Q, MODEL_TABS as R, resolveIpLocation as S, DEPENDENCY_PRIORITIES as T, DND_STICKY_THRESHOLD as U, AI_SOURCE_MODES as V, LOAD_MORE_STEP as W, BillingUnavailableError as X, HostedAiError as Y, SeatsExceededError as Z, OSS_BASE_FEATURES as _, DEFAULT_EMAIL_CATEGORIES as a, resolveImportSpecifiers as at, parseUserAgent as b, normalizeEmailCategories as c, definePlugin as ct, RESOURCE_KEYS as d, generateAssemblyCode as et, ResourceRegistry as f, FeatureRegistry as g, FEATURE_KEYS as h, DEFAULT_CATEGORIES as i, parseProfileImports as it, UnknownPromptVariableError as j, listPromptDefinitions as k, NOTIFICATION_CATEGORIES as l, PlanFeaturesSchema as m, DEVICE_SIZES as n, PRO_FEATURES as nt, isInDndWindow as o, resolvePluginOrder as ot, isResourceDefined as p, registerPrismaSeam as q, moduleRegistry as r, extractPluginLocalNames as rt, normalizeCategoryFrequencies as s, defineProfile as st, ICON_MAP as t, generateAssemblyFiles as tt, NOTIFICATION_FREQUENCIES as u, isOssFeature as v, DEPENDENCY_CATEGORIES as w, getClientIp as x, formatParsedUA as y, PROVIDER_CATEGORIES as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allbluecn/kernel",
3
- "version": "0.10.1",
3
+ "version": "0.10.2",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "description": "AllBlue 插件协议:类型定义 + 构建期装配器(零运行时)",