@zhin.js/scaffold-wizard 0.2.0 → 0.2.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.
Files changed (50) hide show
  1. package/README.md +2 -1
  2. package/lib/adapter-configurers.js +1 -1
  3. package/lib/adapter-configurers.js.map +1 -1
  4. package/lib/adapter.d.ts +5 -0
  5. package/lib/adapter.d.ts.map +1 -1
  6. package/lib/adapter.js +9 -2
  7. package/lib/adapter.js.map +1 -1
  8. package/lib/ai.d.ts +6 -0
  9. package/lib/ai.d.ts.map +1 -1
  10. package/lib/ai.js +49 -6
  11. package/lib/ai.js.map +1 -1
  12. package/lib/apply.d.ts +11 -6
  13. package/lib/apply.d.ts.map +1 -1
  14. package/lib/apply.js +84 -15
  15. package/lib/apply.js.map +1 -1
  16. package/lib/env.d.ts +14 -0
  17. package/lib/env.d.ts.map +1 -0
  18. package/lib/env.js +89 -0
  19. package/lib/env.js.map +1 -0
  20. package/lib/index.d.ts +4 -3
  21. package/lib/index.d.ts.map +1 -1
  22. package/lib/index.js +3 -2
  23. package/lib/index.js.map +1 -1
  24. package/lib/optional-peers.d.ts.map +1 -1
  25. package/lib/optional-peers.js +11 -0
  26. package/lib/optional-peers.js.map +1 -1
  27. package/lib/project-config-plan.d.ts +0 -1
  28. package/lib/project-config-plan.d.ts.map +1 -1
  29. package/lib/project-config-plan.js +0 -8
  30. package/lib/project-config-plan.js.map +1 -1
  31. package/lib/project-deps.d.ts +2 -1
  32. package/lib/project-deps.d.ts.map +1 -1
  33. package/lib/project-deps.js +14 -4
  34. package/lib/project-deps.js.map +1 -1
  35. package/lib/zhin-stack-deps.d.ts +4 -3
  36. package/lib/zhin-stack-deps.d.ts.map +1 -1
  37. package/lib/zhin-stack-deps.js +4 -20
  38. package/lib/zhin-stack-deps.js.map +1 -1
  39. package/package.json +1 -1
  40. package/src/adapter-configurers.ts +1 -1
  41. package/src/adapter.ts +10 -2
  42. package/src/ai.ts +48 -6
  43. package/src/apply.ts +98 -14
  44. package/src/env.ts +113 -0
  45. package/src/index.ts +11 -2
  46. package/src/optional-peers.ts +9 -0
  47. package/src/project-config-plan.ts +0 -9
  48. package/src/project-deps.ts +14 -4
  49. package/src/stack-versions.generated.json +36 -38
  50. package/src/zhin-stack-deps.ts +4 -22
