@pinepaper.studio/mcp-server 1.6.7 → 1.6.9

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 (174) hide show
  1. package/README.de.md +9 -5
  2. package/README.es.md +9 -5
  3. package/README.fr.md +9 -5
  4. package/README.hi.md +8 -5
  5. package/README.ja.md +8 -5
  6. package/README.ko.md +8 -4
  7. package/README.md +256 -17
  8. package/README.pt-BR.md +9 -5
  9. package/README.zh-CN.md +6 -4
  10. package/dist/browser/index.d.ts +1 -1
  11. package/dist/browser/index.d.ts.map +1 -1
  12. package/dist/browser/index.js +1 -1
  13. package/dist/browser/index.js.map +1 -1
  14. package/dist/browser/puppeteer-controller.d.ts +86 -2
  15. package/dist/browser/puppeteer-controller.d.ts.map +1 -1
  16. package/dist/browser/puppeteer-controller.js +143 -60
  17. package/dist/browser/puppeteer-controller.js.map +1 -1
  18. package/dist/character/data/concepts.json +1 -0
  19. package/dist/character/data/depictions.json +1 -0
  20. package/dist/character/data/styles.json +1 -0
  21. package/dist/character/duration-scale.d.ts +13 -0
  22. package/dist/character/duration-scale.d.ts.map +1 -0
  23. package/dist/character/duration-scale.js +13 -0
  24. package/dist/character/duration-scale.js.map +1 -0
  25. package/dist/character/path-bbox.d.ts +82 -0
  26. package/dist/character/path-bbox.d.ts.map +1 -0
  27. package/dist/character/path-bbox.js +496 -0
  28. package/dist/character/path-bbox.js.map +1 -0
  29. package/dist/character/perform.d.ts +149 -0
  30. package/dist/character/perform.d.ts.map +1 -0
  31. package/dist/character/perform.js +626 -0
  32. package/dist/character/perform.js.map +1 -0
  33. package/dist/character/resolve.d.ts +51 -0
  34. package/dist/character/resolve.d.ts.map +1 -0
  35. package/dist/character/resolve.js +239 -0
  36. package/dist/character/resolve.js.map +1 -0
  37. package/dist/cli.js +12 -0
  38. package/dist/cli.js.map +1 -1
  39. package/dist/design/design-systems.d.ts +224 -0
  40. package/dist/design/design-systems.d.ts.map +1 -0
  41. package/dist/design/design-systems.js +434 -0
  42. package/dist/design/design-systems.js.map +1 -0
  43. package/dist/execution/canvas-state.d.ts +7 -0
  44. package/dist/execution/canvas-state.d.ts.map +1 -1
  45. package/dist/execution/canvas-state.js +20 -8
  46. package/dist/execution/canvas-state.js.map +1 -1
  47. package/dist/index.d.ts +20 -0
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +12 -4
  50. package/dist/index.js.map +1 -1
  51. package/dist/ontology/design-graph.d.ts +9 -0
  52. package/dist/ontology/design-graph.d.ts.map +1 -1
  53. package/dist/ontology/design-graph.js +98 -3
  54. package/dist/ontology/design-graph.js.map +1 -1
  55. package/dist/ontology/types.d.ts +42 -0
  56. package/dist/ontology/types.d.ts.map +1 -1
  57. package/dist/ontology/vocabulary.d.ts.map +1 -1
  58. package/dist/ontology/vocabulary.js +20 -0
  59. package/dist/ontology/vocabulary.js.map +1 -1
  60. package/dist/tools/compact-descriptions.d.ts.map +1 -1
  61. package/dist/tools/compact-descriptions.js +25 -0
  62. package/dist/tools/compact-descriptions.js.map +1 -1
  63. package/dist/tools/definitions.d.ts +1 -1
  64. package/dist/tools/definitions.d.ts.map +1 -1
  65. package/dist/tools/definitions.js +404 -25
  66. package/dist/tools/definitions.js.map +1 -1
  67. package/dist/tools/engine-methods.d.ts +18 -0
  68. package/dist/tools/engine-methods.d.ts.map +1 -0
  69. package/dist/tools/engine-methods.js +241 -0
  70. package/dist/tools/engine-methods.js.map +1 -0
  71. package/dist/tools/handlers/character.d.ts +121 -0
  72. package/dist/tools/handlers/character.d.ts.map +1 -0
  73. package/dist/tools/handlers/character.js +315 -0
  74. package/dist/tools/handlers/character.js.map +1 -0
  75. package/dist/tools/handlers.d.ts +2 -0
  76. package/dist/tools/handlers.d.ts.map +1 -1
  77. package/dist/tools/handlers.js +522 -18
  78. package/dist/tools/handlers.js.map +1 -1
  79. package/dist/tools/minimal-descriptions.d.ts.map +1 -1
  80. package/dist/tools/minimal-descriptions.js +15 -3
  81. package/dist/tools/minimal-descriptions.js.map +1 -1
  82. package/dist/tools/toolkits.d.ts.map +1 -1
  83. package/dist/tools/toolkits.js +8 -0
  84. package/dist/tools/toolkits.js.map +1 -1
  85. package/dist/types/code-generator.d.ts +106 -1
  86. package/dist/types/code-generator.d.ts.map +1 -1
  87. package/dist/types/code-generator.js +1273 -18
  88. package/dist/types/code-generator.js.map +1 -1
  89. package/dist/types/schemas.d.ts +6805 -124
  90. package/dist/types/schemas.d.ts.map +1 -1
  91. package/dist/types/schemas.js +627 -17
  92. package/dist/types/schemas.js.map +1 -1
  93. package/dist/vendor/design/art-deco-generator.d.ts +52 -0
  94. package/dist/vendor/design/art-deco-generator.d.ts.map +1 -0
  95. package/dist/vendor/design/art-deco-generator.js +144 -0
  96. package/dist/vendor/design/art-deco-generator.js.map +1 -0
  97. package/dist/vendor/design/art-nouveau-generator.d.ts +46 -0
  98. package/dist/vendor/design/art-nouveau-generator.d.ts.map +1 -0
  99. package/dist/vendor/design/art-nouveau-generator.js +134 -0
  100. package/dist/vendor/design/art-nouveau-generator.js.map +1 -0
  101. package/dist/vendor/design/bauhaus-generator.d.ts +53 -0
  102. package/dist/vendor/design/bauhaus-generator.d.ts.map +1 -0
  103. package/dist/vendor/design/bauhaus-generator.js +126 -0
  104. package/dist/vendor/design/bauhaus-generator.js.map +1 -0
  105. package/dist/vendor/design/brutalist-generator.d.ts +53 -0
  106. package/dist/vendor/design/brutalist-generator.d.ts.map +1 -0
  107. package/dist/vendor/design/brutalist-generator.js +148 -0
  108. package/dist/vendor/design/brutalist-generator.js.map +1 -0
  109. package/dist/vendor/design/claymorphism-generator.d.ts +46 -0
  110. package/dist/vendor/design/claymorphism-generator.d.ts.map +1 -0
  111. package/dist/vendor/design/claymorphism-generator.js +135 -0
  112. package/dist/vendor/design/claymorphism-generator.js.map +1 -0
  113. package/dist/vendor/design/corporate-memphis-generator.d.ts +47 -0
  114. package/dist/vendor/design/corporate-memphis-generator.d.ts.map +1 -0
  115. package/dist/vendor/design/corporate-memphis-generator.js +144 -0
  116. package/dist/vendor/design/corporate-memphis-generator.js.map +1 -0
  117. package/dist/vendor/design/cyberpunk-generator.d.ts +52 -0
  118. package/dist/vendor/design/cyberpunk-generator.d.ts.map +1 -0
  119. package/dist/vendor/design/cyberpunk-generator.js +162 -0
  120. package/dist/vendor/design/cyberpunk-generator.js.map +1 -0
  121. package/dist/vendor/design/de-stijl-generator.d.ts +50 -0
  122. package/dist/vendor/design/de-stijl-generator.d.ts.map +1 -0
  123. package/dist/vendor/design/de-stijl-generator.js +154 -0
  124. package/dist/vendor/design/de-stijl-generator.js.map +1 -0
  125. package/dist/vendor/design/design-style.d.ts +3 -0
  126. package/dist/vendor/design/design-style.d.ts.map +1 -0
  127. package/dist/vendor/design/design-style.js +12 -0
  128. package/dist/vendor/design/design-style.js.map +1 -0
  129. package/dist/vendor/design/design-systems-dtcg.d.ts +59 -0
  130. package/dist/vendor/design/design-systems-dtcg.d.ts.map +1 -0
  131. package/dist/vendor/design/design-systems-dtcg.js +571 -0
  132. package/dist/vendor/design/design-systems-dtcg.js.map +1 -0
  133. package/dist/vendor/design/frutiger-aero-generator.d.ts +46 -0
  134. package/dist/vendor/design/frutiger-aero-generator.d.ts.map +1 -0
  135. package/dist/vendor/design/frutiger-aero-generator.js +133 -0
  136. package/dist/vendor/design/frutiger-aero-generator.js.map +1 -0
  137. package/dist/vendor/design/memphis-generator.d.ts +56 -0
  138. package/dist/vendor/design/memphis-generator.d.ts.map +1 -0
  139. package/dist/vendor/design/memphis-generator.js +158 -0
  140. package/dist/vendor/design/memphis-generator.js.map +1 -0
  141. package/dist/vendor/design/mid-century-upa-generator.d.ts +46 -0
  142. package/dist/vendor/design/mid-century-upa-generator.d.ts.map +1 -0
  143. package/dist/vendor/design/mid-century-upa-generator.js +137 -0
  144. package/dist/vendor/design/mid-century-upa-generator.js.map +1 -0
  145. package/dist/vendor/design/neumorphic-generator.d.ts +53 -0
  146. package/dist/vendor/design/neumorphic-generator.d.ts.map +1 -0
  147. package/dist/vendor/design/neumorphic-generator.js +182 -0
  148. package/dist/vendor/design/neumorphic-generator.js.map +1 -0
  149. package/dist/vendor/design/op-art-generator.d.ts +45 -0
  150. package/dist/vendor/design/op-art-generator.d.ts.map +1 -0
  151. package/dist/vendor/design/op-art-generator.js +116 -0
  152. package/dist/vendor/design/op-art-generator.js.map +1 -0
  153. package/dist/vendor/design/pixel-art-generator.d.ts +45 -0
  154. package/dist/vendor/design/pixel-art-generator.d.ts.map +1 -0
  155. package/dist/vendor/design/pixel-art-generator.js +143 -0
  156. package/dist/vendor/design/pixel-art-generator.js.map +1 -0
  157. package/dist/vendor/design/pop-art-generator.d.ts +53 -0
  158. package/dist/vendor/design/pop-art-generator.d.ts.map +1 -0
  159. package/dist/vendor/design/pop-art-generator.js +164 -0
  160. package/dist/vendor/design/pop-art-generator.js.map +1 -0
  161. package/dist/vendor/design/risograph-generator.d.ts +53 -0
  162. package/dist/vendor/design/risograph-generator.d.ts.map +1 -0
  163. package/dist/vendor/design/risograph-generator.js +170 -0
  164. package/dist/vendor/design/risograph-generator.js.map +1 -0
  165. package/dist/vendor/design/swiss-style-generator.d.ts +55 -0
  166. package/dist/vendor/design/swiss-style-generator.d.ts.map +1 -0
  167. package/dist/vendor/design/swiss-style-generator.js +147 -0
  168. package/dist/vendor/design/swiss-style-generator.js.map +1 -0
  169. package/dist/vendor/design/vaporwave-generator.d.ts +51 -0
  170. package/dist/vendor/design/vaporwave-generator.d.ts.map +1 -0
  171. package/dist/vendor/design/vaporwave-generator.js +139 -0
  172. package/dist/vendor/design/vaporwave-generator.js.map +1 -0
  173. package/manifest.json +33 -1
  174. package/package.json +13 -5
