@optima-chat/optima-agent 0.8.3 → 0.8.4

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 (76) hide show
  1. package/.claude/skills/order/SKILL.md +74 -25
  2. package/dist/bin/bi-cli.js +0 -0
  3. package/dist/bin/comfy.js +0 -0
  4. package/dist/bin/commerce.js +0 -0
  5. package/dist/bin/google-ads.js +0 -0
  6. package/dist/bin/optima.js +0 -0
  7. package/dist/bin/scout.js +0 -0
  8. package/dist/src/system-prompt.d.ts.map +1 -1
  9. package/dist/src/system-prompt.js +2 -1
  10. package/dist/src/system-prompt.js.map +1 -1
  11. package/package.json +1 -1
  12. package/.claude/settings.local.json +0 -121
  13. package/dist/src/hooks-loader.d.ts +0 -6
  14. package/dist/src/hooks-loader.d.ts.map +0 -1
  15. package/dist/src/hooks-loader.js +0 -215
  16. package/dist/src/hooks-loader.js.map +0 -1
  17. package/dist/src/ui/App.d.ts +0 -6
  18. package/dist/src/ui/App.d.ts.map +0 -1
  19. package/dist/src/ui/App.js +0 -164
  20. package/dist/src/ui/App.js.map +0 -1
  21. package/dist/src/ui/components/Composer.d.ts +0 -10
  22. package/dist/src/ui/components/Composer.d.ts.map +0 -1
  23. package/dist/src/ui/components/Composer.js +0 -13
  24. package/dist/src/ui/components/Composer.js.map +0 -1
  25. package/dist/src/ui/components/Header.d.ts +0 -7
  26. package/dist/src/ui/components/Header.d.ts.map +0 -1
  27. package/dist/src/ui/components/Header.js +0 -7
  28. package/dist/src/ui/components/Header.js.map +0 -1
  29. package/dist/src/ui/components/Message.d.ts +0 -12
  30. package/dist/src/ui/components/Message.d.ts.map +0 -1
  31. package/dist/src/ui/components/Message.js +0 -21
  32. package/dist/src/ui/components/Message.js.map +0 -1
  33. package/dist/src/ui/components/MessageList.d.ts +0 -9
  34. package/dist/src/ui/components/MessageList.d.ts.map +0 -1
  35. package/dist/src/ui/components/MessageList.js +0 -18
  36. package/dist/src/ui/components/MessageList.js.map +0 -1
  37. package/dist/src/ui/components/Spinner.d.ts +0 -6
  38. package/dist/src/ui/components/Spinner.d.ts.map +0 -1
  39. package/dist/src/ui/components/Spinner.js +0 -7
  40. package/dist/src/ui/components/Spinner.js.map +0 -1
  41. package/dist/src/ui/components/StatusBar.d.ts +0 -11
  42. package/dist/src/ui/components/StatusBar.d.ts.map +0 -1
  43. package/dist/src/ui/components/StatusBar.js +0 -7
  44. package/dist/src/ui/components/StatusBar.js.map +0 -1
  45. package/dist/src/ui/components/index.d.ts +0 -7
  46. package/dist/src/ui/components/index.d.ts.map +0 -1
  47. package/dist/src/ui/components/index.js +0 -7
  48. package/dist/src/ui/components/index.js.map +0 -1
  49. package/dist/src/validation/error-formatter.d.ts +0 -21
  50. package/dist/src/validation/error-formatter.d.ts.map +0 -1
  51. package/dist/src/validation/error-formatter.js +0 -98
  52. package/dist/src/validation/error-formatter.js.map +0 -1
  53. package/dist/src/validation/index.d.ts +0 -10
  54. package/dist/src/validation/index.d.ts.map +0 -1
  55. package/dist/src/validation/index.js +0 -10
  56. package/dist/src/validation/index.js.map +0 -1
  57. package/dist/src/validation/json-validator.d.ts +0 -25
  58. package/dist/src/validation/json-validator.d.ts.map +0 -1
  59. package/dist/src/validation/json-validator.js +0 -173
  60. package/dist/src/validation/json-validator.js.map +0 -1
  61. package/dist/src/validation/schema.d.ts +0 -353
  62. package/dist/src/validation/schema.d.ts.map +0 -1
  63. package/dist/src/validation/schema.js +0 -57
  64. package/dist/src/validation/schema.js.map +0 -1
  65. package/dist/src/validation/suggestions.d.ts +0 -25
  66. package/dist/src/validation/suggestions.d.ts.map +0 -1
  67. package/dist/src/validation/suggestions.js +0 -144
  68. package/dist/src/validation/suggestions.js.map +0 -1
  69. package/dist/src/validation/types.d.ts +0 -40
  70. package/dist/src/validation/types.d.ts.map +0 -1
  71. package/dist/src/validation/types.js +0 -5
  72. package/dist/src/validation/types.js.map +0 -1
  73. package/dist/src/validation/yaml-validator.d.ts +0 -25
  74. package/dist/src/validation/yaml-validator.d.ts.map +0 -1
  75. package/dist/src/validation/yaml-validator.js +0 -177
  76. package/dist/src/validation/yaml-validator.js.map +0 -1