package/src/env.ts ADDED
@@ -0,0 +1,113 @@
1
+ import type { DatabaseConfig } from './types.js';
2
+
3
+ /**
4
+ * dotenv 值格式化:含 `#` / 空白 / 引号 / 反斜杠 / 换行 时用双引号包裹并转义,
5
+ * 避免未转义值截断注释或破坏行解析(所有 .env 生成点统一走这里)。
6
+ */
7
+ export function formatEnvValue(value: unknown): string {
8
+ const raw = value == null ? '' : String(value);
9
+ if (raw !== '' && !/[#"'\\\s]/.test(raw)) return raw;
10
+ return `"${raw
11
+ .replace(/\\/g, '\\\\')
12
+ .replace(/"/g, '\\"')
13
+ .replace(/\r/g, '\\r')
14
+ .replace(/\n/g, '\\n')}"`;
15
+ }
16
+
17
+ const ENV_KEY_LINE = /^([A-Za-z_][A-Za-z0-9_]*)=/;
18
+
19
+ /**
20
+ * 幂等合并 .env 内容:extra 中出现的 KEY 覆盖 existing 同名行(原位替换),
21
+ * 新 KEY 连同其段落注释追加到文末。重复执行结果不变。
22
+ */
23
+ export function mergeEnvText(existing: string, extra: string): string {
24
+ const entries: Array<{ comment?: string; key: string; line: string }> = [];
25
+ let pendingComment: string | undefined;
26
+ for (const rawLine of extra.split('\n')) {
27
+ const line = rawLine.trim();
28
+ if (!line) continue;
29
+ if (line.startsWith('#')) {
30
+ pendingComment = line;
31
+ continue;
32
+ }
33
+ const match = ENV_KEY_LINE.exec(line);
34
+ if (!match) continue;
35
+ entries.push({ comment: pendingComment, key: match[1], line });
36
+ pendingComment = undefined;
37
+ }
38
+ const out = existing.split('\n');
39
+ if (entries.length === 0) {
40
+ return existing.replace(/\s*$/, '') + (existing.trim() ? '\n' : '');
41
+ }
42
+ const byKey = new Map(entries.map((entry) => [entry.key, entry]));
43
+ const consumed = new Set<string>();
44
+ for (let index = 0; index < out.length; index += 1) {
45
+ const match = ENV_KEY_LINE.exec(out[index].trim());
46
+ if (match && byKey.has(match[1])) {
47
+ out[index] = byKey.get(match[1])!.line;
48
+ consumed.add(match[1]);
49
+ }
50
+ }
51
+ const fresh = entries.filter((entry) => !consumed.has(entry.key));
52
+ if (fresh.length > 0) {
53
+ while (out.length > 0 && out[out.length - 1].trim() === '') out.pop();
54
+ if (out.length > 0) out.push('');
55
+ let lastComment: string | undefined;
56
+ for (const entry of fresh) {
57
+ if (entry.comment && entry.comment !== lastComment) out.push(entry.comment);
58
+ lastComment = entry.comment;
59
+ out.push(entry.line);
60
+ }
61
+ }
62
+ return out.join('\n').replace(/\s*$/, '') + '\n';
63
+ }
64
+
65
+ /** 生成数据库连接环境变量(连接参数落 .env,配置文件只引用 ${VAR})。 */
66
+ export function generateDatabaseEnvVars(config: DatabaseConfig): string {
67
+ const envVars: string[] = [];
68
+
69
+ switch (config.dialect) {
70
+ case 'mysql':
71
+ envVars.push(
72
+ '# MySQL 数据库配置',
73
+ `DB_HOST=${formatEnvValue(config.host || 'localhost')}`,
74
+ `DB_PORT=${formatEnvValue(config.port || 3306)}`,
75
+ `DB_USER=${formatEnvValue(config.user || 'root')}`,
76
+ `DB_PASSWORD=${formatEnvValue(config.password || '')}`,
77
+ `DB_DATABASE=${formatEnvValue(config.database || 'zhin_bot')}`
78
+ );
79
+ break;
80
+ case 'pg':
81
+ envVars.push(
82
+ '# PostgreSQL 数据库配置',
83
+ `DB_HOST=${formatEnvValue(config.host || 'localhost')}`,
84
+ `DB_PORT=${formatEnvValue(config.port || 5432)}`,
85
+ `DB_USER=${formatEnvValue(config.user || 'postgres')}`,
86
+ `DB_PASSWORD=${formatEnvValue(config.password || '')}`,
87
+ `DB_DATABASE=${formatEnvValue(config.database || 'zhin_bot')}`
88
+ );
89
+ break;
90
+ case 'mongodb':
91
+ envVars.push(
92
+ '# MongoDB 数据库配置',
93
+ `DB_URL=${formatEnvValue(config.url || 'mongodb://localhost:27017')}`,
94
+ `DB_NAME=${formatEnvValue(config.dbName || 'zhin_bot')}`
95
+ );
96
+ break;
97
+ case 'redis':
98
+ envVars.push(
99
+ '# Redis 数据库配置',
100
+ `REDIS_HOST=${formatEnvValue(config.socket?.host || 'localhost')}`,
101
+ `REDIS_PORT=${formatEnvValue(config.socket?.port || 6379)}`,
102
+ `REDIS_PASSWORD=${formatEnvValue(config.password || '')}`,
103
+ `REDIS_DB=${formatEnvValue(config.database ?? 0)}`
104
+ );
105
+ break;
106
+ case 'sqlite':
107
+ default:
108
+ // SQLite 不需要额外的环境变量
109
+ break;
110
+ }
111
+
112
+ return envVars.length > 0 ? `\n\n${envVars.join('\n')}` : '';
113
+ }
package/src/index.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  export type { InitOptions, DatabaseConfig } from './types.js';
2
2
  export { DATABASE_PACKAGES } from './types.js';
3
3
 
4
- export type { AdapterSetupResult, AdapterPluginInstance } from './adapter.js';
4
+ export type { AdapterSetupResult, AdapterPluginInstance, AdapterDefinition } from './adapter.js';
5
5
  export {
6
+ ADAPTERS,
7
+ findAdapterByPackage,
6
8
  configureAdapters,
7
9
  buildFieldBasedInstanceConfig,
8
10
  generateAdapterEnvVars,
@@ -31,6 +33,12 @@ export {
31
33
 
32
34
  export { configureDatabaseOptions } from './database.js';
33
35
 
36
+ export {
37
+ formatEnvValue,
38
+ mergeEnvText,
39
+ generateDatabaseEnvVars,
40
+ } from './env.js';
41
+
34
42
  export {
35
43
  AI_STACK_VERSIONS,
36
44
  MCP_SDK_VERSION,
@@ -100,13 +108,14 @@ export type {
100
108
  } from './project-config-plan.js';
101
109
 
102
110
  export {
103
- CONSOLE_HOST_PLUGINS,
104
111
  applyDatabaseToConfig,
105
112
  applyAdaptersToConfig,
106
113
  applyAIToConfig,
107
114
  appendWizardEnvVars,
108
115
  collectWizardDependencies,
116
+ collectWizardFeatures,
109
117
  mergeDependenciesIntoPackageJson,
118
+ mergeFeaturesIntoPackageJson,
110
119
  mergePluginManifestIntoPackageJson,
111
120
  finalizeWizardOptions,
112
121
  applyWizardOptionsToConfig,
@@ -46,6 +46,15 @@ function configUsesHtmlImageAdapter(config: Record<string, unknown>): boolean {
46
46
  if (plugin.includes(`adapter-${ctx}`)) return true;
47
47
  }
48
48
  }
49
+ // 新 runtime 配置形态:plugins 为 instanceKey → 配置 的映射,instanceKey 即适配器 context
50
+ if (config.plugins && typeof config.plugins === 'object' && !Array.isArray(config.plugins)) {
51
+ for (const instanceKey of Object.keys(config.plugins as Record<string, unknown>)) {
52
+ if (ADAPTERS_PREFER_HTML_IMAGE.has(instanceKey)) return true;
53
+ for (const ctx of ADAPTERS_PREFER_HTML_IMAGE) {
54
+ if (instanceKey.includes(`adapter-${ctx}`)) return true;
55
+ }
56
+ }
57
+ }
49
58
  const endpoints = Array.isArray(config.endpoints) ? config.endpoints : [];
50
59
  for (const ep of endpoints) {
51
60
  if (!ep || typeof ep !== 'object' || Array.isArray(ep)) continue;
@@ -12,8 +12,6 @@ const CONFIG_CANDIDATES = [
12
12
  'zhin.config.toml',
13
13
  'zhin.config.ts',
14
14
  ] as const;
15
- /** @deprecated Plugin Runtime 由 CLI 装配 Console Host,无需在配置中声明;仅用于 legacy 数组配置诊断 */
16
- const CONSOLE_HOST_PLUGINS = ['@zhin.js/host-router', '@zhin.js/host-api'] as const;
17
15
  const SANDBOX_PLUGIN = '@zhin.js/adapter-sandbox';
18
16
  const LEGACY_AI_PROVIDER_FIELDS = ['driver', 'api', 'preset', 'spec'] as const;
19
17
 
@@ -66,7 +64,6 @@ export interface ProjectConfigPlan {
66
64
  }
67
65
 
68
66
  export interface ConsoleConfigDiagnosis {
69
- missingHostPlugins: string[];
70
67
  missingSandboxPlugin: boolean;
71
68
  missingConsoleOrigin: boolean;
72
69
  missingHttpToken: boolean;
@@ -344,10 +341,6 @@ export function createProjectConfigPlan(options: ProjectConfigPlanOptions): Proj
344
341
  const mutations: string[] = [];
345
342
 
346
343
  if (loaded.status === 'loaded' || options.config) {
347
- if (options.ensureConsole && Array.isArray(after.plugins)) {
348
- // legacy 数组形态:host 插件仍需写入列表(旧项目行为不变)
349
- ensurePlugins(after, CONSOLE_HOST_PLUGINS, mutations);
350
- }
351
344
  if (options.ensureSandbox) {
352
345
  ensurePlugins(after, [SANDBOX_PLUGIN], mutations);
353
346
  }
@@ -406,7 +399,6 @@ export function diagnoseConsoleConfig(config: Record<string, unknown>): ConsoleC
406
399
  // legacy 数组形式配置
407
400
  const plugins = config.plugins.filter((p): p is string => typeof p === 'string');
408
401
  return {
409
- missingHostPlugins: CONSOLE_HOST_PLUGINS.filter((plugin) => !plugins.includes(plugin)),
410
402
  missingSandboxPlugin: !plugins.includes(SANDBOX_PLUGIN),
411
403
  missingConsoleOrigin: !hasConsoleOrigin(corsOrigins.filter((origin): origin is string => typeof origin === 'string')),
412
404
  missingHttpToken: typeof http.token !== 'string' || http.token.trim().length === 0,
@@ -418,7 +410,6 @@ export function diagnoseConsoleConfig(config: Record<string, unknown>): ConsoleC
418
410
  ? config.plugins as Record<string, unknown>
419
411
  : {};
420
412
  return {
421
- missingHostPlugins: [],
422
413
  missingSandboxPlugin: !('sandbox' in plugins),
423
414
  missingConsoleOrigin: !hasConsoleOrigin(corsOrigins.filter((origin): origin is string => typeof origin === 'string')),
424
415
  missingHttpToken: typeof http.token !== 'string' || http.token.trim().length === 0,
@@ -51,6 +51,7 @@ const PROVIDER_SDK_PACKAGES: Record<string, { pkg: string; version: string }> =
51
51
  ollama: { pkg: '@ai-sdk/openai-compatible', version: AI_STACK_VERSIONS['@ai-sdk/openai-compatible'] },
52
52
  moonshot: { pkg: '@ai-sdk/openai-compatible', version: AI_STACK_VERSIONS['@ai-sdk/openai-compatible'] },
53
53
  zhipu: { pkg: '@ai-sdk/openai-compatible', version: AI_STACK_VERSIONS['@ai-sdk/openai-compatible'] },
54
+ 'openai-compatible': { pkg: '@ai-sdk/openai-compatible', version: AI_STACK_VERSIONS['@ai-sdk/openai-compatible'] },
54
55
  };
55
56
 
56
57
  /** @ai-sdk/* 主版本 ≥ threshold 时需 ai@7 */
@@ -211,7 +212,7 @@ export function findInstalledAiStackIncompatibilities(
211
212
  /** 启用 AI 时将写入 package.json 的依赖名(用于向导提示与 CLI 输出) */
212
213
  export function listAIDependencyNames(provider?: string, options?: { includeMcp?: boolean }): string[] {
213
214
  const names = ['@zhin.js/agent', 'zod', 'ai'];
214
- if (options?.includeMcp !== false) {
215
+ if (options?.includeMcp === true) {
215
216
  names.push('@modelcontextprotocol/sdk');
216
217
  }
217
218
  const sdk = providerSdkPackage(provider);
@@ -314,7 +315,11 @@ export function findUnresolvedPackageInstalls(cwd: string, packageNames: string[
314
315
  try {
315
316
  req.resolve(`${name}/package.json`);
316
317
  } catch {
317
- missing.push(name);
318
+ // exports map 未暴露 ./package.json(ERR_PACKAGE_PATH_NOT_EXPORTED,如 zhin.js)
319
+ // 时 resolve 必炸,退到 node_modules 文件系统判断(pnpm 顶层 symlink 可直达)。
320
+ if (!fs.existsSync(path.join(cwd, 'node_modules', name, 'package.json'))) {
321
+ missing.push(name);
322
+ }
318
323
  }
319
324
  }
320
325
  return missing;
@@ -376,7 +381,8 @@ export function formatAIDependencyFixCommand(packages: string[], required: Recor
376
381
  }
377
382
 
378
383
  /**
379
- * AI 启用时安装 agent 栈 + 所选 provider 的 @ai-sdk/* + 可选 MCP SDK。
384
+ * AI 启用时安装 agent 栈 + 所选 provider 的 @ai-sdk/*。
385
+ * `@modelcontextprotocol/sdk` 仅在 memoryMcp / mcpServers 时写入(与 doctor 对齐)。
380
386
  */
381
387
  export function getAIDependencies(ai?: AISetupConfig): Record<string, string> {
382
388
  if (!ai?.enabled) return {};
@@ -385,9 +391,13 @@ export function getAIDependencies(ai?: AISetupConfig): Record<string, string> {
385
391
  '@zhin.js/agent': AI_STACK_VERSIONS['@zhin.js/agent'],
386
392
  zod: AI_STACK_VERSIONS.zod,
387
393
  ai: AI_STACK_VERSIONS.ai,
388
- '@modelcontextprotocol/sdk': AI_STACK_VERSIONS['@modelcontextprotocol/sdk'],
389
394
  ...collectSdkPackagesFromSetup(ai),
390
395
  };
396
+ const needsMcp = ai.memoryMcp === true
397
+ || (Array.isArray(ai.mcpServers) && ai.mcpServers.length > 0);
398
+ if (needsMcp) {
399
+ deps['@modelcontextprotocol/sdk'] = AI_STACK_VERSIONS['@modelcontextprotocol/sdk'];
400
+ }
391
401
 
392
402
  return deps;
393
403
  }
@@ -1,48 +1,46 @@
1
1
  {
2
2
  "$comment": "Auto-generated by scripts/sync-scaffold-deps.mjs — do not edit; run pnpm sync:scaffold-deps",
3
3
  "zhinStack": {
4
- "zhin.js": "^4.1.0",
5
- "@zhin.js/cli": "^1.0.91",
6
- "@zhin.js/agent": "^1.0.1",
7
- "@zhin.js/database": "^1.0.74",
8
- "@zhin.js/host-router": "^2.0.1",
9
- "@zhin.js/host-api": "^2.0.3",
10
- "@zhin.js/client": "^2.0.3",
11
- "@zhin.js/contract": "^1.0.1",
12
- "@zhin.js/satori": "^1.0.15",
13
- "@zhin.js/speech": "^1.0.1",
14
- "@zhin.js/html-renderer": "^1.0.1",
15
- "@zhin.js/mcp": "^4.0.0",
16
- "@zhin.js/adapter-sandbox": "^5.0.3",
17
- "@zhin.js/adapter-dingtalk": "^4.0.0",
18
- "@zhin.js/adapter-discord": "^5.0.0",
19
- "@zhin.js/adapter-email": "^3.0.0",
20
- "@zhin.js/adapter-github": "^3.0.0",
21
- "@zhin.js/adapter-icqq": "^6.0.0",
22
- "@zhin.js/adapter-kook": "^5.0.0",
23
- "@zhin.js/adapter-lark": "^4.0.0",
24
- "@zhin.js/adapter-line": "^2.0.0",
25
- "@zhin.js/adapter-milky": "^3.0.0",
26
- "@zhin.js/adapter-napcat": "^3.0.0",
27
- "@zhin.js/adapter-onebot11": "^4.0.0",
28
- "@zhin.js/adapter-onebot12": "^3.0.0",
29
- "@zhin.js/adapter-qq": "^5.0.0",
30
- "@zhin.js/adapter-satori": "^3.0.0",
31
- "@zhin.js/adapter-slack": "^4.0.0",
32
- "@zhin.js/adapter-telegram": "^5.0.0",
33
- "@zhin.js/adapter-wechat-mp": "^3.0.0",
34
- "@zhin.js/adapter-wecom": "^2.0.0",
35
- "@zhin.js/adapter-weixin-ilink": "^3.0.0"
4
+ "zhin.js": "^5.0.0",
5
+ "@zhin.js/cli": "^2.0.0",
6
+ "@zhin.js/agent": "^1.0.5",
7
+ "@zhin.js/database": "^1.0.77",
8
+ "@zhin.js/client": "^2.1.0",
9
+ "@zhin.js/contract": "^1.0.5",
10
+ "@zhin.js/satori": "^1.0.16",
11
+ "@zhin.js/speech": "^2.0.0",
12
+ "@zhin.js/html-renderer": "^2.0.0",
13
+ "@zhin.js/mcp": "^5.0.0",
14
+ "@zhin.js/adapter-sandbox": "^6.0.0",
15
+ "@zhin.js/adapter-dingtalk": "^5.0.0",
16
+ "@zhin.js/adapter-discord": "^6.0.0",
17
+ "@zhin.js/adapter-email": "^4.0.0",
18
+ "@zhin.js/adapter-github": "^4.0.0",
19
+ "@zhin.js/adapter-icqq": "^7.0.0",
20
+ "@zhin.js/adapter-kook": "^6.0.0",
21
+ "@zhin.js/adapter-lark": "^5.0.0",
22
+ "@zhin.js/adapter-line": "^3.0.0",
23
+ "@zhin.js/adapter-milky": "^5.0.0",
24
+ "@zhin.js/adapter-napcat": "^5.0.0",
25
+ "@zhin.js/adapter-onebot11": "^5.0.0",
26
+ "@zhin.js/adapter-onebot12": "^4.0.0",
27
+ "@zhin.js/adapter-qq": "^6.0.0",
28
+ "@zhin.js/adapter-satori": "^4.0.0",
29
+ "@zhin.js/adapter-slack": "^5.0.0",
30
+ "@zhin.js/adapter-telegram": "^6.0.0",
31
+ "@zhin.js/adapter-wechat-mp": "^4.0.0",
32
+ "@zhin.js/adapter-wecom": "^3.0.0",
33
+ "@zhin.js/adapter-weixin-ilink": "^4.0.0"
36
34
  },
37
35
  "aiStack": {
38
- "@zhin.js/agent": "^1.0.1",
36
+ "@zhin.js/agent": "^1.0.5",
39
37
  "ai": "^7.0.0",
40
38
  "zod": "^4.0.0",
41
- "@ai-sdk/openai": "^4.0.0",
42
- "@ai-sdk/anthropic": "^4.0.0",
43
- "@ai-sdk/google": "^4.0.0",
44
- "@ai-sdk/deepseek": "^3.0.0",
45
- "@ai-sdk/openai-compatible": "^3.0.0",
39
+ "@ai-sdk/openai": "^4.0.8",
40
+ "@ai-sdk/anthropic": "^4.0.9",
41
+ "@ai-sdk/google": "^4.0.9",
42
+ "@ai-sdk/deepseek": "^3.0.5",
43
+ "@ai-sdk/openai-compatible": "^3.0.5",
46
44
  "@modelcontextprotocol/sdk": "^1.29.0"
47
45
  }
48
46
  }
@@ -20,8 +20,6 @@ export const ZHIN_STACK_VERSIONS = {
20
20
  '@zhin.js/component': 'latest',
21
21
  '@zhin.js/core': 'latest',
22
22
  '@zhin.js/tool': 'latest',
23
- '@zhin.js/host-router': 'latest',
24
- '@zhin.js/host-api': 'latest',
25
23
  '@zhin.js/client': 'latest',
26
24
  '@zhin.js/contract': 'latest',
27
25
  '@zhin.js/satori': 'latest',
@@ -52,11 +50,6 @@ export const ZHIN_STACK_VERSIONS = {
52
50
 
53
51
  export type ZhinStackPackage = keyof typeof ZHIN_STACK_VERSIONS;
54
52
 
55
- const HOST_CONSOLE_PLUGINS = new Set([
56
- '@zhin.js/host-router',
57
- '@zhin.js/host-api',
58
- ]);
59
-
60
53
  function parseMajor(versionSpec: string | undefined): number | undefined {
61
54
  if (!versionSpec?.trim()) return undefined;
62
55
  if (versionSpec === 'workspace:*') return undefined;
@@ -115,17 +108,13 @@ export function getCreateBotPnpmConfig(_aiEnabled?: boolean): Record<string, unk
115
108
  };
116
109
  }
117
110
 
118
- /** create-zhin-app Plugin Runtime 骨架 production 依赖(不含适配器 / AI / 数据库驱动) */
111
+ /**
112
+ * create-zhin-app Plugin Runtime 骨架 production 依赖(不含适配器 / AI / 数据库驱动)。
113
+ * Stable Features(adapter/command/component/middleware)由 `@zhin.js/core` 的 `package.json#zhin.features` 继承;创作面 API 经 `zhin.js/*` 便利入口。
114
+ */
119
115
  export function getCreateBotBaseDependencies(): Record<string, string> {
120
116
  return {
121
117
  'zhin.js': ZHIN_STACK_VERSIONS['zhin.js'],
122
- '@zhin.js/plugin-runtime': ZHIN_STACK_VERSIONS['@zhin.js/plugin-runtime'],
123
- '@zhin.js/runtime': ZHIN_STACK_VERSIONS['@zhin.js/runtime'],
124
- '@zhin.js/adapter': ZHIN_STACK_VERSIONS['@zhin.js/adapter'],
125
- '@zhin.js/command': ZHIN_STACK_VERSIONS['@zhin.js/command'],
126
- '@zhin.js/component': ZHIN_STACK_VERSIONS['@zhin.js/component'],
127
- '@zhin.js/core': ZHIN_STACK_VERSIONS['@zhin.js/core'],
128
- '@zhin.js/satori': ZHIN_STACK_VERSIONS['@zhin.js/satori'],
129
118
  };
130
119
  }
131
120
 
@@ -149,13 +138,6 @@ export function getRequiredZhinDependenciesForConfig(config: Record<string, unkn
149
138
  }
150
139
  }
151
140
 
152
- const usesHost = collectZhinPluginsFromConfig(config).some((p) => HOST_CONSOLE_PLUGINS.has(p));
153
- if (usesHost) {
154
- for (const pkg of ['@zhin.js/host-router', '@zhin.js/host-api'] as const) {
155
- deps[pkg] = ZHIN_STACK_VERSIONS[pkg];
156
- }
157
- }
158
-
159
141
  return deps;
160
142
  }
161
143