libero-mcp 0.2.12 → 0.2.13
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/knowledge/_schema/analysis-model.schema.js +32 -0
- package/dist/knowledge/_schema/entry.schema.js +45 -0
- package/dist/knowledge/_schema/persona.schema.js +23 -0
- package/dist/knowledge/_schema/scenario-pack.schema.js +29 -0
- package/dist/knowledge/src/repo/types.js +1 -0
- package/dist/mcp/server-core.js +499 -323
- package/dist/mcp/src/coachmod/index.js +135 -0
- package/dist/mcp/src/repo/factory.js +32 -0
- package/dist/mcp/src/timeline/index.js +61 -3
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* COACH-MOD §3.2 — 复盘分析模型 schema。
|
|
4
|
+
* 与 entry.schema.ts 解耦:分析模型不属于 prescription/principle/research,
|
|
5
|
+
* 是复盘时脑装载的"分析框架/步骤"。全库唯一一个 is_default:true 作基线。
|
|
6
|
+
*/
|
|
7
|
+
export const analysisModelSchema = z.object({
|
|
8
|
+
id: z.string().regex(/^[a-z0-9-]+$/),
|
|
9
|
+
kind: z.literal("analysis-model"),
|
|
10
|
+
title: z.string().min(1),
|
|
11
|
+
is_default: z.boolean().optional().default(false),
|
|
12
|
+
triggers: z
|
|
13
|
+
.object({
|
|
14
|
+
// 手层粗筛用的情境标签(coachmod.suggest 匹配)
|
|
15
|
+
context_tags: z.array(z.string()).optional().default([]),
|
|
16
|
+
})
|
|
17
|
+
.optional()
|
|
18
|
+
.default({ context_tags: [] }),
|
|
19
|
+
description: z.string().min(1),
|
|
20
|
+
// 分析框架/步骤(脑装载后据此复盘)
|
|
21
|
+
method: z.array(z.string()).min(1, { message: "method 至少一步" }),
|
|
22
|
+
output_shape: z.array(z.string()).optional().default([]),
|
|
23
|
+
source: z.object({
|
|
24
|
+
ref: z.string().min(1),
|
|
25
|
+
evidence_level: z
|
|
26
|
+
.enum(["research-rct", "research-observational", "book", "framework", "folk"])
|
|
27
|
+
.optional(),
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
export function validateAnalysisModel(data) {
|
|
31
|
+
return analysisModelSchema.parse(data);
|
|
32
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const triggerSignalSchema = z.object({
|
|
3
|
+
quadrant: z.enum(["能耗黑洞", "可放弃", "保持区", "亮点区"]).optional(),
|
|
4
|
+
daily_total_minutes: z.string().optional(), // like ">600"
|
|
5
|
+
});
|
|
6
|
+
export const knowledgeEntrySchema = z.object({
|
|
7
|
+
id: z.string().regex(/^[a-z0-9-]+$/),
|
|
8
|
+
kind: z.enum(["prescription", "principle", "research"]),
|
|
9
|
+
dimension: z.string().min(1),
|
|
10
|
+
title: z.string().min(1),
|
|
11
|
+
triggers: z.object({
|
|
12
|
+
signals: z.array(triggerSignalSchema).optional().default([]),
|
|
13
|
+
symptoms: z.array(z.string()).optional().default([]),
|
|
14
|
+
}).refine(v => (v.signals?.length || 0) + (v.symptoms?.length || 0) > 0, {
|
|
15
|
+
message: "triggers: signals 与 symptoms 至少有一个非空(否则永远召不回)",
|
|
16
|
+
}),
|
|
17
|
+
prescription: z.object({
|
|
18
|
+
one_liner: z.string(),
|
|
19
|
+
steps: z.array(z.string()).optional(),
|
|
20
|
+
micro_experiment: z.string(),
|
|
21
|
+
verify: z.string().optional(),
|
|
22
|
+
}).optional(),
|
|
23
|
+
source: z.object({
|
|
24
|
+
ref: z.string().min(1),
|
|
25
|
+
cite_url: z.string().optional(),
|
|
26
|
+
}),
|
|
27
|
+
evidence_level: z.enum(["research-rct", "research-observational", "book", "framework", "folk"]),
|
|
28
|
+
evidence_note: z.string().optional(),
|
|
29
|
+
applicability: z.object({
|
|
30
|
+
personas_fit: z.array(z.string()).default([]),
|
|
31
|
+
personas_avoid: z.array(z.string()).default([]),
|
|
32
|
+
boundaries: z.array(z.string()).default([]),
|
|
33
|
+
}).optional().default({ personas_fit: [], personas_avoid: [], boundaries: [] }),
|
|
34
|
+
tags: z.array(z.string()).optional().default([]),
|
|
35
|
+
}).refine(data => {
|
|
36
|
+
if (data.kind === "prescription") {
|
|
37
|
+
return data.prescription !== undefined
|
|
38
|
+
&& data.prescription.one_liner.length > 0
|
|
39
|
+
&& data.prescription.micro_experiment.length > 0;
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}, { message: "kind=prescription 时 prescription.one_liner 与 micro_experiment 必填" });
|
|
43
|
+
export function validateEntry(data) {
|
|
44
|
+
return knowledgeEntrySchema.parse(data);
|
|
45
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* COACH-MOD §3.4 — 画像 schema。
|
|
4
|
+
* 画像驱动语气/视角自适应(呼应 S15 §6)。存于 _registry/personas.yaml 的 personas 列表。
|
|
5
|
+
*/
|
|
6
|
+
export const personaSchema = z.object({
|
|
7
|
+
id: z.string().regex(/^[a-z0-9-]+$/),
|
|
8
|
+
label: z.string().min(1),
|
|
9
|
+
traits: z.array(z.string()).optional().default([]),
|
|
10
|
+
constraints: z.array(z.string()).optional().default([]),
|
|
11
|
+
// 语气自适应说明(S15 §6)
|
|
12
|
+
tone_adjust: z.string().optional(),
|
|
13
|
+
});
|
|
14
|
+
/** _registry/personas.yaml 顶层结构:{ personas: [...] } */
|
|
15
|
+
export const personaRegistrySchema = z.object({
|
|
16
|
+
personas: z.array(personaSchema).optional().default([]),
|
|
17
|
+
});
|
|
18
|
+
export function validatePersona(data) {
|
|
19
|
+
return personaSchema.parse(data);
|
|
20
|
+
}
|
|
21
|
+
export function validatePersonaRegistry(data) {
|
|
22
|
+
return personaRegistrySchema.parse(data);
|
|
23
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* COACH-MOD §3.3 — 场景包 schema。
|
|
4
|
+
* 场景包 = 一个情境入口,内含推荐画像 + 推荐分析模型 + 场景专属提示。
|
|
5
|
+
* 装一个全来(recommends 展开),仍可单换(coachmod.load 单 id)。
|
|
6
|
+
*/
|
|
7
|
+
export const scenarioPackSchema = z.object({
|
|
8
|
+
id: z.string().regex(/^[a-z0-9-]+$/),
|
|
9
|
+
kind: z.literal("scenario-pack"),
|
|
10
|
+
title: z.string().min(1),
|
|
11
|
+
triggers: z.object({
|
|
12
|
+
// 手层粗筛用的情境标签(coachmod.suggest 匹配),至少一个否则永远召不回
|
|
13
|
+
context_tags: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.min(1, { message: "triggers.context_tags 至少一个(否则永远召不回)" }),
|
|
16
|
+
}),
|
|
17
|
+
recommends: z.object({
|
|
18
|
+
persona_id: z.string().min(1),
|
|
19
|
+
analysis_model_ids: z
|
|
20
|
+
.array(z.string())
|
|
21
|
+
.min(1, { message: "recommends.analysis_model_ids 至少一个" }),
|
|
22
|
+
// 场景专属提示(脑装载后遵循)
|
|
23
|
+
subskill_prompt: z.string().min(1),
|
|
24
|
+
}),
|
|
25
|
+
description: z.string().min(1),
|
|
26
|
+
});
|
|
27
|
+
export function validateScenarioPack(data) {
|
|
28
|
+
return scenarioPackSchema.parse(data);
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|