@@ -0,0 +1,434 @@
1
+ /**
2
+ * The design vocabulary, answered in this server.
3
+ *
4
+ * Everything here is a pure function over vendored data — no browser, no
5
+ * engine call. That is the point of where it lives: a design system's tokens
6
+ * and a style's composition are decisions, and a decision does not need the
7
+ * canvas to be open. `compose` is the only one that produces anything to draw,
8
+ * and even that returns items the caller may inspect instead.
9
+ *
10
+ * The data itself is vendored from mcp-cloud by scripts/sync-design-systems.mjs
11
+ * and must not be edited here — see src/vendor/design/.
12
+ */
13
+ import { OPEN_DESIGN_SYSTEMS, getDTCGDesignSystem, tokenToCubicBezier, } from '../vendor/design/design-systems-dtcg.js';
14
+ import { generateArtDecoPoster } from '../vendor/design/art-deco-generator.js';
15
+ import { generateArtNouveauPoster } from '../vendor/design/art-nouveau-generator.js';
16
+ import { generateBauhausPoster } from '../vendor/design/bauhaus-generator.js';
17
+ import { generateBrutalistPoster } from '../vendor/design/brutalist-generator.js';
18
+ import { generateClaymorphismPoster } from '../vendor/design/claymorphism-generator.js';
19
+ import { generateCorporateMemphisPoster } from '../vendor/design/corporate-memphis-generator.js';
20
+ import { generateCyberpunkPoster } from '../vendor/design/cyberpunk-generator.js';
21
+ import { generateDeStijlPoster } from '../vendor/design/de-stijl-generator.js';
22
+ import { generateFrutigerAeroPoster } from '../vendor/design/frutiger-aero-generator.js';
23
+ import { generateMemphisPoster } from '../vendor/design/memphis-generator.js';
24
+ import { generateMidCenturyUpaPoster } from '../vendor/design/mid-century-upa-generator.js';
25
+ import { generateNeumorphicDashboard } from '../vendor/design/neumorphic-generator.js';
26
+ import { generateOpArtPoster } from '../vendor/design/op-art-generator.js';
27
+ import { generatePixelArtPoster } from '../vendor/design/pixel-art-generator.js';
28
+ import { generatePopArtPoster } from '../vendor/design/pop-art-generator.js';
29
+ import { generateRisographArt } from '../vendor/design/risograph-generator.js';
30
+ import { generateSwissPoster } from '../vendor/design/swiss-style-generator.js';
31
+ import { generateVaporwavePoster } from '../vendor/design/vaporwave-generator.js';
32
+ const num = (v) => (typeof v === 'number' ? v : undefined);
33
+ const str = (v) => (typeof v === 'string' ? v : undefined);
34
+ /** Fold either upstream shape into one. Throws rather than returning empty. */
35
+ function normalise(style, raw) {
36
+ const r = (raw ?? {});
37
+ const fromScene = Array.isArray(r.elements);
38
+ const rows = (fromScene ? r.elements : r.items) ?? [];
39
+ if (!Array.isArray(rows) || rows.length === 0) {
40
+ // An empty composition is never a correct answer here — every generator
41
+ // lays out at least a title. Say so instead of handing back a blank canvas
42
+ // that looks like the style simply being minimal.
43
+ throw new Error(`the ${style} generator returned no elements — its upstream shape may have changed ` +
44
+ '(expected `elements[]` or `items[]`); re-run bun run sync:design and check the vendored source');
45
+ }
46
+ const width = num(r.width) ?? r.canvas?.width;
47
+ const height = num(r.height) ?? r.canvas?.height;
48
+ if (width === undefined || height === undefined) {
49
+ throw new Error(`the ${style} generator returned no canvas size (expected width/height or canvas{})`);
50
+ }
51
+ const elements = rows.map((row, i) => {
52
+ const e = row;
53
+ return {
54
+ id: str(e.id) ?? `${style}_${i}`,
55
+ type: str(e.type) ?? 'rect',
56
+ // 'content' in the scene shape, 'text' in the layout shape.
57
+ content: str(e.content) ?? str(e.text),
58
+ fontSize: num(e.fontSize),
59
+ fontWeight: (typeof e.fontWeight === 'string' || typeof e.fontWeight === 'number') ? e.fontWeight : undefined,
60
+ fontFamily: str(e.fontFamily),
61
+ // 'fillHex' in the scene shape, 'fill' in the layout shape.
62
+ fillHex: str(e.fillHex) ?? str(e.fill) ?? '#000000',
63
+ strokeHex: str(e.strokeHex) ?? str(e.stroke),
64
+ strokeWidthPx: num(e.strokeWidthPx) ?? num(e.strokeWidth),
65
+ radius: num(e.radius),
66
+ x: num(e.x) ?? 0,
67
+ y: num(e.y) ?? 0,
68
+ width: num(e.width),
69
+ height: num(e.height),
70
+ textAlign: str(e.textAlign),
71
+ };
72
+ });
73
+ return {
74
+ style: str(r.style) ?? style,
75
+ width, height,
76
+ backgroundHex: str(r.backgroundHex),
77
+ palette: Array.isArray(r.palette) ? r.palette : undefined,
78
+ elements,
79
+ composedFrom: fromScene ? 'scene' : 'layout',
80
+ };
81
+ }
82
+ /**
83
+ * Which style each generator answers to.
84
+ *
85
+ * Keyed on the upstream DesignStyle union, so a caller names the same style
86
+ * here that the cloud's recipes name. Styles in the union with no entry are
87
+ * describable but not composable, and `listStyles` says which is which rather
88
+ * than letting a caller discover it by getting nothing back.
89
+ */
90
+ const COMPOSERS = {
91
+ art_deco_geometric: (o) => generateArtDecoPoster({
92
+ title: o.title, subtitle: o.subtitle ?? '', body: o.body,
93
+ width: o.width, height: o.height, emeraldVariant: o.variant === 'emerald',
94
+ }),
95
+ art_nouveau: (o) => generateArtNouveauPoster(o),
96
+ bauhaus_geometric: (o) => generateBauhausPoster(o),
97
+ brutalist_raw: (o) => generateBrutalistPoster(o),
98
+ claymorphism: (o) => generateClaymorphismPoster(o),
99
+ corporate_memphis: (o) => generateCorporateMemphisPoster(o),
100
+ cyberpunk_neon: (o) => generateCyberpunkPoster(o),
101
+ de_stijl_neoplasticism: (o) => generateDeStijlPoster(o),
102
+ y2k_frutiger_aero: (o) => generateFrutigerAeroPoster(o),
103
+ memphis_group: (o) => generateMemphisPoster(o),
104
+ mid_century_upa: (o) => generateMidCenturyUpaPoster(o),
105
+ neumorphic_glass: (o) => generateNeumorphicDashboard(o),
106
+ op_art_psychedelic: (o) => generateOpArtPoster(o),
107
+ pixel_art_8bit: (o) => generatePixelArtPoster(o),
108
+ pop_art_expression: (o) => generatePopArtPoster(o),
109
+ risograph_print: (o) => generateRisographArt(o),
110
+ swiss_typographic: (o) => generateSwissPoster(o),
111
+ vaporwave_retro: (o) => generateVaporwavePoster(o),
112
+ };
113
+ /** Every style the union declares, whether or not it can compose. */
114
+ export const ALL_STYLES = [
115
+ 'minimal', 'editorial', 'playful', 'cinematic', 'energetic', 'scrapbook',
116
+ 'swiss_typographic', 'neumorphic_glass', 'risograph_print', 'cyberpunk_neon',
117
+ 'bauhaus_geometric', 'art_deco_geometric', 'memphis_group', 'brutalist_raw',
118
+ 'de_stijl_neoplasticism', 'pop_art_expression', 'vaporwave_retro',
119
+ 'corporate_memphis', 'y2k_frutiger_aero', 'mid_century_upa', 'comic_benday',
120
+ 'pixel_art_8bit', 'isometric_lowpoly', 'hand_drawn_sketch', 'claymorphism',
121
+ 'constructivism_suprematism', 'art_nouveau', 'op_art_psychedelic',
122
+ 'print_monochrome_crisp', 'print_early_learner', 'print_stem_technical',
123
+ ];
124
+ /**
125
+ * Styles whose palette a named variant changes. Only art deco has one today,
126
+ * and it is listed rather than inferred because `emeraldVariant` is a bespoke
127
+ * boolean on that one generator, not a shape the others share.
128
+ */
129
+ const STYLE_VARIANTS = {
130
+ art_deco_geometric: ['emerald'],
131
+ };
132
+ /**
133
+ * A style's palette and type, DERIVED by composing it — never transcribed.
134
+ *
135
+ * The data was always one layer below the API: every generator holds its colours
136
+ * in a `*_PALETTE` constant and its type in per-element `fontFamily` strings,
137
+ * and `listStyles` published neither. The only way to build an authentic
138
+ * bauhaus or memphis scene by hand was to read this server's own source, which
139
+ * is the report that prompted this.
140
+ *
141
+ * Reading the 18 `*_PALETTE` constants would have been the obvious fix and the
142
+ * wrong one: they are 18 different shapes under 18 different names, so a
143
+ * hand-written map is a second copy that drifts the first time `sync:design`
144
+ * pulls an upstream change — the exact failure this repo keeps paying to
145
+ * remove. Composing a throwaway poster and reading what comes out cannot drift:
146
+ * it reports what the generator will actually draw.
147
+ *
148
+ * Safe to do eagerly because no generator is procedural — there is no
149
+ * `Math.random` in any vendored file, so one run is the whole palette for that
150
+ * variant, and a style with variants says so rather than pretending its first
151
+ * variant is all of it.
152
+ */
153
+ export function styleTokens(style) {
154
+ if (!ALL_STYLES.includes(style))
155
+ return null;
156
+ const composable = !!COMPOSERS[style];
157
+ const variants = STYLE_VARIANTS[style];
158
+ if (!composable) {
159
+ // Describable but not composable: there is no generator to ask, and an
160
+ // invented palette would be worse than an empty one.
161
+ return { style, composable, palette: [], fonts: [], fontSizes: [] };
162
+ }
163
+ let scene = null;
164
+ try {
165
+ scene = compose(style, { title: 'Title', subtitle: 'Subtitle', body: 'Body' });
166
+ }
167
+ catch {
168
+ // normalise() throws when an upstream shape changed. That is a real signal
169
+ // and design-systems.test.ts asserts on it through compose(); here it only
170
+ // means the tokens are unavailable, and losing the whole listing to one
171
+ // broken generator would be the worse trade.
172
+ return { style, composable, palette: [], fonts: [], fontSizes: [], ...(variants ? { variants } : {}) };
173
+ }
174
+ if (!scene)
175
+ return { style, composable, palette: [], fonts: [], fontSizes: [] };
176
+ const uses = new Map();
177
+ const count = (hex) => {
178
+ if (!hex || hex === 'transparent' || hex === 'none')
179
+ return;
180
+ uses.set(hex, (uses.get(hex) ?? 0) + 1);
181
+ };
182
+ const fonts = new Set();
183
+ const sizes = new Set();
184
+ for (const el of scene.elements) {
185
+ count(el.fillHex);
186
+ count(el.strokeHex);
187
+ if (el.fontFamily)
188
+ fonts.add(el.fontFamily);
189
+ if (el.fontSize !== undefined)
190
+ sizes.add(el.fontSize);
191
+ }
192
+ // A declared palette leads, in its own order: the eleven layout-shape
193
+ // generators publish one, and the author's ordering carries intent that a
194
+ // frequency count does not. Observed colours follow, so a hue used once in a
195
+ // motif is still reachable.
196
+ const declared = (scene.palette ?? []).filter((c) => c && c !== 'transparent');
197
+ const observed = [...uses.entries()].sort((a, b) => b[1] - a[1]).map(([hex]) => hex);
198
+ const palette = [...new Set([...declared, ...observed])];
199
+ return {
200
+ style, composable, palette,
201
+ ...(scene.backgroundHex ? { background: scene.backgroundHex } : {}),
202
+ fonts: [...fonts],
203
+ fontSizes: [...sizes].sort((a, b) => a - b),
204
+ ...(variants ? { variants } : {}),
205
+ };
206
+ }
207
+ /**
208
+ * Every style, with its tokens.
209
+ *
210
+ * The tokens ride along rather than sitting behind a second call: an agent that
211
+ * did not know palettes existed here will not go looking for the action that
212
+ * reveals them, and undiscoverability is the complaint this answers.
213
+ */
214
+ export function listStyles() {
215
+ return ALL_STYLES.map((style) => styleTokens(style));
216
+ }
217
+ export function listSystems() {
218
+ return Object.values(OPEN_DESIGN_SYSTEMS).map((s) => ({
219
+ id: s.id, name: s.name, vendor: s.vendor, license: s.license,
220
+ version: s.version, category: s.category,
221
+ tokenCount: Object.keys(s.tokens ?? {}).length,
222
+ }));
223
+ }
224
+ export function getSystem(systemId, tokenType) {
225
+ const sys = getDTCGDesignSystem(systemId);
226
+ if (!sys)
227
+ return null;
228
+ if (!tokenType)
229
+ return sys;
230
+ const tokens = {};
231
+ for (const [k, t] of Object.entries(sys.tokens ?? {})) {
232
+ if (t.$type === tokenType)
233
+ tokens[k] = t;
234
+ }
235
+ return { ...sys, tokens };
236
+ }
237
+ /**
238
+ * A duration token in milliseconds. DTCG writes them as strings.
239
+ *
240
+ * Every value in the vendored systems is `<n>ms` today, and `<n>s` is parsed
241
+ * too rather than silently returning null on an upstream change — a dropped
242
+ * token would thin the listing without anything saying so.
243
+ */
244
+ function tokenToMilliseconds(token) {
245
+ if (token.$type !== 'duration')
246
+ return null;
247
+ const raw = String(token.$value).trim();
248
+ const ms = /^(\d+(?:\.\d+)?)ms$/.exec(raw);
249
+ if (ms)
250
+ return Number(ms[1]);
251
+ const s = /^(\d+(?:\.\d+)?)s$/.exec(raw);
252
+ if (s)
253
+ return Number(s[1]) * 1000;
254
+ return null;
255
+ }
256
+ /**
257
+ * The other half of a motion token, which this surface was not publishing.
258
+ *
259
+ * `listEasings` exposed the 27 cubicBezier tokens and nothing read the 47
260
+ * duration tokens sitting beside them in the same store — so an agent could
261
+ * match a system's CURVE and had to invent its TIMING, which is half a motion
262
+ * vocabulary and the half that is easy to get wrong. A curve is a shape; a
263
+ * motion is a shape over a length.
264
+ *
265
+ * These are the licensed SYSTEMS' motion scales — Material's duration ladder,
266
+ * Carbon's, and so on. They are NOT per-aesthetic-style motion: a style like
267
+ * bauhaus_geometric has no upstream motion data at all, and manufacturing some
268
+ * would be inventing a fact about someone else's design system.
269
+ */
270
+ export function listDurations(authoredOnly) {
271
+ const out = [];
272
+ for (const sys of Object.values(OPEN_DESIGN_SYSTEMS)) {
273
+ for (const [path, token] of Object.entries(sys.tokens ?? {})) {
274
+ const ms = tokenToMilliseconds(token);
275
+ if (ms === null)
276
+ continue;
277
+ const authored = token.$extensions?.['pinepaper:authored'] === true;
278
+ if (authoredOnly !== undefined && authored !== authoredOnly)
279
+ continue;
280
+ out.push({
281
+ name: `${sys.id}.${path}`,
282
+ system: sys.id,
283
+ systemName: sys.name,
284
+ token: path,
285
+ ms,
286
+ // Every animation tool here takes seconds. Publishing only the DTCG
287
+ // unit would make each caller do the same division, and one of them
288
+ // would do it wrong.
289
+ seconds: Math.round((ms / 1000) * 1000) / 1000,
290
+ description: token.$description,
291
+ license: sys.license,
292
+ authored,
293
+ });
294
+ }
295
+ }
296
+ return out;
297
+ }
298
+ export function listEasings(authoredOnly) {
299
+ const out = [];
300
+ for (const sys of Object.values(OPEN_DESIGN_SYSTEMS)) {
301
+ for (const [path, token] of Object.entries(sys.tokens ?? {})) {
302
+ const css = tokenToCubicBezier(token);
303
+ if (!css)
304
+ continue;
305
+ const authored = token.$extensions?.['pinepaper:authored'] === true;
306
+ if (authoredOnly !== undefined && authored !== authoredOnly)
307
+ continue;
308
+ out.push({
309
+ name: `${sys.id}.${path}`,
310
+ system: sys.id,
311
+ systemName: sys.name,
312
+ token: path,
313
+ cubicBezier: css,
314
+ values: token.$value,
315
+ description: token.$description,
316
+ license: sys.license,
317
+ authored,
318
+ });
319
+ }
320
+ }
321
+ return out;
322
+ }
323
+ /**
324
+ * Compose a scene in a style. Returns null when the style cannot compose.
325
+ *
326
+ * `subtitle` and `body` are filled with empty strings before the call. Six
327
+ * generators — art deco, brutalist, de stijl, cyberpunk, pop art, vaporwave —
328
+ * declare both optional and then dereference them (`options.subtitle
329
+ * .toUpperCase()`), so a title-only compose throws a TypeError from inside
330
+ * vendored code. Defaulting here is the smallest honest adaptation: it is one
331
+ * rule applied to every generator rather than a patch to a generated file,
332
+ * which the provenance test would fail on anyway. The nullability gap is
333
+ * upstream's to close.
334
+ */
335
+ export function compose(style, options) {
336
+ const fn = COMPOSERS[style];
337
+ if (!fn)
338
+ return null;
339
+ return normalise(style, fn({ ...options, subtitle: options.subtitle ?? '', body: options.body ?? '' }));
340
+ }
341
+ /**
342
+ * A composed scene as create-item ops.
343
+ *
344
+ * Every generator returns absolutely-positioned elements with hex fills. Text
345
+ * keeps its content and size; everything else becomes a rectangle at the
346
+ * element's bounds, because a style's "fan_motif" is a named shape upstream and
347
+ * a filled box here rather than a silently dropped element.
348
+ *
349
+ * IT IS NOT A RENAME, which is what this used to claim while passing `x`/`y`
350
+ * straight through. The generators author CSS-shaped layout — a TOP-LEFT box —
351
+ * and `app.create` is CENTRE-anchored: js/shapes/basic.js builds a rectangle at
352
+ * `point: position - size/2` and a circle at `center: position`. So every
353
+ * composed scene rendered half a box up and to the left of where the generator
354
+ * put it, and a left-aligned headline was worse than that: bauhaus authors its
355
+ * title at x = 0.1 × width, which on a 1080 canvas is 108, and a 600px-wide
356
+ * string centred on 108 starts at -192. That is the "title half off-canvas"
357
+ * this surface was reported with, and why composing was abandoned for
358
+ * hand-built primitives.
359
+ *
360
+ * Three conventions, resolved per element, because one blanket shift breaks two
361
+ * of them:
362
+ *
363
+ * - **A box** (`width`/`height`, no radius) → the centre is (x + w/2, y + h/2).
364
+ * - **An explicit `radius`** → x/y is ALREADY the centre. art-nouveau's halo
365
+ * and op-art's concentric rings are authored from a ring centre, so shifting
366
+ * them by a radius would break the styles that are currently *correct*.
367
+ * - **Text** → PinePaper reads `alignment` ('left' makes x the LEFT edge,
368
+ * 'right' the right edge, y the bounds centre either way). That accommodation
369
+ * exists in the engine specifically for scene authors, and this function was
370
+ * dropping `textAlign` on the floor — so every left-aligned string centred on
371
+ * its anchor even once the boxes were right.
372
+ *
373
+ * The one place this stops short of certain: the layout-shape generators author
374
+ * text as x/y/fontSize with no box at all, and nothing upstream says whether
375
+ * that y is the top or the baseline. Where there is a box, y moves by half of
376
+ * it; where there is not, y is left alone rather than shifted by a guess. The
377
+ * horizontal fix — the one that put titles off-canvas — applies either way.
378
+ */
379
+ export function sceneToOps(scene) {
380
+ const ops = [];
381
+ for (const el of scene.elements) {
382
+ const isText = el.content !== undefined && el.content !== '';
383
+ const authorsOwnCentre = el.radius !== undefined;
384
+ const w = el.width ?? 0;
385
+ const h = el.height ?? 0;
386
+ // 'center' is the engine's default and the only other value it reads.
387
+ const alignment = el.textAlign === 'left' || el.textAlign === 'right' ? el.textAlign : 'center';
388
+ let x = el.x;
389
+ let y = el.y;
390
+ if (isText) {
391
+ if (alignment === 'center')
392
+ x = el.x + w / 2;
393
+ else if (alignment === 'right')
394
+ x = el.x + w;
395
+ // 'left': x is the left edge, which is what the engine wants for it.
396
+ if (el.height !== undefined)
397
+ y = el.y + h / 2;
398
+ }
399
+ else if (!authorsOwnCentre) {
400
+ x = el.x + w / 2;
401
+ y = el.y + h / 2;
402
+ }
403
+ const common = {
404
+ x, y,
405
+ fillColor: el.fillHex,
406
+ ...(el.strokeHex ? { strokeColor: el.strokeHex } : {}),
407
+ ...(el.strokeWidthPx !== undefined ? { strokeWidth: el.strokeWidthPx } : {}),
408
+ };
409
+ if (isText) {
410
+ ops.push({
411
+ type: 'text', name: el.id, ...common, content: el.content,
412
+ ...(el.fontSize !== undefined ? { fontSize: el.fontSize } : {}),
413
+ ...(el.fontFamily ? { fontFamily: el.fontFamily } : {}),
414
+ ...(el.fontWeight !== undefined ? { fontWeight: el.fontWeight } : {}),
415
+ alignment,
416
+ });
417
+ }
418
+ else if (el.type === 'circle' || authorsOwnCentre) {
419
+ ops.push({ type: 'circle', name: el.id, ...common, radius: el.radius ?? w / 2 });
420
+ }
421
+ else {
422
+ ops.push({
423
+ type: 'rectangle', name: el.id, ...common,
424
+ width: w, height: h,
425
+ // The upstream type is kept as a note rather than dropped: a caller
426
+ // re-reading the scene can tell a frame from a fan motif even though
427
+ // both arrive as rectangles.
428
+ note: el.type,
429
+ });
430
+ }
431
+ }
432
+ return ops;
433
+ }
434
+ //# sourceMappingURL=design-systems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-systems.js","sourceRoot":"","sources":["../../src/design/design-systems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,GAInB,MAAM,yCAA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EAAE,CAAC;gBACnB,oEAAoE;gBACpE,qEAAqE;gBACrE,6BAA6B;gBAC7B,IAAI,EAAE,EAAE,CAAC,IAAI;aACd,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -51,6 +51,13 @@ export interface ErrorContext {
51
51
  export declare function captureCanvasState(browserController: PinePaperBrowserController): Promise<CanvasState | null>;
