@tpitre/story-ui 3.4.0 → 3.4.1

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 (282) hide show
  1. package/dist/cli/index.js +0 -0
  2. package/dist/mcp-server/index.js +32 -0
  3. package/package.json +2 -1
  4. package/dist/cli/index.js.map +0 -1
  5. package/dist/cli/setup.js.map +0 -1
  6. package/dist/cloudflare-edge/src/mcp-session.js +0 -462
  7. package/dist/cloudflare-edge/src/types.js +0 -4
  8. package/dist/cloudflare-edge/src/worker.js +0 -106
  9. package/dist/cloudflare-pages/vite.config.js +0 -14
  10. package/dist/index.d.ts +0 -13
  11. package/dist/index.d.ts.map +0 -1
  12. package/dist/index.js +0 -12
  13. package/dist/index.js.map +0 -1
  14. package/dist/mcp-server/index.js.map +0 -1
  15. package/dist/mcp-server/mcp-stdio-server.js.map +0 -1
  16. package/dist/mcp-server/routes/claude.js.map +0 -1
  17. package/dist/mcp-server/routes/components.js.map +0 -1
  18. package/dist/mcp-server/routes/generateStory.js.map +0 -1
  19. package/dist/mcp-server/routes/hybridStories.d.ts +0 -18
  20. package/dist/mcp-server/routes/hybridStories.d.ts.map +0 -1
  21. package/dist/mcp-server/routes/hybridStories.js +0 -216
  22. package/dist/mcp-server/routes/hybridStories.js.map +0 -1
  23. package/dist/mcp-server/routes/memoryStories.d.ts +0 -26
  24. package/dist/mcp-server/routes/memoryStories.d.ts.map +0 -1
  25. package/dist/mcp-server/routes/memoryStories.js +0 -158
  26. package/dist/mcp-server/routes/memoryStories.js.map +0 -1
  27. package/dist/mcp-server/routes/storySync.d.ts +0 -26
  28. package/dist/mcp-server/routes/storySync.d.ts.map +0 -1
  29. package/dist/mcp-server/routes/storySync.js +0 -147
  30. package/dist/mcp-server/routes/storySync.js.map +0 -1
  31. package/dist/mcp-server/routes/updateStory.js +0 -246
  32. package/dist/mcp-server/sessionManager.d.ts +0 -50
  33. package/dist/mcp-server/sessionManager.d.ts.map +0 -1
  34. package/dist/mcp-server/sessionManager.js +0 -125
  35. package/dist/mcp-server/sessionManager.js.map +0 -1
  36. package/dist/playground/components/AIAssistant/AIAssistant.d.ts +0 -6
  37. package/dist/playground/components/AIAssistant/AIAssistant.d.ts.map +0 -1
  38. package/dist/playground/components/AIAssistant/AIAssistant.js +0 -109
  39. package/dist/playground/components/AIAssistant/AIAssistant.js.map +0 -1
  40. package/dist/playground/components/AIAssistant/AIAssistant.module.css +0 -166
  41. package/dist/playground/components/Canvas/Canvas.d.ts +0 -9
  42. package/dist/playground/components/Canvas/Canvas.d.ts.map +0 -1
  43. package/dist/playground/components/Canvas/Canvas.js +0 -58
  44. package/dist/playground/components/Canvas/Canvas.js.map +0 -1
  45. package/dist/playground/components/Canvas/Canvas.module.css +0 -189
  46. package/dist/playground/components/Canvas/CanvasWithDnd.d.ts +0 -9
  47. package/dist/playground/components/Canvas/CanvasWithDnd.d.ts.map +0 -1
  48. package/dist/playground/components/Canvas/CanvasWithDnd.js +0 -158
  49. package/dist/playground/components/Canvas/CanvasWithDnd.js.map +0 -1
  50. package/dist/playground/components/Canvas/ComponentRenderer.d.ts +0 -15
  51. package/dist/playground/components/Canvas/ComponentRenderer.d.ts.map +0 -1
  52. package/dist/playground/components/Canvas/ComponentRenderer.js +0 -177
  53. package/dist/playground/components/Canvas/ComponentRenderer.js.map +0 -1
  54. package/dist/playground/components/Canvas/DraggableComponent.d.ts +0 -15
  55. package/dist/playground/components/Canvas/DraggableComponent.d.ts.map +0 -1
  56. package/dist/playground/components/Canvas/DraggableComponent.js +0 -49
  57. package/dist/playground/components/Canvas/DraggableComponent.js.map +0 -1
  58. package/dist/playground/components/Canvas/index.d.ts +0 -9
  59. package/dist/playground/components/Canvas/index.d.ts.map +0 -1
  60. package/dist/playground/components/Canvas/index.js +0 -5
  61. package/dist/playground/components/Canvas/index.js.map +0 -1
  62. package/dist/playground/components/CodeView/CodeView.d.ts +0 -12
  63. package/dist/playground/components/CodeView/CodeView.d.ts.map +0 -1
  64. package/dist/playground/components/CodeView/CodeView.js +0 -77
  65. package/dist/playground/components/CodeView/CodeView.js.map +0 -1
  66. package/dist/playground/components/CodeView/CodeView.module.css +0 -178
  67. package/dist/playground/components/ComponentPalette/ComponentPalette.d.ts +0 -17
  68. package/dist/playground/components/ComponentPalette/ComponentPalette.d.ts.map +0 -1
  69. package/dist/playground/components/ComponentPalette/ComponentPalette.js +0 -138
  70. package/dist/playground/components/ComponentPalette/ComponentPalette.js.map +0 -1
  71. package/dist/playground/components/ComponentPalette/ComponentPalette.module.css +0 -217
  72. package/dist/playground/components/ComponentPalette/index.d.ts +0 -3
  73. package/dist/playground/components/ComponentPalette/index.d.ts.map +0 -1
  74. package/dist/playground/components/ComponentPalette/index.js +0 -2
  75. package/dist/playground/components/ComponentPalette/index.js.map +0 -1
  76. package/dist/playground/components/DropZone/DropZone.d.ts +0 -17
  77. package/dist/playground/components/DropZone/DropZone.d.ts.map +0 -1
  78. package/dist/playground/components/DropZone/DropZone.js +0 -73
  79. package/dist/playground/components/DropZone/DropZone.js.map +0 -1
  80. package/dist/playground/components/DropZone/DropZone.module.css +0 -86
  81. package/dist/playground/components/ExportDialog/ExportDialog.d.ts +0 -10
  82. package/dist/playground/components/ExportDialog/ExportDialog.d.ts.map +0 -1
  83. package/dist/playground/components/ExportDialog/ExportDialog.js +0 -57
  84. package/dist/playground/components/ExportDialog/ExportDialog.js.map +0 -1
  85. package/dist/playground/components/ExportDialog/ExportDialog.module.css +0 -328
  86. package/dist/playground/components/LayoutHelpers/LayoutHelpers.d.ts +0 -134
  87. package/dist/playground/components/LayoutHelpers/LayoutHelpers.d.ts.map +0 -1
  88. package/dist/playground/components/LayoutHelpers/LayoutHelpers.js +0 -254
  89. package/dist/playground/components/LayoutHelpers/LayoutHelpers.js.map +0 -1
  90. package/dist/playground/components/LayoutHelpers/index.d.ts +0 -3
  91. package/dist/playground/components/LayoutHelpers/index.d.ts.map +0 -1
  92. package/dist/playground/components/LayoutHelpers/index.js +0 -2
  93. package/dist/playground/components/LayoutHelpers/index.js.map +0 -1
  94. package/dist/playground/components/Playground/Playground.d.ts +0 -10
  95. package/dist/playground/components/Playground/Playground.d.ts.map +0 -1
  96. package/dist/playground/components/Playground/Playground.js +0 -128
  97. package/dist/playground/components/Playground/Playground.js.map +0 -1
  98. package/dist/playground/components/Playground/Playground.module.css +0 -308
  99. package/dist/playground/components/PropertiesPanel/PropertiesPanel.d.ts +0 -10
  100. package/dist/playground/components/PropertiesPanel/PropertiesPanel.d.ts.map +0 -1
  101. package/dist/playground/components/PropertiesPanel/PropertiesPanel.js +0 -150
  102. package/dist/playground/components/PropertiesPanel/PropertiesPanel.js.map +0 -1
  103. package/dist/playground/components/PropertiesPanel/PropertiesPanel.module.css +0 -155
  104. package/dist/playground/components/PropertiesPanel/index.d.ts +0 -3
  105. package/dist/playground/components/PropertiesPanel/index.d.ts.map +0 -1
  106. package/dist/playground/components/PropertiesPanel/index.js +0 -2
  107. package/dist/playground/components/PropertiesPanel/index.js.map +0 -1
  108. package/dist/playground/components/PropertyEditors/BooleanEditor.d.ts +0 -12
  109. package/dist/playground/components/PropertyEditors/BooleanEditor.d.ts.map +0 -1
  110. package/dist/playground/components/PropertyEditors/BooleanEditor.js +0 -14
  111. package/dist/playground/components/PropertyEditors/BooleanEditor.js.map +0 -1
  112. package/dist/playground/components/PropertyEditors/ColorEditor.d.ts +0 -12
  113. package/dist/playground/components/PropertyEditors/ColorEditor.d.ts.map +0 -1
  114. package/dist/playground/components/PropertyEditors/ColorEditor.js +0 -62
  115. package/dist/playground/components/PropertyEditors/ColorEditor.js.map +0 -1
  116. package/dist/playground/components/PropertyEditors/IconEditor.d.ts +0 -12
  117. package/dist/playground/components/PropertyEditors/IconEditor.d.ts.map +0 -1
  118. package/dist/playground/components/PropertyEditors/IconEditor.js +0 -123
  119. package/dist/playground/components/PropertyEditors/IconEditor.js.map +0 -1
  120. package/dist/playground/components/PropertyEditors/NumberEditor.d.ts +0 -15
  121. package/dist/playground/components/PropertyEditors/NumberEditor.d.ts.map +0 -1
  122. package/dist/playground/components/PropertyEditors/NumberEditor.js +0 -46
  123. package/dist/playground/components/PropertyEditors/NumberEditor.js.map +0 -1
  124. package/dist/playground/components/PropertyEditors/PropertyEditors.module.css +0 -432
  125. package/dist/playground/components/PropertyEditors/SelectEditor.d.ts +0 -19
  126. package/dist/playground/components/PropertyEditors/SelectEditor.d.ts.map +0 -1
  127. package/dist/playground/components/PropertyEditors/SelectEditor.js +0 -17
  128. package/dist/playground/components/PropertyEditors/SelectEditor.js.map +0 -1
  129. package/dist/playground/components/PropertyEditors/SpacingEditor.d.ts +0 -19
  130. package/dist/playground/components/PropertyEditors/SpacingEditor.d.ts.map +0 -1
  131. package/dist/playground/components/PropertyEditors/SpacingEditor.js +0 -162
  132. package/dist/playground/components/PropertyEditors/SpacingEditor.js.map +0 -1
  133. package/dist/playground/components/PropertyEditors/SpacingEditor.module.css +0 -214
  134. package/dist/playground/components/PropertyEditors/TextEditor.d.ts +0 -14
  135. package/dist/playground/components/PropertyEditors/TextEditor.d.ts.map +0 -1
  136. package/dist/playground/components/PropertyEditors/TextEditor.js +0 -38
  137. package/dist/playground/components/PropertyEditors/TextEditor.js.map +0 -1
  138. package/dist/playground/components/PropertyEditors/TokenEditor.d.ts +0 -23
  139. package/dist/playground/components/PropertyEditors/TokenEditor.d.ts.map +0 -1
  140. package/dist/playground/components/PropertyEditors/TokenEditor.js +0 -50
  141. package/dist/playground/components/PropertyEditors/TokenEditor.js.map +0 -1
  142. package/dist/playground/components/PropertyEditors/index.d.ts +0 -20
  143. package/dist/playground/components/PropertyEditors/index.d.ts.map +0 -1
  144. package/dist/playground/components/PropertyEditors/index.js +0 -12
  145. package/dist/playground/components/PropertyEditors/index.js.map +0 -1
  146. package/dist/playground/components/TreeView/TreeView.d.ts +0 -10
  147. package/dist/playground/components/TreeView/TreeView.d.ts.map +0 -1
  148. package/dist/playground/components/TreeView/TreeView.js +0 -146
  149. package/dist/playground/components/TreeView/TreeView.js.map +0 -1
  150. package/dist/playground/components/TreeView/TreeView.module.css +0 -214
  151. package/dist/playground/components/TreeView/index.d.ts +0 -3
  152. package/dist/playground/components/TreeView/index.d.ts.map +0 -1
  153. package/dist/playground/components/TreeView/index.js +0 -2
  154. package/dist/playground/components/TreeView/index.js.map +0 -1
  155. package/dist/playground/config/propertyDefinitions.d.ts +0 -73
  156. package/dist/playground/config/propertyDefinitions.d.ts.map +0 -1
  157. package/dist/playground/config/propertyDefinitions.js +0 -809
  158. package/dist/playground/config/propertyDefinitions.js.map +0 -1
  159. package/dist/playground/hooks/useKeyboardShortcuts.d.ts +0 -38
  160. package/dist/playground/hooks/useKeyboardShortcuts.d.ts.map +0 -1
  161. package/dist/playground/hooks/useKeyboardShortcuts.js +0 -191
  162. package/dist/playground/hooks/useKeyboardShortcuts.js.map +0 -1
  163. package/dist/playground/index.d.ts +0 -21
  164. package/dist/playground/index.d.ts.map +0 -1
  165. package/dist/playground/index.js +0 -23
  166. package/dist/playground/index.js.map +0 -1
  167. package/dist/playground/services/CodeGenerator.d.ts +0 -73
  168. package/dist/playground/services/CodeGenerator.d.ts.map +0 -1
  169. package/dist/playground/services/CodeGenerator.js +0 -359
  170. package/dist/playground/services/CodeGenerator.js.map +0 -1
  171. package/dist/playground/services/DragDropManager.d.ts +0 -95
  172. package/dist/playground/services/DragDropManager.d.ts.map +0 -1
  173. package/dist/playground/services/DragDropManager.js +0 -408
  174. package/dist/playground/services/DragDropManager.js.map +0 -1
  175. package/dist/playground/services/StoryParser.d.ts +0 -73
  176. package/dist/playground/services/StoryParser.d.ts.map +0 -1
  177. package/dist/playground/services/StoryParser.js +0 -419
  178. package/dist/playground/services/StoryParser.js.map +0 -1
  179. package/dist/playground/store/playgroundStore.d.ts +0 -86
  180. package/dist/playground/store/playgroundStore.d.ts.map +0 -1
  181. package/dist/playground/store/playgroundStore.js +0 -337
  182. package/dist/playground/store/playgroundStore.js.map +0 -1
  183. package/dist/playground/stories/PlaygroundDragDrop.stories.d.ts +0 -13
  184. package/dist/playground/stories/PlaygroundDragDrop.stories.d.ts.map +0 -1
  185. package/dist/playground/stories/PlaygroundDragDrop.stories.js +0 -227
  186. package/dist/playground/stories/PlaygroundDragDrop.stories.js.map +0 -1
  187. package/dist/playground/stories/PlaygroundPhase4.stories.d.ts +0 -13
  188. package/dist/playground/stories/PlaygroundPhase4.stories.d.ts.map +0 -1
  189. package/dist/playground/stories/PlaygroundPhase4.stories.js +0 -334
  190. package/dist/playground/stories/PlaygroundPhase4.stories.js.map +0 -1
  191. package/dist/playground/stories/PlaygroundPhase5.stories.d.ts +0 -14
  192. package/dist/playground/stories/PlaygroundPhase5.stories.d.ts.map +0 -1
  193. package/dist/playground/stories/PlaygroundPhase5.stories.js +0 -512
  194. package/dist/playground/stories/PlaygroundPhase5.stories.js.map +0 -1
  195. package/dist/playground/stories/PlaygroundProperties.stories.d.ts +0 -13
  196. package/dist/playground/stories/PlaygroundProperties.stories.d.ts.map +0 -1
  197. package/dist/playground/stories/PlaygroundProperties.stories.js +0 -342
  198. package/dist/playground/stories/PlaygroundProperties.stories.js.map +0 -1
  199. package/dist/playground/types/index.d.ts +0 -251
  200. package/dist/playground/types/index.d.ts.map +0 -1
  201. package/dist/playground/types/index.js +0 -5
  202. package/dist/playground/types/index.js.map +0 -1
  203. package/dist/scripts/verify-framework-adapters.js +0 -105
  204. package/dist/story-generator/componentBlacklist.js.map +0 -1
  205. package/dist/story-generator/componentDiscovery.js.map +0 -1
  206. package/dist/story-generator/configLoader.js.map +0 -1
  207. package/dist/story-generator/considerationsLoader.js.map +0 -1
  208. package/dist/story-generator/documentation-sources.js.map +0 -1
  209. package/dist/story-generator/documentationLoader.js.map +0 -1
  210. package/dist/story-generator/dynamicPackageDiscovery.js.map +0 -1
  211. package/dist/story-generator/enhancedComponentDiscovery.js.map +0 -1
  212. package/dist/story-generator/generateStory.js.map +0 -1
  213. package/dist/story-generator/gitignoreManager.js.map +0 -1
  214. package/dist/story-generator/inMemoryStoryService.d.ts +0 -89
  215. package/dist/story-generator/inMemoryStoryService.d.ts.map +0 -1
  216. package/dist/story-generator/inMemoryStoryService.js +0 -128
  217. package/dist/story-generator/inMemoryStoryService.js.map +0 -1
  218. package/dist/story-generator/logger.js.map +0 -1
  219. package/dist/story-generator/postProcessStory.js.map +0 -1
  220. package/dist/story-generator/postgresStoryService.d.ts +0 -56
  221. package/dist/story-generator/postgresStoryService.d.ts.map +0 -1
  222. package/dist/story-generator/postgresStoryService.js +0 -240
  223. package/dist/story-generator/productionGitignoreManager.d.ts +0 -91
  224. package/dist/story-generator/productionGitignoreManager.d.ts.map +0 -1
  225. package/dist/story-generator/productionGitignoreManager.js +0 -340
  226. package/dist/story-generator/productionGitignoreManager.js.map +0 -1
  227. package/dist/story-generator/promptGenerator.js.map +0 -1
  228. package/dist/story-generator/providerPresets.d.ts +0 -54
  229. package/dist/story-generator/providerPresets.d.ts.map +0 -1
  230. package/dist/story-generator/providerPresets.js +0 -214
  231. package/dist/story-generator/storyHistory.js.map +0 -1
  232. package/dist/story-generator/storyServiceFactory.d.ts +0 -22
  233. package/dist/story-generator/storyServiceFactory.d.ts.map +0 -1
  234. package/dist/story-generator/storyServiceFactory.js +0 -97
  235. package/dist/story-generator/storyServiceInterface.d.ts +0 -85
  236. package/dist/story-generator/storyServiceInterface.d.ts.map +0 -1
  237. package/dist/story-generator/storyServiceInterface.js +0 -5
  238. package/dist/story-generator/storySync.d.ts +0 -68
  239. package/dist/story-generator/storySync.d.ts.map +0 -1
  240. package/dist/story-generator/storySync.js +0 -201
  241. package/dist/story-generator/storySync.js.map +0 -1
  242. package/dist/story-generator/storyTracker.js.map +0 -1
  243. package/dist/story-generator/storyValidator.js.map +0 -1
  244. package/dist/story-generator/test_validation.d.ts +0 -2
  245. package/dist/story-generator/test_validation.d.ts.map +0 -1
  246. package/dist/story-generator/test_validation.js +0 -51
  247. package/dist/story-generator/universalDesignSystemAdapter.js.map +0 -1
  248. package/dist/story-generator/urlRedirectService.js.map +0 -1
  249. package/dist/story-generator/validateStory.js.map +0 -1
  250. package/dist/story-ui.config.js.map +0 -1
  251. package/dist/story-ui.config.loader.d.ts +0 -36
  252. package/dist/story-ui.config.loader.d.ts.map +0 -1
  253. package/dist/story-ui.config.loader.js +0 -205
  254. package/dist/story-ui.config.loader.js.map +0 -1
  255. package/dist/temp/package/templates/StoryUI/StoryUIPanel.js +0 -807
  256. package/dist/temp/package/templates/StoryUI/StoryUIPanel.stories.js +0 -37
  257. package/dist/temp/package/templates/StoryUI/index.js +0 -2
  258. package/dist/templates/StoryUI/StoryUIPanel.js.map +0 -1
  259. package/dist/templates/StoryUI/StoryUIPanel.stories.js.map +0 -1
  260. package/dist/templates/StoryUI/index.js.map +0 -1
  261. package/dist/templates/StoryUI/manager.d.ts +0 -14
  262. package/dist/templates/StoryUI/manager.d.ts.map +0 -1
  263. package/dist/templates/production-app/src/App.d.ts +0 -10
  264. package/dist/templates/production-app/src/App.d.ts.map +0 -1
  265. package/dist/templates/production-app/src/App.js +0 -653
  266. package/dist/templates/production-app/src/LivePreviewRenderer.d.ts +0 -24
  267. package/dist/templates/production-app/src/LivePreviewRenderer.d.ts.map +0 -1
  268. package/dist/templates/production-app/src/LivePreviewRenderer.js +0 -199
  269. package/dist/templates/production-app/src/componentRegistry.d.ts +0 -20
  270. package/dist/templates/production-app/src/componentRegistry.d.ts.map +0 -1
  271. package/dist/templates/production-app/src/componentRegistry.js +0 -316
  272. package/dist/templates/production-app/src/main.d.ts +0 -9
  273. package/dist/templates/production-app/src/main.d.ts.map +0 -1
  274. package/dist/templates/production-app/src/main.js +0 -18
  275. package/dist/templates/production-app/vite.config.d.ts +0 -3
  276. package/dist/templates/production-app/vite.config.d.ts.map +0 -1
  277. package/dist/templates/production-app/vite.config.js +0 -71
  278. package/dist/test-storybooks/angular-material-storybook/src/main.js +0 -66
  279. package/dist/test-storybooks/chakra-storybook/vite.config.js +0 -6
  280. package/dist/test-storybooks/mantine-storybook/vite.config.js +0 -93
  281. package/dist/test-storybooks/web-components-shoelace/vite.config.js +0 -9
  282. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,158 +0,0 @@
