@vertesia/tools-sdk 1.2.0 → 1.4.0-dev.20260615.042549Z

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 (271) hide show
  1. package/lib/{types/ActivityCollection.d.ts → ActivityCollection.d.ts} +7 -7
  2. package/lib/ActivityCollection.d.ts.map +1 -0
  3. package/lib/{esm/ActivityCollection.js → ActivityCollection.js} +6 -6
  4. package/lib/ActivityCollection.js.map +1 -0
  5. package/lib/{types/ContentTypesCollection.d.ts → ContentTypesCollection.d.ts} +2 -2
  6. package/lib/ContentTypesCollection.d.ts.map +1 -0
  7. package/lib/{esm/ContentTypesCollection.js → ContentTypesCollection.js} +3 -3
  8. package/lib/ContentTypesCollection.js.map +1 -0
  9. package/lib/{types/InteractionCollection.d.ts → InteractionCollection.d.ts} +2 -2
  10. package/lib/InteractionCollection.d.ts.map +1 -0
  11. package/lib/{esm/InteractionCollection.js → InteractionCollection.js} +3 -3
  12. package/lib/InteractionCollection.js.map +1 -0
  13. package/lib/{types/RenderingTemplateCollection.d.ts → RenderingTemplateCollection.d.ts} +1 -1
  14. package/lib/RenderingTemplateCollection.d.ts.map +1 -0
  15. package/lib/{esm/RenderingTemplateCollection.js → RenderingTemplateCollection.js} +3 -3
  16. package/lib/RenderingTemplateCollection.js.map +1 -0
  17. package/lib/{types/SkillCollection.d.ts → SkillCollection.d.ts} +5 -5
  18. package/lib/SkillCollection.d.ts.map +1 -0
  19. package/lib/{esm/SkillCollection.js → SkillCollection.js} +68 -51
  20. package/lib/SkillCollection.js.map +1 -0
  21. package/lib/{types/ToolCollection.d.ts → ToolCollection.d.ts} +10 -10
  22. package/lib/ToolCollection.d.ts.map +1 -0
  23. package/lib/{esm/ToolCollection.js → ToolCollection.js} +21 -18
  24. package/lib/ToolCollection.js.map +1 -0
  25. package/lib/ToolRegistry.d.ts +22 -0
  26. package/lib/ToolRegistry.d.ts.map +1 -0
  27. package/lib/{esm/ToolRegistry.js → ToolRegistry.js} +6 -36
  28. package/lib/ToolRegistry.js.map +1 -0
  29. package/lib/{types/auth.d.ts → auth.d.ts} +5 -5
  30. package/lib/auth.d.ts.map +1 -0
  31. package/lib/{esm/auth.js → auth.js} +23 -17
  32. package/lib/auth.js.map +1 -0
  33. package/lib/build/validate.d.ts.map +1 -0
  34. package/lib/build/validate.js.map +1 -0
  35. package/lib/copy-assets.d.ts.map +1 -0
  36. package/lib/{esm/copy-assets.js → copy-assets.js} +4 -7
  37. package/lib/copy-assets.js.map +1 -0
  38. package/lib/index.d.ts +16 -0
  39. package/lib/index.d.ts.map +1 -0
  40. package/lib/index.js +15 -0
  41. package/lib/index.js.map +1 -0
  42. package/lib/server/activities.d.ts +4 -0
  43. package/lib/server/activities.d.ts.map +1 -0
  44. package/lib/{esm/server → server}/activities.js +12 -9
  45. package/lib/server/activities.js.map +1 -0
  46. package/lib/server/app-package.d.ts +12 -0
  47. package/lib/server/app-package.d.ts.map +1 -0
  48. package/lib/server/app-package.js +197 -0
  49. package/lib/server/app-package.js.map +1 -0
  50. package/lib/server/content-types.d.ts +4 -0
  51. package/lib/server/content-types.d.ts.map +1 -0
  52. package/lib/server/content-types.js +100 -0
  53. package/lib/server/content-types.js.map +1 -0
  54. package/lib/server/dashboards.d.ts +4 -0
  55. package/lib/server/dashboards.d.ts.map +1 -0
  56. package/lib/server/dashboards.js +25 -0
  57. package/lib/server/dashboards.js.map +1 -0
  58. package/lib/server/interactions.d.ts +4 -0
  59. package/lib/server/interactions.d.ts.map +1 -0
  60. package/lib/{esm/server → server}/interactions.js +16 -16
  61. package/lib/server/interactions.js.map +1 -0
  62. package/lib/server/mcp.d.ts +4 -0
  63. package/lib/server/mcp.d.ts.map +1 -0
  64. package/lib/{esm/server → server}/mcp.js +5 -4
  65. package/lib/server/mcp.js.map +1 -0
  66. package/lib/server/processes.d.ts +4 -0
  67. package/lib/server/processes.d.ts.map +1 -0
  68. package/lib/server/processes.js +26 -0
  69. package/lib/server/processes.js.map +1 -0
  70. package/lib/server/site.d.ts +4 -0
  71. package/lib/server/site.d.ts.map +1 -0
  72. package/lib/{esm/server → server}/site.js +4 -2
  73. package/lib/server/site.js.map +1 -0
  74. package/lib/server/skills.d.ts +4 -0
  75. package/lib/server/skills.d.ts.map +1 -0
  76. package/lib/{esm/server → server}/skills.js +14 -12
  77. package/lib/server/skills.js.map +1 -0
  78. package/lib/server/templates.d.ts +4 -0
  79. package/lib/server/templates.d.ts.map +1 -0
  80. package/lib/{esm/server → server}/templates.js +10 -10
  81. package/lib/server/templates.js.map +1 -0
  82. package/lib/server/tools.d.ts +4 -0
  83. package/lib/server/tools.d.ts.map +1 -0
  84. package/lib/{esm/server → server}/tools.js +7 -9
  85. package/lib/server/tools.js.map +1 -0
  86. package/lib/{types/server → server}/types.d.ts +21 -16
  87. package/lib/server/types.d.ts.map +1 -0
  88. package/lib/{cjs → server}/types.js.map +1 -1
  89. package/lib/server/widgets.d.ts +4 -0
  90. package/lib/server/widgets.d.ts.map +1 -0
  91. package/lib/server/widgets.js.map +1 -0
  92. package/lib/{types/server.d.ts → server.d.ts} +3 -3
  93. package/lib/server.d.ts.map +1 -0
  94. package/lib/{esm/server.js → server.js} +28 -22
  95. package/lib/server.js.map +1 -0
  96. package/lib/site/styles.d.ts.map +1 -0
  97. package/lib/{esm/site → site}/styles.js.map +1 -1
  98. package/lib/{types/site → site}/templates.d.ts +9 -9
  99. package/lib/site/templates.d.ts.map +1 -0
  100. package/lib/{esm/site → site}/templates.js +152 -98
  101. package/lib/site/templates.js.map +1 -0
  102. package/lib/{types/types.d.ts → types.d.ts} +29 -16
  103. package/lib/types.d.ts.map +1 -0
  104. package/lib/types.js.map +1 -0
  105. package/lib/utils.d.ts.map +1 -0
  106. package/lib/{esm/utils.js → utils.js} +11 -5
  107. package/lib/utils.js.map +1 -0
  108. package/package.json +21 -23
  109. package/src/ActivityCollection.test.ts +60 -59
  110. package/src/ActivityCollection.ts +27 -20
  111. package/src/ContentTypesCollection.ts +6 -9
  112. package/src/InteractionCollection.ts +6 -8
  113. package/src/RenderingTemplateCollection.ts +49 -51
  114. package/src/SkillCollection.ts +91 -72
  115. package/src/ToolCollection.ts +52 -43
  116. package/src/ToolRegistry.ts +20 -50
  117. package/src/auth.ts +35 -27
  118. package/src/copy-assets.ts +5 -12
  119. package/src/index.ts +15 -15
  120. package/src/server/activities.test.ts +70 -67
  121. package/src/server/activities.ts +17 -13
  122. package/src/server/app-package.test.ts +140 -0
  123. package/src/server/app-package.ts +115 -52
  124. package/src/server/content-types.test.ts +64 -0
  125. package/src/server/content-types.ts +53 -25
  126. package/src/server/dashboards.ts +31 -0
  127. package/src/server/interactions.ts +29 -28
  128. package/src/server/mcp.ts +16 -16
  129. package/src/server/processes.ts +35 -0
  130. package/src/server/site.ts +7 -15
  131. package/src/server/skills.ts +19 -18
  132. package/src/server/templates.ts +82 -80
  133. package/src/server/tools.ts +12 -16
  134. package/src/server/types.ts +29 -20
  135. package/src/server/widgets.ts +5 -9
  136. package/src/server.ts +55 -47
  137. package/src/site/styles.ts +1 -1
  138. package/src/site/templates.ts +259 -157
  139. package/src/types.ts +55 -31
  140. package/src/utils.ts +11 -6
  141. package/lib/cjs/ActivityCollection.js +0 -93
  142. package/lib/cjs/ActivityCollection.js.map +0 -1
  143. package/lib/cjs/ContentTypesCollection.js +0 -43
  144. package/lib/cjs/ContentTypesCollection.js.map +0 -1
  145. package/lib/cjs/InteractionCollection.js +0 -43
  146. package/lib/cjs/InteractionCollection.js.map +0 -1
  147. package/lib/cjs/RenderingTemplateCollection.js +0 -43
  148. package/lib/cjs/RenderingTemplateCollection.js.map +0 -1
  149. package/lib/cjs/SkillCollection.js +0 -384
  150. package/lib/cjs/SkillCollection.js.map +0 -1
  151. package/lib/cjs/ToolCollection.js +0 -221
  152. package/lib/cjs/ToolCollection.js.map +0 -1
  153. package/lib/cjs/ToolRegistry.js +0 -95
  154. package/lib/cjs/ToolRegistry.js.map +0 -1
  155. package/lib/cjs/auth.js +0 -131
  156. package/lib/cjs/auth.js.map +0 -1
  157. package/lib/cjs/build/validate.js +0 -7
  158. package/lib/cjs/build/validate.js.map +0 -1
  159. package/lib/cjs/copy-assets.js +0 -84
  160. package/lib/cjs/copy-assets.js.map +0 -1
  161. package/lib/cjs/index.js +0 -34
  162. package/lib/cjs/index.js.map +0 -1
  163. package/lib/cjs/package.json +0 -3
  164. package/lib/cjs/server/activities.js +0 -103
  165. package/lib/cjs/server/activities.js.map +0 -1
  166. package/lib/cjs/server/app-package.js +0 -154
  167. package/lib/cjs/server/app-package.js.map +0 -1
  168. package/lib/cjs/server/content-types.js +0 -73
  169. package/lib/cjs/server/content-types.js.map +0 -1
  170. package/lib/cjs/server/interactions.js +0 -101
  171. package/lib/cjs/server/interactions.js.map +0 -1
  172. package/lib/cjs/server/mcp.js +0 -45
  173. package/lib/cjs/server/mcp.js.map +0 -1
  174. package/lib/cjs/server/site.js +0 -48
  175. package/lib/cjs/server/site.js.map +0 -1
  176. package/lib/cjs/server/skills.js +0 -124
  177. package/lib/cjs/server/skills.js.map +0 -1
  178. package/lib/cjs/server/templates.js +0 -67
  179. package/lib/cjs/server/templates.js.map +0 -1
  180. package/lib/cjs/server/tools.js +0 -87
  181. package/lib/cjs/server/tools.js.map +0 -1
  182. package/lib/cjs/server/types.js +0 -3
  183. package/lib/cjs/server/types.js.map +0 -1
  184. package/lib/cjs/server/widgets.js +0 -27
  185. package/lib/cjs/server/widgets.js.map +0 -1
  186. package/lib/cjs/server.js +0 -142
  187. package/lib/cjs/server.js.map +0 -1
  188. package/lib/cjs/site/styles.js +0 -692
  189. package/lib/cjs/site/styles.js.map +0 -1
  190. package/lib/cjs/site/templates.js +0 -1320
  191. package/lib/cjs/site/templates.js.map +0 -1
  192. package/lib/cjs/types.js +0 -3
  193. package/lib/cjs/utils.js +0 -44
  194. package/lib/cjs/utils.js.map +0 -1
  195. package/lib/esm/ActivityCollection.js.map +0 -1
  196. package/lib/esm/ContentTypesCollection.js.map +0 -1
  197. package/lib/esm/InteractionCollection.js.map +0 -1
  198. package/lib/esm/RenderingTemplateCollection.js.map +0 -1
  199. package/lib/esm/SkillCollection.js.map +0 -1
  200. package/lib/esm/ToolCollection.js.map +0 -1
  201. package/lib/esm/ToolRegistry.js.map +0 -1
  202. package/lib/esm/auth.js.map +0 -1
  203. package/lib/esm/build/validate.js.map +0 -1
  204. package/lib/esm/copy-assets.js.map +0 -1
  205. package/lib/esm/index.js +0 -14
  206. package/lib/esm/index.js.map +0 -1
  207. package/lib/esm/server/activities.js.map +0 -1
  208. package/lib/esm/server/app-package.js +0 -151
  209. package/lib/esm/server/app-package.js.map +0 -1
  210. package/lib/esm/server/content-types.js +0 -70
  211. package/lib/esm/server/content-types.js.map +0 -1
  212. package/lib/esm/server/interactions.js.map +0 -1
  213. package/lib/esm/server/mcp.js.map +0 -1
  214. package/lib/esm/server/site.js.map +0 -1
  215. package/lib/esm/server/skills.js.map +0 -1
  216. package/lib/esm/server/templates.js.map +0 -1
  217. package/lib/esm/server/tools.js.map +0 -1
  218. package/lib/esm/server/types.js.map +0 -1
  219. package/lib/esm/server/widgets.js.map +0 -1
  220. package/lib/esm/server.js.map +0 -1
  221. package/lib/esm/site/templates.js.map +0 -1
  222. package/lib/esm/types.js.map +0 -1
  223. package/lib/esm/utils.js.map +0 -1
  224. package/lib/types/ActivityCollection.d.ts.map +0 -1
  225. package/lib/types/ContentTypesCollection.d.ts.map +0 -1
  226. package/lib/types/InteractionCollection.d.ts.map +0 -1
  227. package/lib/types/RenderingTemplateCollection.d.ts.map +0 -1
  228. package/lib/types/SkillCollection.d.ts.map +0 -1
  229. package/lib/types/ToolCollection.d.ts.map +0 -1
  230. package/lib/types/ToolRegistry.d.ts +0 -22
  231. package/lib/types/ToolRegistry.d.ts.map +0 -1
  232. package/lib/types/auth.d.ts.map +0 -1
  233. package/lib/types/build/validate.d.ts.map +0 -1
  234. package/lib/types/copy-assets.d.ts.map +0 -1
  235. package/lib/types/index.d.ts +0 -14
  236. package/lib/types/index.d.ts.map +0 -1
  237. package/lib/types/server/activities.d.ts +0 -4
  238. package/lib/types/server/activities.d.ts.map +0 -1
  239. package/lib/types/server/app-package.d.ts +0 -4
  240. package/lib/types/server/app-package.d.ts.map +0 -1
  241. package/lib/types/server/content-types.d.ts +0 -4
  242. package/lib/types/server/content-types.d.ts.map +0 -1
  243. package/lib/types/server/interactions.d.ts +0 -4
  244. package/lib/types/server/interactions.d.ts.map +0 -1
  245. package/lib/types/server/mcp.d.ts +0 -4
  246. package/lib/types/server/mcp.d.ts.map +0 -1
  247. package/lib/types/server/site.d.ts +0 -4
  248. package/lib/types/server/site.d.ts.map +0 -1
  249. package/lib/types/server/skills.d.ts +0 -4
  250. package/lib/types/server/skills.d.ts.map +0 -1
  251. package/lib/types/server/templates.d.ts +0 -4
  252. package/lib/types/server/templates.d.ts.map +0 -1
  253. package/lib/types/server/tools.d.ts +0 -4
  254. package/lib/types/server/tools.d.ts.map +0 -1
  255. package/lib/types/server/types.d.ts.map +0 -1
  256. package/lib/types/server/widgets.d.ts +0 -4
  257. package/lib/types/server/widgets.d.ts.map +0 -1
  258. package/lib/types/server.d.ts.map +0 -1
  259. package/lib/types/site/styles.d.ts.map +0 -1
  260. package/lib/types/site/templates.d.ts.map +0 -1
  261. package/lib/types/types.d.ts.map +0 -1
  262. package/lib/types/utils.d.ts.map +0 -1
  263. /package/lib/{types/build → build}/validate.d.ts +0 -0
  264. /package/lib/{esm/build → build}/validate.js +0 -0
  265. /package/lib/{types/copy-assets.d.ts → copy-assets.d.ts} +0 -0
  266. /package/lib/{esm/server → server}/types.js +0 -0
  267. /package/lib/{esm/server → server}/widgets.js +0 -0
  268. /package/lib/{types/site → site}/styles.d.ts +0 -0
  269. /package/lib/{esm/site → site}/styles.js +0 -0
  270. /package/lib/{esm/types.js → types.js} +0 -0
  271. /package/lib/{types/utils.d.ts → utils.d.ts} +0 -0