52
52
  /**
53
53
  * Format canvas state for human-readable error messages
54
+ *
55
+ * Every field is read DEFENSIVELY. captureCanvasState promises never to throw
56
+ * and returns whatever the studio handed back, so a studio on an older shape —
57
+ * or any probe that half-succeeds — produced a state missing `itemTypes` or
58
+ * `canvasSize`, and this function then threw while formatting somebody else's
59
+ * error. The real failure was lost and replaced with a TypeError from the error
60
+ * path itself, which is the worst place to have one.
54
61
  */
55
62
  export declare function formatCanvasState(state: CanvasState): string;
56
63
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"canvas-state.d.ts","sourceRoot":"","sources":["../../src/execution/canvas-state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAElB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElC,wBAAwB;IACxB,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,0BAA0B;IAC1B,SAAS,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC;IAEF,sCAAsC;IACtC,WAAW,EAAE,KAAK,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,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ACT,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC;IAEF,sCAAsC;IACtC,WAAW,EAAE,KAAK,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;IAEH,8BAA8B;IAC9B,OAAO,EAAE,OAAO,CAAC;IAEjB,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oCAAoC;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,iBAAiB,EAAE,0BAA0B,GAC5C,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAkF7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAoD5D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAqBhE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,CAAC,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,YAAY,CAKd"}
@@ -88,29 +88,39 @@ export async function captureCanvasState(browserController) {
88
88
  }