@@ -1,173 +0,0 @@
1
- /**
2
- * JSON 配置验证器
3
- */
4
- import { ZodError } from "zod";
5
- import { OptimaConfigSchema } from "./schema.js";
6
- import { generateSuggestionsFromZodError, generateJsonSyntaxSuggestions, generateOptimaConfigSuggestions, } from "./suggestions.js";
7
- export class JsonValidator {
8
- /**
9
- * 解析 JSON 内容
10
- */
11
- parseJson(content) {
12
- try {
13
- const data = JSON.parse(content);
14
- return { data };
15
- }
16
- catch (error) {
17
- const position = this.extractErrorPosition(error);
18
- return { data: null, error: error, position };
19
- }
20
- }
21
- /**
22
- * 从 JSON 错误中提取位置信息
23
- */
24
- extractErrorPosition(error) {
25
- // JSON.parse 错误通常包含 "at position X"
26
- const match = error.message.match(/position (\d+)/);
27
- if (match) {
28
- return parseInt(match[1], 10);
29
- }
30
- return undefined;
31
- }
32
- /**
33
- * 将字符位置转换为行号和列号
34
- */
35
- positionToLineColumn(content, position) {
36
- const lines = content.substring(0, position).split("\n");
37
- return {
38
- line: lines.length,
39
- column: lines[lines.length - 1].length + 1,
40
- };
41
- }
42
- /**
43
- * 验证 JSON 配置
44
- */
45
- validate(content, filePath) {
46
- const errors = [];
47
- const warnings = [];
48
- // 1. 检查是否为空
49
- if (!content.trim()) {
50
- errors.push({
51
- type: "syntax",
52
- filePath,
53
- message: "配置文件为空",
54
- suggestions: [
55
- "添加配置内容",
56
- "如果不需要配置,可以删除该文件",
57
- "最小配置示例: {}",
58
- ],
59
- });
60
- return { valid: false, errors, warnings };
61
- }
62
- // 2. 解析 JSON
63
- const { data, error: jsonError, position } = this.parseJson(content);
64
- if (jsonError) {
65
- let line;
66
- let column;
67
- if (position !== undefined) {
68
- const loc = this.positionToLineColumn(content, position);
69
- line = loc.line;
70
- column = loc.column;
71
- }
72
- errors.push({
73
- type: "syntax",
74
- filePath,
75
- message: "JSON 语法错误",
76
- details: jsonError.message,
77
- line,
78
- column,
79
- suggestions: generateJsonSyntaxSuggestions(jsonError.message),
80
- });
81
- return { valid: false, errors, warnings };
82
- }
83
- // 3. 检查是否为对象
84
- if (typeof data !== "object" || data === null || Array.isArray(data)) {
85
- errors.push({
86
- type: "schema",
87
- filePath,
88
- message: "配置文件必须是一个 JSON 对象",
89
- suggestions: ["配置应该用大括号 {} 包裹", "示例: { \"model\": \"...\", \"theme\": \"dark\" }"],
90
- });
91
- return { valid: false, errors, warnings };
92
- }
93
- // 4. 使用 Zod 验证 schema
94
- try {
95
- OptimaConfigSchema.parse(data);
96
- }
97
- catch (error) {
98
- if (error instanceof ZodError) {
99
- for (const issue of error.issues) {
100
- const zodSuggestions = generateSuggestionsFromZodError(error);
101
- const optimaSuggestions = generateOptimaConfigSuggestions(issue.path.map(String));
102
- errors.push({
103
- type: "schema",
104
- filePath,
105
- message: issue.message,
106
- path: issue.path.map(String),
107
- suggestions: [...zodSuggestions, ...optimaSuggestions],
108
- });
109
- }
110
- }
111
- else {
112
- errors.push({
113
- type: "schema",
114
- filePath,
115
- message: "未知的验证错误",
116
- details: String(error),
117
- suggestions: ["请检查配置文件格式"],
118
- });
119
- }
120
- return { valid: false, errors, warnings };
121
- }
122
- // 5. 语义检查和警告
123
- // 检查未知字段
124
- const knownFields = ["model", "theme", "ui", "server"];
125
- const unknownFields = Object.keys(data).filter((key) => !knownFields.includes(key));
126
- if (unknownFields.length > 0) {
127
- warnings.push({
128
- type: "semantic",
129
- filePath,
130
- message: `发现未知字段: ${unknownFields.join(", ")}`,
131
- suggestions: [
132
- "这些字段会被忽略",
133
- "检查是否拼写错误",
134
- `已知字段: ${knownFields.join(", ")}`,
135
- ],
136
- });
137
- }
138
- // 检查服务器配置
139
- if (data.server?.port) {
140
- const commonPorts = [3000, 8080, 8000, 5000];
141
- if (!commonPorts.includes(data.server.port)) {
142
- warnings.push({
143
- type: "semantic",
144
- filePath,
145
- message: `使用非常见端口: ${data.server.port}`,
146
- path: ["server", "port"],
147
- suggestions: ["确保该端口未被占用", `常用端口: ${commonPorts.join(", ")}`],
148
- });
149
- }
150
- }
151
- return {
152
- valid: errors.length === 0,
153
- errors,
154
- warnings,
155
- };
156
- }
157
- /**
158
- * 解析配置(验证成功后调用)
159
- */
160
- parse(content) {
161
- const { data, error } = this.parseJson(content);
162
- if (error) {
163
- return null;
164
- }
165
- try {
166
- return OptimaConfigSchema.parse(data);
167
- }
168
- catch {
169
- return null;
170
- }
171
- }
172
- }
173
- //# sourceMappingURL=json-validator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-validator.js","sourceRoot":"","sources":["../../../src/validation/json-validator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAqB,MAAM,aAAa,CAAC;AACpE,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,EAC7B,+BAA+B,GAChC,MAAM,kBAAkB,CAAC;AAE1B,MAAM,OAAO,aAAa;IACxB;;OAEG;IACK,SAAS,CAAC,OAAe;QAC/B,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACjC,OAAO,EAAE,IAAI,EAAE,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,QAAQ,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAc,CAAC,CAAC;YAC3D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAc,EAAE,QAAQ,EAAE,CAAC;QACzD,CAAC;IACH,CAAC;IAED;;OAEG;IACK,oBAAoB,CAAC,KAAY;QACvC,oCAAoC;QACpC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACpD,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,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AAC;YAC7C,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC5C,QAAQ,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,UAAU;oBAChB,QAAQ;oBACR,OAAO,EAAE,YAAY,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;oBACvC,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;oBACxB,WAAW,EAAE,CAAC,WAAW,EAAE,SAAS,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;iBAC9D,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC1B,MAAM;YACN,QAAQ;SACT,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAe;QACnB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC;YACH,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
@@ -1,353 +0,0 @@
1
- /**
2
- * 配置文件 Zod Schema 定义
3
- */
4
- import { z } from "zod";
5
- export declare const SkillYamlFrontmatterSchema: z.ZodObject<{
6
- name: z.ZodString;
7
- description: z.ZodOptional<z.ZodString>;
8
- version: z.ZodOptional<z.ZodString>;
9
- "user-invocable": z.ZodOptional<z.ZodBoolean>;
10
- "allowed-tools": z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
11
- hooks: z.ZodOptional<z.ZodEffects<z.ZodObject<{
12
- SessionStart: z.ZodOptional<z.ZodArray<z.ZodObject<{
13
- matcher: z.ZodOptional<z.ZodString>;
14
- hooks: z.ZodArray<z.ZodObject<{
15
- type: z.ZodLiteral<"command">;
16
- command: z.ZodString;
17
- }, "strip", z.ZodTypeAny, {
18
- type: "command";
19
- command: string;
20
- }, {
21
- type: "command";
22
- command: string;
23
- }>, "many">;
24
- }, "strip", z.ZodTypeAny, {
25
- hooks: {
26
- type: "command";
27
- command: string;
28
- }[];
29
- matcher?: string | undefined;
30
- }, {
31
- hooks: {
32
- type: "command";
33
- command: string;
34
- }[];
35
- matcher?: string | undefined;
36
- }>, "many">>;
37
- PreToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
38
- matcher: z.ZodOptional<z.ZodString>;
39
- hooks: z.ZodArray<z.ZodObject<{
40
- type: z.ZodLiteral<"command">;
41
- command: z.ZodString;
42
- }, "strip", z.ZodTypeAny, {
43
- type: "command";
44
- command: string;
45
- }, {
46
- type: "command";
47
- command: string;
48
- }>, "many">;
49
- }, "strip", z.ZodTypeAny, {
50
- hooks: {
51
- type: "command";
52
- command: string;
53
- }[];
54
- matcher?: string | undefined;
55
- }, {
56
- hooks: {
57
- type: "command";
58
- command: string;
59
- }[];
60
- matcher?: string | undefined;
61
- }>, "many">>;
62
- PostToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
63
- matcher: z.ZodOptional<z.ZodString>;
64
- hooks: z.ZodArray<z.ZodObject<{
65
- type: z.ZodLiteral<"command">;
66
- command: z.ZodString;
67
- }, "strip", z.ZodTypeAny, {
68
- type: "command";
69
- command: string;
70
- }, {
71
- type: "command";
72
- command: string;
73
- }>, "many">;
74
- }, "strip", z.ZodTypeAny, {
75
- hooks: {
76
- type: "command";
77
- command: string;
78
- }[];
79
- matcher?: string | undefined;
80
- }, {
81
- hooks: {
82
- type: "command";
83
- command: string;
84
- }[];
85
- matcher?: string | undefined;
86
- }>, "many">>;
87
- Stop: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
- matcher: z.ZodOptional<z.ZodString>;
89
- hooks: z.ZodArray<z.ZodObject<{
90
- type: z.ZodLiteral<"command">;
91
- command: z.ZodString;
92
- }, "strip", z.ZodTypeAny, {
93
- type: "command";
94
- command: string;
95
- }, {
96
- type: "command";
97
- command: string;
98
- }>, "many">;
99
- }, "strip", z.ZodTypeAny, {
100
- hooks: {
101
- type: "command";
102
- command: string;
103
- }[];
104
- matcher?: string | undefined;
105
- }, {
106
- hooks: {
107
- type: "command";
108
- command: string;
109
- }[];
110
- matcher?: string | undefined;
111
- }>, "many">>;
112
- }, "strip", z.ZodTypeAny, {
113
- SessionStart?: {
114
- hooks: {
115
- type: "command";
116
- command: string;
117
- }[];
118
- matcher?: string | undefined;
119
- }[] | undefined;
120
- PreToolUse?: {
121
- hooks: {
122
- type: "command";
123
- command: string;
124
- }[];
125
- matcher?: string | undefined;
126
- }[] | undefined;
127
- PostToolUse?: {
128
- hooks: {
129
- type: "command";
130
- command: string;
131
- }[];
132
- matcher?: string | undefined;
133
- }[] | undefined;
134
- Stop?: {
135
- hooks: {
136
- type: "command";
137
- command: string;
138
- }[];
139
- matcher?: string | undefined;
140
- }[] | undefined;
141
- }, {
142
- SessionStart?: {
143
- hooks: {
144
- type: "command";
145
- command: string;
146
- }[];
147
- matcher?: string | undefined;
148
- }[] | undefined;
149
- PreToolUse?: {
150
- hooks: {
151
- type: "command";
152
- command: string;
153
- }[];
154
- matcher?: string | undefined;
155
- }[] | undefined;
156
- PostToolUse?: {
157
- hooks: {
158
- type: "command";
159
- command: string;
160
- }[];
161
- matcher?: string | undefined;
162
- }[] | undefined;
163
- Stop?: {
164
- hooks: {
165
- type: "command";
166
- command: string;
167
- }[];
168
- matcher?: string | undefined;
169
- }[] | undefined;
170
- }>, {
171
- SessionStart?: {
172
- hooks: {
173
- type: "command";
174
- command: string;
175
- }[];
176
- matcher?: string | undefined;
177
- }[] | undefined;
178
- PreToolUse?: {
179
- hooks: {
180
- type: "command";
181
- command: string;
182
- }[];
183
- matcher?: string | undefined;
184
- }[] | undefined;
185
- PostToolUse?: {
186
- hooks: {
187
- type: "command";
188
- command: string;
189
- }[];
190
- matcher?: string | undefined;
191
- }[] | undefined;
192
- Stop?: {
193
- hooks: {
194
- type: "command";
195
- command: string;
196
- }[];
197
- matcher?: string | undefined;
198
- }[] | undefined;
199
- }, {
200
- SessionStart?: {
201
- hooks: {
202
- type: "command";
203
- command: string;
204
- }[];
205
- matcher?: string | undefined;
206
- }[] | undefined;
207
- PreToolUse?: {
208
- hooks: {
209
- type: "command";
210
- command: string;
211
- }[];
212
- matcher?: string | undefined;
213
- }[] | undefined;
214
- PostToolUse?: {
215
- hooks: {
216
- type: "command";
217
- command: string;
218
- }[];
219
- matcher?: string | undefined;
220
- }[] | undefined;
221
- Stop?: {
222
- hooks: {
223
- type: "command";
224
- command: string;
225
- }[];
226
- matcher?: string | undefined;
227
- }[] | undefined;
228
- }>>;
229
- }, "strip", z.ZodTypeAny, {
230
- name: string;
231
- hooks?: {
232
- SessionStart?: {
233
- hooks: {
234
- type: "command";
235
- command: string;
236
- }[];
237
- matcher?: string | undefined;
238
- }[] | undefined;
239
- PreToolUse?: {
240
- hooks: {
241
- type: "command";
242
- command: string;
243
- }[];
244
- matcher?: string | undefined;
245
- }[] | undefined;
246
- PostToolUse?: {
247
- hooks: {
248
- type: "command";
249
- command: string;
250
- }[];
251
- matcher?: string | undefined;
252
- }[] | undefined;
253
- Stop?: {
254
- hooks: {
255
- type: "command";
256
- command: string;
257
- }[];
258
- matcher?: string | undefined;
259
- }[] | undefined;
260
- } | undefined;
261
- description?: string | undefined;
262
- version?: string | undefined;
263
- "user-invocable"?: boolean | undefined;
264
- "allowed-tools"?: string[] | undefined;
265
- }, {
266
- name: string;
267
- hooks?: {
268
- SessionStart?: {
269
- hooks: {
270
- type: "command";
271
- command: string;
272
- }[];
273
- matcher?: string | undefined;
274
- }[] | undefined;
275
- PreToolUse?: {
276
- hooks: {
277
- type: "command";
278
- command: string;
279
- }[];
280
- matcher?: string | undefined;
281
- }[] | undefined;
282
- PostToolUse?: {
283
- hooks: {
284
- type: "command";
285
- command: string;
286
- }[];
287
- matcher?: string | undefined;
288
- }[] | undefined;
289
- Stop?: {
290
- hooks: {
291
- type: "command";
292
- command: string;
293
- }[];
294
- matcher?: string | undefined;
295
- }[] | undefined;
296
- } | undefined;
297
- description?: string | undefined;
298
- version?: string | undefined;
299
- "user-invocable"?: boolean | undefined;
300
- "allowed-tools"?: string[] | undefined;
301
- }>;
302
- export type SkillYamlFrontmatter = z.infer<typeof SkillYamlFrontmatterSchema>;
303
- /**
304
- * OPTIMA.json / settings.json Schema
305
- */
306
- export declare const OptimaConfigSchema: z.ZodObject<{
307
- model: z.ZodOptional<z.ZodString>;
308
- theme: z.ZodOptional<z.ZodEnum<["dark", "light"]>>;
309
- ui: z.ZodOptional<z.ZodObject<{
310
- showTokens: z.ZodOptional<z.ZodBoolean>;
311
- showSkills: z.ZodOptional<z.ZodBoolean>;
312
- }, "strip", z.ZodTypeAny, {
313
- showTokens?: boolean | undefined;
314
- showSkills?: boolean | undefined;
315
- }, {
316
- showTokens?: boolean | undefined;
317
- showSkills?: boolean | undefined;
318
- }>>;
319
- server: z.ZodOptional<z.ZodObject<{
320
- port: z.ZodOptional<z.ZodNumber>;
321
- token: z.ZodOptional<z.ZodString>;
322
- }, "strip", z.ZodTypeAny, {
323
- port?: number | undefined;
324
- token?: string | undefined;
325
- }, {
326
- port?: number | undefined;
327
- token?: string | undefined;
328
- }>>;
329
- }, "strip", z.ZodTypeAny, {
330
- model?: string | undefined;
331
- theme?: "dark" | "light" | undefined;
332
- ui?: {
333
- showTokens?: boolean | undefined;
334
- showSkills?: boolean | undefined;
335
- } | undefined;
336
- server?: {
337
- port?: number | undefined;
338
- token?: string | undefined;
339
- } | undefined;
340
- }, {
341
- model?: string | undefined;
342
- theme?: "dark" | "light" | undefined;
343
- ui?: {
344
- showTokens?: boolean | undefined;
345
- showSkills?: boolean | undefined;
346
- } | undefined;
347
- server?: {
348
- port?: number | undefined;
349
- token?: string | undefined;
350
- } | undefined;
351
- }>;
352
- export type OptimaConfig = z.infer<typeof OptimaConfigSchema>;
353
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/validation/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;GAEG;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAe7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -1,57 +0,0 @@
1
- /**
2
- * 配置文件 Zod Schema 定义
3
- */
4
- import { z } from "zod";
5
- /**
6
- * SKILL.md YAML Frontmatter Schema
7
- */
8
- // Hook 配置
9
- const HookConfigSchema = z.object({
10
- type: z.literal("command"),
11
- command: z.string().min(1, "command 不能为空"),
12
- });
13
- // Skill Hook 配置(单个事件的钩子配置)
14
- const SkillHookConfigSchema = z.object({
15
- matcher: z.string().optional(),
16
- hooks: z.array(HookConfigSchema).min(1, "hooks 数组至少需要一个元素"),
17
- });
18
- // Hooks 配置
19
- const HooksSchema = z
20
- .object({
21
- SessionStart: z.array(SkillHookConfigSchema).optional(),
22
- PreToolUse: z.array(SkillHookConfigSchema).optional(),
23
- PostToolUse: z.array(SkillHookConfigSchema).optional(),
24
- Stop: z.array(SkillHookConfigSchema).optional(),
25
- })
26
- .refine((hooks) => Object.keys(hooks).length > 0, {
27
- message: "hooks 至少需要定义一个事件(SessionStart/PreToolUse/PostToolUse/Stop)",
28
- });
29
- // SKILL.md Frontmatter
30
- export const SkillYamlFrontmatterSchema = z.object({
31
- name: z.string().min(1, "name 字段不能为空"),
32
- description: z.string().optional(),
33
- version: z.string().optional(),
34
- "user-invocable": z.boolean().optional(),
35
- "allowed-tools": z.array(z.string()).optional(),
36
- hooks: HooksSchema.optional(),
37
- });
38
- /**
39
- * OPTIMA.json / settings.json Schema
40
- */
41
- export const OptimaConfigSchema = z.object({
42
- model: z.string().optional(),
43
- theme: z.enum(["dark", "light"]).optional(),
44
- ui: z
45
- .object({
46
- showTokens: z.boolean().optional(),
47
- showSkills: z.boolean().optional(),
48
- })
49
- .optional(),
50
- server: z
51
- .object({
52
- port: z.number().int().min(1).max(65535).optional(),
53
- token: z.string().optional(),
54
- })
55
- .optional(),
56
- });
57
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/validation/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AAEH,UAAU;AACV,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,cAAc,CAAC;CAC3C,CAAC,CAAC;AAEH,2BAA2B;AAC3B,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACr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,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3C,EAAE,EAAE,CAAC;SACF,MAAM,CAAC;QACN,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;QAClC,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;KACnC,CAAC;SACD,QAAQ,EAAE;IACb,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;QACnD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC7B,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC"}
@@ -1,25 +0,0 @@
1
- /**
2
- * 修复建议生成器
3
- */
4
- import type { ZodError } from "zod";
5
- /**
6
- * 从 Zod 错误生成修复建议
7
- */
8
- export declare function generateSuggestionsFromZodError(zodError: ZodError): string[];
9
- /**
10
- * 为 YAML 语法错误生成建议
11
- */
12
- export declare function generateYamlSyntaxSuggestions(errorMessage: string): string[];
13
- /**
14
- * 为 JSON 语法错误生成建议
15
- */
16
- export declare function generateJsonSyntaxSuggestions(errorMessage: string): string[];
17
- /**
18
- * 为 Skill 配置生成特定建议
19
- */
20
- export declare function generateSkillConfigSuggestions(path: string[]): string[];
21
- /**
22
- * 为 Optima 配置生成特定建议
23
- */
24
- export declare function generateOptimaConfigSuggestions(path: string[]): string[];
25
- //# sourceMappingURL=suggestions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"suggestions.d.ts","sourceRoot":"","sources":["../../../src/validation/suggestions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEpC;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAAE,CAiD5E;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CA8B5E;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAuB5E;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CA6BvE;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAmBxE"}