@vertesia/build-tools 1.0.0-dev.20260203.130115Z → 1.0.0-dev.20260227.104700Z
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/README.md +39 -0
- package/lib/build-tools.js +2020 -0
- package/lib/build-tools.js.map +1 -0
- package/lib/cjs/index.js +43 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/parsers/frontmatter.js +25 -0
- package/lib/cjs/parsers/frontmatter.js.map +1 -0
- package/lib/cjs/plugin.js +150 -0
- package/lib/cjs/plugin.js.map +1 -0
- package/lib/cjs/presets/index.js +25 -0
- package/lib/cjs/presets/index.js.map +1 -0
- package/lib/cjs/presets/prompt.js +185 -0
- package/lib/cjs/presets/prompt.js.map +1 -0
- package/lib/cjs/presets/raw.js +25 -0
- package/lib/cjs/presets/raw.js.map +1 -0
- package/lib/cjs/presets/skill-collection.js +83 -0
- package/lib/cjs/presets/skill-collection.js.map +1 -0
- package/lib/cjs/presets/skill.js +272 -0
- package/lib/cjs/presets/skill.js.map +1 -0
- package/lib/cjs/presets/template-collection.js +80 -0
- package/lib/cjs/presets/template-collection.js.map +1 -0
- package/lib/cjs/presets/template.js +105 -0
- package/lib/cjs/presets/template.js.map +1 -0
- package/lib/cjs/types.js +6 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/cjs/utils/asset-copy.js +61 -0
- package/lib/cjs/utils/asset-copy.js.map +1 -0
- package/lib/cjs/utils/asset-discovery.js +100 -0
- package/lib/cjs/utils/asset-discovery.js.map +1 -0
- package/lib/cjs/utils/template-asset-discovery.js +63 -0
- package/lib/cjs/utils/template-asset-discovery.js.map +1 -0
- package/lib/cjs/utils/widget-compiler.js +115 -0
- package/lib/cjs/utils/widget-compiler.js.map +1 -0
- package/lib/esm/index.js +26 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/parsers/frontmatter.js +19 -0
- package/lib/esm/parsers/frontmatter.js.map +1 -0
- package/lib/esm/plugin.js +144 -0
- package/lib/esm/plugin.js.map +1 -0
- package/lib/esm/presets/index.js +10 -0
- package/lib/esm/presets/index.js.map +1 -0
- package/lib/esm/presets/prompt.js +181 -0
- package/lib/esm/presets/prompt.js.map +1 -0
- package/lib/esm/presets/raw.js +22 -0
- package/lib/esm/presets/raw.js.map +1 -0
- package/lib/esm/presets/skill-collection.js +77 -0
- package/lib/esm/presets/skill-collection.js.map +1 -0
- package/lib/esm/presets/skill.js +266 -0
- package/lib/esm/presets/skill.js.map +1 -0
- package/lib/esm/presets/template-collection.js +74 -0
- package/lib/esm/presets/template-collection.js.map +1 -0
- package/lib/esm/presets/template.js +99 -0
- package/lib/esm/presets/template.js.map +1 -0
- package/lib/esm/types.js +5 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/esm/utils/asset-copy.js +54 -0
- package/lib/esm/utils/asset-copy.js.map +1 -0
- package/lib/esm/utils/asset-discovery.js +94 -0
- package/lib/esm/utils/asset-discovery.js.map +1 -0
- package/lib/esm/utils/template-asset-discovery.js +57 -0
- package/lib/esm/utils/template-asset-discovery.js.map +1 -0
- package/lib/esm/utils/widget-compiler.js +76 -0
- package/lib/esm/utils/widget-compiler.js.map +1 -0
- package/lib/types/index.d.ts +24 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/parsers/frontmatter.d.ts +19 -0
- package/lib/types/parsers/frontmatter.d.ts.map +1 -0
- package/lib/types/plugin.d.ts +10 -0
- package/lib/types/plugin.d.ts.map +1 -0
- package/lib/types/presets/index.d.ts +10 -0
- package/lib/types/presets/index.d.ts.map +1 -0
- package/lib/types/presets/prompt.d.ts +63 -0
- package/lib/types/presets/prompt.d.ts.map +1 -0
- package/lib/types/presets/raw.d.ts +16 -0
- package/lib/types/presets/raw.d.ts.map +1 -0
- package/lib/types/presets/skill-collection.d.ts +26 -0
- package/lib/types/presets/skill-collection.d.ts.map +1 -0
- package/lib/types/presets/skill.d.ts +361 -0
- package/lib/types/presets/skill.d.ts.map +1 -0
- package/lib/types/presets/template-collection.d.ts +25 -0
- package/lib/types/presets/template-collection.d.ts.map +1 -0
- package/lib/types/presets/template.d.ts +58 -0
- package/lib/types/presets/template.d.ts.map +1 -0
- package/lib/types/types.d.ts +115 -0
- package/lib/types/types.d.ts.map +1 -0
- package/lib/types/utils/asset-copy.d.ts +20 -0
- package/lib/types/utils/asset-copy.d.ts.map +1 -0
- package/lib/types/utils/asset-discovery.d.ts +38 -0
- package/lib/types/utils/asset-discovery.d.ts.map +1 -0
- package/lib/types/utils/template-asset-discovery.d.ts +23 -0
- package/lib/types/utils/template-asset-discovery.d.ts.map +1 -0
- package/lib/types/utils/widget-compiler.d.ts +15 -0
- package/lib/types/utils/widget-compiler.d.ts.map +1 -0
- package/package.json +6 -6
- package/src/index.ts +5 -0
- package/src/presets/index.ts +3 -1
- package/src/presets/skill.ts +51 -3
- package/src/presets/template-collection.ts +83 -0
- package/src/presets/template.ts +116 -0
- package/src/types.ts +1 -1
- package/src/utils/template-asset-discovery.ts +77 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill collection transformer for directory-based skill imports
|
|
3
|
+
* Scans a directory for subdirectories containing SKILL.md files
|
|
4
|
+
*/
|
|
5
|
+
import { readdirSync, statSync, existsSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
/**
|
|
8
|
+
* Skill collection transformer preset
|
|
9
|
+
* Transforms directory imports with ?skills suffix into an array of skill imports
|
|
10
|
+
*
|
|
11
|
+
* Matches:
|
|
12
|
+
* - ./all?skills (recommended - generates all.js in the directory)
|
|
13
|
+
* - ./_skills?skills (generates _skills.js in the directory)
|
|
14
|
+
* - Any path ending with a filename and ?skills
|
|
15
|
+
*
|
|
16
|
+
* NOTE: A filename before ?skills is REQUIRED to avoid naming conflicts.
|
|
17
|
+
* The filename becomes the output module name.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import skills from './all?skills';
|
|
22
|
+
* // Scans current directory for subdirectories with SKILL.md
|
|
23
|
+
* // Generates all.js containing array of all skills
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export const skillCollectionTransformer = {
|
|
27
|
+
pattern: /\/[^/?]+\?skills$/,
|
|
28
|
+
virtual: true, // Indicates this doesn't transform a real file
|
|
29
|
+
transform: (_content, filePath) => {
|
|
30
|
+
// Remove ?skills suffix and the filename to get directory path
|
|
31
|
+
// Example: /path/code/all?skills -> /path/code/all -> /path/code/
|
|
32
|
+
const pathWithoutQuery = filePath.replace(/\?skills$/, '');
|
|
33
|
+
const dirPath = path.dirname(pathWithoutQuery);
|
|
34
|
+
if (!existsSync(dirPath)) {
|
|
35
|
+
throw new Error(`Directory not found: ${dirPath}`);
|
|
36
|
+
}
|
|
37
|
+
if (!statSync(dirPath).isDirectory()) {
|
|
38
|
+
throw new Error(`Not a directory: ${dirPath}`);
|
|
39
|
+
}
|
|
40
|
+
// Scan for subdirectories containing SKILL.md
|
|
41
|
+
const entries = readdirSync(dirPath);
|
|
42
|
+
const imports = [];
|
|
43
|
+
const names = [];
|
|
44
|
+
for (const entry of entries) {
|
|
45
|
+
const entryPath = path.join(dirPath, entry);
|
|
46
|
+
try {
|
|
47
|
+
if (statSync(entryPath).isDirectory()) {
|
|
48
|
+
const skillFile = path.join(entryPath, 'SKILL.md');
|
|
49
|
+
if (existsSync(skillFile)) {
|
|
50
|
+
// Generate unique identifier from directory name
|
|
51
|
+
const identifier = `Skill_${entry.replace(/[^a-zA-Z0-9_]/g, '_')}`;
|
|
52
|
+
imports.push(`import ${identifier} from './${entry}/SKILL.md';`);
|
|
53
|
+
names.push(identifier);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
// Skip entries that can't be read
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (names.length === 0) {
|
|
63
|
+
console.warn(`No SKILL.md files found in subdirectories of ${dirPath}`);
|
|
64
|
+
}
|
|
65
|
+
// Generate code that imports all skills and exports as array
|
|
66
|
+
const code = [
|
|
67
|
+
...imports,
|
|
68
|
+
'',
|
|
69
|
+
`export default [${names.join(', ')}];`
|
|
70
|
+
].join('\n');
|
|
71
|
+
return {
|
|
72
|
+
data: null, // Not used when custom code is provided
|
|
73
|
+
code
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=skill-collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-collection.js","sourceRoot":"","sources":["../../../src/presets/skill-collection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IACzD,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,IAAI,EAAE,+CAA+C;IAC9D,SAAS,EAAE,CAAC,QAAgB,EAAE,QAAgB,EAAE,EAAE;QAC9C,+DAA+D;QAC/D,kEAAkE;QAClE,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC3D,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAE/C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;QACvD,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;QAED,8CAA8C;QAC9C,M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
|
1
|
+
/**
|
|
2
|
+
* Skill transformer preset for markdown files with frontmatter
|
|
3
|
+
*/
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { existsSync } from 'node:fs';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { parseFrontmatter } from '../parsers/frontmatter.js';
|
|
8
|
+
import { discoverSkillAssets } from '../utils/asset-discovery.js';
|
|
9
|
+
/**
|
|
10
|
+
* Context triggers for auto-injection of skills (for frontmatter validation)
|
|
11
|
+
*/
|
|
12
|
+
const SkillContextTriggersFrontmatterSchema = z.object({
|
|
13
|
+
keywords: z.array(z.string()).optional(),
|
|
14
|
+
tool_names: z.array(z.string()).optional(),
|
|
15
|
+
data_patterns: z.array(z.string()).optional()
|
|
16
|
+
}).strict();
|
|
17
|
+
/**
|
|
18
|
+
* Context triggers for auto-injection of skills (for output validation)
|
|
19
|
+
*/
|
|
20
|
+
const SkillContextTriggersSchema = z.object({
|
|
21
|
+
keywords: z.array(z.string()).optional(),
|
|
22
|
+
tool_names: z.array(z.string()).optional(),
|
|
23
|
+
data_patterns: z.array(z.string()).optional()
|
|
24
|
+
}).optional();
|
|
25
|
+
/**
|
|
26
|
+
* Execution configuration for skills that need code execution (for frontmatter validation)
|
|
27
|
+
*/
|
|
28
|
+
const SkillExecutionFrontmatterSchema = z.object({
|
|
29
|
+
language: z.string(),
|
|
30
|
+
packages: z.array(z.string()).optional(),
|
|
31
|
+
system_packages: z.array(z.string()).optional(),
|
|
32
|
+
template: z.string().optional()
|
|
33
|
+
}).strict();
|
|
34
|
+
/**
|
|
35
|
+
* Execution configuration for skills that need code execution (for output validation)
|
|
36
|
+
*/
|
|
37
|
+
const SkillExecutionSchema = z.object({
|
|
38
|
+
language: z.string(),
|
|
39
|
+
packages: z.array(z.string()).optional(),
|
|
40
|
+
system_packages: z.array(z.string()).optional(),
|
|
41
|
+
template: z.string().optional()
|
|
42
|
+
}).optional();
|
|
43
|
+
/**
|
|
44
|
+
* Zod schema for skill frontmatter validation
|
|
45
|
+
* This validates the YAML frontmatter before transformation
|
|
46
|
+
* Supports both flat and nested structures
|
|
47
|
+
*/
|
|
48
|
+
const SkillFrontmatterSchema = z.object({
|
|
49
|
+
// Required fields
|
|
50
|
+
name: z.string().min(1, 'Skill name is required'),
|
|
51
|
+
description: z.string().min(1, 'Skill description is required'),
|
|
52
|
+
// Optional fields
|
|
53
|
+
title: z.string().optional(),
|
|
54
|
+
content_type: z.enum(['md', 'jst']).optional(),
|
|
55
|
+
// Flat structure fields (legacy)
|
|
56
|
+
keywords: z.array(z.string()).optional(),
|
|
57
|
+
tools: z.array(z.string()).optional(),
|
|
58
|
+
data_patterns: z.array(z.string()).optional(),
|
|
59
|
+
language: z.string().optional(),
|
|
60
|
+
packages: z.array(z.string()).optional(),
|
|
61
|
+
system_packages: z.array(z.string()).optional(),
|
|
62
|
+
// Nested structure fields
|
|
63
|
+
context_triggers: SkillContextTriggersFrontmatterSchema.optional(),
|
|
64
|
+
execution: SkillExecutionFrontmatterSchema.optional(),
|
|
65
|
+
related_tools: z.array(z.string()).optional(),
|
|
66
|
+
input_schema: z.object({
|
|
67
|
+
type: z.literal('object'),
|
|
68
|
+
properties: z.record(z.any()).optional(),
|
|
69
|
+
required: z.array(z.string()).optional()
|
|
70
|
+
}).optional(),
|
|
71
|
+
// Asset fields (auto-discovered but can be overridden)
|
|
72
|
+
scripts: z.array(z.string()).optional(),
|
|
73
|
+
widgets: z.array(z.string()).optional()
|
|
74
|
+
}).strict();
|
|
75
|
+
/**
|
|
76
|
+
* MUST be kept in sync with @vertesia/tools-sdk SkillDefinition
|
|
77
|
+
* Zod schema for skill definition
|
|
78
|
+
* This validates the structure of skill objects generated from markdown
|
|
79
|
+
* Matches the SkillDefinition interface from @vertesia/tools-sdk
|
|
80
|
+
*
|
|
81
|
+
* Note: The isEnabled property is not included in this schema because Zod cannot
|
|
82
|
+
* properly validate function signatures. It will be type-checked by TypeScript instead.
|
|
83
|
+
*/
|
|
84
|
+
export const SkillDefinitionSchema = z.object({
|
|
85
|
+
name: z.string().min(1, 'Skill name is required'),
|
|
86
|
+
title: z.string().optional(),
|
|
87
|
+
description: z.string().min(1, 'Skill description is required'),
|
|
88
|
+
instructions: z.string(),
|
|
89
|
+
content_type: z.enum(['md', 'jst']),
|
|
90
|
+
input_schema: z.object({
|
|
91
|
+
type: z.literal('object'),
|
|
92
|
+
properties: z.record(z.any()).optional(),
|
|
93
|
+
required: z.array(z.string()).optional()
|
|
94
|
+
}).optional(),
|
|
95
|
+
context_triggers: SkillContextTriggersSchema,
|
|
96
|
+
execution: SkillExecutionSchema,
|
|
97
|
+
related_tools: z.array(z.string()).optional(),
|
|
98
|
+
scripts: z.array(z.string()).optional(),
|
|
99
|
+
widgets: z.array(z.string()).optional()
|
|
100
|
+
}).passthrough();
|
|
101
|
+
/**
|
|
102
|
+
* Schema for validating properties exported from properties.ts
|
|
103
|
+
* This is a partial schema - allows any subset of SkillDefinition fields
|
|
104
|
+
*
|
|
105
|
+
* Note: Function properties like isEnabled cannot be validated by Zod for their signatures.
|
|
106
|
+
* Zod will only check that they are functions, not their specific parameter/return types.
|
|
107
|
+
* Use TypeScript for proper type checking of function signatures.
|
|
108
|
+
*/
|
|
109
|
+
export const SkillPropertiesSchema = SkillDefinitionSchema.partial().passthrough();
|
|
110
|
+
/**
|
|
111
|
+
* Build a SkillDefinition from frontmatter and markdown content.
|
|
112
|
+
* This mirrors the logic in @vertesia/tools-sdk parseSkillFile function.
|
|
113
|
+
*
|
|
114
|
+
* Supports two frontmatter structures:
|
|
115
|
+
*
|
|
116
|
+
* 1. Flat structure (matches parseSkillFile in tools-sdk):
|
|
117
|
+
* keywords: [...]
|
|
118
|
+
* tools: [...]
|
|
119
|
+
* language: python
|
|
120
|
+
* packages: [...]
|
|
121
|
+
*
|
|
122
|
+
* 2. Nested structure (for more explicit YAML):
|
|
123
|
+
* context_triggers:
|
|
124
|
+
* keywords: [...]
|
|
125
|
+
* tool_names: [...]
|
|
126
|
+
* execution:
|
|
127
|
+
* language: python
|
|
128
|
+
* packages: [...]
|
|
129
|
+
* related_tools: [...]
|
|
130
|
+
*
|
|
131
|
+
* @param frontmatter - Parsed frontmatter object
|
|
132
|
+
* @param instructions - Markdown content (body of the file)
|
|
133
|
+
* @param contentType - Content type ('md' or 'jst')
|
|
134
|
+
* @param widgets - Discovered widget names
|
|
135
|
+
* @param scripts - Discovered script names
|
|
136
|
+
* @returns Skill definition object
|
|
137
|
+
*/
|
|
138
|
+
function buildSkillDefinition(frontmatter, instructions, contentType, widgets, scripts) {
|
|
139
|
+
const skill = {
|
|
140
|
+
name: frontmatter.name,
|
|
141
|
+
title: frontmatter.title,
|
|
142
|
+
description: frontmatter.description,
|
|
143
|
+
instructions,
|
|
144
|
+
content_type: contentType,
|
|
145
|
+
widgets: widgets.length > 0 ? widgets : undefined,
|
|
146
|
+
scripts: scripts.length > 0 ? scripts : undefined,
|
|
147
|
+
};
|
|
148
|
+
// Build context triggers - support both flat and nested structure
|
|
149
|
+
// Nested: context_triggers: { keywords: [...], tool_names: [...] }
|
|
150
|
+
// Flat: keywords: [...], tools: [...]
|
|
151
|
+
const contextTriggers = frontmatter.context_triggers;
|
|
152
|
+
const hasNestedTriggers = contextTriggers && typeof contextTriggers === 'object';
|
|
153
|
+
const hasFlatTriggers = frontmatter.keywords || frontmatter.tools || frontmatter.data_patterns;
|
|
154
|
+
if (hasNestedTriggers || hasFlatTriggers) {
|
|
155
|
+
skill.context_triggers = {
|
|
156
|
+
keywords: hasNestedTriggers ? contextTriggers.keywords : frontmatter.keywords,
|
|
157
|
+
tool_names: hasNestedTriggers ? contextTriggers.tool_names : frontmatter.tools,
|
|
158
|
+
data_patterns: hasNestedTriggers ? contextTriggers.data_patterns : frontmatter.data_patterns,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
// Build execution config - support both flat and nested structure
|
|
162
|
+
const execution = frontmatter.execution;
|
|
163
|
+
const hasNestedExecution = execution && typeof execution === 'object';
|
|
164
|
+
const hasFlatExecution = frontmatter.language;
|
|
165
|
+
if (hasNestedExecution || hasFlatExecution) {
|
|
166
|
+
skill.execution = {
|
|
167
|
+
language: hasNestedExecution ? execution.language : frontmatter.language,
|
|
168
|
+
packages: hasNestedExecution ? execution.packages : frontmatter.packages,
|
|
169
|
+
system_packages: hasNestedExecution ? execution.system_packages : frontmatter.system_packages,
|
|
170
|
+
};
|
|
171
|
+
// Extract code template from instructions if present
|
|
172
|
+
const codeBlockMatch = instructions.match(/```(?:python|javascript|typescript|js|ts|py)\n([\s\S]*?)```/);
|
|
173
|
+
if (codeBlockMatch) {
|
|
174
|
+
skill.execution.template = codeBlockMatch[1].trim();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Related tools - support both direct field and from tools field
|
|
178
|
+
if (frontmatter.related_tools) {
|
|
179
|
+
skill.related_tools = frontmatter.related_tools;
|
|
180
|
+
}
|
|
181
|
+
else if (frontmatter.tools && !hasNestedTriggers) {
|
|
182
|
+
// If tools is not part of context_triggers, use it as related_tools
|
|
183
|
+
skill.related_tools = frontmatter.tools;
|
|
184
|
+
}
|
|
185
|
+
// Input schema from frontmatter
|
|
186
|
+
if (frontmatter.input_schema) {
|
|
187
|
+
skill.input_schema = frontmatter.input_schema;
|
|
188
|
+
}
|
|
189
|
+
return skill;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Skill transformer preset
|
|
193
|
+
* Transforms markdown files with ?skill suffix OR SKILL.md files into skill definition objects
|
|
194
|
+
*
|
|
195
|
+
* Matches:
|
|
196
|
+
* - Files with ?skill suffix: ./my-skill.md?skill
|
|
197
|
+
* - SKILL.md files: ./my-skill/SKILL.md
|
|
198
|
+
*
|
|
199
|
+
* Runtime Properties:
|
|
200
|
+
* - Supports properties.ts file in skill directory for runtime properties (functions, overrides)
|
|
201
|
+
* - Properties from properties.ts override those from frontmatter
|
|
202
|
+
* - See README.md for detailed usage examples
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* import skill1 from './my-skill.md?skill';
|
|
207
|
+
* import skill2 from './my-skill/SKILL.md';
|
|
208
|
+
* // Both are SkillDefinition objects
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
export const skillTransformer = {
|
|
212
|
+
pattern: /(\.md\?skill$|\/SKILL\.md$)/,
|
|
213
|
+
schema: SkillDefinitionSchema,
|
|
214
|
+
transform: (content, filePath) => {
|
|
215
|
+
const { frontmatter, content: markdown } = parseFrontmatter(content);
|
|
216
|
+
// Validate frontmatter first to catch unknown properties
|
|
217
|
+
const frontmatterValidation = SkillFrontmatterSchema.safeParse(frontmatter);
|
|
218
|
+
if (!frontmatterValidation.success) {
|
|
219
|
+
const errors = frontmatterValidation.error.errors
|
|
220
|
+
.map((err) => {
|
|
221
|
+
const pathStr = err.path.length > 0 ? err.path.join('.') : 'frontmatter';
|
|
222
|
+
return ` - ${pathStr}: ${err.message}`;
|
|
223
|
+
})
|
|
224
|
+
.join('\n');
|
|
225
|
+
throw new Error(`Invalid frontmatter in ${filePath}:\n${errors}`);
|
|
226
|
+
}
|
|
227
|
+
// Determine content type from frontmatter or file extension
|
|
228
|
+
const content_type = frontmatter.content_type || 'md';
|
|
229
|
+
// Discover assets (scripts and widgets) in the skill directory
|
|
230
|
+
const assets = discoverSkillAssets(filePath);
|
|
231
|
+
// Build skill definition using the same logic as parseSkillFile in tools-sdk
|
|
232
|
+
const skillData = buildSkillDefinition(frontmatter, markdown, content_type, assets.widgets, assets.scripts);
|
|
233
|
+
// Check if properties.ts exists in the skill directory
|
|
234
|
+
const skillDir = path.dirname(filePath);
|
|
235
|
+
const propertiesPath = path.join(skillDir, 'properties.ts');
|
|
236
|
+
const hasProperties = existsSync(propertiesPath);
|
|
237
|
+
// If properties.ts exists, generate custom code with import and merge
|
|
238
|
+
// Rollup will handle transpiling properties.ts to properties.js
|
|
239
|
+
if (hasProperties) {
|
|
240
|
+
const skillDataJson = JSON.stringify(skillData, null, 2);
|
|
241
|
+
const code = `import properties from './properties.js';
|
|
242
|
+
|
|
243
|
+
// Runtime validation for function properties
|
|
244
|
+
if ('isEnabled' in properties && typeof properties.isEnabled !== 'function') {
|
|
245
|
+
throw new Error('properties.isEnabled must be a function, got ' + typeof properties.isEnabled);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const skill = ${skillDataJson};
|
|
249
|
+
|
|
250
|
+
export default { ...skill, ...properties };
|
|
251
|
+
`;
|
|
252
|
+
return {
|
|
253
|
+
data: skillData,
|
|
254
|
+
assets: assets.assetFiles,
|
|
255
|
+
widgets: assets.widgetMetadata,
|
|
256
|
+
code
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
data: skillData,
|
|
261
|
+
assets: assets.assetFiles,
|
|
262
|
+
widgets: assets.widgetMetadata
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../../../src/presets/skill.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAOlE;;GAEG;AACH,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1C,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,C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AC;YAChB,MAAM,IAAI,KAAK,CACX,0BAA0B,QAAQ,MAAM,MAAM,EAAE,CACnD,CAAC;QACN,CAAC;QAED,4DAA4D;QAC5D,MAAM,YAAY,GAAqB,WAAW,CAAC,YAAY,IAAI,IAAI,CAAC;QAExE,+DAA+D;QAC/D,MAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAE7C,6EAA6E;QAC7E,MAAM,SAAS,GAAG,oBAAoB,CAClC,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,OAAO,CACjB,CAAC;QAEF,uDAAuD;QACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC5D,MAAM,aAAa,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;QAEjD,sEAAsE;QACtE,gEAAgE;QAChE,IAAI,aAAa,EAAE,CAAC;YAChB,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACzD,MAAM,IAAI,GAAG;;;;;;;gBAOT,aAAa;;;CAG5B,CAAC;YACU,OAAO;gBACH,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,MAAM,CAAC,UAAU;gBACzB,OAAO,EAAE,MAAM,CAAC,cAAc;gBAC9B,IAAI;aACP,CAAC;QACN,CAAC;QAED,OAAO;YACH,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,MAAM,CAAC,UAAU;YACzB,OAAO,EAAE,MAAM,CAAC,cAAc;SACjC,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template collection transformer for directory-based template imports
|
|
3
|
+
* Scans a directory for subdirectories containing TEMPLATE.md files
|
|
4
|
+
*/
|
|
5
|
+
import { readdirSync, statSync, existsSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
/**
|
|
8
|
+
* Template collection transformer preset
|
|
9
|
+
* Transforms directory imports with ?templates suffix into an array of template imports
|
|
10
|
+
*
|
|
11
|
+
* Matches:
|
|
12
|
+
* - ./all?templates (recommended - generates all.js in the directory)
|
|
13
|
+
* - Any path ending with a filename and ?templates
|
|
14
|
+
*
|
|
15
|
+
* NOTE: A filename before ?templates is REQUIRED to avoid naming conflicts.
|
|
16
|
+
* The filename becomes the output module name.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import templates from './all?templates';
|
|
21
|
+
* // Scans current directory for subdirectories with TEMPLATE.md
|
|
22
|
+
* // Generates all.js containing array of all templates
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export const templateCollectionTransformer = {
|
|
26
|
+
pattern: /\/[^/?]+\?templates$/,
|
|
27
|
+
virtual: true,
|
|
28
|
+
transform: (_content, filePath) => {
|
|
29
|
+
// Remove ?templates suffix and the filename to get directory path
|
|
30
|
+
const pathWithoutQuery = filePath.replace(/\?templates$/, '');
|
|
31
|
+
const dirPath = path.dirname(pathWithoutQuery);
|
|
32
|
+
if (!existsSync(dirPath)) {
|
|
33
|
+
throw new Error(`Directory not found: ${dirPath}`);
|
|
34
|
+
}
|
|
35
|
+
if (!statSync(dirPath).isDirectory()) {
|
|
36
|
+
throw new Error(`Not a directory: ${dirPath}`);
|
|
37
|
+
}
|
|
38
|
+
// Scan for subdirectories containing TEMPLATE.md
|
|
39
|
+
const entries = readdirSync(dirPath);
|
|
40
|
+
const imports = [];
|
|
41
|
+
const names = [];
|
|
42
|
+
for (const entry of entries) {
|
|
43
|
+
const entryPath = path.join(dirPath, entry);
|
|
44
|
+
try {
|
|
45
|
+
if (statSync(entryPath).isDirectory()) {
|
|
46
|
+
const templateFile = path.join(entryPath, 'TEMPLATE.md');
|
|
47
|
+
if (existsSync(templateFile)) {
|
|
48
|
+
const identifier = `Template_${entry.replace(/[^a-zA-Z0-9_]/g, '_')}`;
|
|
49
|
+
imports.push(`import ${identifier} from './${entry}/TEMPLATE.md';`);
|
|
50
|
+
names.push(identifier);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (_err) {
|
|
55
|
+
// Skip entries that can't be read
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (names.length === 0) {
|
|
60
|
+
console.warn(`No TEMPLATE.md files found in subdirectories of ${dirPath}`);
|
|
61
|
+
}
|
|
62
|
+
// Generate code that imports all templates and exports as array
|
|
63
|
+
const code = [
|
|
64
|
+
...imports,
|
|
65
|
+
'',
|
|
66
|
+
`export default [${names.join(', ')}];`
|
|
67
|
+
].join('\n');
|
|
68
|
+
return {
|
|
69
|
+
data: null,
|
|
70
|
+
code
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=template-collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-collection.js","sourceRoot":"","sources":["../../../src/presets/template-collection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAsB;IAC5D,OAAO,EAAE,sBAAsB;IAC/B,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,CAAC,QAAgB,EAAE,QAAgB,EAAE,EAAE;QAC9C,kEAAkE;QAClE,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAE/C,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E;QAChE,MAAM,IAAI,GAAG;YACT,GAAG,OAAO;YACV,EAAE;YACF,mBAAmB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;SAC1C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;YACH,IAAI,EAAE,IAAI;YACV,IAAI;SACP,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template transformer preset for markdown files with frontmatter
|
|
3
|
+
*/
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { parseFrontmatter } from '../parsers/frontmatter.js';
|
|
7
|
+
import { discoverTemplateAssets } from '../utils/template-asset-discovery.js';
|
|
8
|
+
/**
|
|
9
|
+
* Zod schema for template frontmatter validation.
|
|
10
|
+
* Only includes fields authored by the user.
|
|
11
|
+
* The name and id are inferred from the directory structure.
|
|
12
|
+
*/
|
|
13
|
+
const TemplateFrontmatterSchema = z.object({
|
|
14
|
+
title: z.string().optional(),
|
|
15
|
+
description: z.string().min(1, 'Template description is required'),
|
|
16
|
+
tags: z.array(z.string()).optional(),
|
|
17
|
+
type: z.enum(['presentation', 'document']),
|
|
18
|
+
}).strict();
|
|
19
|
+
/**
|
|
20
|
+
* MUST be kept in sync with @vertesia/tools-sdk RenderingTemplateDefinition
|
|
21
|
+
* Zod schema for template definition
|
|
22
|
+
*/
|
|
23
|
+
export const RenderingTemplateDefinitionSchema = z.object({
|
|
24
|
+
id: z.string().min(1, 'Template id is required'),
|
|
25
|
+
name: z.string().min(1, 'Template name is required'),
|
|
26
|
+
title: z.string().optional(),
|
|
27
|
+
description: z.string().min(1, 'Template description is required'),
|
|
28
|
+
instructions: z.string(),
|
|
29
|
+
tags: z.array(z.string()).optional(),
|
|
30
|
+
type: z.enum(['presentation', 'document']),
|
|
31
|
+
assets: z.array(z.string()),
|
|
32
|
+
}).passthrough();
|
|
33
|
+
/**
|
|
34
|
+
* Derive the template path segments from the file path.
|
|
35
|
+
*
|
|
36
|
+
* Example: .../templates/examples/report/TEMPLATE.md
|
|
37
|
+
* → category: "examples", name: "report", relative: "examples/report"
|
|
38
|
+
*/
|
|
39
|
+
function deriveTemplatePathInfo(filePath) {
|
|
40
|
+
const templateDir = path.dirname(filePath);
|
|
41
|
+
const templateName = path.basename(templateDir);
|
|
42
|
+
const collectionDir = path.dirname(templateDir);
|
|
43
|
+
const category = path.basename(collectionDir);
|
|
44
|
+
return { category, templateName, relative: `${category}/${templateName}` };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Template transformer preset
|
|
48
|
+
* Transforms markdown files with ?template suffix OR TEMPLATE.md files into template definition objects
|
|
49
|
+
*
|
|
50
|
+
* Matches:
|
|
51
|
+
* - Files with ?template suffix: ./my-template.md?template
|
|
52
|
+
* - TEMPLATE.md files: ./my-template/TEMPLATE.md
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* import template1 from './my-template.md?template';
|
|
57
|
+
* import template2 from './my-template/TEMPLATE.md';
|
|
58
|
+
* // Both are RenderingTemplateDefinition objects
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export const templateTransformer = {
|
|
62
|
+
pattern: /(\.md\?template$|\/TEMPLATE\.md$)/,
|
|
63
|
+
schema: RenderingTemplateDefinitionSchema,
|
|
64
|
+
transform: (content, filePath) => {
|
|
65
|
+
const { frontmatter, content: markdown } = parseFrontmatter(content);
|
|
66
|
+
// Validate frontmatter
|
|
67
|
+
const frontmatterValidation = TemplateFrontmatterSchema.safeParse(frontmatter);
|
|
68
|
+
if (!frontmatterValidation.success) {
|
|
69
|
+
const errors = frontmatterValidation.error.errors
|
|
70
|
+
.map((err) => {
|
|
71
|
+
const pathStr = err.path.length > 0 ? err.path.join('.') : 'frontmatter';
|
|
72
|
+
return ` - ${pathStr}: ${err.message}`;
|
|
73
|
+
})
|
|
74
|
+
.join('\n');
|
|
75
|
+
throw new Error(`Invalid frontmatter in ${filePath}:\n${errors}`);
|
|
76
|
+
}
|
|
77
|
+
// Derive template path from directory structure
|
|
78
|
+
const { category, templateName, relative: templatePath } = deriveTemplatePathInfo(filePath);
|
|
79
|
+
// Discover asset files in the template directory
|
|
80
|
+
const assets = discoverTemplateAssets(filePath, templatePath);
|
|
81
|
+
// Build template definition
|
|
82
|
+
// Assets use absolute paths for direct server-side resolution
|
|
83
|
+
const templateData = {
|
|
84
|
+
id: `${category}:${templateName}`,
|
|
85
|
+
name: templateName,
|
|
86
|
+
title: frontmatter.title,
|
|
87
|
+
description: frontmatter.description,
|
|
88
|
+
instructions: markdown,
|
|
89
|
+
tags: frontmatter.tags,
|
|
90
|
+
type: frontmatter.type,
|
|
91
|
+
assets: assets.fileNames.map(f => `/templates/${templatePath}/${f}`),
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
data: templateData,
|
|
95
|
+
assets: assets.assetFiles,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/presets/template.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,kCAAkC,CAAC;IAClE,IAAI,EAAE,CAAC,CAAC,KAAK,CAA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AC9C,EAAE,EAAE,GAAG,QAAQ,IAAI,YAAY,EAAE;YACjC,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,YAAY,EAAE,QAAQ;YACtB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,YAAY,IAAI,CAAC,EAAE,CAAC;SACvE,CAAC;QAEF,OAAO;YACH,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,MAAM,CAAC,UAAU;SAC5B,CAAC;IACN,CAAC;CACJ,CAAC"}
|
package/lib/esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for copying asset files during build
|
|
3
|
+
*/
|
|
4
|
+
import { copyFileSync, mkdirSync } from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
/**
|
|
7
|
+
* Ensure a directory exists, creating it recursively if needed
|
|
8
|
+
*/
|
|
9
|
+
function ensureDirectory(dirPath) {
|
|
10
|
+
try {
|
|
11
|
+
mkdirSync(dirPath, { recursive: true });
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
// Ignore if directory already exists
|
|
15
|
+
if (error.code !== 'EEXIST') {
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Copy an asset file to its destination
|
|
22
|
+
*
|
|
23
|
+
* @param asset - Asset file information
|
|
24
|
+
* @param assetsRoot - Root directory for assets
|
|
25
|
+
*/
|
|
26
|
+
export function copyAssetFile(asset, assetsRoot) {
|
|
27
|
+
const destPath = path.join(assetsRoot, asset.destPath);
|
|
28
|
+
const destDir = path.dirname(destPath);
|
|
29
|
+
// Ensure destination directory exists
|
|
30
|
+
ensureDirectory(destDir);
|
|
31
|
+
// Copy file
|
|
32
|
+
try {
|
|
33
|
+
copyFileSync(asset.sourcePath, destPath);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
throw new Error(`Failed to copy asset from ${asset.sourcePath} to ${destPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Copy multiple asset files
|
|
41
|
+
*
|
|
42
|
+
* @param assets - Array of asset files to copy
|
|
43
|
+
* @param assetsRoot - Root directory for assets
|
|
44
|
+
* @returns Number of files copied
|
|
45
|
+
*/
|
|
46
|
+
export function copyAssets(assets, assetsRoot) {
|
|
47
|
+
let copied = 0;
|
|
48
|
+
for (const asset of assets) {
|
|
49
|
+
copyAssetFile(asset, assetsRoot);
|
|
50
|
+
copied++;
|
|
51
|
+
}
|
|
52
|
+
return copied;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=asset-copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-copy.js","sourceRoot":"","sources":["../../../src/utils/asset-copy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B;;GAEG;AACH,SAAS,eAAe,CAAC,OAAe;IACpC,IAAI,CAAC;QACD,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,qCAAqC;QACrC,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACrD,MAAM,KAAK,CAAC;QAChB,CAAC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