@@ -1,8 +1,8 @@
1
- import type { ToolDefinition, ToolUse } from "@llumiverse/common";
2
- import { VertesiaClient } from "@vertesia/client";
3
- import { AgentToolDefinition, AuthTokenPayload, ProjectConfiguration, RenderingTemplateDefinition, ToolExecutionMetadata, ToolResult, ToolResultContent } from "@vertesia/common";
1
+ import type { ToolDefinition, ToolUse } from '@llumiverse/common';
2
+ import type { VertesiaClient } from '@vertesia/client';
3
+ import type { AgentToolDefinition, AuthTokenPayload, MCPToolAnnotations, ProjectConfiguration, RenderingTemplateDefinition, ToolExecutionMetadata, ToolResult, ToolResultContent } from '@vertesia/common';
4
4
  export type { ToolExecutionMetadata };
5
- export type ICollection<T = any> = CollectionProperties & Iterable<T>;
5
+ export type ICollection<T = object> = CollectionProperties & Iterable<T>;
6
6
  export interface CollectionProperties {
7
7
  /**
8
8
  * A kebab case collection name. Must only contains alphanumeric and dash characters,
@@ -43,7 +43,7 @@ export interface ToolExecutionResult extends ToolResultContent {
43
43
  /**
44
44
  * Medata can be used to return more info on the tool execution like stats or user messages.
45
45
  */
46
- meta?: Record<string, any>;
46
+ meta?: Record<string, unknown>;
47
47
  }
