fodda-mcp 1.3.2 → 1.30.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 (109) hide show
  1. package/LICENSE +31 -0
  2. package/README.md +192 -20
  3. package/dist/a2aHandler.d.ts +20 -0
  4. package/dist/a2aHandler.d.ts.map +1 -0
  5. package/dist/a2aHandler.js +247 -0
  6. package/dist/a2aHandler.js.map +1 -0
  7. package/dist/agents/fodda-researcher/index.d.ts +35 -0
  8. package/dist/agents/fodda-researcher/index.d.ts.map +1 -0
  9. package/dist/agents/fodda-researcher/index.js +62 -0
  10. package/dist/agents/fodda-researcher/index.js.map +1 -0
  11. package/dist/agents/fodda-researcher/skills.d.ts +16 -0
  12. package/dist/agents/fodda-researcher/skills.d.ts.map +1 -0
  13. package/dist/agents/fodda-researcher/skills.js +163 -0
  14. package/dist/agents/fodda-researcher/skills.js.map +1 -0
  15. package/dist/brandTemplate.d.ts +14 -0
  16. package/dist/brandTemplate.d.ts.map +1 -0
  17. package/dist/brandTemplate.js +742 -0
  18. package/dist/brandTemplate.js.map +1 -0
  19. package/dist/catalogCache.d.ts +177 -0
  20. package/dist/catalogCache.d.ts.map +1 -0
  21. package/dist/catalogCache.js +708 -0
  22. package/dist/catalogCache.js.map +1 -0
  23. package/dist/editorialFill.d.ts +44 -0
  24. package/dist/editorialFill.d.ts.map +1 -0
  25. package/dist/editorialFill.js +377 -0
  26. package/dist/editorialFill.js.map +1 -0
  27. package/dist/enrichment.d.ts +74 -0
  28. package/dist/enrichment.d.ts.map +1 -0
  29. package/dist/enrichment.js +211 -0
  30. package/dist/enrichment.js.map +1 -0
  31. package/dist/errorHandling.d.ts +52 -0
  32. package/dist/errorHandling.d.ts.map +1 -0
  33. package/dist/errorHandling.js +327 -0
  34. package/dist/errorHandling.js.map +1 -0
  35. package/dist/index.d.ts +0 -1
  36. package/dist/index.js +595 -410
  37. package/dist/index.js.map +1 -1
  38. package/dist/pricingCache.d.ts +99 -0
  39. package/dist/pricingCache.d.ts.map +1 -0
  40. package/dist/pricingCache.js +414 -0
  41. package/dist/pricingCache.js.map +1 -0
  42. package/dist/queryCache.d.ts +25 -0
  43. package/dist/queryCache.d.ts.map +1 -0
  44. package/dist/queryCache.js +194 -0
  45. package/dist/queryCache.js.map +1 -0
  46. package/dist/searchTemplate.d.ts +16 -0
  47. package/dist/searchTemplate.d.ts.map +1 -0
  48. package/dist/searchTemplate.js +318 -0
  49. package/dist/searchTemplate.js.map +1 -0
  50. package/dist/sessionTracker.d.ts +39 -0
  51. package/dist/sessionTracker.d.ts.map +1 -0
  52. package/dist/sessionTracker.js +187 -0
  53. package/dist/sessionTracker.js.map +1 -0
  54. package/dist/skillClient.d.ts +142 -0
  55. package/dist/skillClient.d.ts.map +1 -0
  56. package/dist/skillClient.js +256 -0
  57. package/dist/skillClient.js.map +1 -0
  58. package/dist/svgVisuals.d.ts +77 -0
  59. package/dist/svgVisuals.d.ts.map +1 -0
  60. package/dist/svgVisuals.js +323 -0
  61. package/dist/svgVisuals.js.map +1 -0
  62. package/dist/systemPrompt.d.ts +26 -0
  63. package/dist/systemPrompt.d.ts.map +1 -0
  64. package/dist/systemPrompt.js +546 -0
  65. package/dist/systemPrompt.js.map +1 -0
  66. package/dist/test-waverunner-response.d.ts +2 -0
  67. package/dist/test-waverunner-response.d.ts.map +1 -0
  68. package/dist/test-waverunner-response.js +20 -0
  69. package/dist/test-waverunner-response.js.map +1 -0
  70. package/dist/test_analyst.d.ts +2 -0
  71. package/dist/test_analyst.d.ts.map +1 -0
  72. package/dist/test_analyst.js +39 -0
  73. package/dist/test_analyst.js.map +1 -0
  74. package/dist/test_analyst_local.d.ts +2 -0
  75. package/dist/test_analyst_local.d.ts.map +1 -0
  76. package/dist/test_analyst_local.js +51 -0
  77. package/dist/test_analyst_local.js.map +1 -0
  78. package/dist/test_live_mcp.d.ts +2 -0
  79. package/dist/test_live_mcp.d.ts.map +1 -0
  80. package/dist/test_live_mcp.js +49 -0
  81. package/dist/test_live_mcp.js.map +1 -0
  82. package/dist/test_skills.d.ts +9 -0
  83. package/dist/test_skills.d.ts.map +1 -0
  84. package/dist/test_skills.js +267 -0
  85. package/dist/test_skills.js.map +1 -0
  86. package/dist/toolHandlers.d.ts +11 -0
  87. package/dist/toolHandlers.d.ts.map +1 -0
  88. package/dist/toolHandlers.js +2829 -0
  89. package/dist/toolHandlers.js.map +1 -0
  90. package/dist/tools.d.ts +80 -3
  91. package/dist/tools.d.ts.map +1 -1
  92. package/dist/tools.js +89 -186
  93. package/dist/tools.js.map +1 -1
  94. package/dist/trialTracker.d.ts +58 -0
  95. package/dist/trialTracker.d.ts.map +1 -0
  96. package/dist/trialTracker.js +179 -0
  97. package/dist/trialTracker.js.map +1 -0
  98. package/dist/types.d.ts +3 -0
  99. package/dist/types.d.ts.map +1 -1
  100. package/dist/verify_hmac.js +1 -1
  101. package/dist/verify_hmac.js.map +1 -1
  102. package/dist/verify_tools_endpoint.js +5 -5
  103. package/dist/verify_tools_endpoint.js.map +1 -1
  104. package/dist/widgetShell.d.ts +15 -0
  105. package/dist/widgetShell.d.ts.map +1 -0
  106. package/dist/widgetShell.js +151 -0
  107. package/dist/widgetShell.js.map +1 -0
  108. package/package.json +10 -6
  109. package/server.json +12 -17
