@pinepaper.studio/mcp-server 1.0.0

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 (295) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +406 -0
  3. package/dist/__tests__/fixtures/index.d.ts +8 -0
  4. package/dist/__tests__/fixtures/index.d.ts.map +1 -0
  5. package/dist/__tests__/fixtures/index.js +8 -0
  6. package/dist/__tests__/fixtures/index.js.map +1 -0
  7. package/dist/__tests__/fixtures/mock-animations.d.ts +213 -0
  8. package/dist/__tests__/fixtures/mock-animations.d.ts.map +1 -0
  9. package/dist/__tests__/fixtures/mock-animations.js +96 -0
  10. package/dist/__tests__/fixtures/mock-animations.js.map +1 -0
  11. package/dist/__tests__/fixtures/mock-generators.d.ts +147 -0
  12. package/dist/__tests__/fixtures/mock-generators.d.ts.map +1 -0
  13. package/dist/__tests__/fixtures/mock-generators.js +90 -0
  14. package/dist/__tests__/fixtures/mock-generators.js.map +1 -0
  15. package/dist/__tests__/fixtures/mock-items.d.ts +157 -0
  16. package/dist/__tests__/fixtures/mock-items.d.ts.map +1 -0
  17. package/dist/__tests__/fixtures/mock-items.js +74 -0
  18. package/dist/__tests__/fixtures/mock-items.js.map +1 -0
  19. package/dist/__tests__/fixtures/mock-relations.d.ts +147 -0
  20. package/dist/__tests__/fixtures/mock-relations.d.ts.map +1 -0
  21. package/dist/__tests__/fixtures/mock-relations.js +90 -0
  22. package/dist/__tests__/fixtures/mock-relations.js.map +1 -0
  23. package/dist/browser/bridge.d.ts +127 -0
  24. package/dist/browser/bridge.d.ts.map +1 -0
  25. package/dist/browser/bridge.js +320 -0
  26. package/dist/browser/bridge.js.map +1 -0
  27. package/dist/browser/index.d.ts +8 -0
  28. package/dist/browser/index.d.ts.map +1 -0
  29. package/dist/browser/index.js +8 -0
  30. package/dist/browser/index.js.map +1 -0
  31. package/dist/browser/puppeteer-controller.d.ts +93 -0
  32. package/dist/browser/puppeteer-controller.d.ts.map +1 -0
  33. package/dist/browser/puppeteer-controller.js +280 -0
  34. package/dist/browser/puppeteer-controller.js.map +1 -0
  35. package/dist/cli.d.ts +8 -0
  36. package/dist/cli.d.ts.map +1 -0
  37. package/dist/cli.js +109 -0
  38. package/dist/cli.js.map +1 -0
  39. package/dist/i18n/i18n-manager.d.ts +88 -0
  40. package/dist/i18n/i18n-manager.d.ts.map +1 -0
  41. package/dist/i18n/i18n-manager.js +209 -0
  42. package/dist/i18n/i18n-manager.js.map +1 -0
  43. package/dist/i18n/index.d.ts +10 -0
  44. package/dist/i18n/index.d.ts.map +1 -0
  45. package/dist/i18n/index.js +10 -0
  46. package/dist/i18n/index.js.map +1 -0
  47. package/dist/i18n/locales/ar.d.ts +6 -0
  48. package/dist/i18n/locales/ar.d.ts.map +1 -0
  49. package/dist/i18n/locales/ar.js +106 -0
  50. package/dist/i18n/locales/ar.js.map +1 -0
  51. package/dist/i18n/locales/base.d.ts +17 -0
  52. package/dist/i18n/locales/base.d.ts.map +1 -0
  53. package/dist/i18n/locales/base.js +213 -0
  54. package/dist/i18n/locales/base.js.map +1 -0
  55. package/dist/i18n/locales/bn.d.ts +6 -0
  56. package/dist/i18n/locales/bn.d.ts.map +1 -0
  57. package/dist/i18n/locales/bn.js +106 -0
  58. package/dist/i18n/locales/bn.js.map +1 -0
  59. package/dist/i18n/locales/chp.d.ts +8 -0
  60. package/dist/i18n/locales/chp.d.ts.map +1 -0
  61. package/dist/i18n/locales/chp.js +11 -0
  62. package/dist/i18n/locales/chp.js.map +1 -0
  63. package/dist/i18n/locales/cr.d.ts +8 -0
  64. package/dist/i18n/locales/cr.d.ts.map +1 -0
  65. package/dist/i18n/locales/cr.js +11 -0
  66. package/dist/i18n/locales/cr.js.map +1 -0
  67. package/dist/i18n/locales/crg.d.ts +8 -0
  68. package/dist/i18n/locales/crg.d.ts.map +1 -0
  69. package/dist/i18n/locales/crg.js +11 -0
  70. package/dist/i18n/locales/crg.js.map +1 -0
  71. package/dist/i18n/locales/cs.d.ts +6 -0
  72. package/dist/i18n/locales/cs.d.ts.map +1 -0
  73. package/dist/i18n/locales/cs.js +106 -0
  74. package/dist/i18n/locales/cs.js.map +1 -0
  75. package/dist/i18n/locales/da.d.ts +6 -0
  76. package/dist/i18n/locales/da.d.ts.map +1 -0
  77. package/dist/i18n/locales/da.js +106 -0
  78. package/dist/i18n/locales/da.js.map +1 -0
  79. package/dist/i18n/locales/de.d.ts +6 -0
  80. package/dist/i18n/locales/de.d.ts.map +1 -0
  81. package/dist/i18n/locales/de.js +106 -0
  82. package/dist/i18n/locales/de.js.map +1 -0
  83. package/dist/i18n/locales/el.d.ts +6 -0
  84. package/dist/i18n/locales/el.d.ts.map +1 -0
  85. package/dist/i18n/locales/el.js +106 -0
  86. package/dist/i18n/locales/el.js.map +1 -0
  87. package/dist/i18n/locales/en.d.ts +6 -0
  88. package/dist/i18n/locales/en.d.ts.map +1 -0
  89. package/dist/i18n/locales/en.js +383 -0
  90. package/dist/i18n/locales/en.js.map +1 -0
  91. package/dist/i18n/locales/es.d.ts +6 -0
  92. package/dist/i18n/locales/es.d.ts.map +1 -0
  93. package/dist/i18n/locales/es.js +106 -0
  94. package/dist/i18n/locales/es.js.map +1 -0
  95. package/dist/i18n/locales/fa.d.ts +6 -0
  96. package/dist/i18n/locales/fa.d.ts.map +1 -0
  97. package/dist/i18n/locales/fa.js +106 -0
  98. package/dist/i18n/locales/fa.js.map +1 -0
  99. package/dist/i18n/locales/fi.d.ts +6 -0
  100. package/dist/i18n/locales/fi.d.ts.map +1 -0
  101. package/dist/i18n/locales/fi.js +106 -0
  102. package/dist/i18n/locales/fi.js.map +1 -0
  103. package/dist/i18n/locales/fil.d.ts +6 -0
  104. package/dist/i18n/locales/fil.d.ts.map +1 -0
  105. package/dist/i18n/locales/fil.js +383 -0
  106. package/dist/i18n/locales/fil.js.map +1 -0
  107. package/dist/i18n/locales/fr.d.ts +6 -0
  108. package/dist/i18n/locales/fr.d.ts.map +1 -0
  109. package/dist/i18n/locales/fr.js +106 -0
  110. package/dist/i18n/locales/fr.js.map +1 -0
  111. package/dist/i18n/locales/gu.d.ts +6 -0
  112. package/dist/i18n/locales/gu.d.ts.map +1 -0
  113. package/dist/i18n/locales/gu.js +106 -0
  114. package/dist/i18n/locales/gu.js.map +1 -0
  115. package/dist/i18n/locales/he.d.ts +6 -0
  116. package/dist/i18n/locales/he.d.ts.map +1 -0
  117. package/dist/i18n/locales/he.js +106 -0
  118. package/dist/i18n/locales/he.js.map +1 -0
  119. package/dist/i18n/locales/hi.d.ts +6 -0
  120. package/dist/i18n/locales/hi.d.ts.map +1 -0
  121. package/dist/i18n/locales/hi.js +106 -0
  122. package/dist/i18n/locales/hi.js.map +1 -0
  123. package/dist/i18n/locales/hu.d.ts +6 -0
  124. package/dist/i18n/locales/hu.d.ts.map +1 -0
  125. package/dist/i18n/locales/hu.js +106 -0
  126. package/dist/i18n/locales/hu.js.map +1 -0
  127. package/dist/i18n/locales/id.d.ts +6 -0
  128. package/dist/i18n/locales/id.d.ts.map +1 -0
  129. package/dist/i18n/locales/id.js +106 -0
  130. package/dist/i18n/locales/id.js.map +1 -0
  131. package/dist/i18n/locales/index.d.ts +110 -0
  132. package/dist/i18n/locales/index.d.ts.map +1 -0
  133. package/dist/i18n/locales/index.js +123 -0
  134. package/dist/i18n/locales/index.js.map +1 -0
  135. package/dist/i18n/locales/is.d.ts +6 -0
  136. package/dist/i18n/locales/is.d.ts.map +1 -0
  137. package/dist/i18n/locales/is.js +383 -0
  138. package/dist/i18n/locales/is.js.map +1 -0
  139. package/dist/i18n/locales/it.d.ts +6 -0
  140. package/dist/i18n/locales/it.d.ts.map +1 -0
  141. package/dist/i18n/locales/it.js +106 -0
  142. package/dist/i18n/locales/it.js.map +1 -0
  143. package/dist/i18n/locales/iu.d.ts +8 -0
  144. package/dist/i18n/locales/iu.d.ts.map +1 -0
  145. package/dist/i18n/locales/iu.js +11 -0
  146. package/dist/i18n/locales/iu.js.map +1 -0
  147. package/dist/i18n/locales/ja.d.ts +6 -0
  148. package/dist/i18n/locales/ja.d.ts.map +1 -0
  149. package/dist/i18n/locales/ja.js +106 -0
  150. package/dist/i18n/locales/ja.js.map +1 -0
  151. package/dist/i18n/locales/kn.d.ts +6 -0
  152. package/dist/i18n/locales/kn.d.ts.map +1 -0
  153. package/dist/i18n/locales/kn.js +106 -0
  154. package/dist/i18n/locales/kn.js.map +1 -0
  155. package/dist/i18n/locales/ko.d.ts +6 -0
  156. package/dist/i18n/locales/ko.d.ts.map +1 -0
  157. package/dist/i18n/locales/ko.js +106 -0
  158. package/dist/i18n/locales/ko.js.map +1 -0
  159. package/dist/i18n/locales/mic.d.ts +8 -0
  160. package/dist/i18n/locales/mic.d.ts.map +1 -0
  161. package/dist/i18n/locales/mic.js +11 -0
  162. package/dist/i18n/locales/mic.js.map +1 -0
  163. package/dist/i18n/locales/ml.d.ts +6 -0
  164. package/dist/i18n/locales/ml.d.ts.map +1 -0
  165. package/dist/i18n/locales/ml.js +106 -0
  166. package/dist/i18n/locales/ml.js.map +1 -0
  167. package/dist/i18n/locales/moh.d.ts +8 -0
  168. package/dist/i18n/locales/moh.d.ts.map +1 -0
  169. package/dist/i18n/locales/moh.js +11 -0
  170. package/dist/i18n/locales/moh.js.map +1 -0
  171. package/dist/i18n/locales/mr.d.ts +6 -0
  172. package/dist/i18n/locales/mr.d.ts.map +1 -0
  173. package/dist/i18n/locales/mr.js +106 -0
  174. package/dist/i18n/locales/mr.js.map +1 -0
  175. package/dist/i18n/locales/ms.d.ts +6 -0
  176. package/dist/i18n/locales/ms.d.ts.map +1 -0
  177. package/dist/i18n/locales/ms.js +106 -0
  178. package/dist/i18n/locales/ms.js.map +1 -0
  179. package/dist/i18n/locales/nl.d.ts +6 -0
  180. package/dist/i18n/locales/nl.d.ts.map +1 -0
  181. package/dist/i18n/locales/nl.js +106 -0
  182. package/dist/i18n/locales/nl.js.map +1 -0
  183. package/dist/i18n/locales/no.d.ts +6 -0
  184. package/dist/i18n/locales/no.d.ts.map +1 -0
  185. package/dist/i18n/locales/no.js +106 -0
  186. package/dist/i18n/locales/no.js.map +1 -0
  187. package/dist/i18n/locales/oj.d.ts +8 -0
  188. package/dist/i18n/locales/oj.d.ts.map +1 -0
  189. package/dist/i18n/locales/oj.js +11 -0
  190. package/dist/i18n/locales/oj.js.map +1 -0
  191. package/dist/i18n/locales/pa.d.ts +6 -0
  192. package/dist/i18n/locales/pa.d.ts.map +1 -0
  193. package/dist/i18n/locales/pa.js +106 -0
  194. package/dist/i18n/locales/pa.js.map +1 -0
  195. package/dist/i18n/locales/pl.d.ts +6 -0
  196. package/dist/i18n/locales/pl.d.ts.map +1 -0
  197. package/dist/i18n/locales/pl.js +106 -0
  198. package/dist/i18n/locales/pl.js.map +1 -0
  199. package/dist/i18n/locales/pt-BR.d.ts +6 -0
  200. package/dist/i18n/locales/pt-BR.d.ts.map +1 -0
  201. package/dist/i18n/locales/pt-BR.js +106 -0
  202. package/dist/i18n/locales/pt-BR.js.map +1 -0
  203. package/dist/i18n/locales/pt.d.ts +6 -0
  204. package/dist/i18n/locales/pt.d.ts.map +1 -0
  205. package/dist/i18n/locales/pt.js +106 -0
  206. package/dist/i18n/locales/pt.js.map +1 -0
  207. package/dist/i18n/locales/ro.d.ts +6 -0
  208. package/dist/i18n/locales/ro.d.ts.map +1 -0
  209. package/dist/i18n/locales/ro.js +106 -0
  210. package/dist/i18n/locales/ro.js.map +1 -0
  211. package/dist/i18n/locales/ru.d.ts +6 -0
  212. package/dist/i18n/locales/ru.d.ts.map +1 -0
  213. package/dist/i18n/locales/ru.js +106 -0
  214. package/dist/i18n/locales/ru.js.map +1 -0
  215. package/dist/i18n/locales/sv.d.ts +6 -0
  216. package/dist/i18n/locales/sv.d.ts.map +1 -0
  217. package/dist/i18n/locales/sv.js +106 -0
  218. package/dist/i18n/locales/sv.js.map +1 -0
  219. package/dist/i18n/locales/ta.d.ts +6 -0
  220. package/dist/i18n/locales/ta.d.ts.map +1 -0
  221. package/dist/i18n/locales/ta.js +106 -0
  222. package/dist/i18n/locales/ta.js.map +1 -0
  223. package/dist/i18n/locales/te.d.ts +6 -0
  224. package/dist/i18n/locales/te.d.ts.map +1 -0
  225. package/dist/i18n/locales/te.js +106 -0
  226. package/dist/i18n/locales/te.js.map +1 -0
  227. package/dist/i18n/locales/th.d.ts +6 -0
  228. package/dist/i18n/locales/th.d.ts.map +1 -0
  229. package/dist/i18n/locales/th.js +106 -0
  230. package/dist/i18n/locales/th.js.map +1 -0
  231. package/dist/i18n/locales/tl.d.ts +6 -0
  232. package/dist/i18n/locales/tl.d.ts.map +1 -0
  233. package/dist/i18n/locales/tl.js +106 -0
  234. package/dist/i18n/locales/tl.js.map +1 -0
  235. package/dist/i18n/locales/tr.d.ts +6 -0
  236. package/dist/i18n/locales/tr.d.ts.map +1 -0
  237. package/dist/i18n/locales/tr.js +106 -0
  238. package/dist/i18n/locales/tr.js.map +1 -0
  239. package/dist/i18n/locales/uk.d.ts +6 -0
  240. package/dist/i18n/locales/uk.d.ts.map +1 -0
  241. package/dist/i18n/locales/uk.js +106 -0
  242. package/dist/i18n/locales/uk.js.map +1 -0
  243. package/dist/i18n/locales/ur.d.ts +6 -0
  244. package/dist/i18n/locales/ur.d.ts.map +1 -0
  245. package/dist/i18n/locales/ur.js +383 -0
  246. package/dist/i18n/locales/ur.js.map +1 -0
  247. package/dist/i18n/locales/vi.d.ts +6 -0
  248. package/dist/i18n/locales/vi.d.ts.map +1 -0
  249. package/dist/i18n/locales/vi.js +106 -0
  250. package/dist/i18n/locales/vi.js.map +1 -0
  251. package/dist/i18n/locales/zh-CN.d.ts +6 -0
  252. package/dist/i18n/locales/zh-CN.d.ts.map +1 -0
  253. package/dist/i18n/locales/zh-CN.js +106 -0
  254. package/dist/i18n/locales/zh-CN.js.map +1 -0
  255. package/dist/i18n/locales/zh-TW.d.ts +6 -0
  256. package/dist/i18n/locales/zh-TW.d.ts.map +1 -0
  257. package/dist/i18n/locales/zh-TW.js +106 -0
  258. package/dist/i18n/locales/zh-TW.js.map +1 -0
  259. package/dist/i18n/types.d.ts +101 -0
  260. package/dist/i18n/types.d.ts.map +1 -0
  261. package/dist/i18n/types.js +65 -0
  262. package/dist/i18n/types.js.map +1 -0
  263. package/dist/index.d.ts +20 -0
  264. package/dist/index.d.ts.map +1 -0
  265. package/dist/index.js +472 -0
  266. package/dist/index.js.map +1 -0
  267. package/dist/server/index.d.ts +39 -0
  268. package/dist/server/index.d.ts.map +1 -0
  269. package/dist/server/index.js +89 -0
  270. package/dist/server/index.js.map +1 -0
  271. package/dist/tools/definitions.d.ts +26 -0
  272. package/dist/tools/definitions.d.ts.map +1 -0
  273. package/dist/tools/definitions.js +785 -0
  274. package/dist/tools/definitions.js.map +1 -0
  275. package/dist/tools/handlers.d.ts +19 -0
  276. package/dist/tools/handlers.d.ts.map +1 -0
  277. package/dist/tools/handlers.js +477 -0
  278. package/dist/tools/handlers.js.map +1 -0
  279. package/dist/tools/index.d.ts +3 -0
  280. package/dist/tools/index.d.ts.map +1 -0
  281. package/dist/tools/index.js +3 -0
  282. package/dist/tools/index.js.map +1 -0
  283. package/dist/types/code-generator.d.ts +97 -0
  284. package/dist/types/code-generator.d.ts.map +1 -0
  285. package/dist/types/code-generator.js +545 -0
  286. package/dist/types/code-generator.js.map +1 -0
  287. package/dist/types/index.d.ts +3 -0
  288. package/dist/types/index.d.ts.map +1 -0
  289. package/dist/types/index.js +3 -0
  290. package/dist/types/index.js.map +1 -0
  291. package/dist/types/schemas.d.ts +707 -0
  292. package/dist/types/schemas.d.ts.map +1 -0
  293. package/dist/types/schemas.js +341 -0
  294. package/dist/types/schemas.js.map +1 -0
  295. package/package.json +81 -0