48
48
  export interface ToolExecutionResponse extends ToolExecutionResult, ToolResult {
49
49
  /**
@@ -67,32 +67,44 @@ export interface ToolExecutionResponseError {
67
67
  /**
68
68
  * Additional context information
69
69
  */
70
- data?: Record<string, any>;
70
+ data?: Record<string, unknown>;
71
71
  }
72
- export interface ToolExecutionPayload<ParamsT extends Record<string, any>> {
72
+ export interface ToolExecutionPayload<ParamsT extends object = object> {
73
73
  tool_use: ToolUse<ParamsT>;
74
74
  /**
75
75
  * Optional metadata related to the current execution request
76
76
  */
77
77
  metadata?: ToolExecutionMetadata;
78
78
  }
79
- export type ToolFn<ParamsT extends Record<string, any>> = (payload: ToolExecutionPayload<ParamsT>, context: ToolExecutionContext) => Promise<ToolExecutionResult>;
79
+ export type ToolFn<ParamsT extends object = object> = (payload: ToolExecutionPayload<ParamsT>, context: ToolExecutionContext) => Promise<ToolExecutionResult>;
80
80
  export interface ToolUseContext {
81
81
  project_id?: string;
82
82
  account_id?: string;
83
83
  project_name?: string;
84
84
  project_ns?: string;
85
85
  configuration?: ProjectConfiguration;
86
- vars?: Record<string, any>;
86
+ vars?: Record<string, unknown>;
87
87
  }
88
- export interface Tool<ParamsT extends Record<string, any>> extends ToolDefinition {
89
- run: ToolFn<ParamsT>;
88
+ export interface Tool<ParamsT extends object = object> extends ToolDefinition {
89
+ run(payload: ToolExecutionPayload<ParamsT>, context: ToolExecutionContext): Promise<ToolExecutionResult>;
90
90
  /**
91
91
  * Whether this tool is available by default.
92
92
  * - true/undefined: Tool is always available to agents
93
- * - false: Tool is only available when activated by a skill's related_tools
93
+ * - false: Tool is only available when activated by a skill's tools
94
94
  */
95
95
  default?: boolean;
96
+ /**
97
+ * MCP-style annotations (destructiveHint, readOnlyHint, etc). Propagated
98
+ * into the AgentToolDefinition on catalog / package responses.
99
+ */
100
+ annotations?: MCPToolAnnotations;
101
+ /**
102
+ * When true, agents must obtain explicit user confirmation via `ask_user`
103
+ * (Yes/No) before invoking this tool. If the user answers No, the tool
104
+ * must not run. Stronger than `annotations.destructiveHint` — this is a
105
+ * hard contract.
106
+ */
107
+ requires_user_confirmation?: boolean;
96
108
  /**
97
109
  * Optional filter to check if the tool is enabled for the given project configuration.
98
110
  * This can be used to dynamically enable/disable tools based on project settings, environment variables, or any other logic.
@@ -208,7 +220,7 @@ export interface SkillDefinition {
208
220
  */
209
221
  input_schema?: {
210
222
  type: 'object';
211
- properties?: Record<string, any>;
223
+ properties?: Record<string, unknown>;
212
224
  required?: string[];
213
225
  };
214
226
  /**
@@ -220,9 +232,10 @@ export interface SkillDefinition {
220
232
  */
221
233
  execution?: SkillExecution;
222
234
  /**
223
- * Related tools that work well with this skill
235
+ * Tool names this skill enables (unlocks) when called. Matches the
236
+ * `tools:` key used in SKILL.md frontmatter.
224
237
  */
225
- related_tools?: string[];
238
+ tools?: string[];
226
239
  /**
227
240
  * Scripts bundled with this skill (synced to sandbox when skill is used)
228
241
  */
@@ -255,7 +268,7 @@ export interface SkillExecutionPayload {
255
268
  /**
256
269
  * Data context for JST template rendering
257
270
  */
258
- data?: Record<string, any>;
271
+ data?: Record<string, unknown>;
259
272
  /**
260
273
  * Whether to execute the code template (if present)
261
274
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EACR,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACpB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,oBAAoB,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAEzE,MAAM,WAAW,oBAAoB;IACjC;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACjC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,gBAAgB,CAAC;IAC1B;;;OAGG;IACH,SAAS,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC1D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB,EAAE,UAAU;IAC1E;;OAEG;IACH,WAAW,E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AM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC7B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS/C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,UAK5C;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAE3D;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAc/C"}
@@ -6,15 +6,21 @@
6
6
  export function toPathName(name) {
7
7
  let result = name;
8
8
  if (result.includes(' ') || result.includes('_')) {
9
- result = result.split(/[\s_]+/).map(w => w.charAt(0).toUpperCase() + w.slice(1)).join('');
9
+ result = result
10
+ .split(/[\s_]+/)
11
+ .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
12
+ .join('');
10
13
  }
11
14
  return result.replace(/[^a-zA-Z0-9$_\-@]/g, '-');
12
15
  }
13
16
  export function kebabCaseToTitle(name) {
14
- return name.split('-').map(p => p[0].toUpperCase() + p.substring(1)).join(' ');
17
+ return name
18
+ .split('-')
19
+ .map((p) => p[0].toUpperCase() + p.substring(1))
20
+ .join(' ');
15
21
  }
16
22
  export function makeScriptUrl(origin, script) {
17
- return join(origin, join("/scripts", script));
23
+ return join(origin, join('/scripts', script));
18
24
  }
19
25
  export function join(left, right) {
20
26
  if (left.endsWith('/')) {
@@ -29,10 +35,10 @@ export function join(left, right) {
29
35
  return left + right;
30
36
  }
31
37
  else if (right.startsWith('./')) {
32
- return left + '/' + right.slice(2);
38
+ return `${left}/${right.slice(2)}`;
33
39
  }
34
40
  else {
35
- return left + '/' + right;
41
+ return `${left}/${right}`;
36
42
  }
37
43
  }
38
44
  //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACnC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,MAAM,GAAG,MAAM;aACV,KAAK,CAAC,QAAQ,CAAC;aACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aAClD,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY;IACzC,OAAO,IAAI;SACN,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;SAC/C,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,MAAc;IACxD,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,KAAa;IAC5C,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,OAAO,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,GAAG,KAAK,CAAC;QACxB,CAAC;IACL,CAAC;SAAM,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,GAAG,KAAK,CAAC;IACxB,CAAC;SAAM,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,OAAO,GAAG,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,CAAC;SAAM,CAAC;QACJ,OAAO,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC;IAC9B,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,40 +1,36 @@
1
1
  {
2
2
  "name": "@vertesia/tools-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.4.0-dev.20260615.042549Z",
4
4
  "description": "Tools SDK - utilities for building remote tools",
5
5
  "type": "module",
6
- "types": "./lib/types/index.d.ts",
6
+ "main": "./lib/index.js",
7
+ "types": "./lib/index.d.ts",
7
8
  "files": [
8
9
  "lib",
9
10
  "src"
10
11
  ],
11
12
  "license": "Apache-2.0",
12
13
  "exports": {
13
- "types": "./lib/types/index.d.ts",
14
- "import": "./lib/esm/index.js",
15
- "require": "./lib/cjs/index.js"
16
- },
17
- "bin": {
18
- "tools-sdk-copy-assets": "./lib/esm/copy-assets.js"
14
+ ".": {
15
+ "types": "./lib/index.d.ts",
16
+ "default": "./lib/index.js"
17
+ }
19
18
  },
20
19
  "devDependencies": {
21
- "@types/node": "^24.1.0",
22
- "ts-dual-module": "^0.6.3",
23
- "typescript": "^6.0.2",
24
- "vitest": "^4.0.16"
25
- },
26
- "ts_dual_module": {
27
- "outDir": "lib"
20
+ "@types/node": "^24.12.4",
21
+ "typescript": "^6.0.3",
22
+ "vitest": "^4.1.8",
23
+ "@vertesia/tsconfig": "0.1.0"
28
24
  },
29
25
  "peerDependencies": {
30
- "hono": "^4.12.14"
26
+ "hono": "^4.12.23"
31
27
  },
32
28
  "dependencies": {
33
- "jose": "^6.0.11",
34
- "zod": "^4.3.5",
35
- "@llumiverse/common": "1.1.1-dev.20260505.151157Z",
36
- "@vertesia/common": "1.2.0",
37
- "@vertesia/client": "1.2.0"
29
+ "jose": "^6.2.3",
30
+ "zod": "^4.4.3",
31
+ "@llumiverse/common": "1.3.0",
32
+ "@vertesia/common": "1.4.0-dev.20260615.042549Z",
33
+ "@vertesia/client": "1.4.0-dev.20260615.042549Z"
38
34
  },
39
35
  "repository": {
40
36
  "type": "git",
@@ -51,8 +47,10 @@
51
47
  "typescript"
52
48
  ],
53
49
  "scripts": {
50
+ "lint": "biome lint src",
54
51
  "test": "vitest run",
55
- "build": "pnpm exec tsmod build",
56
- "clean": "rimraf ./node_modules ./lib ./tsconfig.tsbuildinfo"
52
+ "typecheck:test": "tsc -p tsconfig.test.json --noEmit",
53
+ "build": "rm -rf ./lib ./tsconfig.tsbuildinfo && tsc",
54
+ "clean": "rm -rf ./node_modules ./lib ./tsconfig.tsbuildinfo"
57
55
  }
58
56
  }
@@ -1,38 +1,45 @@
1
- import { RemoteActivityExecutionPayload } from "@vertesia/common";
2
- import { beforeEach, describe, expect, it, vi } from "vitest";
3
- import { ActivityCollection, ActivityDefinition } from "./ActivityCollection.js";
1
+ import type { RemoteActivityExecutionPayload } from '@vertesia/common';
2
+ import type { Context } from 'hono';
3
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
4
+ import { ActivityCollection, type ActivityDefinition } from './ActivityCollection.js';
5
+
6
+ type MockContext = Context & {
7
+ json: ReturnType<typeof vi.fn>;
8
+ req: { header: ReturnType<typeof vi.fn>; url: string };
9
+ set: ReturnType<typeof vi.fn>;
10
+ };
4
11
 
5
- vi.mock("./auth.js", () => ({
6
- authorize: vi.fn().mockResolvedValue({ token: "test-token" }),
12
+ vi.mock('./auth.js', () => ({
13
+ authorize: vi.fn().mockResolvedValue({ token: 'test-token' }),
7
14
  }));
8
15
 
9
16
  const mockActivity: ActivityDefinition = {
10
- name: "analyze_sentiment",
11
- title: "Analyze Sentiment",
12
- description: "Analyzes text sentiment",
17
+ name: 'analyze_sentiment',
18
+ title: 'Analyze Sentiment',
19
+ description: 'Analyzes text sentiment',
13
20
  input_schema: {
14
- type: "object",
15
- properties: { text: { type: "string" } },
16
- required: ["text"],
21
+ type: 'object',
22
+ properties: { text: { type: 'string' } },
23
+ required: ['text'],
17
24
  },
18
25
  output_schema: {
19
- type: "object",
20
- properties: { score: { type: "number" } },
26
+ type: 'object',
27
+ properties: { score: { type: 'number' } },
21
28
  },
22
29
  run: vi.fn().mockResolvedValue({ score: 0.95 }),
23
30
  };
24
31
 
25
32
  const mockFailingActivity: ActivityDefinition = {
26
- name: "fail_always",
27
- description: "Always fails",
28
- run: vi.fn().mockRejectedValue(new Error("Intentional failure")),
33
+ name: 'fail_always',
34
+ description: 'Always fails',
35
+ run: vi.fn().mockRejectedValue(new Error('Intentional failure')),
29
36
  };
30
37
 
31
38
  function createCollection(activities: ActivityDefinition[] = [mockActivity]) {
32
39
  return new ActivityCollection({
33
- name: "test-collection",
34
- title: "Test Collection",
35
- description: "A test collection",
40
+ name: 'test-collection',
41
+ title: 'Test Collection',
42
+ description: 'A test collection',
36
43
  activities,
37
44
  });
38
45
  }
@@ -41,118 +48,112 @@ beforeEach(() => {
41
48
  vi.clearAllMocks();
42
49
  });
43
50
 
44
- describe("ActivityCollection", () => {
45
- describe("getActivityDefinitions", () => {
46
- it("returns correct metadata for all registered activities", () => {
51
+ describe('ActivityCollection', () => {
52
+ describe('getActivityDefinitions', () => {
53
+ it('returns correct metadata for all registered activities', () => {
47
54
  const coll = createCollection([mockActivity, mockFailingActivity]);
48
55
  const defs = coll.getActivityDefinitions();
49
56
 
50
57
  expect(defs).toHaveLength(2);
51
58
  expect(defs[0]).toEqual({
52
- name: "analyze_sentiment",
53
- title: "Analyze Sentiment",
54
- description: "Analyzes text sentiment",
59
+ name: 'analyze_sentiment',
60
+ title: 'Analyze Sentiment',
61
+ description: 'Analyzes text sentiment',
55
62
  input_schema: mockActivity.input_schema,
56
63
  output_schema: mockActivity.output_schema,
57
64
  });
58
65
  expect(defs[1]).toEqual({
59
- name: "fail_always",
66
+ name: 'fail_always',
60
67
  title: undefined,
61
- description: "Always fails",
68
+ description: 'Always fails',
62
69
  input_schema: undefined,
63
70
  output_schema: undefined,
64
71
  });
65
72
  });
66
73
 
67
- it("returns empty array when no activities registered", () => {
74
+ it('returns empty array when no activities registered', () => {
68
75
  const coll = createCollection([]);
69
76
  expect(coll.getActivityDefinitions()).toEqual([]);
70
77
  });
71
78
  });
72
79
 
73
- describe("getActivity", () => {
74
- it("returns the activity by name", () => {
80
+ describe('getActivity', () => {
81
+ it('returns the activity by name', () => {
75
82
  const coll = createCollection();
76
- const activity = coll.getActivity("analyze_sentiment");
77
- expect(activity.name).toBe("analyze_sentiment");
83
+ const activity = coll.getActivity('analyze_sentiment');
84
+ expect(activity.name).toBe('analyze_sentiment');
78
85
  expect(activity.run).toBeDefined();
79
86
  });
80
87
 
81
- it("throws 404 for unknown activity name", () => {
88
+ it('throws 404 for unknown activity name', () => {
82
89
  const coll = createCollection();
83
- expect(() => coll.getActivity("nonexistent")).toThrow();
90
+ expect(() => coll.getActivity('nonexistent')).toThrow();
84
91
  });
85
92
  });
86
93
 
87
- describe("iterator", () => {
88
- it("iterates over all activities", () => {
94
+ describe('iterator', () => {
95
+ it('iterates over all activities', () => {
89
96
  const coll = createCollection([mockActivity, mockFailingActivity]);
90
- const names = [...coll].map(a => a.name);
91
- expect(names).toEqual(["analyze_sentiment", "fail_always"]);
97
+ const names = [...coll].map((a) => a.name);
98
+ expect(names).toEqual(['analyze_sentiment', 'fail_always']);
92
99
  });
93
100
  });
94
101
 
95
- describe("execute", () => {
96
- const createMockContext = () => {
102
+ describe('execute', () => {
103
+ const createMockContext = (): MockContext => {
97
104
  const jsonFn = vi.fn().mockReturnThis();
98
105
  return {
99
106
  json: jsonFn,
100
107
  req: {
101
- header: vi.fn().mockReturnValue("Bearer test-token"),
102
- url: "http://localhost/api/activities",
108
+ header: vi.fn().mockReturnValue('Bearer test-token'),
109
+ url: 'http://localhost/api/activities',
103
110
  },
104
111
  set: vi.fn(),
105
- } as any;
112
+ } as unknown as MockContext;
106
113
  };
107
114
 
108
115
  const payload: RemoteActivityExecutionPayload = {
109
- activity_name: "analyze_sentiment",
110
- params: { text: "Hello world" },
116
+ activity_name: 'analyze_sentiment',
117
+ params: { text: 'Hello world' },
111
118
  metadata: {
112
- app_install_id: "install-1",
119
+ app_install_id: 'install-1',
113
120
  },
114
121
  };
115
122
 
116
- it("calls the correct activity handler and returns result", async () => {
123
+ it('calls the correct activity handler and returns result', async () => {
117
124
  const coll = createCollection();
118
125
  const ctx = createMockContext();
119
126
 
120
127
  await coll.execute(ctx, payload);
121
128
 
122
- expect(mockActivity.run).toHaveBeenCalledWith(
123
- payload,
124
- expect.objectContaining({ token: "test-token" }),
125
- );
129
+ expect(mockActivity.run).toHaveBeenCalledWith(payload, expect.objectContaining({ token: 'test-token' }));
126
130
  expect(ctx.json).toHaveBeenCalledWith({
127
131
  result: { score: 0.95 },
128
132
  is_error: false,
129
133
  });
130
134
  });
131
135
 
132
- it("returns is_error with message when activity throws", async () => {
136
+ it('returns is_error with message when activity throws', async () => {
133
137
  const coll = createCollection([mockFailingActivity]);
134
138
  const ctx = createMockContext();
135
139
 
136
140
  const failPayload: RemoteActivityExecutionPayload = {
137
141
  ...payload,
138
- activity_name: "fail_always",
142
+ activity_name: 'fail_always',
139
143
  };
140
144
 
141
145
  await coll.execute(ctx, failPayload);
142
146
 
143
- expect(ctx.json).toHaveBeenCalledWith(
144
- { result: null, is_error: true, error: "Intentional failure" },
145
- 500,
146
- );
147
+ expect(ctx.json).toHaveBeenCalledWith({ result: null, is_error: true, error: 'Intentional failure' }, 500);
147
148
  });
148
149
 
149
- it("throws 404 when activity_name is not found", async () => {
150
+ it('throws 404 when activity_name is not found', async () => {
150
151
  const coll = createCollection();
151
152
  const ctx = createMockContext();
152
153
 
153
154
  const unknownPayload: RemoteActivityExecutionPayload = {
154
155
  ...payload,
155
- activity_name: "nonexistent",
156
+ activity_name: 'nonexistent',
156
157
  };
157
158
 
158
159
  await expect(coll.execute(ctx, unknownPayload)).rejects.toThrow();
@@ -1,9 +1,13 @@
1
- import { RemoteActivityDefinition, RemoteActivityExecutionPayload, RemoteActivityExecutionResponse } from "@vertesia/common";
2
- import { Context } from "hono";
3
- import { HTTPException } from "hono/http-exception";
4
- import { authorize } from "./auth.js";
5
- import { CollectionProperties, ICollection, ToolExecutionContext } from "./types.js";
6
- import { kebabCaseToTitle } from "./utils.js";
1
+ import type {
2
+ RemoteActivityDefinition,
3
+ RemoteActivityExecutionPayload,
4
+ RemoteActivityExecutionResponse,
5
+ } from '@vertesia/common';
6
+ import type { Context } from 'hono';
7
+ import { HTTPException } from 'hono/http-exception';
8
+ import { authorize } from './auth.js';
9
+ import type { CollectionProperties, ICollection, ToolExecutionContext } from './types.js';
10
+ import { kebabCaseToTitle } from './utils.js';
7
11
 
8
12
  /**
9
13
  * Context provided to activity handlers during execution.
@@ -14,15 +18,15 @@ export type ActivityExecutionContext = ToolExecutionContext;
14
18
  /**
15
19
  * Function signature for a remote activity handler.
16
20
  */
17
- export type ActivityFn<ParamsT extends Record<string, any> = Record<string, any>> = (
21
+ export type ActivityFn<ParamsT extends object = Record<string, unknown>> = (
18
22
  payload: RemoteActivityExecutionPayload<ParamsT>,
19
- context: ActivityExecutionContext
20
- ) => Promise<any>;
23
+ context: ActivityExecutionContext,
24
+ ) => Promise<unknown>;
21
25
 
22
26
  /**
23
27
  * An activity definition within an ActivityCollection.
24
28
  */
25
- export interface ActivityDefinition<ParamsT extends Record<string, any> = Record<string, any>> {
29
+ export interface ActivityDefinition<ParamsT extends object = Record<string, unknown>> {
26
30
  /** Activity name (snake_case) */
27
31
  name: string;
28
32
  /** Display title */
@@ -30,9 +34,9 @@ export interface ActivityDefinition<ParamsT extends Record<string, any> = Record
30
34
  /** Description of what the activity does */
31
35
  description?: string;
32
36
  /** JSON Schema for the activity input parameters */
33
- input_schema?: Record<string, any>;
37
+ input_schema?: Record<string, unknown>;
34
38
  /** JSON Schema for the activity output */
35
- output_schema?: Record<string, any>;
39
+ output_schema?: Record<string, unknown>;
36
40
  /** The activity handler function */
37
41
  run: ActivityFn<ParamsT>;
38
42
  }
@@ -71,7 +75,7 @@ export class ActivityCollection implements ICollection<ActivityDefinition> {
71
75
  return { value: activities[index++], done: false };
72
76
  }
73
77
  return { done: true, value: undefined };
74
- }
78
+ },
75
79
  };
76
80
  }
77
81
 
@@ -79,7 +83,7 @@ export class ActivityCollection implements ICollection<ActivityDefinition> {
79
83
  * Get activity definitions for discovery (metadata only, no run function).
80
84
  */
81
85
  getActivityDefinitions(): RemoteActivityDefinition[] {
82
- return Object.values(this.registry).map(activity => ({
86
+ return Object.values(this.registry).map((activity) => ({
83
87
  name: activity.name,
84
88
  title: activity.title,
85
89
  description: activity.description,
@@ -92,7 +96,7 @@ export class ActivityCollection implements ICollection<ActivityDefinition> {
92
96
  const activity = this.registry[name];
93
97
  if (!activity) {
94
98
  throw new HTTPException(404, {
95
- message: `Activity not found: ${name}. Available: ${Object.keys(this.registry).join(', ')}`
99
+ message: `Activity not found: ${name}. Available: ${Object.keys(this.registry).join(', ')}`,
96
100
  });
97
101
  }
98
102
  return activity;
@@ -126,11 +130,14 @@ export class ActivityCollection implements ICollection<ActivityDefinition> {
126
130
  metadata: payload.metadata,
127
131
  error: message,
128
132
  });
129
- return ctx.json({
130
- result: null,
131
- is_error: true,
132
- error: message,
133
- } satisfies RemoteActivityExecutionResponse, 500);
133
+ return ctx.json(
134
+ {
135
+ result: null,
136
+ is_error: true,
137
+ error: message,
138
+ } satisfies RemoteActivityExecutionResponse,
139
+ 500,
140
+ );
134
141
  }
135
142
  }
136
143
  }
@@ -1,6 +1,6 @@
1
- import { InCodeTypeSpec } from "@vertesia/common";
2
- import { CollectionProperties, ICollection } from "./types.js";
3
- import { kebabCaseToTitle } from "./utils.js";
1
+ import type { InCodeTypeSpec } from '@vertesia/common';
2
+ import type { CollectionProperties, ICollection } from './types.js';
3
+ import { kebabCaseToTitle } from './utils.js';
4
4
 
5
5
  export interface ContentTypesCollectionProps extends CollectionProperties {
6
6
  types: InCodeTypeSpec[];
@@ -11,9 +11,7 @@ export class ContentTypesCollection implements ICollection<InCodeTypeSpec> {
11
11
  title?: string;
12
12
  icon?: string;
13
13
  description?: string;
14
- constructor({
15
- name, title, icon, description, types
16
- }: ContentTypesCollectionProps) {
14
+ constructor({ name, title, icon, description, types }: ContentTypesCollectionProps) {
17
15
  this.name = name;
18
16
  this.title = title || kebabCaseToTitle(name);
19
17
  this.icon = icon;
@@ -36,7 +34,7 @@ export class ContentTypesCollection implements ICollection<InCodeTypeSpec> {
36
34
  } else {
37
35
  return { done: true, value: undefined };
38
36
  }
39
- }
37
+ },
40
38
  };
41
39
  }
42
40
 
@@ -45,7 +43,6 @@ export class ContentTypesCollection implements ICollection<InCodeTypeSpec> {
45
43
  }
46
44
 
47
45
  getTypeByName(name: string): InCodeTypeSpec | undefined {
48
- return this.types.find(type => type.name === name);
46
+ return this.types.find((type) => type.name === name);
49
47
  }
50
-
51
48
  }
@@ -1,6 +1,6 @@
1
- import { InteractionSpec } from "@vertesia/common";
2
- import { CollectionProperties, ICollection } from "./types.js";
3
- import { kebabCaseToTitle } from "./utils.js";
1
+ import type { InteractionSpec } from '@vertesia/common';
2
+ import type { CollectionProperties, ICollection } from './types.js';
3
+ import { kebabCaseToTitle } from './utils.js';
4
4
 
5
5
  export interface InteractionCollectionProps extends CollectionProperties {
6
6
  interactions: InteractionSpec[];
@@ -11,9 +11,7 @@ export class InteractionCollection implements ICollection<InteractionSpec> {
11
11
  title?: string;
12
12
  icon?: string;
13
13
  description?: string;
14
- constructor({
15
- name, title, icon, description, interactions
16
- }: InteractionCollectionProps) {
14
+ constructor({ name, title, icon, description, interactions }: InteractionCollectionProps) {
17
15
  this.name = name;
18
16
  this.title = title || kebabCaseToTitle(name);
19
17
  this.icon = icon;
@@ -36,7 +34,7 @@ export class InteractionCollection implements ICollection<InteractionSpec> {
36
34
  } else {
37
35
  return { done: true, value: undefined };
38
36
  }
39
- }
37
+ },
40
38
  };
41
39
  }
42
40
 
@@ -45,6 +43,6 @@ export class InteractionCollection implements ICollection<InteractionSpec> {
45
43
  }
46
44
 
47
45
  getInteractionByName(name: string): InteractionSpec | undefined {
48
- return this.interactions.find(interaction => interaction.name === name);
46
+ return this.interactions.find((interaction) => interaction.name === name);
49
47
  }
50
48
  }