@spaceflow/core 0.18.0 → 0.19.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaceflow/core",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Spaceflow 核心能力库",
5
5
  "license": "MIT",
6
6
  "author": "Lydanne",
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import * as fs from "fs";
3
3
  import * as path from "path";
4
+ import { SpaceflowConfigSchema } from "./spaceflow.config";
4
5
 
5
6
  /** Schema 注册信息 */
6
7
  export interface SchemaRegistry {
@@ -39,20 +40,14 @@ export class SchemaGeneratorService {
39
40
  * @param outputPath 输出路径
40
41
  */
41
42
  generateJsonSchema(outputPath: string): void {
42
- const properties: Record<string, unknown> = {
43
- dependencies: {
44
- type: "object",
45
- description: "已安装的技能包注册表",
46
- additionalProperties: { type: "string" },
47
- },
48
- support: {
49
- type: "array",
50
- description: "支持的编辑器列表",
51
- items: { type: "string" },
52
- },
53
- };
43
+ // SpaceflowConfigSchema 生成基础 JSON Schema
44
+ const baseSchema = z.toJSONSchema(SpaceflowConfigSchema, {
45
+ target: "draft-07",
46
+ }) as { properties?: Record<string, unknown>; [key: string]: unknown };
47
+
48
+ const properties: Record<string, unknown> = { ...(baseSchema.properties || {}) };
54
49
 
55
- // 添加所有插件的 schema
50
+ // 添加所有插件的 schema(扩展插件配置)
56
51
  for (const [configKey, registry] of schemaRegistry) {
57
52
  try {
58
53
  const schema = registry.schemaFactory();
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import type { LLMMode } from "../shared/llm-proxy";
3
- import { registerPluginSchema } from "./schema-generator.service";
4
3
  import { detectProvider } from "../shared/git-provider/detect-provider";
5
4
 
6
5
  // 从 @spaceflow/shared 重导出配置工具函数
@@ -177,7 +176,7 @@ const StorageConfigSchema = z.object({
177
176
  // ============ 统一配置 Schema ============
178
177
 
179
178
  /** Spaceflow 完整配置 Schema */
180
- const SpaceflowConfigSchema = z.object({
179
+ export const SpaceflowConfigSchema = z.object({
181
180
  /** 界面语言,如 zh-CN、en */
182
181
  lang: z.string().optional().describe("界面语言,如 zh-CN、en"),
183
182
  /** 已安装的技能包注册表 */
@@ -198,13 +197,6 @@ const SpaceflowConfigSchema = z.object({
198
197
  storage: z.preprocess((v) => v ?? {}, StorageConfigSchema).describe("存储服务配置"),
199
198
  });
200
199
 
201
- // 注册完整 schema(供 JSON Schema 生成使用)
202
- registerPluginSchema({
203
- configKey: "spaceflow",
204
- schemaFactory: () => SpaceflowConfigSchema,
205
- description: "Spaceflow 配置",
206
- });
207
-
208
200
  // ============ 类型导出 ============
209
201
 
210
202
  /** Spaceflow 完整配置类型 */