package/dist/index.js ADDED
@@ -0,0 +1,472 @@
1
+ /**
2
+ * PinePaper MCP Server
3
+ *
4
+ * Main server implementation that exposes PinePaper tools via the Model Context Protocol.
5
+ *
6
+ * This server can operate in two modes:
7
+ * 1. Local (stdio): For Claude Desktop and local AI agents
8
+ * 2. Cloud (SSE/HTTP): For cloud-hosted premium features (future)
9
+ *
10
+ * Supports i18n for 41 locales matching PinePaper Studio.
11
+ */
12
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
13
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
14
+ import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
15
+ import { PINEPAPER_TOOLS } from './tools/definitions.js';
16
+ import { handleToolCall } from './tools/handlers.js';
17
+ import { initI18n, DEFAULT_LOCALE, } from './i18n/index.js';
18
+ // =============================================================================
19
+ // SERVER INFO
20
+ // =============================================================================
21
+ const SERVER_INFO = {
22
+ name: 'pinepaper-mcp',
23
+ version: '1.0.0',
24
+ description: 'MCP Server for PinePaper Studio - Create animated graphics with AI',
25
+ };
26
+ // =============================================================================
27
+ // RESOURCES (Documentation & Examples)
28
+ // =============================================================================
29
+ const RESOURCES = [
30
+ {
31
+ uri: 'pinepaper://docs/getting-started',
32
+ name: 'Getting Started Guide',
33
+ description: 'Introduction to PinePaper MCP tools',
34
+ mimeType: 'text/markdown',
35
+ },
36
+ {
37
+ uri: 'pinepaper://docs/relations',
38
+ name: 'Relations Guide',
39
+ description: 'How to use relations for behavior-driven animation',
40
+ mimeType: 'text/markdown',
41
+ },
42
+ {
43
+ uri: 'pinepaper://docs/generators',
44
+ name: 'Background Generators',
45
+ description: 'Available procedural background generators',
46
+ mimeType: 'text/markdown',
47
+ },
48
+ {
49
+ uri: 'pinepaper://examples/solar-system',
50
+ name: 'Solar System Example',
51
+ description: 'Create an animated solar system with orbiting planets',
52
+ mimeType: 'text/markdown',
53
+ },
54
+ ];
55
+ const RESOURCE_CONTENTS = {
56
+ 'pinepaper://docs/getting-started': `# Getting Started with PinePaper MCP
57
+
58
+ ## Overview
59
+
60
+ PinePaper is a canvas-based animation tool. This MCP server lets you create and animate graphics using natural language.
61
+
62
+ ## Quick Start
63
+
64
+ 1. **Connect to browser**: Use \`pinepaper_browser_connect\` to launch PinePaper Studio
65
+ 2. **Clear the canvas**: Use \`pinepaper_clear_canvas\` or \`pinepaper_refresh_page\` to start fresh
66
+ 3. **Create items**: Use \`pinepaper_create_item\` to add text, shapes, or graphics
67
+ 4. **Add animation**: Use \`pinepaper_add_relation\` for behavior-based animation
68
+ 5. **Verify**: Use \`pinepaper_browser_screenshot\` to see your work
69
+ 6. **Export**: Use \`pinepaper_export_svg\` to save your work
70
+
71
+ ## IMPORTANT: Welcome Template
72
+
73
+ First-time visitors to PinePaper Studio see a **welcome template** with example items on the canvas. Before creating your own content:
74
+
75
+ ### To Clear the Welcome Template:
76
+ - **Option 1**: Use \`pinepaper_clear_canvas\` to remove all items
77
+ - **Option 2**: Use \`pinepaper_refresh_page\` to reload the page (most reliable)
78
+ - After clearing, verify with \`pinepaper_get_items\` that the canvas is empty
79
+
80
+ The welcome template only appears once. After refreshing or clearing, it won't appear again.
81
+
82
+ ## Key Concepts
83
+
84
+ ### Items
85
+ Everything on the canvas is an item with a registry ID (e.g., "item_1"). Use this ID to reference items in other operations.
86
+
87
+ **Creating Items:**
88
+ - Use \`pinepaper_create_item\` with \`itemType\` (text, circle, star, rectangle, etc.)
89
+ - Specify \`position\` as {x, y} coordinates
90
+ - Add \`properties\` for styling (color, fontSize, radius, etc.)
91
+
92
+ ### Relations (Primary Animation Method)
93
+ Relations describe HOW items behave relative to each other. This is the **recommended way** to create animations:
94
+ - \`orbits\`: Circular motion around another item
95
+ - \`follows\`: Move toward another item with smoothing
96
+ - \`attached_to\`: Fixed offset from parent item
97
+ - \`points_at\`: Rotate to face another item
98
+ - \`maintains_distance\`: Keep fixed distance from target
99
+
100
+ **Verifying Animations:**
101
+ After adding a relation, use \`pinepaper_browser_screenshot\` to verify the animation is working. Check that:
102
+ 1. Items are positioned correctly
103
+ 2. Animation is visibly moving (take multiple screenshots at intervals)
104
+ 3. The relation appears in \`pinepaper_query_relations\`
105
+
106
+ ### Deleting Items
107
+ - Use \`pinepaper_delete_item\` with the item's registry ID
108
+ - Use \`pinepaper_get_items\` first to find item IDs
109
+ - If deletion fails, try \`pinepaper_clear_canvas\` to remove everything
110
+
111
+ ### Generators
112
+ Procedural backgrounds like sunburst, waves, grid patterns.
113
+
114
+ ## Example Workflow
115
+
116
+ \`\`\`
117
+ 1. Connect: pinepaper_browser_connect
118
+ 2. Clear canvas: pinepaper_clear_canvas (removes welcome template)
119
+ 3. Verify empty: pinepaper_get_items (should return count: 0)
120
+ 4. Create sun: pinepaper_create_item type=circle, color=#fbbf24, radius=60
121
+ 5. Create earth: pinepaper_create_item type=circle, color=#3b82f6, radius=20
122
+ 6. Add orbit: pinepaper_add_relation earth orbits sun, radius=150
123
+ 7. Screenshot: pinepaper_browser_screenshot (verify animation)
124
+ \`\`\`
125
+ `,
126
+ 'pinepaper://docs/relations': `# Relations Guide
127
+
128
+ Relations are the PRIMARY way to add animation in PinePaper. They describe behavior, not keyframes.
129
+
130
+ ## Why Relations?
131
+
132
+ 1. **Natural Language**: "moon orbits earth" is easier than specifying every frame
133
+ 2. **Compositional**: Multiple relations can work together
134
+ 3. **Training Data**: Relations generate instruction/code pairs for LLM fine-tuning
135
+
136
+ ## Available Relations
137
+
138
+ ### orbits
139
+ Circular motion around target.
140
+ - \`radius\`: Orbit radius in pixels
141
+ - \`speed\`: Rotation speed (1 = normal)
142
+ - \`direction\`: 'clockwise' or 'counterclockwise'
143
+ - \`phase\`: Starting angle offset in degrees
144
+
145
+ ### follows
146
+ Move toward target with smoothing.
147
+ - \`offset\`: [x, y] offset from target
148
+ - \`smoothing\`: 0-1 (lower = more responsive)
149
+ - \`delay\`: Seconds of lag
150
+
151
+ ### attached_to
152
+ Fixed offset from target (parent-child).
153
+ - \`offset\`: [x, y] fixed offset
154
+ - \`inherit_rotation\`: Also rotate with parent
155
+
156
+ ### maintains_distance
157
+ Stay at fixed distance from target.
158
+ - \`distance\`: Target distance in pixels
159
+ - \`strength\`: How strongly to maintain (0-1)
160
+
161
+ ### points_at
162
+ Rotate to face target.
163
+ - \`offset_angle\`: Additional rotation
164
+ - \`smoothing\`: Rotation smoothing
165
+
166
+ ### mirrors
167
+ Mirror position across axis.
168
+ - \`axis\`: 'vertical', 'horizontal', or 'both'
169
+ - \`center\`: [x, y] mirror center
170
+
171
+ ### parallax
172
+ Move relative to target by depth.
173
+ - \`depth\`: 0-1 (0 = no movement, 1 = full movement)
174
+ - \`origin\`: [x, y] parallax origin
175
+
176
+ ### bounds_to
177
+ Stay within target's bounds.
178
+ - \`padding\`: Inner padding
179
+ - \`bounce\`: Bounce off edges
180
+
181
+ ## Verifying Animations Are Working
182
+
183
+ After adding a relation, **always verify** that the animation is actually running:
184
+
185
+ ### Method 1: Take Multiple Screenshots
186
+ Take 2-3 screenshots with a small delay between them:
187
+ \`\`\`
188
+ 1. pinepaper_browser_screenshot (save position)
189
+ 2. Wait 1-2 seconds
190
+ 3. pinepaper_browser_screenshot (compare position)
191
+ \`\`\`
192
+ If the orbiting item has moved, the animation is working.
193
+
194
+ ### Method 2: Query Relations
195
+ Use \`pinepaper_query_relations\` to confirm the relation was added:
196
+ \`\`\`
197
+ pinepaper_query_relations itemId=earth direction=outgoing
198
+ \`\`\`
199
+ Should return the orbits relation.
200
+
201
+ ### Method 3: Check Item Animation State
202
+ Use \`pinepaper_get_items\` with filter \`hasRelation: true\` to see animated items.
203
+
204
+ ### Troubleshooting Animation Issues
205
+ If animations don't appear to be working:
206
+ 1. Verify both source and target items exist with \`pinepaper_get_items\`
207
+ 2. Check the relation was added with \`pinepaper_query_relations\`
208
+ 3. Try refreshing the page with \`pinepaper_refresh_page\` and recreating
209
+ 4. For keyframe animations, ensure \`pinepaper_play_timeline\` was called
210
+
211
+ ## Composition Example
212
+
213
+ An item can have multiple relations:
214
+
215
+ \`\`\`
216
+ // Planet orbits star AND label stays attached
217
+ addRelation(planet, star, 'orbits', { radius: 200, speed: 0.5 })
218
+ addRelation(label, planet, 'attached_to', { offset: [0, -30] })
219
+ \`\`\`
220
+
221
+ The label will follow the planet as it orbits the star!
222
+ `,
223
+ 'pinepaper://docs/generators': `# Background Generators
224
+
225
+ Procedural backgrounds that create dynamic patterns.
226
+
227
+ ## Available Generators
228
+
229
+ ### drawSunburst
230
+ Radial rays from center.
231
+ - \`rayCount\`: Number of rays (default: 16)
232
+ - \`colors\`: Array of ray colors
233
+ - \`bgColor\`: Background color
234
+ - \`animated\`: Enable rotation
235
+
236
+ ### drawSunsetScene
237
+ Animated sunset with clouds.
238
+ - \`sunColor\`: Sun fill color
239
+ - \`skyColors\`: Array for gradient
240
+ - \`cloudCount\`: Number of clouds
241
+
242
+ ### drawGrid
243
+ Geometric grid patterns.
244
+ - \`gridType\`: 'lines', 'dots', or 'squares'
245
+ - \`spacing\`: Cell size
246
+ - \`lineColor\`: Grid color
247
+
248
+ ### drawWaves
249
+ Layered wave pattern.
250
+ - \`waveCount\`: Number of layers
251
+ - \`colors\`: Wave colors
252
+ - \`amplitude\`: Wave height
253
+ - \`animated\`: Animate waves
254
+
255
+ ### drawCircuit
256
+ Tech circuit board.
257
+ - \`lineColor\`: Circuit lines
258
+ - \`nodeColor\`: Junction color
259
+ - \`density\`: 0-1 complexity
260
+ - \`animated\`: Enable bolt effect
261
+ `,
262
+ 'pinepaper://examples/solar-system': `# Solar System Example
263
+
264
+ Create an animated solar system with orbiting planets.
265
+
266
+ ## Step by Step
267
+
268
+ ### 1. Set up the canvas
269
+ \`\`\`
270
+ Set background color to #0f172a (dark blue)
271
+ \`\`\`
272
+
273
+ ### 2. Create the sun
274
+ \`\`\`
275
+ Create a yellow circle at position (400, 300) with radius 60
276
+ → This creates item_1 (the sun)
277
+ \`\`\`
278
+
279
+ ### 3. Create Earth
280
+ \`\`\`
281
+ Create a blue circle at position (550, 300) with radius 20
282
+ → This creates item_2 (Earth)
283
+ \`\`\`
284
+
285
+ ### 4. Create the Moon
286
+ \`\`\`
287
+ Create a gray circle at position (590, 300) with radius 8
288
+ → This creates item_3 (Moon)
289
+ \`\`\`
290
+
291
+ ### 5. Add orbital relations
292
+ \`\`\`
293
+ Add relation: item_2 (Earth) orbits item_1 (Sun) at radius 150, speed 0.3
294
+ Add relation: item_3 (Moon) orbits item_2 (Earth) at radius 40, speed 0.8
295
+ \`\`\`
296
+
297
+ ### 6. Add labels (optional)
298
+ \`\`\`
299
+ Create text "Sun" at (400, 250)
300
+ Add relation: text attached_to item_1 with offset [0, -70]
301
+ \`\`\`
302
+
303
+ ## Result
304
+
305
+ The Earth orbits the Sun, and the Moon orbits the Earth, all with smooth automatic animation!
306
+
307
+ ## Training Data
308
+
309
+ This scene generates training pairs like:
310
+ - "Earth orbits Sun at radius 150" → \`app.addRelation('item_2', 'item_1', 'orbits', {radius: 150})\`
311
+ `,
312
+ };
313
+ // =============================================================================
314
+ // SERVER CREATION
315
+ // =============================================================================
316
+ export async function createServer(options = {}) {
317
+ // Initialize i18n with specified locale
318
+ const locale = options.locale || detectLocaleFromEnvironment();
319
+ const i18n = await initI18n(locale);
320
+ const server = new Server(SERVER_INFO, {
321
+ capabilities: {
322
+ tools: {},
323
+ resources: {},
324
+ },
325
+ });
326
+ // ---------------------------------------------------------------------------
327
+ // TOOL HANDLERS
328
+ // ---------------------------------------------------------------------------
329
+ // List available tools (with optional localization)
330
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
331
+ // Tool descriptions are kept in English for AI understanding
332
+ // but can be localized if needed for UI display
333
+ return {
334
+ tools: PINEPAPER_TOOLS,
335
+ };
336
+ });
337
+ // Handle tool calls with i18n support for errors and success messages
338
+ // Browser mode enables live execution in PinePaper Studio
339
+ const executeInBrowser = options.browserMode ?? true; // Default to browser mode
340
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
341
+ const { name, arguments: args } = request.params;
342
+ return handleToolCall(name, args, {
343
+ i18n,
344
+ executeInBrowser,
345
+ });
346
+ });
347
+ // ---------------------------------------------------------------------------
348
+ // RESOURCE HANDLERS
349
+ // ---------------------------------------------------------------------------
350
+ // List available resources
351
+ server.setRequestHandler(ListResourcesRequestSchema, async () => {
352
+ return {
353
+ resources: RESOURCES,
354
+ };
355
+ });
356
+ // Read resource content
357
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
358
+ const { uri } = request.params;
359
+ const content = RESOURCE_CONTENTS[uri];
360
+ if (!content) {
361
+ throw new Error(`Resource not found: ${uri}`);
362
+ }
363
+ return {
364
+ contents: [
365
+ {
366
+ uri,
367
+ mimeType: 'text/markdown',
368
+ text: content,
369
+ },
370
+ ],
371
+ };
372
+ });
373
+ return server;
374
+ }
375
+ // =============================================================================
376
+ // LOCALE DETECTION
377
+ // =============================================================================
378
+ /**
379
+ * Detect locale from environment variables
380
+ * Checks PINEPAPER_LOCALE, LANG, LC_ALL, LC_MESSAGES
381
+ */
382
+ function detectLocaleFromEnvironment() {
383
+ // Check explicit PinePaper locale setting
384
+ const pinepaperLocale = process.env.PINEPAPER_LOCALE;
385
+ if (pinepaperLocale && isValidLocale(pinepaperLocale)) {
386
+ return pinepaperLocale;
387
+ }
388
+ // Check standard locale environment variables
389
+ const envLocale = process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || '';
390
+ // Parse locale string (e.g., "en_US.UTF-8" -> "en")
391
+ const localePart = envLocale.split('.')[0]; // Remove encoding
392
+ const langPart = localePart.split('_')[0]; // Get language code
393
+ if (isValidLocale(langPart)) {
394
+ return langPart;
395
+ }
396
+ // Check for regional variants (e.g., "zh_CN" -> "zh-CN")
397
+ const regionalLocale = localePart.replace('_', '-');
398
+ if (isValidLocale(regionalLocale)) {
399
+ return regionalLocale;
400
+ }
401
+ return DEFAULT_LOCALE;
402
+ }
403
+ /**
404
+ * Check if a string is a valid supported locale
405
+ */
406
+ function isValidLocale(locale) {
407
+ const SUPPORTED = [
408
+ 'en',
409
+ 'es',
410
+ 'fr',
411
+ 'de',
412
+ 'it',
413
+ 'pt',
414
+ 'pt-BR',
415
+ 'nl',
416
+ 'pl',
417
+ 'ru',
418
+ 'uk',
419
+ 'zh-CN',
420
+ 'zh-TW',
421
+ 'ja',
422
+ 'ko',
423
+ 'th',
424
+ 'vi',
425
+ 'id',
426
+ 'ms',
427
+ 'tl',
428
+ 'hi',
429
+ 'bn',
430
+ 'ta',
431
+ 'te',
432
+ 'mr',
433
+ 'gu',
434
+ 'kn',
435
+ 'ml',
436
+ 'pa',
437
+ 'ar',
438
+ 'he',
439
+ 'fa',
440
+ 'tr',
441
+ 'sv',
442
+ 'da',
443
+ 'no',
444
+ 'fi',
445
+ 'cs',
446
+ 'el',
447
+ 'hu',
448
+ 'ro',
449
+ ];
450
+ return SUPPORTED.includes(locale);
451
+ }
452
+ // =============================================================================
453
+ // MAIN ENTRY POINT
454
+ // =============================================================================
455
+ async function main() {
456
+ const locale = detectLocaleFromEnvironment();
457
+ const server = await createServer({ locale });
458
+ const transport = new StdioServerTransport();
459
+ console.error('PinePaper MCP Server starting...');
460
+ console.error(`Version: ${SERVER_INFO.version}`);
461
+ console.error(`Locale: ${locale}`);
462
+ console.error(`Tools: ${PINEPAPER_TOOLS.length}`);
463
+ console.error(`Resources: ${RESOURCES.length}`);
464
+ await server.connect(transport);
465
+ console.error('PinePaper MCP Server running on stdio');
466
+ }
467
+ // Run if executed directly
468
+ main().catch((error) => {
469
+ console.error('Fatal error:', error);
470
+ process.exit(1);
471
+ });
472
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAqB,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EA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AM,EAAE,CAAC,CAAC;IAClD,OAAO,CAAC,KAAK,CAAC,cAAc,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IAEhD,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;AACzD,CAAC;AAED,2BAA2B;AAC3B,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * PinePaper MCP Server - Transport Factory
3
+ *
4
+ * This module provides a unified interface for creating server transports.
5
+ * The public package only includes stdio transport. Cloud transports
6
+ * (SSE/HTTP) are available via the optional @pinepaper/mcp-cloud package.
7
+ */
8
+ export type TransportType = 'stdio' | 'sse';
9
+ export interface TransportConfig {
10
+ type: TransportType;
11
+ port?: number;
12
+ host?: string;
13
+ apiKey?: string;
14
+ corsOrigins?: string[];
15
+ }
16
+ export interface TransportResult {
17
+ transport: unknown;
18
+ type: TransportType;
19
+ info: {
20
+ description: string;
21
+ connectionInfo?: string;
22
+ };
23
+ }
24
+ /**
25
+ * Create a transport based on configuration
26
+ *
27
+ * @param config - Transport configuration
28
+ * @returns Transport instance
29
+ */
30
+ export declare function createTransport(config: TransportConfig): Promise<TransportResult>;
31
+ /**
32
+ * Check if cloud features are available
33
+ */
34
+ export declare function isCloudAvailable(): Promise<boolean>;
35
+ /**
36
+ * Get available transport types
37
+ */
38
+ export declare function getAvailableTransports(): Promise<TransportType[]>;
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IAEpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAMD;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAiBvF;AAwCD;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAOzD;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC,CAQvE"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * PinePaper MCP Server - Transport Factory
3
+ *
4
+ * This module provides a unified interface for creating server transports.
5
+ * The public package only includes stdio transport. Cloud transports
6
+ * (SSE/HTTP) are available via the optional @pinepaper/mcp-cloud package.
7
+ */
8
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
9
+ // =============================================================================
10
+ // TRANSPORT FACTORY
11
+ // =============================================================================
12
+ /**
13
+ * Create a transport based on configuration
14
+ *
15
+ * @param config - Transport configuration
16
+ * @returns Transport instance
17
+ */
18
+ export async function createTransport(config) {
19
+ switch (config.type) {
20
+ case 'stdio':
21
+ return {
22
+ transport: new StdioServerTransport(),
23
+ type: 'stdio',
24
+ info: {
25
+ description: 'Standard I/O transport for local use with Claude Desktop',
26
+ },
27
+ };
28
+ case 'sse':
29
+ return createCloudTransport(config);
30
+ default:
31
+ throw new Error(`Unknown transport type: ${config.type}`);
32
+ }
33
+ }
34
+ /**
35
+ * Attempt to create a cloud transport using the optional @pinepaper/mcp-cloud package
36
+ */
37
+ async function createCloudTransport(config) {
38
+ try {
39
+ // Try to dynamically import the cloud package
40
+ // This will fail gracefully if the package is not installed
41
+ const cloudModule = await import('@pinepaper/mcp-cloud');
42
+ const transport = cloudModule.createSSEServer({
43
+ port: config.port || 3000,
44
+ host: config.host || '0.0.0.0',
45
+ apiKey: config.apiKey,
46
+ corsOrigins: config.corsOrigins || ['*'],
47
+ });
48
+ await transport.start();
49
+ return {
50
+ transport,
51
+ type: 'sse',
52
+ info: {
53
+ description: 'SSE/HTTP transport for cloud deployment',
54
+ connectionInfo: `http://${config.host || '0.0.0.0'}:${config.port || 3000}`,
55
+ },
56
+ };
57
+ }
58
+ catch (error) {
59
+ if (error.code === 'ERR_MODULE_NOT_FOUND') {
60
+ throw new Error('SSE transport requires the @pinepaper/mcp-cloud package.\n' +
61
+ 'This is a Pro tier feature. Visit https://pinepaper.studio/pro for more info.\n\n' +
62
+ 'For local development, use the stdio transport with Claude Desktop.');
63
+ }
64
+ throw error;
65
+ }
66
+ }
67
+ /**
68
+ * Check if cloud features are available
69
+ */
70
+ export async function isCloudAvailable() {
71
+ try {
72
+ await import('@pinepaper/mcp-cloud');
73
+ return true;
74
+ }
75
+ catch {
76
+ return false;
77
+ }
78
+ }
79
+ /**
80
+ * Get available transport types
81
+ */
82
+ export async function getAvailableTransports() {
83
+ const transports = ['stdio'];
84
+ if (await isCloudAvailable()) {
85
+ transports.push('sse');
86
+ }
87
+ return transports;
88
+ }
89
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AA0BjF,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;;;;GA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1D,mFAAmF;gBACnF,qEAAqE,CACxE,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,MAAM,UAAU,GAAoB,CAAC,OAAO,CAAC,CAAC;IAE9C,IAAI,MAAM,gBAAgB,EAAE,EAAE,CAAC;QAC7B,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * PinePaper MCP Tool Definitions
3
+ *
4
+ * This file contains all the tool definitions for the MCP server.
5
+ * Each tool has a name, description, and JSON schema for inputs.
6
+ *
7
+ * Note: Tool descriptions remain in English for optimal AI/LLM understanding.
8
+ * User-facing messages (errors, success) are translated via i18n.
9
+ */
10
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
11
+ import { I18nManager } from '../i18n/index.js';
12
+ export declare const PINEPAPER_TOOLS: Tool[];
13
+ /**
14
+ * Get a tool definition by name
15
+ */
16
+ export declare function getToolByName(name: string): Tool | undefined;
17
+ /**
18
+ * Get all tool names
19
+ */
20
+ export declare function getToolNames(): string[];
21
+ /**
22
+ * Get tools with localized descriptions from i18n manager
23
+ * Tool descriptions remain in English for AI, but names can be localized for UI
24
+ */
25
+ export declare function getLocalizedTools(i18n: I18nManager): Tool[];
26
+ //# sourceMappingURL=definitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM/C,eAAO,MAAM,eAAe,EAAE,IAAI,EAmwBjC,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAE5D;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,CAO3D"}