@vertesia/tools-sdk 1.0.0-dev.20260203.130115Z → 1.0.0-dev.20260225.024852Z

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 (153) hide show
  1. package/lib/cjs/ContentTypesCollection.js +43 -0
  2. package/lib/cjs/ContentTypesCollection.js.map +1 -0
  3. package/lib/cjs/InteractionCollection.js +43 -0
  4. package/lib/cjs/InteractionCollection.js.map +1 -0
  5. package/lib/cjs/SkillCollection.js +384 -0
  6. package/lib/cjs/SkillCollection.js.map +1 -0
  7. package/lib/cjs/ToolCollection.js +221 -0
  8. package/lib/cjs/ToolCollection.js.map +1 -0
  9. package/lib/cjs/ToolRegistry.js +95 -0
  10. package/lib/cjs/ToolRegistry.js.map +1 -0
  11. package/lib/cjs/auth.js +104 -0
  12. package/lib/cjs/auth.js.map +1 -0
  13. package/lib/cjs/build/validate.js +7 -0
  14. package/lib/cjs/build/validate.js.map +1 -0
  15. package/lib/cjs/copy-assets.js +84 -0
  16. package/lib/cjs/copy-assets.js.map +1 -0
  17. package/lib/cjs/index.js +32 -0
  18. package/lib/cjs/index.js.map +1 -0
  19. package/lib/cjs/package.json +3 -0
  20. package/lib/cjs/server/app-package.js +130 -0
  21. package/lib/cjs/server/app-package.js.map +1 -0
  22. package/lib/cjs/server/content-types.js +73 -0
  23. package/lib/cjs/server/content-types.js.map +1 -0
  24. package/lib/cjs/server/interactions.js +89 -0
  25. package/lib/cjs/server/interactions.js.map +1 -0
  26. package/lib/cjs/server/mcp.js +45 -0
  27. package/lib/cjs/server/mcp.js.map +1 -0
  28. package/lib/cjs/server/site.js +36 -0
  29. package/lib/cjs/server/site.js.map +1 -0
  30. package/lib/cjs/server/skills.js +114 -0
  31. package/lib/cjs/server/skills.js.map +1 -0
  32. package/lib/cjs/server/tools.js +87 -0
  33. package/lib/cjs/server/tools.js.map +1 -0
  34. package/lib/cjs/server/types.js +3 -0
  35. package/lib/cjs/server/types.js.map +1 -0
  36. package/lib/cjs/server/widgets.js +27 -0
  37. package/lib/cjs/server/widgets.js.map +1 -0
  38. package/lib/cjs/server.js +136 -0
  39. package/lib/cjs/server.js.map +1 -0
  40. package/lib/cjs/site/styles.js +692 -0
  41. package/lib/cjs/site/styles.js.map +1 -0
  42. package/lib/cjs/site/templates.js +1014 -0
  43. package/lib/cjs/site/templates.js.map +1 -0
  44. package/lib/cjs/types.js +3 -0
  45. package/lib/cjs/types.js.map +1 -0
  46. package/lib/cjs/utils.js +44 -0
  47. package/lib/cjs/utils.js.map +1 -0
  48. package/lib/esm/ContentTypesCollection.js +39 -0
  49. package/lib/esm/ContentTypesCollection.js.map +1 -0
  50. package/lib/esm/InteractionCollection.js +39 -0
  51. package/lib/esm/InteractionCollection.js.map +1 -0
  52. package/lib/esm/SkillCollection.js +377 -0
  53. package/lib/esm/SkillCollection.js.map +1 -0
  54. package/lib/esm/ToolCollection.js +183 -0
  55. package/lib/esm/ToolCollection.js.map +1 -0
  56. package/lib/esm/ToolRegistry.js +90 -0
  57. package/lib/esm/ToolRegistry.js.map +1 -0
  58. package/lib/esm/auth.js +97 -0
  59. package/lib/esm/auth.js.map +1 -0
  60. package/lib/esm/build/validate.js +4 -0
  61. package/lib/esm/build/validate.js.map +1 -0
  62. package/lib/esm/copy-assets.js +81 -0
  63. package/lib/esm/copy-assets.js.map +1 -0
  64. package/lib/esm/index.js +12 -0
  65. package/lib/esm/index.js.map +1 -0
  66. package/lib/esm/server/app-package.js +127 -0
  67. package/lib/esm/server/app-package.js.map +1 -0
  68. package/lib/esm/server/content-types.js +70 -0
  69. package/lib/esm/server/content-types.js.map +1 -0
  70. package/lib/esm/server/interactions.js +86 -0
  71. package/lib/esm/server/interactions.js.map +1 -0
  72. package/lib/esm/server/mcp.js +42 -0
  73. package/lib/esm/server/mcp.js.map +1 -0
  74. package/lib/esm/server/site.js +33 -0
  75. package/lib/esm/server/site.js.map +1 -0
  76. package/lib/esm/server/skills.js +111 -0
  77. package/lib/esm/server/skills.js.map +1 -0
  78. package/lib/esm/server/tools.js +84 -0
  79. package/lib/esm/server/tools.js.map +1 -0
  80. package/lib/esm/server/types.js +2 -0
  81. package/lib/esm/server/types.js.map +1 -0
  82. package/lib/esm/server/widgets.js +24 -0
  83. package/lib/esm/server/widgets.js.map +1 -0
  84. package/lib/esm/server.js +132 -0
  85. package/lib/esm/server.js.map +1 -0
  86. package/lib/esm/site/styles.js +689 -0
  87. package/lib/esm/site/styles.js.map +1 -0
  88. package/lib/esm/site/templates.js +1001 -0
  89. package/lib/esm/site/templates.js.map +1 -0
  90. package/lib/esm/types.js +2 -0
  91. package/lib/esm/types.js.map +1 -0
  92. package/lib/esm/utils.js +38 -0
  93. package/lib/esm/utils.js.map +1 -0
  94. package/lib/types/ContentTypesCollection.d.ts +18 -0
  95. package/lib/types/ContentTypesCollection.d.ts.map +1 -0
  96. package/lib/types/InteractionCollection.d.ts +18 -0
  97. package/lib/types/InteractionCollection.d.ts.map +1 -0
  98. package/lib/types/SkillCollection.d.ts +119 -0
  99. package/lib/types/SkillCollection.d.ts.map +1 -0
  100. package/lib/types/ToolCollection.d.ts +67 -0
  101. package/lib/types/ToolCollection.d.ts.map +1 -0
  102. package/lib/types/ToolRegistry.d.ts +22 -0
  103. package/lib/types/ToolRegistry.d.ts.map +1 -0
  104. package/lib/types/auth.d.ts +32 -0
  105. package/lib/types/auth.d.ts.map +1 -0
  106. package/lib/types/build/validate.d.ts +2 -0
  107. package/lib/types/build/validate.d.ts.map +1 -0
  108. package/lib/types/copy-assets.d.ts +14 -0
  109. package/lib/types/copy-assets.d.ts.map +1 -0
  110. package/lib/types/index.d.ts +12 -0
  111. package/lib/types/index.d.ts.map +1 -0
  112. package/lib/types/server/app-package.d.ts +4 -0
  113. package/lib/types/server/app-package.d.ts.map +1 -0
  114. package/lib/types/server/content-types.d.ts +4 -0
  115. package/lib/types/server/content-types.d.ts.map +1 -0
  116. package/lib/types/server/interactions.d.ts +4 -0
  117. package/lib/types/server/interactions.d.ts.map +1 -0
  118. package/lib/types/server/mcp.d.ts +4 -0
  119. package/lib/types/server/mcp.d.ts.map +1 -0
  120. package/lib/types/server/site.d.ts +4 -0
  121. package/lib/types/server/site.d.ts.map +1 -0
  122. package/lib/types/server/skills.d.ts +4 -0
  123. package/lib/types/server/skills.d.ts.map +1 -0
  124. package/lib/types/server/tools.d.ts +4 -0
  125. package/lib/types/server/tools.d.ts.map +1 -0
  126. package/lib/types/server/types.d.ts +88 -0
  127. package/lib/types/server/types.d.ts.map +1 -0
  128. package/lib/types/server/widgets.d.ts +4 -0
  129. package/lib/types/server/widgets.d.ts.map +1 -0
  130. package/lib/types/server.d.ts +27 -0
  131. package/lib/types/server.d.ts.map +1 -0
  132. package/lib/types/site/styles.d.ts +5 -0
  133. package/lib/types/site/styles.d.ts.map +1 -0
  134. package/lib/types/site/templates.d.ts +60 -0
  135. package/lib/types/site/templates.d.ts.map +1 -0
  136. package/lib/types/types.d.ts +293 -0
  137. package/lib/types/types.d.ts.map +1 -0
  138. package/lib/types/utils.d.ts +10 -0
  139. package/lib/types/utils.d.ts.map +1 -0
  140. package/package.json +4 -4
  141. package/src/ContentTypesCollection.ts +8 -8
  142. package/src/SkillCollection.ts +11 -2
  143. package/src/ToolCollection.ts +9 -18
  144. package/src/ToolRegistry.ts +17 -56
  145. package/src/server/app-package.ts +88 -43
  146. package/src/server/{conyent-types.ts → content-types.ts} +29 -11
  147. package/src/server/interactions.ts +11 -6
  148. package/src/server/tools.ts +3 -22
  149. package/src/server/types.ts +9 -1
  150. package/src/server/widgets.ts +2 -6
  151. package/src/server.ts +1 -1
  152. package/src/types.ts +34 -1
  153. package/src/utils.ts +15 -1
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContentTypesCollection = void 0;
4
+ const utils_js_1 = require("./utils.js");
5
+ class ContentTypesCollection {
6
+ types;
7
+ name;
8
+ title;
9
+ icon;
10
+ description;
11
+ constructor({ name, title, icon, description, types }) {
12
+ this.name = name;
13
+ this.title = title || (0, utils_js_1.kebabCaseToTitle)(name);
14
+ this.icon = icon;
15
+ this.description = description;
16
+ this.types = types;
17
+ }
18
+ getContentTypes() {
19
+ return this.types;
20
+ }
21
+ [Symbol.iterator]() {
22
+ let index = 0;
23
+ const types = this.types;
24
+ return {
25
+ next() {
26
+ if (index < types.length) {
27
+ return { value: types[index++], done: false };
28
+ }
29
+ else {
30
+ return { done: true, value: undefined };
31
+ }
32
+ }
33
+ };
34
+ }
35
+ map(callback) {
36
+ return this.types.map(callback);
37
+ }
38
+ getTypeByName(name) {
39
+ return this.types.find(type => type.name === name);
40
+ }
41
+ }
42
+ exports.ContentTypesCollection = ContentTypesCollection;
43
+ //# sourceMappingURL=ContentTypesCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentTypesCollection.js","sourceRoot":"","sources":["../../src/ContentTypesCollection.ts"],"names":[],"mappings":";;;AAEA,yCAA8C;AAK9C,MAAa,sBAAsB;IAC/B,KAAK,CAAmB;IACxB,IAAI,CAAS;IACb,KAAK,CAAU;IACf,IAAI,CAAU;IACd,WAAW,CAAU;IACrB,YAAY,EACR,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EACX;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,IAAA,2BAAgB,EAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,eAAe;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACb,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,OAAO;YACH,IAAI;gBACA,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;oBACvB,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gBAClD,CAAC;qBAAM,CAAC;oBACJ,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;gBAC5C,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;IAED,GAAG,CAAI,QAAoD;QACvD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,aAAa,CAAC,IAAY;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACvD,CAAC;CAEJ;AA3CD,wDA2CC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InteractionCollection = void 0;
4
+ const utils_js_1 = require("./utils.js");
5
+ class InteractionCollection {
6
+ interactions;
7
+ name;
8
+ title;
9
+ icon;
10
+ description;
11
+ constructor({ name, title, icon, description, interactions }) {
12
+ this.name = name;
13
+ this.title = title || (0, utils_js_1.kebabCaseToTitle)(name);
14
+ this.icon = icon;
15
+ this.description = description;
16
+ this.interactions = interactions;
17
+ }
18
+ getInteractions() {
19
+ return this.interactions;
20
+ }
21
+ [Symbol.iterator]() {
22
+ let index = 0;
23
+ const interactions = this.interactions;
24
+ return {
25
+ next() {
26
+ if (index < interactions.length) {
27
+ return { value: interactions[index++], done: false };
28
+ }
29
+ else {
30
+ return { done: true, value: undefined };
31
+ }
32
+ }
33
+ };
34
+ }
35
+ map(callback) {
36
+ return this.interactions.map(callback);
37
+ }
38
+ getInteractionByName(name) {
39
+ return this.interactions.find(interaction => interaction.name === name);
40
+ }
41
+ }
42
+ exports.InteractionCollection = InteractionCollection;
43
+ //# sourceMappingURL=InteractionCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InteractionCollection.js","sourceRoot":"","sources":["../../src/InteractionCollection.ts"],"names":[],"mappings":";;;AAEA,yCAA8C;AAK9C,MAAa,qBAAqB;IAC9B,YAAY,CAAoB;IAChC,IAAI,CAAS;IACb,KAAK,CAAU;IACf,IAAI,CAAU;IACd,WAAW,CAAU;IACrB,YAAY,EACR,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EACnB;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,IAAA,2BAAgB,EAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IAED,eAAe;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACb,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAEvC,OAAO;YACH,IAAI;gBACA,IAAI,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;oBAC9B,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gBACzD,CAAC;qBAAM,CAAC;oBACJ,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;gBAC5C,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;IAED,GAAG,CAAI,QAA4D;QAC/D,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,oBAAoB,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC5E,CAAC;CACJ;AA1CD,sDA0CC"}
@@ -0,0 +1,384 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SkillCollection = void 0;
4
+ exports.parseSkillFile = parseSkillFile;
5
+ exports.loadSkillFromFile = loadSkillFromFile;
6
+ exports.loadSkillsFromDirectory = loadSkillsFromDirectory;
7
+ const fs_1 = require("fs");
8
+ const http_exception_1 = require("hono/http-exception");
9
+ const path_1 = require("path");
10
+ const utils_js_1 = require("./utils.js");
11
+ /**
12
+ * Implements a skills collection endpoint.
13
+ * Skills provide contextual instructions to agents.
14
+ * They can be static (markdown) or dynamic (JST templates).
15
+ */
16
+ class SkillCollection {
17
+ /**
18
+ * A kebab case collection name
19
+ */
20
+ name;
21
+ /**
22
+ * Optional title for UI display
23
+ */
24
+ title;
25
+ /**
26
+ * Optional icon for UI display
27
+ */
28
+ icon;
29
+ /**
30
+ * A short description
31
+ */
32
+ description;
33
+ /**
34
+ * The skills in this collection
35
+ */
36
+ skills;
37
+ constructor({ name, title, icon, description, skills }) {
38
+ this.name = name;
39
+ this.title = title || (0, utils_js_1.kebabCaseToTitle)(name);
40
+ this.icon = icon;
41
+ this.description = description;
42
+ this.skills = new Map(skills.map(s => [s.name, s]));
43
+ }
44
+ [Symbol.iterator]() {
45
+ return this.skills.values();
46
+ }
47
+ map(callback) {
48
+ return Array.from(this.skills.values()).map(callback);
49
+ }
50
+ /**
51
+ * Get a skill by name
52
+ */
53
+ getSkill(name) {
54
+ return this.skills.get(name);
55
+ }
56
+ /**
57
+ * Get all skill definitions
58
+ */
59
+ getSkillDefinitions() {
60
+ return Array.from(this.skills.values());
61
+ }
62
+ /**
63
+ * Get skills exposed as tool definitions.
64
+ * This allows skills to appear alongside regular tools.
65
+ * When called, they return rendered instructions.
66
+ * Includes related_tools for dynamic tool discovery.
67
+ */
68
+ getToolDefinitions(filterContext) {
69
+ const defaultSchema = {
70
+ type: 'object',
71
+ properties: {
72
+ context: {
73
+ type: "string",
74
+ description: "Additional context or specific requirements for this task"
75
+ }
76
+ }
77
+ };
78
+ let skills = Array.from(this.skills.values());
79
+ if (filterContext) {
80
+ skills = skills.filter(skill => {
81
+ return skill.isEnabled ? skill.isEnabled(filterContext) : true;
82
+ });
83
+ }
84
+ return skills.map(skill => {
85
+ // Build description with related tools info if available
86
+ let description = `[Skill] ${skill.description}. Returns contextual instructions for this task.`;
87
+ if (skill.related_tools && skill.related_tools.length > 0) {
88
+ description += ` Unlocks tools: ${skill.related_tools.join(', ')}.`;
89
+ }
90
+ return {
91
+ url: `skills/${this.name}`,
92
+ name: `learn_${skill.name}`,
93
+ description,
94
+ input_schema: skill.input_schema || defaultSchema,
95
+ related_tools: skill.related_tools,
96
+ category: this.name,
97
+ };
98
+ });
99
+ }
100
+ /**
101
+ * Get as a tool collection definition (for listing alongside tools)
102
+ */
103
+ getAsToolCollection(baseUrl) {
104
+ return {
105
+ title: this.title || this.name,
106
+ description: this.description || `Skills: ${this.name}`,
107
+ src: `${baseUrl}/api/skills/${this.name}`,
108
+ tools: this.getToolDefinitions()
109
+ };
110
+ }
111
+ getWidgets() {
112
+ const out = [];
113
+ for (const skill of this.skills.values()) {
114
+ if (skill.widgets) {
115
+ for (const widget of skill.widgets) {
116
+ out.push({
117
+ name: widget,
118
+ skill: skill.name,
119
+ });
120
+ }
121
+ }
122
+ }
123
+ return Array.from(out);
124
+ }
125
+ /**
126
+ * Execute a skill - accepts standard tool execution payload.
127
+ * Returns rendered instructions in tool result format.
128
+ *
129
+ * @param ctx - Hono context
130
+ * @param preParsedPayload - Optional pre-parsed payload (used when routing from root endpoint)
131
+ */
132
+ async execute(ctx, preParsedPayload) {
133
+ const toolCtx = ctx;
134
+ let payload = preParsedPayload;
135
+ try {
136
+ if (!payload) {
137
+ // Check if body was already parsed and validated by middleware
138
+ if (toolCtx.payload) {
139
+ payload = toolCtx.payload;
140
+ }
141
+ else {
142
+ throw new http_exception_1.HTTPException(400, {
143
+ message: 'Invalid or missing skill execution payload. Expected { tool_use: { id, tool_name, tool_input? }, metadata? }'
144
+ });
145
+ }
146
+ }
147
+ const toolName = payload.tool_use.tool_name;
148
+ // Extract skill name from tool name (remove "learn_" prefix if present)
149
+ const skillName = toolName.startsWith('learn_')
150
+ ? toolName.replace('learn_', '')
151
+ : toolName;
152
+ const skill = this.skills.get(skillName);
153
+ if (!skill) {
154
+ console.warn("[SkillCollection] Skill not found", {
155
+ collection: this.name,
156
+ requestedSkill: skillName,
157
+ toolName,
158
+ availableSkills: Array.from(this.skills.keys()),
159
+ });
160
+ throw new http_exception_1.HTTPException(404, {
161
+ message: `Skill not found: ${skillName}`
162
+ });
163
+ }
164
+ const data = payload.tool_use.tool_input || {};
165
+ const result = await this.renderSkill(skill, data);
166
+ // TODO: If skill.execution is set, run via Daytona
167
+ // Return in tool result format
168
+ return ctx.json({
169
+ tool_use_id: payload.tool_use.id,
170
+ is_error: false,
171
+ content: result.instructions,
172
+ meta: {
173
+ skill_name: skill.name,
174
+ content_type: skill.content_type,
175
+ execution: skill.execution,
176
+ }
177
+ });
178
+ }
179
+ catch (err) {
180
+ const status = err.status || 500;
181
+ const toolName = payload?.tool_use?.tool_name;
182
+ const toolUseId = payload?.tool_use?.id;
183
+ if (status >= 500) {
184
+ console.error("[SkillCollection] Skill execution failed", {
185
+ collection: this.name,
186
+ skill: toolName,
187
+ toolUseId,
188
+ error: err.message,
189
+ status,
190
+ toolInput: payload?.tool_use?.tool_input,
191
+ stack: err.stack,
192
+ });
193
+ }
194
+ return ctx.json({
195
+ tool_use_id: toolUseId || "unknown",
196
+ is_error: true,
197
+ content: err.message || "Error executing skill",
198
+ }, status);
199
+ }
200
+ }
201
+ /**
202
+ * Render skill instructions (static or dynamic)
203
+ */
204
+ async renderSkill(skill, _data) {
205
+ const instructions = skill.instructions;
206
+ if (skill.content_type === 'jst') {
207
+ // JST templates are not currently supported
208
+ throw new http_exception_1.HTTPException(501, {
209
+ message: `JST templates are not currently supported. Use 'md' content type instead.`
210
+ });
211
+ }
212
+ return {
213
+ name: skill.name,
214
+ instructions,
215
+ };
216
+ }
217
+ }
218
+ exports.SkillCollection = SkillCollection;
219
+ /**
220
+ * Parse a SKILL.md or SKILL.jst file content into a SkillDefinition.
221
+ *
222
+ * Format:
223
+ * ```
224
+ * ---
225
+ * name: skill-name
226
+ * description: Short description
227
+ * keywords: [keyword1, keyword2]
228
+ * tools: [tool1, tool2]
229
+ * language: python
230
+ * packages: [numpy, pandas]
231
+ * ---
232
+ *
233
+ * # Instructions
234
+ *
235
+ * Your markdown/jst content here...
236
+ * ```
237
+ */
238
+ function parseSkillFile(content, contentType) {
239
+ // Parse YAML frontmatter
240
+ const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
241
+ if (!frontmatterMatch) {
242
+ throw new Error("Invalid skill file: missing YAML frontmatter");
243
+ }
244
+ const [, yamlContent, body] = frontmatterMatch;
245
+ const frontmatter = parseYamlFrontmatter(yamlContent);
246
+ const instructions = body.trim();
247
+ if (!frontmatter.name) {
248
+ throw new Error("Skill file missing required 'name' field");
249
+ }
250
+ if (!frontmatter.description) {
251
+ throw new Error("Skill file missing required 'description' field");
252
+ }
253
+ const skill = {
254
+ name: frontmatter.name,
255
+ title: frontmatter.title,
256
+ description: frontmatter.description,
257
+ instructions,
258
+ content_type: contentType,
259
+ widgets: frontmatter.widgets || undefined,
260
+ scripts: frontmatter.scripts || undefined,
261
+ };
262
+ // Build context triggers
263
+ if (frontmatter.keywords || frontmatter.tools || frontmatter.data_patterns) {
264
+ skill.context_triggers = {
265
+ keywords: frontmatter.keywords,
266
+ tool_names: frontmatter.tools,
267
+ data_patterns: frontmatter.data_patterns,
268
+ };
269
+ }
270
+ // Build execution config
271
+ if (frontmatter.language) {
272
+ skill.execution = {
273
+ language: frontmatter.language,
274
+ packages: frontmatter.packages,
275
+ system_packages: frontmatter.system_packages,
276
+ };
277
+ // Extract code template from instructions if present
278
+ const codeBlockMatch = instructions.match(/```(?:python|javascript|typescript|js|ts|py)\n([\s\S]*?)```/);
279
+ if (codeBlockMatch) {
280
+ skill.execution.template = codeBlockMatch[1].trim();
281
+ }
282
+ }
283
+ // Related tools from frontmatter
284
+ if (frontmatter.tools) {
285
+ skill.related_tools = frontmatter.tools;
286
+ }
287
+ return skill;
288
+ }
289
+ /**
290
+ * Simple YAML frontmatter parser (handles basic key: value and arrays)
291
+ */
292
+ function parseYamlFrontmatter(yaml) {
293
+ const result = {};
294
+ const lines = yaml.split('\n');
295
+ for (const line of lines) {
296
+ const trimmed = line.trim();
297
+ if (!trimmed || trimmed.startsWith('#'))
298
+ continue;
299
+ const colonIndex = trimmed.indexOf(':');
300
+ if (colonIndex === -1)
301
+ continue;
302
+ const key = trimmed.slice(0, colonIndex).trim();
303
+ let value = trimmed.slice(colonIndex + 1).trim();
304
+ // Handle array syntax: [item1, item2]
305
+ if (value.startsWith('[') && value.endsWith(']')) {
306
+ const items = value.slice(1, -1).split(',').map(s => s.trim());
307
+ result[key] = items.filter(s => s.length > 0);
308
+ }
309
+ else {
310
+ // Remove quotes if present
311
+ if ((value.startsWith('"') && value.endsWith('"')) ||
312
+ (value.startsWith("'") && value.endsWith("'"))) {
313
+ value = value.slice(1, -1);
314
+ }
315
+ result[key] = value;
316
+ }
317
+ }
318
+ return result;
319
+ }
320
+ /**
321
+ * Helper to load skill from file path (for Node.js usage)
322
+ */
323
+ async function loadSkillFromFile(filePath, fs) {
324
+ const content = await fs.readFile(filePath, 'utf-8');
325
+ const contentType = filePath.endsWith('.jst') ? 'jst' : 'md';
326
+ return parseSkillFile(content, contentType);
327
+ }
328
+ /**
329
+ * Load all skills from a directory.
330
+ * Scans for subdirectories containing SKILL.md files.
331
+ *
332
+ * Directory structure:
333
+ * ```
334
+ * skills/
335
+ * nagare/
336
+ * fund-onboarding/
337
+ * SKILL.md
338
+ * monte-carlo/
339
+ * SKILL.md
340
+ * ```
341
+ *
342
+ * @param dirPath - Path to the skills collection directory
343
+ * @returns Array of parsed skill definitions
344
+ */
345
+ function loadSkillsFromDirectory(dirPath) {
346
+ const skills = [];
347
+ let entries;
348
+ try {
349
+ entries = (0, fs_1.readdirSync)(dirPath);
350
+ }
351
+ catch {
352
+ console.warn(`Could not read skills directory: ${dirPath}`);
353
+ return skills;
354
+ }
355
+ for (const entry of entries) {
356
+ const entryPath = (0, path_1.join)(dirPath, entry);
357
+ try {
358
+ const stat = (0, fs_1.statSync)(entryPath);
359
+ if (!stat.isDirectory())
360
+ continue;
361
+ // Look for SKILL.md or SKILL.jst
362
+ const mdPath = (0, path_1.join)(entryPath, "SKILL.md");
363
+ const jstPath = (0, path_1.join)(entryPath, "SKILL.jst");
364
+ let content;
365
+ let contentType = 'md';
366
+ if ((0, fs_1.existsSync)(mdPath)) {
367
+ content = (0, fs_1.readFileSync)(mdPath, "utf-8");
368
+ contentType = 'md';
369
+ }
370
+ else if ((0, fs_1.existsSync)(jstPath)) {
371
+ content = (0, fs_1.readFileSync)(jstPath, "utf-8");
372
+ contentType = 'jst';
373
+ }
374
+ if (content) {
375
+ skills.push(parseSkillFile(content, contentType));
376
+ }
377
+ }
378
+ catch (err) {
379
+ console.warn(`Error loading skill from ${entryPath}:`, err);
380
+ }
381
+ }
382
+ return skills;
383
+ }
384
+ //# sourceMappingURL=SkillCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SkillCollection.js","sourceRoot":"","sources":["../../src/SkillCollection.ts"],"names":[],"mappings":";;;AA6SA,wCA8DC;AAuCD,8CAOC;AAmBD,0DA0CC;AArdD,2BAAqE;AAErE,wDAAoD;AACpD,+BAA4B;AAa5B,yCAA8C;AAU9C;;;;GAIG;AACH,MAAa,eAAe;IACxB;;OAEG;IACH,IAAI,CAAS;IACb;;OAEG;IACH,KAAK,CAAU;IACf;;O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