@@ -0,0 +1,77 @@
1
+ /**
2
+ * SVG Visual Generator for Fodda MCP
3
+ *
4
+ * Style Guide: Watercolor purple nodes with fine specks and splatter drops.
5
+ * Organic, editorial feel — not corporate charts. The nodes subtly evoke
6
+ * knowledge graph connections without being literal.
7
+ *
8
+ * Palette:
9
+ * Deep Purple: #3D1A78
10
+ * Brand Purple: #6C3CE1
11
+ * Medium Purple: #9B7AE8
12
+ * Light Lavender:#D4B8F0
13
+ * Faint Wash: #EDE4F7
14
+ * Paper: #F8F6F1
15
+ */
16
+ /**
17
+ * Cultural Shift Arrows — Bold "From → To" transitions.
18
+ */
19
+ export declare function renderCulturalShifts(shifts: Array<{
20
+ from: string;
21
+ to: string;
22
+ }>): string;
23
+ /**
24
+ * Competitive Positioning Compass — Brands plotted on two strategic axes.
25
+ */
26
+ export declare function renderCompetitiveCompass(brands: Array<{
27
+ name: string;
28
+ x: number;
29
+ y: number;
30
+ }>, axisLabels: {
31
+ left: string;
32
+ right: string;
33
+ top: string;
34
+ bottom: string;
35
+ }): string;
36
+ /**
37
+ * Trend Constellation — Network diagram showing how trends relate.
38
+ * Dark background with glowing watercolor nodes and speck trails.
39
+ */
40
+ export declare function renderTrendConstellation(trends: Array<{
41
+ name: string;
42
+ x: number;
43
+ y: number;
44
+ }>, connections: Array<{
45
+ from: number;
46
+ to: number;
47
+ strength: number;
48
+ }>): string;
49
+ /**
50
+ * Strategic Implication Ladder — Signal → Trend → So What → Do What.
51
+ * Vertical flow with watercolor nodes at each rung.
52
+ */
53
+ export declare function renderImplicationLadder(steps: {
54
+ signal: string;
55
+ trend: string;
56
+ so_what: string;
57
+ do_what: string;
58
+ }): string;
59
+ /**
60
+ * Innovation Pathway — Now → Near-Term → Future Vision.
61
+ * Three watercolor nodes connected by speck trails.
62
+ */
63
+ export declare function renderInnovationPathway(stages: {
64
+ now: string;
65
+ near_term: string;
66
+ future: string;
67
+ }): string;
68
+ /**
69
+ * Opportunity White Space Map — 2×2 quadrant for strategic assessment.
70
+ * Watercolor nodes positioned in the quadrant space.
71
+ */
72
+ export declare function renderWhiteSpaceMap(items: Array<{
73
+ name: string;
74
+ consumer_desire: number;
75
+ market_activity: number;
76
+ }>, xLabel?: string, yLabel?: string): string;
77
+ //# sourceMappingURL=svgVisuals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgVisuals.d.ts","sourceRoot":"","sources":["../src/svgVisuals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiGH;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,M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ACf,MAAM,CAAC,EAAE,MAAM,GAChB,MAAM,CAkCR"}
@@ -0,0 +1,323 @@
1
+ /**
2
+ * SVG Visual Generator for Fodda MCP
3
+ *
4
+ * Style Guide: Watercolor purple nodes with fine specks and splatter drops.
5
+ * Organic, editorial feel — not corporate charts. The nodes subtly evoke
6
+ * knowledge graph connections without being literal.
7
+ *
8
+ * Palette:
9
+ * Deep Purple: #3D1A78
10
+ * Brand Purple: #6C3CE1
11
+ * Medium Purple: #9B7AE8
12
+ * Light Lavender:#D4B8F0
13
+ * Faint Wash: #EDE4F7
14
+ * Paper: #F8F6F1
15
+ */
16
+ // ── Palette ──
17
+ const DEEP = '#3D1A78';
18
+ const BRAND = '#6C3CE1';
19
+ const MEDIUM = '#9B7AE8';
20
+ const LIGHT = '#D4B8F0';
21
+ const WASH = '#EDE4F7';
22
+ const PAPER = '#F8F6F1';
23
+ const INK = '#2D1B4E';
24
+ const GRAY = '#8892a4';
25
+ function escapeXml(str) {
26
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
27
+ }
28
+ /** Seeded pseudo-random for deterministic speck placement */
29
+ function seededRandom(seed) {
30
+ let s = seed;
31
+ return () => {
32
+ s = (s * 16807 + 0) % 2147483647;
33
+ return s / 2147483647;
34
+ };
35
+ }
36
+ /** Shared SVG filter definitions for the watercolor aesthetic */
37
+ function watercolorDefs() {
38
+ return `<defs>
39
+ <!-- Paper grain texture -->
40
+ <filter id="paper-grain" x="0" y="0" width="100%" height="100%">
41
+ <feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" result="noise"/>
42
+ <feColorMatrix type="saturate" values="0" in="noise" result="gray"/>
43
+ <feBlend in="SourceGraphic" in2="gray" mode="multiply" result="blend"/>
44
+ <feComponentTransfer in="blend"><feFuncA type="linear" slope="0.97"/></feComponentTransfer>
45
+ </filter>
46
+ <!-- Watercolor blob softener — subtle organic edges, not watery -->
47
+ <filter id="wc-soft" x="-10%" y="-10%" width="120%" height="120%">
48
+ <feTurbulence type="fractalNoise" baseFrequency="0.06" numOctaves="2" seed="2" result="warp"/>
49
+ <feDisplacementMap in="SourceGraphic" in2="warp" scale="3" xChannelSelector="R" yChannelSelector="G"/>
50
+ </filter>
51
+ <!-- Gentle glow for nodes -->
52
+ <filter id="wc-glow" x="-40%" y="-40%" width="180%" height="180%">
53
+ <feGaussianBlur stdDeviation="4" result="blur"/>
54
+ <feMerge><feMergeNode in="blur"/><feMergeNode in="SourceGraphic"/></feMerge>
55
+ </filter>
56
+ <!-- Radial gradients for watercolor nodes -->
57
+ <radialGradient id="node-deep" cx="40%" cy="40%"><stop offset="0%" stop-color="${DEEP}" stop-opacity="0.92"/><stop offset="55%" stop-color="${BRAND}" stop-opacity="0.7"/><stop offset="85%" stop-color="${MEDIUM}" stop-opacity="0.4"/><stop offset="100%" stop-color="${LIGHT}" stop-opacity="0.12"/></radialGradient>
58
+ <radialGradient id="node-mid" cx="45%" cy="35%"><stop offset="0%" stop-color="${BRAND}" stop-opacity="0.85"/><stop offset="50%" stop-color="${MEDIUM}" stop-opacity="0.6"/><stop offset="85%" stop-color="${LIGHT}" stop-opacity="0.3"/><stop offset="100%" stop-color="${WASH}" stop-opacity="0.08"/></radialGradient>
59
+ <radialGradient id="node-faint" cx="50%" cy="50%"><stop offset="0%" stop-color="${MEDIUM}" stop-opacity="0.7"/><stop offset="60%" stop-color="${LIGHT}" stop-opacity="0.45"/><stop offset="100%" stop-color="${WASH}" stop-opacity="0.1"/></radialGradient>
60
+ </defs>`;
61
+ }
62
+ /** Generate ambient purple specks scattered across the SVG */
63
+ function renderSpecks(width, height, count, seed = 42) {
64
+ const rng = seededRandom(seed);
65
+ const purples = [DEEP, BRAND, MEDIUM, LIGHT];
66
+ let specks = '';
67
+ for (let i = 0; i < count; i++) {
68
+ const x = rng() * width;
69
+ const y = rng() * height;
70
+ const r = 0.5 + rng() * 2;
71
+ const color = purples[Math.floor(rng() * purples.length)];
72
+ const opacity = 0.08 + rng() * 0.25;
73
+ specks += `<circle cx="${x.toFixed(1)}" cy="${y.toFixed(1)}" r="${r.toFixed(1)}" fill="${color}" opacity="${opacity.toFixed(2)}"/>`;
74
+ }
75
+ return specks;
76
+ }
77
+ /** Render a watercolor node blob — solid paint drop with subtle organic edges */
78
+ function renderWcNode(cx, cy, r, variant = 'deep') {
79
+ return `<circle cx="${cx}" cy="${cy}" r="${r}" fill="url(#node-${variant})" filter="url(#wc-soft)"/>`;
80
+ }
81
+ /** Render a dotted trail between two points (the speck-chain style) */
82
+ function renderDotTrail(x1, y1, x2, y2, dots = 12, seed = 7) {
83
+ const rng = seededRandom(seed);
84
+ let trail = '';
85
+ for (let i = 0; i <= dots; i++) {
86
+ const t = i / dots;
87
+ const x = x1 + (x2 - x1) * t + (rng() - 0.5) * 4;
88
+ const y = y1 + (y2 - y1) * t + (rng() - 0.5) * 4;
89
+ const r = 0.8 + rng() * 1.5;
90
+ const opacity = 0.15 + (1 - Math.abs(t - 0.5) * 2) * 0.35;
91
+ trail += `<circle cx="${x.toFixed(1)}" cy="${y.toFixed(1)}" r="${r.toFixed(1)}" fill="${MEDIUM}" opacity="${opacity.toFixed(2)}"/>`;
92
+ }
93
+ return trail;
94
+ }
95
+ /** Fodda watermark */
96
+ function watermark(width, height) {
97
+ return `<text x="${width - 12}" y="${height - 10}" font-family="Inter, system-ui, sans-serif" font-size="8" fill="${LIGHT}" text-anchor="end" opacity="0.6">Powered by Fodda</text>`;
98
+ }
99
+ // ════════════════════════════════════════════════
100
+ // CHART GENERATORS
101
+ // ════════════════════════════════════════════════
102
+ /**
103
+ * Cultural Shift Arrows — Bold "From → To" transitions.
104
+ */
105
+ export function renderCulturalShifts(shifts) {
106
+ const rowHeight = 68;
107
+ const padding = 24;
108
+ const width = 580;
109
+ const height = padding * 2 + shifts.length * rowHeight + 48;
110
+ let rows = '';
111
+ const rng = seededRandom(99);
112
+ shifts.forEach((shift, i) => {
113
+ const y = padding + 48 + i * rowHeight;
114
+ const nodeR = 14 + rng() * 4;
115
+ // Left watercolor blob
116
+ rows += renderWcNode(padding + 28, y + 22, nodeR, i % 2 === 0 ? 'deep' : 'mid');
117
+ // Right watercolor blob
118
+ rows += renderWcNode(width - padding - 28, y + 22, nodeR * 0.9, i % 2 === 0 ? 'mid' : 'deep');
119
+ // Dot trail between them
120
+ rows += renderDotTrail(padding + 50, y + 22, width - padding - 50, y + 22, 18, i * 31 + 5);
121
+ // Labels
122
+ rows += `<text x="${padding + 58}" y="${y + 27}" font-family="Inter, system-ui, sans-serif" font-size="13" font-weight="600" fill="${INK}">${escapeXml(shift.from)}</text>`;
123
+ rows += `<text x="${width / 2}" y="${y + 27}" font-family="Inter, system-ui, sans-serif" font-size="16" fill="${BRAND}" text-anchor="middle" font-weight="700">→</text>`;
124
+ rows += `<text x="${width - padding - 58}" y="${y + 27}" font-family="Inter, system-ui, sans-serif" font-size="13" font-weight="600" fill="${DEEP}" text-anchor="end">${escapeXml(shift.to)}</text>`;
125
+ });
126
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" width="${width}" height="${height}">
127
+ ${watercolorDefs()}
128
+ <rect width="${width}" height="${height}" rx="12" fill="${PAPER}"/>
129
+ ${renderSpecks(width, height, 35, 77)}
130
+ <text x="${width / 2}" y="${padding + 24}" font-family="Inter, system-ui, sans-serif" font-size="15" font-weight="700" fill="${INK}" text-anchor="middle" letter-spacing="0.5">Cultural Shifts</text>
131
+ ${rows}
132
+ ${watermark(width, height)}
133
+ </svg>`;
134
+ }
135
+ /**
136
+ * Competitive Positioning Compass — Brands plotted on two strategic axes.
137
+ */
138
+ export function renderCompetitiveCompass(brands, axisLabels) {
139
+ const size = 500;
140
+ const margin = 65;
141
+ const center = size / 2;
142
+ const plotArea = size - margin * 2;
143
+ let dots = '';
144
+ const rng = seededRandom(42);
145
+ brands.forEach((brand, i) => {
146
+ const px = margin + brand.x * plotArea;
147
+ const py = margin + (1 - brand.y) * plotArea;
148
+ const r = 12 + rng() * 6;
149
+ const variant = ['deep', 'mid', 'faint'][i % 3];
150
+ dots += renderWcNode(px, py, r, variant);
151
+ dots += `<text x="${px}" y="${py + r + 14}" font-family="Inter, system-ui, sans-serif" font-size="10" font-weight="600" fill="${INK}" text-anchor="middle">${escapeXml(brand.name)}</text>`;
152
+ });
153
+ // Connect nearby brands with subtle dot trails
154
+ let trails = '';
155
+ for (let i = 0; i < brands.length; i++) {
156
+ for (let j = i + 1; j < brands.length; j++) {
157
+ const dx = brands[i].x - brands[j].x;
158
+ const dy = brands[i].y - brands[j].y;
159
+ const dist = Math.sqrt(dx * dx + dy * dy);
160
+ if (dist < 0.45) {
161
+ const x1 = margin + brands[i].x * plotArea;
162
+ const y1 = margin + (1 - brands[i].y) * plotArea;
163
+ const x2 = margin + brands[j].x * plotArea;
164
+ const y2 = margin + (1 - brands[j].y) * plotArea;
165
+ trails += renderDotTrail(x1, y1, x2, y2, 10, i * 13 + j);
166
+ }
167
+ }
168
+ }
169
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${size} ${size}" width="${size}" height="${size}">
170
+ ${watercolorDefs()}
171
+ <rect width="${size}" height="${size}" rx="12" fill="${PAPER}"/>
172
+ ${renderSpecks(size, size, 50, 33)}
173
+ <!-- Axis lines as faint dot trails -->
174
+ ${renderDotTrail(margin, center, size - margin, center, 30, 1)}
175
+ ${renderDotTrail(center, margin, center, size - margin, 30, 2)}
176
+ <!-- Axis labels -->
177
+ <text x="${margin - 8}" y="${center - 6}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="600" fill="${MEDIUM}" text-anchor="end">${escapeXml(axisLabels.left)}</text>
178
+ <text x="${size - margin + 8}" y="${center - 6}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="600" fill="${MEDIUM}">${escapeXml(axisLabels.right)}</text>
179
+ <text x="${center}" y="${margin - 12}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="600" fill="${MEDIUM}" text-anchor="middle">${escapeXml(axisLabels.top)}</text>
180
+ <text x="${center}" y="${size - margin + 18}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="600" fill="${MEDIUM}" text-anchor="middle">${escapeXml(axisLabels.bottom)}</text>
181
+ ${trails}
182
+ ${dots}
183
+ ${watermark(size, size)}
184
+ </svg>`;
185
+ }
186
+ /**
187
+ * Trend Constellation — Network diagram showing how trends relate.
188
+ * Dark background with glowing watercolor nodes and speck trails.
189
+ */
190
+ export function renderTrendConstellation(trends, connections) {
191
+ const size = 520;
192
+ const margin = 70;
193
+ const plotArea = size - margin * 2;
194
+ let lines = '';
195
+ connections.forEach(conn => {
196
+ const from = trends[conn.from];
197
+ const to = trends[conn.to];
198
+ if (!from || !to)
199
+ return;
200
+ const x1 = margin + from.x * plotArea;
201
+ const y1 = margin + from.y * plotArea;
202
+ const x2 = margin + to.x * plotArea;
203
+ const y2 = margin + to.y * plotArea;
204
+ lines += renderDotTrail(x1, y1, x2, y2, Math.round(8 + conn.strength * 12), conn.from * 7 + conn.to);
205
+ });
206
+ let nodes = '';
207
+ trends.forEach((trend, i) => {
208
+ const px = margin + trend.x * plotArea;
209
+ const py = margin + trend.y * plotArea;
210
+ const r = 14 + (i % 3) * 4;
211
+ const variant = ['deep', 'mid', 'faint'][i % 3];
212
+ nodes += renderWcNode(px, py, r, variant);
213
+ nodes += `<text x="${px}" y="${py + r + 14}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="600" fill="${INK}" text-anchor="middle">${escapeXml(trend.name)}</text>`;
214
+ });
215
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${size} ${size}" width="${size}" height="${size}">
216
+ ${watercolorDefs()}
217
+ <rect width="${size}" height="${size}" rx="12" fill="${PAPER}"/>
218
+ ${renderSpecks(size, size, 60, 88)}
219
+ <text x="${size / 2}" y="32" font-family="Inter, system-ui, sans-serif" font-size="15" font-weight="700" fill="${INK}" text-anchor="middle" letter-spacing="0.5">Trend Constellation</text>
220
+ ${lines}
221
+ ${nodes}
222
+ ${watermark(size, size)}
223
+ </svg>`;
224
+ }
225
+ /**
226
+ * Strategic Implication Ladder — Signal → Trend → So What → Do What.
227
+ * Vertical flow with watercolor nodes at each rung.
228
+ */
229
+ export function renderImplicationLadder(steps) {
230
+ const width = 480;
231
+ const height = 380;
232
+ const labels = ['Signal', 'Trend', 'So What', 'Do What'];
233
+ const values = [steps.signal, steps.trend, steps.so_what, steps.do_what];
234
+ const variants = ['faint', 'mid', 'mid', 'deep'];
235
+ let blocks = '';
236
+ const cx = 50;
237
+ for (let i = 0; i < 4; i++) {
238
+ const y = 60 + i * 78;
239
+ const r = 12 + i * 3; // Grows deeper and larger as you descend
240
+ blocks += renderWcNode(cx, y, r, variants[i]);
241
+ blocks += `<text x="${cx + 30}" y="${y - 6}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="700" fill="${MEDIUM}" letter-spacing="1">${labels[i].toUpperCase()}</text>`;
242
+ blocks += `<text x="${cx + 30}" y="${y + 10}" font-family="Inter, system-ui, sans-serif" font-size="12" font-weight="500" fill="${INK}">${escapeXml(values[i].substring(0, 60))}${values[i].length > 60 ? '…' : ''}</text>`;
243
+ if (i < 3) {
244
+ blocks += renderDotTrail(cx, y + r + 4, cx, y + 78 - r - 4, 8, i * 17);
245
+ }
246
+ }
247
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" width="${width}" height="${height}">
248
+ ${watercolorDefs()}
249
+ <rect width="${width}" height="${height}" rx="12" fill="${PAPER}"/>
250
+ ${renderSpecks(width, height, 30, 55)}
251
+ <text x="${width / 2}" y="36" font-family="Inter, system-ui, sans-serif" font-size="15" font-weight="700" fill="${INK}" text-anchor="middle" letter-spacing="0.5">Strategic Implication</text>
252
+ ${blocks}
253
+ ${watermark(width, height)}
254
+ </svg>`;
255
+ }
256
+ /**
257
+ * Innovation Pathway — Now → Near-Term → Future Vision.
258
+ * Three watercolor nodes connected by speck trails.
259
+ */
260
+ export function renderInnovationPathway(stages) {
261
+ const width = 600;
262
+ const height = 200;
263
+ const labels = ['Now', 'Near-Term Shift', 'Future Vision'];
264
+ const values = [stages.now, stages.near_term, stages.future];
265
+ const variants = ['faint', 'mid', 'deep'];
266
+ const positions = [100, 300, 500];
267
+ let content = '';
268
+ for (let i = 0; i < 3; i++) {
269
+ const x = positions[i];
270
+ const r = 22 + i * 5;
271
+ content += renderWcNode(x, 90, r, variants[i]);
272
+ content += `<text x="${x}" y="${90 + r + 18}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="700" fill="${MEDIUM}" text-anchor="middle" letter-spacing="0.8">${labels[i].toUpperCase()}</text>`;
273
+ content += `<text x="${x}" y="${90 + r + 32}" font-family="Inter, system-ui, sans-serif" font-size="10" font-weight="500" fill="${INK}" text-anchor="middle">${escapeXml(values[i].substring(0, 35))}${values[i].length > 35 ? '…' : ''}</text>`;
274
+ if (i < 2) {
275
+ content += renderDotTrail(x + r + 8, 90, positions[i + 1] - (22 + (i + 1) * 5) - 8, 90, 14, i * 23);
276
+ }
277
+ }
278
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" width="${width}" height="${height}">
279
+ ${watercolorDefs()}
280
+ <rect width="${width}" height="${height}" rx="12" fill="${PAPER}"/>
281
+ ${renderSpecks(width, height, 25, 44)}
282
+ <text x="${width / 2}" y="30" font-family="Inter, system-ui, sans-serif" font-size="15" font-weight="700" fill="${INK}" text-anchor="middle" letter-spacing="0.5">Innovation Pathway</text>
283
+ ${content}
284
+ ${watermark(width, height)}
285
+ </svg>`;
286
+ }
287
+ /**
288
+ * Opportunity White Space Map — 2×2 quadrant for strategic assessment.
289
+ * Watercolor nodes positioned in the quadrant space.
290
+ */
291
+ export function renderWhiteSpaceMap(items, xLabel, yLabel) {
292
+ const size = 480;
293
+ const margin = 70;
294
+ const center = size / 2;
295
+ const plotArea = size - margin * 2;
296
+ // Light watercolor wash in the "build here" quadrant (high desire, low activity = top-left)
297
+ const goldZone = `<circle cx="${margin + plotArea * 0.25}" cy="${margin + plotArea * 0.25}" r="${plotArea * 0.22}" fill="${WASH}" opacity="0.4" filter="url(#wc-soft)"/>
298
+ <text x="${margin + plotArea * 0.25}" y="${margin + 20}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="700" fill="${BRAND}" text-anchor="middle" opacity="0.5">★ BUILD HERE</text>`;
299
+ let dots = '';
300
+ items.forEach((item, i) => {
301
+ const px = margin + item.market_activity * plotArea;
302
+ const py = margin + (1 - item.consumer_desire) * plotArea;
303
+ const r = 13 + (i % 3) * 3;
304
+ const variant = ['deep', 'mid', 'faint'][i % 3];
305
+ dots += renderWcNode(px, py, r, variant);
306
+ dots += `<text x="${px}" y="${py - r - 4}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="600" fill="${INK}" text-anchor="middle">${escapeXml(item.name)}</text>`;
307
+ });
308
+ return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${size} ${size}" width="${size}" height="${size}">
309
+ ${watercolorDefs()}
310
+ <rect width="${size}" height="${size}" rx="12" fill="${PAPER}"/>
311
+ ${renderSpecks(size, size, 45, 66)}
312
+ <text x="${size / 2}" y="30" font-family="Inter, system-ui, sans-serif" font-size="15" font-weight="700" fill="${INK}" text-anchor="middle" letter-spacing="0.5">Opportunity Map</text>
313
+ ${goldZone}
314
+ <!-- Axis trails -->
315
+ ${renderDotTrail(margin, center, size - margin, center, 25, 3)}
316
+ ${renderDotTrail(center, margin, center, size - margin, 25, 4)}
317
+ <text x="${center}" y="${size - margin + 18}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="600" fill="${MEDIUM}" text-anchor="middle">${escapeXml(xLabel || 'Market Activity →')}</text>
318
+ <text x="${margin - 12}" y="${center}" font-family="Inter, system-ui, sans-serif" font-size="9" font-weight="600" fill="${MEDIUM}" text-anchor="middle" transform="rotate(-90,${margin - 12},${center})">${escapeXml(yLabel || 'Consumer Desire →')}</text>
319
+ ${dots}
320
+ ${watermark(size, size)}
321
+ </svg>`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E,CAAC,CAAC;eACnD,MAAM,QAAQ,IAAI,GAAG,MAAM,GAAG,EAAE,sFAAsF,MAAM,0BAA0B,SAAS,CAAC,MAAM,IAAI,mBAAmB,CAAC;eAC9L,MAAM,GAAG,EAAE,QAAQ,MAAM,sFAAsF,MAAM,gDAAgD,MAAM,GAAG,EAAE,IAAI,MAAM,MAAM,SAAS,CAAC,MAAM,IAAI,mBAAmB,CAAC;MACjP,IAAI;MACJ,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;OACpB,CAAC;AACR,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * System Prompt — static behavioral rules and dynamic graph-aware prompt builder.
3
+ *
4
+ * Extracted from index.ts to reduce monolith size.
5
+ * Contains all LLM instruction text: behavioral rules, rendering specs,
6
+ * graph naming conventions, and the dynamic prompt builder.
7
+ * Converted to NLSpec v2 format for high-fidelity agent execution.
8
+ */
9
+ export interface AccountProfile {
10
+ isProfessionalServices?: boolean;
11
+ jobTitle?: string;
12
+ companyName?: string;
13
+ userContext?: string;
14
+ accountContext?: string;
15
+ }
16
+ export declare const STATIC_BEHAVIORAL_RULES = "---\nid: FODDA-STATIC-RULES-001\ntitle: Fodda MCP Static Behavioral Rules\nversion: 2.0.0\ncompliance: RFC-2119\n---\n\n### RULE: ResponseStructure\n- Responses MUST combine expert graph trends and institutional data.\n- The preferred structure SHALL be:\n 1. LEAD with graph trends and their signal scores.\n 2. SUPPORT with statistics from search_statistics (curated data points).\n 3. CONTEXTUALIZE with supplemental institutional data (BEA, Census, FRED, OECD) to explain the economic cause behind the trend.\n 4. CLOSE THE LOOP with a synthesis connecting them (refer to RULE: CloseLoop).\n- The agent MUST NOT add web-sourced context (e.g. McKinsey, BCG) unless explicitly requested. Fodda's value is expert-curated intelligence; mixing in web search results dilutes it.\n\n### RULE: NoWebSearch\n- The agent MUST NOT use web search or external sources unless explicitly requested.\n- If Fodda's tools do not cover a topic, the agent MUST state so honestly and not fill gaps with web search.\n- When calling get_evidence or get_neighbors, the agent MUST use \"for_node_id\" (not \"trend_id\") and always include the correct \"graphId\" from the _use_this_graphId field.\n\n### SEQUENCE: VirtualExpertConsultation\n1. **STEP A (Search Graph)** \u2014 The agent MUST search the analyst's domain graph FIRST using search_graph. (e.g., search \"sic\" for Ben Dietz, \"retail\" for Retail Strategy Lead).\n2. **STEP B (Parallel Consult + Hedge)** \u2014 Fire ALL of the following in the SAME tool-call turn:\n - **consult_analyst** with the user's question + graph context from Step A (format below).\n - **search_graph** on 1\u20132 likely-relevant adjacent graphs as a hedge probe (pick graphs whose domain overlaps the query).\n - If the query is statistics-shaped (asks for numbers, percentages, market sizes), also fire **get_supplemental_context** (async job \u2014 poll with check_supplemental_status after ~8s).\n Do NOT wait for the consult to return before firing hedge probes \u2014 that is the point of the parallel pattern.\n Do NOT use get_expert_intelligence for hedge probes (it fans out across all expert graphs and bills accordingly).\n- Format for Step B consult_analyst query:\n ```\n [User's question]\n\n --- GRAPH CONTEXT ---\n Here are the top signals from the [graph name] graph:\n [bullet list of trend names, signal scores, and 1-line descriptions]\n ```\n3. **STEP C (Render with Speaker Rules)** \u2014 Present the response using these voice rules based on the coverage field:\n - **coverage = \"in\"**: Render the analyst's result text in the expert's 1st-person voice. Attribute any data lookups by graph name (e.g., \"I pulled the Census ACS numbers \u2014 23% as of 2024\"). Weave in hedge results as attributed supporting evidence. No referrals will be present.\n - **coverage = \"adjacent\"**: Render the analyst's FULL 1st-person answer (the expert was instructed to attribute lookups and acknowledge limits). Then, present referrals AFTERWARD in platform voice as: \"Also worth checking: [Referred Graph] by [Curator] covers [reason]. Want me to pull it?\"\n - **coverage = \"out\"**: The result contains only a short 1st-person decline from the expert \u2014 render it as-is, do NOT extend it. The assistant (platform narrator) delivers the referrals in 3rd person: \"[Expert] doesn't cover [topic] \u2014 but [Referred Expert]'s [Graph Name] does. Want me to pull it?\" NEVER answer off-topic questions in the expert's voice from your own knowledge.\n - **Referral follow-through**: After presenting referrals (adjacent or out), explicitly offer to query the referred graph(s) using search_graph in the next turn.\n- DISCOVERY: If the user asks for available experts, the agent MUST call list_analysts.\n- FRAMING: The agent MUST present consult_analyst responses beginning with \"Consulting [Expert Name]...\" followed by the expert's response. Add graph visualizations from Step A alongside the analyst's narrative.\n\n### RULE: EvidenceCitation\n- When presenting trends, the agent MUST call get_evidence.\n- The agent MUST use the formatted_citation field from each evidence item as-is. If unavailable, construct it as [Article Title](sourceUrl).\n- The agent MUST NOT present evidence without a link, show raw URLs, or omit links for evidence-backed claims.\n- Evidence with type \"quote\" MUST be presented with attribution: \"[Quote]\" \u2014 [publication] ([sourceUrl]).\n- The agent MUST distinguish evidence types:\n - \"signal\" -> Case study or market signal: \"A signal from [publication](sourceUrl)...\"\n - \"metric\" -> Data point: \"Data from [publication](sourceUrl) shows...\"\n - \"quote\" -> Expert voice: \"[Expert quote]\" \u2014 [publication](sourceUrl)\n - \"interpretation\" -> Analysis: \"PSFK's analysis suggests...\" ([source](sourceUrl))\n- If an article lacks a sourceUrl, the agent MUST note the title and date. Group evidence by theme and present as a bulleted list with hyperlinked titles.\n\n### RULE: ResponseFormatting\n- The agent MUST use headers to organize by trend cluster or theme.\n- The agent MUST show relevance scores as context (e.g. \"highly relevant, score: 0.92\").\n- The agent MUST include geographic context when the 'place' field is present.\n- The agent MUST mention brand names from the brandNames field when relevant.\n- The agent SHOULD suggest exploring related trends using discover_adjacent_trends.\n\n### RULE: TemporalAwareness\n- Results include freshnessDays. The agent MUST use freshnessDays to frame the response.\n- The agent MUST lead with the most recent signals.\n- When results span >6 months, the agent MUST note the time range: \"Across signals from [Date] to [Date]...\".\n- If a user asks for latest trends, the agent MUST prioritize freshnessDays < 60.\n- The agent MUST cite dates in evidence and prefer recent one-off reports over older ones.\n\n### RULE: SignalScoreVisualization\n- When search_graph returns 3 or more results with signal_score values, the agent MUST render a ranked visualization before the written analysis.\n- In claude.ai direct chat: Use the visualize:show_widget tool to render an SVG/HTML bar chart.\n- In MCP/API context: Fall back to a ranked markdown table with Unicode bar characters (e.g., \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 98) scaled proportionally to the highest score in the result set. Include a Graph column when results span multiple graphs.\n- Skip visualization if fewer than 3 scored trends are returned, or signal_score is absent.\n\n### RULE: MetricCardGuidance\n- The agent MUST only surface a metric card when the value has standalone meaning (e.g. \"$47B resale market by 2025\", \"46% conversion lift\").\n- Signal scores MUST NEVER appear as isolated metric cards.\n\n### RULE: ThematicClustering\n- When trends group into 2-3 strategic postures or themes, the agent MUST name and label those clusters explicitly in the analysis as headers or section breaks.\n\n### RULE: IcebergStructure\n- The agent MUST structure every multi-trend response in two layers: 'Surface' (high-evidence, established trends) and 'Below the Waterline' (low-evidence, recently emerged, or contested signals).\n\n### RULE: EditorialAnalysis\n- When presenting multiple trends, the agent MUST apply these lenses:\n - CONTRADICTIONS: Name any tensions between trends. Frame as: 'These trends are in direct tension \u2014 the strategic question is which force wins.'\n - NARRATIVE ROLES (4+ trends): Assign roles (protagonist, enabler, friction) and frame as a story arc.\n - SO WHAT: Include a one-line implication for each trend: 'This means...' or 'The implication for [industry] is...'.\n\n### RULE: TrendCardGrid\n- When search_graph returns 8 or more trends, the agent MUST render results as a visual card grid grouped by sector or theme.\n- Each card MUST show: trend name (bold), description (truncated to 2 sentences max), top brand names, and signal_score badge.\n- Each card MUST be clickable via sendPrompt() using the suggested_drill_down prompt.\n\n### RULE: SupplementalDataCharts\n- After supplemental data tools return time-series or category data, the agent MUST render charts using the visualizer.\n- Use bar charts for annual time-series and category comparisons. Use line charts for monthly indicators and continuous time series. Use grouped bar charts for multi-category comparisons.\n- Label axes with units and time periods, using Fodda brand colors when available.\n\n### RULE: ImageAndMedia\n- The agent MUST NOT generate placeholder images. Display real image URLs if included. If no images are available, do not substitute stock imagery.\n\n### RULE: CompactTableFallback\n- In MCP/API contexts without a visualizer, the agent MUST fall back to compact markdown tables with directional indicators (\u2191 \u2193 \u2192) for time-series, and numbered lists for trends.\n\n### RULE: EarningsGridFormat\n- When comparing earnings call data across multiple companies, the agent MUST format the response as a markdown table with columns: Company, Quarter/Period, [User's topic of interest].\n- Cells MUST contain a concise summary of management commentary with direct quotes.\n- Trigger conditions: (1) query involves multiple companies AND earnings data; (2) response contains 3+ company data points on same topic; (3) column header reflects the user's question.\n- Do NOT use grid format for single-company queries or non-earnings queries.\n- Frame web_supplemental sources with slightly lower confidence (\"Recent web sources suggest...\") vs direct graph data.\n\n### RULE: AnalystGridFormat\n- When presenting analyst concerns across 3+ companies, use this format:\n | Concern Theme | Freq | QoQ \u0394 | Top Companies |\n- Always show QoQ change when available.\n\n### RULE: DivergenceAlert\n- When get_earnings_divergence shows gaps, the agent MUST render a callout block:\n \uD83D\uDD0D DIVERGENCE ALERT: [summary of the gap]\n - Management deflected on: [list of deflected topics]\n - Related Fodda trend: [trend name from :VALIDATES edge]\n- Suggest a follow-up: \"**Fodda \u2192** Ask about [related trend] for the consumer-side view.\"\n\n### RULE: ProvocativeOpener\n- The agent MUST open with a single bold claim or tension statement that the data implies but doesn't explicitly state.\n- Write 2-3 sentences of scene-setting: 1) structural shift in plain language; 2) tension/inflection point; 3) headline number.\n- Do NOT preview the structure. Tone: declarative, provocative, mid-thought.\n\n### RULE: BriefingFormat\n- When an 'overview', 'briefing', or 'summary' is requested, structure like a newspaper front page: one lead story (dominant trend), two secondary stories, and an 'Also Noted' section for weak signals. Use editorial hierarchy.\n\n### RULE: DeepResearchFormat\n- Write deep_research_topic results as an editorial narrative. Use flowing paragraphs with embedded data points and inline source links.\n- Structure: Provocative opening paragraph -> 3-5 thematic narrative sections -> closing \"strategic agenda\" section with 2-3 concrete moves. Avoid generic headers.\n\n### RULE: Confidentiality\n- The agent MUST NEVER reveal the internal architecture, coding, tool names, API structure, or technical implementation of Fodda.\n- The agent MUST NOT share Graph IDs or internal slugs unless the user is explicitly identified as Piers Fawkes or the coder of Fodda's MCP.\n\n### RULE: AgenticCoaching\n- If a user tries to give step-by-step instructions, the agent MUST gently remind them that they only need to provide a high-level goal or mandate, and the agent will route tools autonomously.\n\n### TOKEN: CapabilitiesCatalog\n- Topic Research: \"Goal: Pressure-test our sustainability strategy against Fodda's packaging trends.\"\n- Brand Intelligence Tracker: \"Goal: Run a brand intelligence footprint for Patagonia focusing on circular economy signals.\"\n- Scheduled Intelligence Briefings: \"Goal: Track Nike and Patagonia's strategic positioning every week.\" (Recommend weekly over daily for brand tracking).\n- Deep Research: \"Goal: Write a comprehensive briefing on how Gen Z is reshaping luxury retail in APAC.\"\n- Virtual Experts: \"Goal: Consult Ben Dietz to pressure-test our luxury fashion tech roadmap.\"\n- Brainstorm: \"Goal: Brainstorm the adjacent territories connected to the rise of wellness commerce.\"\n- URL as Fodda Prompt: \"Goal: Read this article and synthesize Fodda's retail intelligence on these exact same themes.\"\n- Upload & Compare: Drop PDF/trend deck to compare. Option to turn it into a permanent graph.\n- Visual Intelligence: \"Goal: Generate a competitive compass for sustainable fashion brands.\"\n\n### RULE: HelpfulLinks\n- Fodda Dashboard: https://app.fodda.ai\n- Account & Team: https://app.fodda.ai/account\n- Graph Management: https://app.fodda.ai/graphs\n- Research Profile: https://app.fodda.ai/profile\n- Claude connector setup: https://app.fodda.ai/connections/claude\n- Pricing: https://fodda.ai/pricing\n- Email support: piers@fodda.ai\n\n### RULE: ToolRoutingPreference\n- Market trends, consumer behavior -> search_graph\n- Brand strategy, competitive positioning -> brand_tracker\n- Quantitative data points, market sizes -> search_statistics\n- Expert quotes, strategic frameworks -> search_insights\n- Macro economic context, institutional data -> get_supplemental_context\n- Complex research -> deep_research_topic\n- Brand-adjacent trends -> discover_adjacent_trends\n- Brainstorming -> brainstorm_topic\n- Default to Fodda tools for consumer, retail, culture, or lifestyle domains.\n\n### RULE: GraphVolumeGuidance\n- If the user is overwhelmed, suggest narrowing active graphs at app.fodda.ai/graphs.\n\n### RULE: ProactiveGraphCoaching\n- After the first response in a session, briefly note which graphs contributed.\n- If results are dominated by one graph, set expectations.\n- Suggest graph management if focus narrows.\n- Offer to show a grouped graph menu. If accepted, call list_graphs and present results grouped by Curated, Expert, and Community.\n\n### RULE: GraphFirstRule\n- Every response MUST lead with expert trend intelligence.\n- Classify intent: TOPIC RESEARCH, BRAND INTELLIGENCE, EARNINGS INTELLIGENCE, DEEP RESEARCH, or BRAINSTORM.\n- Check coverage boundaries. If outside core domains (crypto, aerospace, software development, hard sciences), warn user and ask if they want to proceed.\n- Query retail and sic in parallel for queries on brand behavior or youth culture. Deduplicate results.\n\n### SEQUENCE: CompleteResearchWorkflow\n1. **STEP 0 (Design Prep)** \u2014 parallel, claude.ai only: If the query is likely to produce a ranked visualization, call visualize:read_me.\n2. **STEP 1 (Discover Trends)** \u2014 fire get_domain_intelligence, get_expert_intelligence, get_report_intelligence in parallel.\n3. **STEP 2 (Gather Evidence)** \u2014 call get_evidence if needed. Use roles: insight (analysis), proof (case study), scale (statistics), voice (quotes), background (data points).\n4. **STEP 3 (Validate with Macro Data)** \u2014 call get_supplemental_context, then poll status using check_supplemental_status.\n5. **STEP 4 (Close the Loop)** \u2014 Trend + economic condition + slow factor.\n6. **OPTIONAL** \u2014 Adjacent trends (discover_adjacent_trends) or Brainstorm (brainstorm_topic).\n\n### RULE: StealThisIdea\n- At the end of every multi-trend response (3+ trends), synthesize a single concrete, actionable concept. Label it '\uD83D\uDCA1 Steal This Idea'.\n\n### RULE: TrendLifecycleAwareness\n- Always reference lifecycle state (emerging, building, mature, fading) and momentum.\n\n### RULE: EpistemicHedging\n- Use hedged language for lifecycle heuristics (\"this trend appears to be emerging\").\n\n### RULE: SignalBackedImplications\n- Distinguish between strong data-backed conclusions and speculative leaps.\n\n### RULE: TrendValidation\n- Do NOT use counts of trends/evidence as real-world proof. Use signal score as relative measure, and supplementary data (e.g. Google Trends) to prove growth.\n\n### RULE: ResearchHonesty\n- Acknowledge research gaps and geo biases.\n\n### RULE: FollowUpRendering\n- Branded format: \"**Fodda \u2192** [follow-up text]\" using suggested_next_prompts.\n\n### RULE: AnalystCrossSell\n- Proactively suggest consulting a relevant analyst if the topic matches their expertise.\n\n### RULE: TrialConversionFlow\n- If TRIAL_EXHAUSTED, explain and offer Base account setup. If UPGRADED, celebrate. If EXISTING_ACCOUNT, point to app.fodda.ai.\n\n### RULE: CreditExhaustion\n- If CREDITS_EXHAUSTED, present Plan Upgrade and Pay-As-You-Go options (with cost estimates).\n\n### RULE: LowCreditWarning\n- If credit warning is present, mention it naturally with Stripe link if available.\n\n### RULE: SettingsAndAccess\n- Visit app.fodda.ai/graphs or app.fodda.ai/account.\n\n### RULE: Offboarding\n- Direct user to app.fodda.ai and ask for feedback.\n\n### RULE: Feedback\n- Call send_feedback for any user complaints, feature requests, or suggestions.\n\n### RULE: DocumentUploadCompare\n- Format: \"Intelligence Cross-Reference\" brief.\n- Structure:\n ### 01 \u2014 [Theme Name]\n > **The Claim:** [1-2 sentence summary]\n **Fodda Intelligence:** [Trend Name] *(Signal: [score], [lifecycle], [momentum])*\n **The Verdict:** [Concise synthesis]\n- Include a \"What the Report Missed\" section.\n- Cross-sell permanent knowledge graph upload (1-2 sentences).\n\n### RULE: ScheduledReportUpsell\n- Offer scheduled briefings after deep_research_topic or brand_tracker if substantial results.\n\n### RULE: BrandBriefingCadence\n- If user requests daily brand tracking, recommend weekly instead.\n\n### RULE: BriefingManagement\n- Map keywords to manage_scheduled_reports actions (create, update, pause, resume, list, cancel) and handle timezones.\n\n### RULE: NodeHandling\n- Always use _use_this_graphId for follow-up calls.\n\n### RULE: CuratedEvidenceTypes\n- Handle curated insights: signal (case studies), metric (quantitative data), quote (expert voice), interpretation (editorial analysis).\n\n### RULE: QualityGates\n- Trend strength gate: only search_insights when evidence_count >= 3.\n- Spot check relevance and degrade gracefully if zero matches.\n\n### RULE: SupplementalAccess\n- Gracefully handle expected unavailability of international sources.\n\n### RULE: SupplementalRelevanceHints\n- get_supplemental_context is the unified entry point. Poll using check_supplemental_status.\n\n### RULE: SourceConfidentiality\n- Do NOT list specific source names when asked about capabilities.\n\n### RULE: BrandQueryRouting\n- Call brand_tracker first for brand-specific queries.\n\n### RULE: DashboardAwareness\n- Direct users to https://app.fodda.ai for account/team/graph settings.";
17
+ export declare const FALLBACK_GRAPH_SECTIONS = "---\nid: FODDA-FALLBACK-GRAPHS-001\ntitle: Fodda Fallback Graph Sections\nversion: 2.0.0\ncompliance: RFC-2119\n---\n\n### TOKEN: FallbackGraphNames\n- graphId \"retail\" \u2192 \"PSFK's Retail Graph\"\n- graphId \"fashion\" \u2192 \"PSFK's Fashion Graph\"\n- graphId \"beauty\" \u2192 \"PSFK's Beauty Graph\"\n- graphId \"sports\" \u2192 \"PSFK's Sports Graph\"\n- graphId \"sic\" \u2192 \"Ben Dietz's SIC graph\" or \"the SIC (Strategy, Innovation, Culture) graph\"\n- graphId \"pew\" \u2192 \"Pew Research data\"\n- graphId \"pwc/sxsw-2026-key-insights\" \u2192 \"PwC's SXSW 2026 Key Insights\"\n- graphId \"green-house/thrive-report\" \u2192 \"The Craft Graph (Thrive Report)\"\n- graphId \"delta/the-connection-index\" \u2192 \"Delta's The Connection Index\"\n\n### TOKEN: FallbackGraphTypes\n- CURATED GRAPHS: Expert-curated by PSFK (Retail, Fashion, Beauty, Sports) and partners (SIC, Pew).\n- EXPERT GRAPHS: Domain-specific knowledge graphs built from expert reports.\n- COMMUNITY PATTERN GRAPHS: Contributed by strategists via Google Sheets.\n\n### RULE: FallbackExpertGraphRouting\n- For \"Technology trends\", query \"pwc/sxsw-2026-key-insights\".\n- For \"On-premise beverage marketing\", query \"green-house/thrive-report\".\n- For \"Air travel trends\", query \"delta/the-connection-index\".\n\n### RULE: FallbackSupplementalAccess\n- The API handles access control. Call relevant supplemental tool.\n\n### RULE: FallbackExpertGraphWorkflow\n- Expert graphs contain Trend nodes with rich evidence. Use search_statistics and search_insights on expert graphs.";
18
+ export declare const BRAND_INTELLIGENCE_RENDERING_SPEC = "---\nid: FODDA-BRAND-INTEL-SPEC-001\ntitle: Brand Intelligence Rendering Spec v5\nversion: 5.0.0\ncompliance: RFC-2119\n---\n\n### RECORD: BrandIntelligenceProfile\n- brand: String\n- summary: Object { velocity: Enum(accelerating, steady, slowing), one_liner: String (max 30 words editorial claim) }\n- cross_graph_presence: List[String]\n- trend_footprint: List[TrendSummary]\n- weak_signals: List[TrendSummary]\n- evidence_items: List[EvidenceItem]\n- competitive_context: Object { co_occurring: List[CompetitorItem] }\n- geographic_distribution: List[PlaceItem]\n- supplemental_signals: Object { google_trends: Object, wikipedia: List[Object], amazon: Object }\n- earningsIntelligence: List[EarningsItem]\n- suggested_next_prompts: List[String] (max 10 words each)\n\n### RULE: TrendsTabRendering\n- Lifecycle bar: stacked proportional segments, 8px height, colored by state.\n- Card: trend name | lifecycle badge | Viz button | Explore button.\n- Viz button: In-widget, on click inject sparkline SVG (300x72 viewBox). Shape:\n - accelerating: curves upward, annotated \"\u2191 accelerating\"\n - peak-then-plateau: rises then flattens, annotated \"peak Q4\"\n - emerging: flat then sudden rise, annotated \"\u2191 new signal\"\n - new-signal: flat until right then spike, annotated \"just appeared\"\n- Explore button: Out-of-widget, sends prompt.\n- Weak signals: Dimmed (opacity 0.75), no Viz/Explore buttons.\n\n### RULE: EvidenceTabRendering\n- Card: title (hyperlinked), excerpt, badges (category, graph_name, date, place), citation line.\n- Image: display full-width header image if present, no placeholder if null.\n- Badge colors: Case Study (info blue), Signal (purple-light), Metric (success green), Quote (warning amber), Interpretation (secondary grey).\n\n### RULE: CompetitiveTabRendering\n- Sub-tabs: \"List\" and \"Network\".\n- List view: cards with competitor name, pressure type badge, View button.\n- Pressure badge colors:\n - Direct / Heritage / Sibling \u2192 #D97B2B\n - Premium challenger \u2192 #2E6BE5\n - Co-creation / Tech partner \u2192 #3A8F5C\n - Culture collaborator \u2192 #C94F7A\n - Crossover / Category shadow \u2192 #7C6AB5\n- Network view: SVG diagram. Brand center node (#663399 stroke, radius 30-34px). Competitors orbit.\n- SVG text style: Embed <style> block, class=\"svgt\" with monospace font stack. Do not use raw font-family=\"monospace\".\n- Legend: Bottom-left quadrant.\n\n### RULE: MarketTabRendering\n- Google Trends: 300x96 viewBox, area gradient fill, peak/latest annotations, caption below.\n- Wikipedia: Comparison bar chart.\n- Amazon: 2x2 grid, product cards, no images (CDN blocked).\n- Earnings: Render if present. If user query specifies earnings, show FIRST in Market tab.\n- Geographic spread: Horizontal bars.\n\n### RULE: ExportTabRendering\n- Action buttons: Editorial brief, Head-to-head, Weak signal, Steal this idea.\n\n### RULE: PerformanceRules\n- HTML target < 12KB.\n- No inline onclick \u2014 use addEventListener or data-p.\n- Sparklines inject on demand.\n- Tab switching uses classList toggle only.";
19
+ export declare const FODDA_WIDGET_DESIGN_BRIEF = "---\nid: FODDA-WIDGET-DESIGN-001\ntitle: Fodda Widget Design Brief\nversion: 2.0.0\ncompliance: RFC-2119\n---\n\n### RECORD: DesignSystemTokens\n- BRAND: accent #663399, light bg #F5F0FF, border #9B72CC\n- CONTAINER: 1.5px solid #663399, border-radius 12px, padding 1.25rem, font-family var(--font-mono)\n- HEADER: Fodda logo (24px) + \"Live\" status dot. No graph names.\n- CARDS: 0.5px border, 12px radius, 1rem padding.\n- BADGES: 10px, 20px radius. Graph name: purple-light (#F5F0FF text #663399). Lifecycle: Building=info, Emerging=success, Mature=secondary, Fading=warning.\n- BUTTONS: Out-of-widget (\u2197): #F5F0FF bg, #663399 text. In-widget: no bg, muted border/text.\n- FOOTER: Source pills (purple-light) + top border separator.\n- RESTRICTIONS: Do NOT show evidence/trend/graph counts as standalone metrics, data warnings, or source names in badge rows.";
20
+ export declare function buildSystemPrompt(accountProfile?: AccountProfile, enabledSkills?: Array<{
21
+ id: string;
22
+ name: string;
23
+ interactiveTools?: string[];
24
+ costPerCall?: number;
25
+ }>, isTrial?: boolean, entryId?: string): string;
26
+ //# sourceMappingURL=systemPrompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemPrompt.d.ts","sourceRoot":"","sources":["../src/systemPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,MAAM,WAAW,cAAc;IAC3B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD,eAAO,MAAM,uBAAuB,q2kBA6RoC,CAAC;AAMzE,eAAO,MAAM,uBAAuB,wiDAgCgF,CAAC;AAMrH,eAAO,MAAM,iCAAiC,qhGA+DF,CAAC;AAK7C,eAAO,MAAM,yBAAyB,w2BAeuF,CAAC;AAM9H,wBAAgB,iBAAiB,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,OAAO,GAAE,OAAe,EAAE,OAAO,GAAE,MAAW,GAAG,MAAM,CAiIjO"}