89
89
  /**
90
90
  * Format canvas state for human-readable error messages
91
+ *
92
+ * Every field is read DEFENSIVELY. captureCanvasState promises never to throw
93
+ * and returns whatever the studio handed back, so a studio on an older shape —
94
+ * or any probe that half-succeeds — produced a state missing `itemTypes` or
95
+ * `canvasSize`, and this function then threw while formatting somebody else's
96
+ * error. The real failure was lost and replaced with a TypeError from the error
97
+ * path itself, which is the worst place to have one.
91
98
  */
92
99
  export function formatCanvasState(state) {
93
100
  const lines = [];
101
+ const counts = (v) => (v && typeof v === 'object') ? Object.entries(v) : [];
94
102
  lines.push('Canvas State:');
95
103
  if (state.isEmpty) {
96
104
  lines.push(' - Canvas is EMPTY (no items)');
97
105
  }
98
106
  else {
99
- lines.push(` - Total Items: ${state.itemCount}`);
107
+ lines.push(` - Total Items: ${state.itemCount ?? 'unknown'}`);
100
108
  // Item types
101
- if (Object.keys(state.itemTypes).length > 0) {
109
+ const itemTypes = counts(state.itemTypes);
110
+ if (itemTypes.length > 0) {
102
111
  lines.push(' - Item Types:');
103
- Object.entries(state.itemTypes)
112
+ itemTypes
104
113
  .sort(([, a], [, b]) => b - a) // Sort by count descending
105
114
  .forEach(([type, count]) => {
106
115
  lines.push(` • ${type}: ${count}`);
107
116
  });
108
117
  }
109
118
  // Relations
110
- if (state.relations.total > 0) {
119
+ if (state.relations && state.relations.total > 0) {
111
120
  lines.push(` - Relations: ${state.relations.total}`);
112
- if (Object.keys(state.relations.byType).length > 0) {
113
- Object.entries(state.relations.byType)
121
+ const byType = counts(state.relations.byType);
122
+ if (byType.length > 0) {
123
+ byType
114
124
  .sort(([, a], [, b]) => b - a)
115
125
  .forEach(([type, count]) => {
116
126
  lines.push(` • ${type}: ${count}`);
@@ -121,14 +131,16 @@ export function formatCanvasState(state) {
121
131
  lines.push(' - Relations: None');
122
132
  }
123
133
  // Recent items
124
- if (state.recentItems.length > 0) {
134
+ if (Array.isArray(state.recentItems) && state.recentItems.length > 0) {
125
135
  lines.push(' - Recent Items:');
126
136
  state.recentItems.forEach(item => {
127
137
  lines.push(` • ${item.id} (${item.type})`);
128
138
  });
129
139
  }
130
140
  }
131
- lines.push(` - Canvas Size: ${state.canvasSize.width}x${state.canvasSize.height}`);
141
+ if (state.canvasSize) {
142
+ lines.push(` - Canvas Size: ${state.canvasSize.width}x${state.canvasSize.height}`);
143
+ }
132
144
  return lines.join('\n');
133
145
  }
134
146
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"canvas-state.js","sourceRoot":"","sources":["../../src/execution/canvas-state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsDH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,iBAA6C;IAE7C,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,mDAAmD;QACnD,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqDjB,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAErE,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YACpC,mBAAmB;YACnB,MAAM,KAAK,GAAG,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;gBAC7C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC3B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;YAElB,OAAO;gBACL,GAAG,KAAK;gBACR,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE;aACvB,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,2DAA2D;QAC3D,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAkB;IAClD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAE5B,IAAI,KAAK,C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AAiB,EACjB,QAAkC;IAElC,OAAO;QACL,QAAQ;QACR,QAAQ;KACT,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -14,6 +14,26 @@ import type { ToolVerbosity } from './tools/definitions.js';
14
14
  import type { ToolkitProfile } from './tools/toolkits.js';
15
15
  import { ExecutionMode } from './tools/handlers.js';
16
16
  import { SupportedLocale } from './i18n/index.js';
17
+ /**
18
+ * SUBSTITUTION, NOT FORMAT. This string said "NEVER generate HTML or React"
19
+ * while the server ships pinepaper_export_widget_html and
20
+ * pinepaper_export_widget, which produce exactly those. It is also the FIRST
21
+ * text a client puts in front of a model — before any tool, every session — so
22
+ * it was the widest-read instance of the defect mcp-cloud found and the one
23
+ * fixed in agent_start_job. Guarded by no-capability-prohibitions.test.ts.
24
+ */
25
+ export declare const SERVER_INFO: {
26
+ name: string;
27
+ version: string;
28
+ description: string;
29
+ };
30
+ export declare const RESOURCES: {
31
+ uri: string;
32
+ name: string;
33
+ description: string;
34
+ mimeType: string;
35
+ }[];
36
+ export declare const RESOURCE_CONTENTS: Record<string, string>;
17
37
  export interface ServerOptions {
18
38
  locale?: SupportedLocale;
19
39
  /** Enable browser execution mode - executes code in real browser via Puppeteer */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAS5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAkB,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAEL,eAAe,EAEhB,MAAM,iBAAiB,CAAC;AAgoLzB,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,kFAAkF;IAClF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uFAAuF;IACvF,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,qEAAqE;IACrE,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,uEAAuE;IACvE,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAMD,wBAAsB,YAAY,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkL/E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAS5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAkB,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAEL,eAAe,EAEhB,MAAM,iBAAiB,CAAC;AASzB;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAMF,eAAO,MAAM,SAAS;;;;;GA8HrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAu+KpD,CAAC;AAMF,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,kFAAkF;IAClF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uFAAuF;IACvF,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,qEAAqE;IACrE,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,uEAAuE;IACvE,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAMD,wBAAsB,YAAY,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkL/E"}
package/dist/index.js CHANGED
@@ -21,15 +21,23 @@ import { PROMPTS, getPromptMessages } from './prompts/index.js';
21
21
  // SERVER INFO
22
22
  // =============================================================================
23
23
  import { SERVER_VERSION } from './version.js';
24
- const SERVER_INFO = {
24
+ /**
25
+ * SUBSTITUTION, NOT FORMAT. This string said "NEVER generate HTML or React"
26
+ * while the server ships pinepaper_export_widget_html and
27
+ * pinepaper_export_widget, which produce exactly those. It is also the FIRST
28
+ * text a client puts in front of a model — before any tool, every session — so
29
+ * it was the widest-read instance of the defect mcp-cloud found and the one
30
+ * fixed in agent_start_job. Guarded by no-capability-prohibitions.test.ts.
31
+ */
32
+ export const SERVER_INFO = {
25
33
  name: 'pinepaper-mcp',
26
34
  version: SERVER_VERSION,
27
- description: 'PinePaper Studio — canvas animation engine. Use PinePaper tools to create animations, videos, and graphics. NEVER generate HTML or React.',
35
+ description: 'PinePaper Studio — canvas animation engine. Build animations, videos and graphics with PinePaper tools rather than hand-writing HTML or React; it exports to both itself (export_widget_html, export_widget).',
28
36
  };
29
37
  // =============================================================================
30
38
  // RESOURCES (Documentation & Examples)
31
39
  // =============================================================================
32
- const RESOURCES = [
40
+ export const RESOURCES = [
33
41
  // === CORE GUIDES (Start here) ===
34
42
  {
35
43
  uri: 'pinepaper://docs/agent-guide',
@@ -156,7 +164,7 @@ const RESOURCES = [
156
164
  mimeType: 'text/markdown',
157
165
  },
158
166
  ];
159
- const RESOURCE_CONTENTS = {
167
+ export const RESOURCE_CONTENTS = {
160
168
  // Agent guide — single source of truth for the canonical workflow + tool
161
169
  // categories text. Mirrors what pinepaper_tool_guide returns with no args
162
170
  // so MCP clients can pull it via the resources API without a tool call.