1
- import { getStoryService, getStorageType } from '../../story-generator/storyServiceFactory.js';
2
- import { loadUserConfig } from '../../story-generator/configLoader.js';
3
- /**
4
- * Get all stories metadata
5
- */
6
- export async function getStoriesMetadata(req, res) {
7
- try {
8
- const config = loadUserConfig();
9
- const storyService = await getStoryService(config);
10
- const metadata = await storyService.getStoryMetadata();
11
- res.json({
12
- success: true,
13
- stories: metadata,
14
- count: metadata.length,
15
- storage: getStorageType()
16
- });
17
- }
18
- catch (error) {
19
- console.error('Error in getStoriesMetadata:', error);
20
- res.status(500).json({
21
- success: false,
22
- error: 'Failed to retrieve stories metadata'
23
- });
24
- }
25
- }
26
- /**
27
- * Get a specific story by ID
28
- */
29
- export async function getStoryById(req, res) {
30
- try {
31
- const { id } = req.params;
32
- const config = loadUserConfig();
33
- const storyService = await getStoryService(config);
34
- const story = await storyService.getStory(id);
35
- if (!story) {
36
- return res.status(404).json({
37
- success: false,
38
- error: 'Story not found'
39
- });
40
- }
41
- res.json({
42
- success: true,
43
- story,
44
- storage: getStorageType()
45
- });
46
- }
47
- catch (error) {
48
- console.error('Error in getStoryById:', error);
49
- res.status(500).json({
50
- success: false,
51
- error: 'Failed to retrieve story'
52
- });
53
- }
54
- }
55
- /**
56
- * Get story content for Storybook integration
57
- */
58
- export async function getStoryContent(req, res) {
59
- try {
60
- const { id } = req.params;
61
- const config = loadUserConfig();
62
- const storyService = await getStoryService(config);
63
- const content = await storyService.getStoryContent(id);
64
- if (!content) {
65
- return res.status(404).json({
66
- success: false,
67
- error: 'Story content not found'
68
- });
69
- }
70
- // Return as TypeScript/JSX content
71
- res.setHeader('Content-Type', 'text/plain');
72
- res.send(content);
73
- }
74
- catch (error) {
75
- console.error('Error in getStoryContent:', error);
76
- res.status(500).json({
77
- success: false,
78
- error: 'Failed to retrieve story content'
79
- });
80
- }
81
- }
82
- /**
83
- * Delete a story by ID
84
- */
85
- export async function deleteStory(req, res) {
86
- try {
87
- const { id } = req.params;
88
- const config = loadUserConfig();
89
- const storyService = await getStoryService(config);
90
- const deleted = await storyService.deleteStory(id);
91
- if (!deleted) {
92
- return res.status(404).json({
93
- success: false,
94
- error: 'Story not found'
95
- });
96
- }
97
- res.json({
98
- success: true,
99
- message: 'Story deleted successfully',
100
- storage: getStorageType()
101
- });
102
- }
103
- catch (error) {
104
- console.error('Error in deleteStory:', error);
105
- res.status(500).json({
106
- success: false,
107
- error: 'Failed to delete story'
108
- });
109
- }
110
- }
111
- /**
112
- * Clear all stories
113
- */
114
- export async function clearAllStories(req, res) {
115
- try {
116
- const config = loadUserConfig();
117
- const storyService = await getStoryService(config);
118
- await storyService.clearAllStories();
119
- res.json({
120
- success: true,
121
- message: 'All stories cleared successfully',
122
- storage: getStorageType()
123
- });
124
- }
125
- catch (error) {
126
- console.error('Error in clearAllStories:', error);
127
- res.status(500).json({
128
- success: false,
129
- error: 'Failed to clear stories'
130
- });
131
- }
132
- }
133
- /**
134
- * Get storage usage statistics
135
- */
136
- export async function getMemoryStats(req, res) {
137
- try {
138
- const config = loadUserConfig();
139
- const storyService = await getStoryService(config);
140
- const stats = await storyService.getStorageStats();
141
- res.json({
142
- success: true,
143
- stats: {
144
- ...stats,
145
- totalSizeMB: Math.round(stats.totalSizeBytes / 1024 / 1024 * 100) / 100,
146
- averageSizeKB: Math.round(stats.averageSizeBytes / 1024 * 100) / 100
147
- },
148
- storage: getStorageType()
149
- });
150
- }
151
- catch (error) {
152
- console.error('Error in getMemoryStats:', error);
153
- res.status(500).json({
154
- success: false,
155
- error: 'Failed to retrieve storage statistics'
156
- });
157
- }
158
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"memoryStories.js","sourceRoot":"","sources":["../../../mcp-server/routes/memoryStories.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,uCA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BACL,GAAG,KAAK;gBACR,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG;gBACvE,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG;aACrE;SACF,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,sCAAsC;SAC9C,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1,26 +0,0 @@
1
- import { Request, Response } from 'express';
2
- /**
3
- * Get all synchronized stories (from both file system and memory)
4
- */
5
- export declare function getSyncedStories(req: Request, res: Response): Promise<void>;
6
- /**
7
- * Delete a story from both file system and memory
8
- */
9
- export declare function deleteSyncedStory(req: Request, res: Response): Promise<Response<any, Record<string, any>> | undefined>;
10
- /**
11
- * Clear all stories from both file system and memory
12
- */
13
- export declare function clearAllSyncedStories(req: Request, res: Response): Promise<void>;
14
- /**
15
- * Sync chat history with actual stories
16
- */
17
- export declare function syncChatHistory(req: Request, res: Response): Promise<void>;
18
- /**
19
- * Validate that a chat session corresponds to an actual story
20
- */
21
- export declare function validateChatSession(req: Request, res: Response): Promise<void>;
22
- /**
23
- * Get a specific synced story by ID
24
- */
25
- export declare function getSyncedStoryById(req: Request, res: Response): Promise<Response<any, Record<string, any>> | undefined>;
26
- //# sourceMappingURL=storySync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storySync.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/storySync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI5C;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,iBAyBjE;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,2DAwBlE;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,iBAgBtE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,iBAgBhE;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,iBAkBpE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,2DAwBnE"}
@@ -1,147 +0,0 @@
1
- import { getStorySyncService } from '../../story-generator/storySync.js';
2
- import { loadUserConfig } from '../../story-generator/configLoader.js';
3
- /**
4
- * Get all synchronized stories (from both file system and memory)
5
- */
6
- export async function getSyncedStories(req, res) {
7
- try {
8
- const config = loadUserConfig();
9
- const syncService = getStorySyncService(config);
10
- const stories = await syncService.getAllStories();
11
- res.json({
12
- success: true,
13
- stories: stories.map(story => ({
14
- id: story.id,
15
- title: story.title,
16
- fileName: story.fileName,
17
- description: story.description,
18
- createdAt: story.createdAt,
19
- lastAccessed: story.lastAccessed,
20
- source: story.source
21
- })),
22
- count: stories.length
23
- });
24
- }
25
- catch (error) {
26
- res.status(500).json({
27
- success: false,
28
- error: 'Failed to retrieve synchronized stories'
29
- });
30
- }
31
- }
32
- /**
33
- * Delete a story from both file system and memory
34
- */
35
- export async function deleteSyncedStory(req, res) {
36
- try {
37
- const { id } = req.params;
38
- const config = loadUserConfig();
39
- const syncService = getStorySyncService(config);
40
- const deleted = await syncService.deleteStory(id);
41
- if (!deleted) {
42
- return res.status(404).json({
43
- success: false,
44
- error: 'Story not found'
45
- });
46
- }
47
- res.json({
48
- success: true,
49
- message: 'Story deleted successfully from all sources'
50
- });
51
- }
52
- catch (error) {
53
- res.status(500).json({
54
- success: false,
55
- error: 'Failed to delete story'
56
- });
57
- }
58
- }
59
- /**
60
- * Clear all stories from both file system and memory
61
- */
62
- export async function clearAllSyncedStories(req, res) {
63
- try {
64
- const config = loadUserConfig();
65
- const syncService = getStorySyncService(config);
66
- await syncService.clearAllStories();
67
- res.json({
68
- success: true,
69
- message: 'All stories cleared successfully'
70
- });
71
- }
72
- catch (error) {
73
- res.status(500).json({
74
- success: false,
75
- error: 'Failed to clear stories'
76
- });
77
- }
78
- }
79
- /**
80
- * Sync chat history with actual stories
81
- */
82
- export async function syncChatHistory(req, res) {
83
- try {
84
- const config = loadUserConfig();
85
- const syncService = getStorySyncService(config);
86
- const syncResult = await syncService.syncChatHistory();
87
- res.json({
88
- success: true,
89
- ...syncResult
90
- });
91
- }
92
- catch (error) {
93
- res.status(500).json({
94
- success: false,
95
- error: 'Failed to sync chat history'
96
- });
97
- }
98
- }
99
- /**
100
- * Validate that a chat session corresponds to an actual story
101
- */
102
- export async function validateChatSession(req, res) {
103
- try {
104
- const { id } = req.params;
105
- const config = loadUserConfig();
106
- const syncService = getStorySyncService(config);
107
- const isValid = await syncService.validateChatSession(id);
108
- res.json({
109
- success: true,
110
- isValid,
111
- message: isValid ? 'Chat session is valid' : 'Chat session has no corresponding story'
112
- });
113
- }
114
- catch (error) {
115
- res.status(500).json({
116
- success: false,
117
- error: 'Failed to validate chat session'
118
- });
119
- }
120
- }
121
- /**
122
- * Get a specific synced story by ID
123
- */
124
- export async function getSyncedStoryById(req, res) {
125
- try {
126
- const { id } = req.params;
127
- const config = loadUserConfig();
128
- const syncService = getStorySyncService(config);
129
- const story = await syncService.getStory(id);
130
- if (!story) {
131
- return res.status(404).json({
132
- success: false,
133
- error: 'Story not found'
134
- });
135
- }
136
- res.json({
137
- success: true,
138
- story
139
- });
140
- }
141
- catch (error) {
142
- res.status(500).json({
143
- success: false,
144
- error: 'Failed to retrieve story'
145
- });
146
- }
147
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"storySync.js","sourceRoot":"","sources":["../../../mcp-server/routes/storySync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAAY,EAAE,GAAa;IAChE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;QAChC,MAAM,WAAW,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAChD,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,aAAa,EAAE,CAAC;QAElD,GAAG,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBAC7B,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,MAAM,EAAE,KAAK,CAAC,MAAM;aACrB,CAAC,CAAC;YACH,KAAK,EAAE,OAAO,CAAC,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,yCAAyC;SACjD,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,GAAY,EAAE,GAAa;IACjE,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,EA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ClE,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;QAChC,MAAM,WAAW,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAE7C,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBAC1B,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,iBAAiB;aACzB,CAAC,CAAC;QACL,CAAC;QAED,GAAG,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,IAAI;YACb,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,0BAA0B;SAClC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1,246 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { loadUserConfig } from '../../story-generator/configLoader.js';
4
- import { logger } from '../../story-generator/logger.js';
5
- /**
6
- * Update an existing story file with new content from Visual Builder
7
- * This uses the same file system access that Story UI already uses for generation
8
- */
9
- export async function updateStoryFromVisualBuilder(req, res) {
10
- const { filePath, components, storyName, fileName, createBackup = false } = req.body;
11
- if (!fileName && !filePath) {
12
- return res.status(400).json({
13
- error: 'Missing required parameters',
14
- details: 'Either fileName or filePath must be provided'
15
- });
16
- }
17
- try {
18
- // Load the Story UI configuration to get the stories path
19
- const config = loadUserConfig();
20
- // Determine the target file path - save edited stories to edited/ subdirectory
21
- let targetPath;
22
- let cleanFileName;
23
- if (filePath) {
24
- // If full path is provided, extract the filename
25
- cleanFileName = path.basename(filePath);
26
- }
27
- else {
28
- // Use fileName to construct path and ensure proper extension
29
- cleanFileName = fileName;
30
- }
31
- // Smart extension handling to prevent double .stories extensions
32
- // First, remove any existing .stories.tsx or .stories.stories.tsx patterns
33
- cleanFileName = cleanFileName
34
- .replace(/\.stories\.stories\.tsx$/, '') // Remove double extension if present
35
- .replace(/\.stories\.tsx$/, '') // Remove single extension if present
36
- .replace(/\.stories$/, ''); // Remove partial extension if present
37
- // Now add the correct extension
38
- cleanFileName = cleanFileName + '.stories.tsx';
39
- // Determine if this should be saved as an edited story
40
- const isEditedStory = cleanFileName.startsWith('edited-') ||
41
- cleanFileName.startsWith('generated-') ||
42
- req.body.isEdited === true;
43
- if (isEditedStory) {
44
- // Save edited stories to the edited/ subdirectory
45
- const editedPath = path.join(config.generatedStoriesPath, '..', 'edited');
46
- // Ensure the edited directory exists
47
- if (!fs.existsSync(editedPath)) {
48
- fs.mkdirSync(editedPath, { recursive: true });
49
- }
50
- // Smart file name handling to prevent duplicate prefixes
51
- let finalFileName = cleanFileName;
52
- // If it's a generated story being edited for the first time, convert the prefix
53
- if (cleanFileName.startsWith('generated-')) {
54
- finalFileName = cleanFileName.replace(/^generated-/, 'edited-');
55
- }
56
- // If it doesn't start with 'edited-', add the prefix (for new stories)
57
- else if (!cleanFileName.startsWith('edited-')) {
58
- finalFileName = `edited-${cleanFileName}`;
59
- }
60
- // If it already starts with 'edited-', keep it as is (re-editing existing edited story)
61
- // Check if a file already exists in the edited directory with the original name
62
- // This handles re-editing scenarios where we want to update the existing file
63
- const originalNamePath = path.join(editedPath, cleanFileName);
64
- if (fs.existsSync(originalNamePath) && !cleanFileName.startsWith('edited-')) {
65
- // Use the original filename to update the existing edited file
66
- finalFileName = cleanFileName;
67
- }
68
- targetPath = path.join(editedPath, finalFileName);
69
- }
70
- else {
71
- // Save generated stories to the main generated directory
72
- targetPath = path.join(config.generatedStoriesPath, cleanFileName);
73
- }
74
- // Optional backup creation (only if explicitly requested)
75
- if (createBackup && fs.existsSync(targetPath)) {
76
- const backupPath = targetPath.replace('.stories.tsx', '.backup.stories.tsx');
77
- fs.copyFileSync(targetPath, backupPath);
78
- logger.log(`📦 Created backup: ${backupPath}`);
79
- }
80
- logger.log(`📝 Updating story file: ${targetPath}`);
81
- logger.log(`🔍 File name resolution: ${fileName} → ${cleanFileName} → ${path.basename(targetPath)}`);
82
- // Generate the new story content from components
83
- const { generateStoryFileContent } = await import('../../visual-builder/utils/storyFileUpdater.js');
84
- const newContent = generateStoryFileContent(components, storyName || 'Updated Story', path.basename(targetPath));
85
- // Check if file exists (for updates) or create new (for saves)
86
- const fileExists = fs.existsSync(targetPath);
87
- // Write the file - always overwrite
88
- fs.writeFileSync(targetPath, newContent, 'utf-8');
89
- logger.log(`✅ Successfully ${fileExists ? 'updated' : 'created'} story file`);
90
- // Return success response
91
- res.json({
92
- success: true,
93
- filePath: targetPath,
94
- fileName: path.basename(targetPath),
95
- action: fileExists ? 'updated' : 'created',
96
- hasBackup: createBackup && fileExists,
97
- message: `Story ${fileExists ? 'updated' : 'created'} successfully`
98
- });
99
- }
100
- catch (error) {
101
- logger.log(`❌ Error updating story file: ${error.message}`);
102
- res.status(500).json({
103
- error: 'Failed to update story file',
104
- details: error.message
105
- });
106
- }
107
- }
108
- /**
109
- * Get story content for editing in Visual Builder
110
- * This allows Visual Builder to load existing stories
111
- */
112
- export async function getStoryForVisualBuilder(req, res) {
113
- const { fileName, isEdited } = req.query;
114
- if (!fileName) {
115
- return res.status(400).json({
116
- error: 'Missing fileName parameter'
117
- });
118
- }
119
- try {
120
- const config = loadUserConfig();
121
- // Clean the filename - remove any double extensions first
122
- let cleanFileName = String(fileName)
123
- .replace(/\.stories\.stories\.tsx$/, '.stories.tsx') // Fix double extension
124
- .replace(/\.stories\.tsx$/, '.stories.tsx'); // Keep single extension
125
- // If no extension, add it
126
- if (!cleanFileName.endsWith('.stories.tsx')) {
127
- if (cleanFileName.endsWith('.stories')) {
128
- cleanFileName = cleanFileName + '.tsx';
129
- }
130
- else {
131
- cleanFileName = cleanFileName + '.stories.tsx';
132
- }
133
- }
134
- const isEditedStory = isEdited === 'true' || String(fileName).startsWith('edited-');
135
- let fullPath;
136
- // Priority-based lookup: edited stories get priority in edited/ directory
137
- if (isEditedStory) {
138
- // For edited stories, check edited/ directory first
139
- const editedDir = path.join(config.generatedStoriesPath, '..', 'edited');
140
- // Try multiple filename patterns to handle existing double-extension files
141
- const filenamesToTry = [
142
- cleanFileName, // Correct format: filename.stories.tsx
143
- cleanFileName.replace('.stories.tsx', '.stories.stories.tsx'), // Double extension format
144
- ];
145
- // Check edited directory with all possible filenames
146
- for (const tryFileName of filenamesToTry) {
147
- const editedPath = path.join(editedDir, tryFileName);
148
- if (fs.existsSync(editedPath)) {
149
- fullPath = editedPath;
150
- console.log(`✅ Found edited story at: ${editedPath}`);
151
- break;
152
- }
153
- }
154
- // If not found in edited, try generated directory
155
- if (!fullPath) {
156
- const generatedPath = path.join(config.generatedStoriesPath, cleanFileName);
157
- if (fs.existsSync(generatedPath)) {
158
- fullPath = generatedPath;
159
- console.log(`⚠️ Edited story not found, falling back to generated: ${generatedPath}`);
160
- }
161
- }
162
- // If still not found, try pattern matching
163
- if (!fullPath) {
164
- const baseFileName = cleanFileName.replace('.stories.tsx', '');
165
- // Check edited directory first with pattern matching
166
- if (fs.existsSync(editedDir)) {
167
- const editedFiles = fs.readdirSync(editedDir);
168
- const matchingEditedFile = editedFiles.find(file => file.startsWith(baseFileName) && (file.endsWith('.stories.tsx') || file.endsWith('.stories.stories.tsx')));
169
- if (matchingEditedFile) {
170
- fullPath = path.join(editedDir, matchingEditedFile);
171
- console.log(`✅ Found edited story by pattern: ${fullPath}`);
172
- }
173
- }
174
- // If still not found, check generated directory
175
- if (!fullPath) {
176
- const generatedDir = config.generatedStoriesPath;
177
- if (fs.existsSync(generatedDir)) {
178
- const generatedFiles = fs.readdirSync(generatedDir);
179
- const matchingGeneratedFile = generatedFiles.find(file => file.startsWith(baseFileName) && file.endsWith('.stories.tsx'));
180
- if (matchingGeneratedFile) {
181
- fullPath = path.join(generatedDir, matchingGeneratedFile);
182
- }
183
- }
184
- }
185
- if (!fullPath) {
186
- return res.status(404).json({
187
- error: 'Story file not found',
188
- fileName: cleanFileName,
189
- searched: ['edited/', 'generated/'],
190
- baseFileName
191
- });
192
- }
193
- }
194
- }
195
- else {
196
- // For generated stories, check generated/ directory first
197
- fullPath = path.join(config.generatedStoriesPath, cleanFileName);
198
- if (!fs.existsSync(fullPath)) {
199
- const editedPath = path.join(config.generatedStoriesPath, '..', 'edited', cleanFileName);
200
- if (fs.existsSync(editedPath)) {
201
- fullPath = editedPath;
202
- }
203
- else {
204
- // Also try to find files with a hash suffix (e.g., basic-card-781ccd01.stories.tsx)
205
- const baseFileName = cleanFileName.replace('.stories.tsx', '');
206
- const generatedDir = config.generatedStoriesPath;
207
- // Check if there's a file that starts with the base name
208
- if (fs.existsSync(generatedDir)) {
209
- const files = fs.readdirSync(generatedDir);
210
- const matchingFile = files.find(file => file.startsWith(baseFileName) && file.endsWith('.stories.tsx'));
211
- if (matchingFile) {
212
- fullPath = path.join(generatedDir, matchingFile);
213
- }
214
- else {
215
- return res.status(404).json({
216
- error: 'Story file not found',
217
- fileName: cleanFileName,
218
- searched: ['generated/', 'edited/'],
219
- baseFileName
220
- });
221
- }
222
- }
223
- }
224
- }
225
- }
226
- if (!fullPath) {
227
- return res.status(404).json({
228
- error: 'Story file not found',
229
- fileName: cleanFileName
230
- });
231
- }
232
- const content = fs.readFileSync(fullPath, 'utf-8');
233
- res.json({
234
- success: true,
235
- fileName: path.basename(fullPath),
236
- content,
237
- filePath: fullPath
238
- });
239
- }
240
- catch (error) {
241
- res.status(500).json({
242
- error: 'Failed to read story file',
243
- details: error.message
244
- });
245
- }
246
- }
@@ -1,50 +0,0 @@
1
- interface SessionStory {
2
- id: string;
3
- fileName: string;
4
- title: string;
5
- prompt: string;
6
- timestamp: Date;
7
- keywords: string[];
8
- }
9
- export declare class SessionManager {
10
- private static instance;
11
- private sessions;
12
- private currentStoryId;
13
- private constructor();
14
- static getInstance(): SessionManager;
15
- /**
16
- * Track a newly generated story in the current session
17
- */
18
- trackStory(sessionId: string, story: {
19
- id: string;
20
- fileName: string;
21
- title: string;
22
- prompt: string;
23
- }): void;
24
- /**
25
- * Get the current story being discussed
26
- */
27
- getCurrentStory(sessionId: string): SessionStory | null;
28
- /**
29
- * Find a story by context (keywords in the user's message)
30
- */
31
- findStoryByContext(sessionId: string, userMessage: string): SessionStory | null;
32
- /**
33
- * Get all stories in the current session
34
- */
35
- getSessionStories(sessionId: string): SessionStory[];
36
- /**
37
- * Set the current story being discussed
38
- */
39
- setCurrentStory(sessionId: string, storyId: string): void;
40
- /**
41
- * Clear session data (for cleanup)
42
- */
43
- clearSession(sessionId: string): void;
44
- /**
45
- * Extract meaningful keywords from text
46
- */
47
- private extractKeywords;
48
- }
49
- export {};
50
- //# sourceMappingURL=sessionManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sessionManager.d.ts","sourceRoot":"","sources":["../../mcp-server/sessionManager.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAA0C;IAC1D,OAAO,CAAC,cAAc,CAAuB;IAE7C,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,cAAc;IAOpC;;OAEG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE;QACnC,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB;IAmBD;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IASvD;;OAEG;IACH,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAiC/E;;OAEG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,EAAE;IAIpD;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAQlD;;OAEG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM;IAO9B;;OAEG;IACH,OAAO,CAAC,eAAe;CAkCxB"}