@bike4mind/cli 0.2.64-worktree-refactor-extract-search-query-builders.21815 → 0.2.64

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 (85) hide show
  1. package/bin/bike4mind-cli.mjs +6 -6
  2. package/dist/BubblewrapRuntime-BHbtqvLx.mjs +72 -0
  3. package/dist/ConfigStore-CllM6jOf.mjs +8614 -0
  4. package/dist/ImageStore-DaKT_Ew8.mjs +202 -0
  5. package/dist/ProxyManager-Dl2nFk-A.mjs +259 -0
  6. package/dist/ProxyManager-kiOD1X8-.mjs +3 -0
  7. package/dist/SandboxOrchestrator-BEW3rqYi.mjs +159 -0
  8. package/dist/SandboxOrchestrator-CHZgSR3P.mjs +3 -0
  9. package/dist/SandboxRuntimeAdapter-C1B4t20N.mjs +57 -0
  10. package/dist/SandboxRuntimeAdapter-D7UAG13n.mjs +3 -0
  11. package/dist/SeatbeltRuntime-D4m0VOcD.mjs +116 -0
  12. package/dist/StderrViolationParser-D0afQ3-1.mjs +70 -0
  13. package/dist/ViolationLogStore-CZl35HcA.mjs +96 -0
  14. package/dist/bashExecute-BTkdqlSs-5foM20Lb.mjs +466 -0
  15. package/dist/commands/doctorCommand.mjs +101 -0
  16. package/dist/commands/headlessCommand.mjs +319 -0
  17. package/dist/commands/mcpCommand.mjs +218 -0
  18. package/dist/commands/updateCommand.mjs +40 -0
  19. package/dist/createFile-yQfh8uvk-I-yM5DxC.mjs +63 -0
  20. package/dist/deleteFile-DKHfnyny-G3b1Kj2T.mjs +66 -0
  21. package/dist/globFiles-D1en6joM-8jekiXdX.mjs +100 -0
  22. package/dist/grepSearch-aMamoBn_-DCJcY8JS.mjs +173 -0
  23. package/dist/index.mjs +6722 -0
  24. package/dist/pathValidation-Cgjh5WQO-DiCZTcq6.mjs +63 -0
  25. package/dist/store-Dw1nZX2Y.mjs +128 -0
  26. package/dist/store-nZExNOWX.mjs +3 -0
  27. package/dist/terminalSetup-rmr1P8KF.mjs +254 -0
  28. package/dist/tools-C6M5aW8W.mjs +20907 -0
  29. package/dist/treeSitterEngine-DCSXcm_3.mjs +309 -0
  30. package/dist/types-DBEjF9YS.mjs +59 -0
  31. package/dist/types-DK3P88Px.mjs +3 -0
  32. package/dist/updateChecker-Cu9dkHxV.mjs +120 -0
  33. package/package.json +10 -10
  34. package/dist/BubblewrapRuntime-PMIOLWKR.js +0 -71
  35. package/dist/HydrationEngine-YL2HWJ3V.js +0 -9
  36. package/dist/ImageStore-MMUOUPI2.js +0 -224
  37. package/dist/ProxyManager-HEB4TLVX.js +0 -7
  38. package/dist/SandboxOrchestrator-UIJ5GYBB.js +0 -8
  39. package/dist/SandboxRuntimeAdapter-FQ56MAB2.js +0 -13
  40. package/dist/SeatbeltRuntime-EE3TTLEP.js +0 -98
  41. package/dist/StderrViolationParser-7OYPM2DJ.js +0 -59
  42. package/dist/ViolationLogStore-RIIUVURH.js +0 -104
  43. package/dist/artifactExtractor-R7DIP2XO.js +0 -180
  44. package/dist/bashExecute-GLGLD3JD.js +0 -379
  45. package/dist/chunk-4BIBE3J7.js +0 -48
  46. package/dist/chunk-5LZS5CVJ.js +0 -161
  47. package/dist/chunk-BDQBOLYG.js +0 -120
  48. package/dist/chunk-BPFEGDC7.js +0 -192
  49. package/dist/chunk-EPIYC3LA.js +0 -13770
  50. package/dist/chunk-G4ZGEQFT.js +0 -250
  51. package/dist/chunk-GQGOWACU.js +0 -770
  52. package/dist/chunk-J6ZBI6TI.js +0 -1079
  53. package/dist/chunk-JW3JRHH7.js +0 -12433
  54. package/dist/chunk-KQAMBXAW.js +0 -163
  55. package/dist/chunk-KUVV2NAB.js +0 -19125
  56. package/dist/chunk-LTLJRF6I.js +0 -44
  57. package/dist/chunk-PFBYGCOW.js +0 -449
  58. package/dist/chunk-QWB6ZYY4.js +0 -48
  59. package/dist/chunk-SGPRXN4C.js +0 -245
  60. package/dist/chunk-UZUHPHZC.js +0 -95
  61. package/dist/chunk-WBE7SQUB.js +0 -241
  62. package/dist/chunk-Y4WOJJM3.js +0 -147
  63. package/dist/commands/doctorCommand.js +0 -87
  64. package/dist/commands/headlessCommand.js +0 -380
  65. package/dist/commands/mcpCommand.js +0 -203
  66. package/dist/commands/updateCommand.js +0 -42
  67. package/dist/create-C4VEEEYR.js +0 -12
  68. package/dist/createFile-6PSPLW6R.js +0 -71
  69. package/dist/deleteFile-AUSRLWIK.js +0 -73
  70. package/dist/formatConverter-5QEJDW24.js +0 -7
  71. package/dist/globFiles-TSRN64N2.js +0 -120
  72. package/dist/grepSearch-634XWZOJ.js +0 -216
  73. package/dist/index.js +0 -6779
  74. package/dist/llmMarkdownGenerator-Z6NB26TT.js +0 -371
  75. package/dist/markdownGenerator-SK2ZQQL4.js +0 -269
  76. package/dist/mementoService-N4IM6QAC.js +0 -12
  77. package/dist/notificationDeduplicator-HUC53NEW.js +0 -9
  78. package/dist/src-F4KZCAA2.js +0 -319
  79. package/dist/src-ISX322I7.js +0 -1101
  80. package/dist/store-CAB6BV3P.js +0 -11
  81. package/dist/subtractCredits-D4KEM6VU.js +0 -12
  82. package/dist/terminalSetup-C5FHMLC3.js +0 -214
  83. package/dist/treeSitterEngine-4SGFQDY3.js +0 -330
  84. package/dist/types-KB5NP6T4.js +0 -7
  85. package/dist/utils-JCHWDM4Z.js +0 -31
@@ -1,371 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- CurationArtifactType
4
- } from "./chunk-JW3JRHH7.js";
5
-
6
- // ../../b4m-core/packages/services/dist/src/notebookCurationService/llmMarkdownGenerator.js
7
- var DEFAULT_OPTIONS = {
8
- includeTimestamps: false,
9
- // Executive summaries don't need timestamps
10
- includeMetadata: true,
11
- includeTableOfContents: true,
12
- maxSummaryLength: 2e3
13
- // ~2000 tokens for summary
14
- };
15
- async function generateExecutiveSummaryMarkdown(session, messages, artifacts, llmContext, model, options = {}) {
16
- const opts = { ...DEFAULT_OPTIONS, ...options };
17
- const sections = [];
18
- let totalTokensUsed = 0;
19
- const generateText = async (prompt) => {
20
- let result = "";
21
- await llmContext.complete(model, [{ role: "user", content: prompt }], { temperature: 0.7, stream: false }, async (chunks) => {
22
- result += chunks[0] || "";
23
- });
24
- return result;
25
- };
26
- sections.push(generateExecutiveHeader(session, messages, artifacts));
27
- if (opts.includeTableOfContents) {
28
- sections.push(generateExecutiveTOC());
29
- }
30
- const summaryResult = await generateAIExecutiveSummary(session, messages, generateText, opts.maxSummaryLength);
31
- sections.push(summaryResult.markdown);
32
- totalTokensUsed += summaryResult.tokensUsed;
33
- const insightsResult = await generateAIKeyInsights(messages, generateText);
34
- sections.push(insightsResult.markdown);
35
- totalTokensUsed += insightsResult.tokensUsed;
36
- const decisionsResult = await generateAIDecisionsAndActions(messages, generateText);
37
- sections.push(decisionsResult.markdown);
38
- totalTokensUsed += decisionsResult.tokensUsed;
39
- if (artifacts.length > 0) {
40
- const artifactsResult = await generateAIArtifactsSection(artifacts, messages, generateText);
41
- sections.push(artifactsResult.markdown);
42
- totalTokensUsed += artifactsResult.tokensUsed;
43
- }
44
- if (opts.includeMetadata) {
45
- sections.push(generateExecutiveMetadata(session, messages, artifacts, totalTokensUsed));
46
- }
47
- return {
48
- markdown: sections.filter(Boolean).join("\n\n---\n\n"),
49
- tokensUsed: totalTokensUsed
50
- };
51
- }
52
- function generateExecutiveHeader(session, messages, artifacts) {
53
- const created = session.firstCreated ? new Date(session.firstCreated).toLocaleDateString() : "Unknown";
54
- const updated = session.lastUpdated ? new Date(session.lastUpdated).toLocaleDateString() : "Unknown";
55
- return `# ${session.name}
56
-
57
- **Executive Summary (AI-Curated)**
58
-
59
- - **Created:** ${created}
60
- - **Last Updated:** ${updated}
61
- - **Conversation Turns:** ${messages.length}
62
- - **Artifacts Generated:** ${artifacts.length}
63
- - **Document Type:** AI-Generated Executive Summary`;
64
- }
65
- function generateExecutiveTOC() {
66
- return `## Table of Contents
67
-
68
- - [Executive Summary](#executive-summary)
69
- - [Key Insights](#key-insights)
70
- - [Decisions & Actions](#decisions--actions)
71
- - [Code & Artifacts](#code--artifacts)
72
- - [Metadata](#metadata)`;
73
- }
74
- async function generateAIExecutiveSummary(session, messages, generateText, maxTokens) {
75
- const conversationSample = sampleConversation(messages, 5e3);
76
- const prompt = `You are an AI assistant helping to curate a notebook conversation into an executive summary.
77
-
78
- Session: ${session.name}
79
- Total Messages: ${messages.length}
80
-
81
- Conversation Sample:
82
- ${conversationSample}
83
-
84
- Generate a comprehensive executive summary that:
85
- 1. Explains what the conversation was about (1-2 paragraphs)
86
- 2. Highlights the main topics discussed
87
- 3. Describes the outcome or final state
88
-
89
- Write in a professional, concise style suitable for knowledge sharing.`;
90
- const text = await generateText(prompt);
91
- const tokensUsed = estimateTokens(prompt + text);
92
- return {
93
- markdown: `## Executive Summary
94
-
95
- ${text}`,
96
- tokensUsed
97
- };
98
- }
99
- async function generateAIKeyInsights(messages, generateText) {
100
- const conversationSample = sampleConversation(messages, 5e3);
101
- const prompt = `Analyze this conversation and extract the top 5-7 key insights or learnings.
102
-
103
- Conversation:
104
- ${conversationSample}
105
-
106
- Format your response as a bullet list of key insights. Each insight should be:
107
- - Concise (1-2 sentences)
108
- - Actionable or informative
109
- - Focused on technical or strategic learnings
110
-
111
- Example format:
112
- - **Understanding of X**: Brief explanation
113
- - **Decision on Y**: What was decided and why
114
- - **Technical approach for Z**: Key technical insight`;
115
- const text = await generateText(prompt);
116
- const tokensUsed = estimateTokens(prompt + text);
117
- return {
118
- markdown: `## Key Insights
119
-
120
- ${text}`,
121
- tokensUsed
122
- };
123
- }
124
- async function generateAIDecisionsAndActions(messages, generateText) {
125
- const conversationSample = sampleConversation(messages, 5e3);
126
- const prompt = `Analyze this conversation and identify key decisions made and action items.
127
-
128
- Conversation:
129
- ${conversationSample}
130
-
131
- Create two sections:
132
-
133
- ### Decisions Made
134
- List 3-5 major decisions with brief rationale
135
-
136
- ### Action Items
137
- List any next steps or TODOs mentioned
138
-
139
- Format as markdown with bullet points.`;
140
- const text = await generateText(prompt);
141
- const tokensUsed = estimateTokens(prompt + text);
142
- return {
143
- markdown: `## Decisions & Actions
144
-
145
- ${text}`,
146
- tokensUsed
147
- };
148
- }
149
- async function generateAIArtifactsSection(artifacts, messages, generateText) {
150
- const sections = ["## Code & Artifacts\n"];
151
- let totalTokensUsed = 0;
152
- const typeGroups = groupArtifactsByType(artifacts);
153
- const typePriority = {
154
- [CurationArtifactType.CODE]: 1,
155
- [CurationArtifactType.REACT]: 2,
156
- [CurationArtifactType.HTML]: 3,
157
- [CurationArtifactType.MERMAID]: 4,
158
- [CurationArtifactType.RECHARTS]: 5,
159
- [CurationArtifactType.SVG]: 6,
160
- [CurationArtifactType.QUESTMASTER_PLAN]: 7,
161
- [CurationArtifactType.DEEP_RESEARCH]: 8,
162
- [CurationArtifactType.IMAGE]: 9
163
- };
164
- const sortedTypes = Object.keys(typeGroups).sort((a, b) => (typePriority[a] || 99) - (typePriority[b] || 99));
165
- const batchDescriptionResult = await generateBatchedArtifactDescriptions(artifacts, messages, generateText);
166
- totalTokensUsed += batchDescriptionResult.tokensUsed;
167
- const descriptionMap = /* @__PURE__ */ new Map();
168
- artifacts.forEach((artifact, index) => {
169
- descriptionMap.set(index, batchDescriptionResult.descriptions[index] || "No description available.");
170
- });
171
- let globalArtifactIndex = 0;
172
- for (const type of sortedTypes) {
173
- const artifactType = type;
174
- const typeArtifacts = typeGroups[type];
175
- const typeLabel = formatArtifactTypeLabel(artifactType);
176
- sections.push(`### ${typeLabel}
177
- `);
178
- for (let i = 0; i < typeArtifacts.length; i++) {
179
- const artifact = typeArtifacts[i];
180
- const description = descriptionMap.get(globalArtifactIndex) || "No description available.";
181
- sections.push(formatArtifactWithDescription(artifact, i + 1, description));
182
- globalArtifactIndex++;
183
- }
184
- }
185
- return {
186
- markdown: sections.join("\n"),
187
- tokensUsed: totalTokensUsed
188
- };
189
- }
190
- async function generateBatchedArtifactDescriptions(artifacts, messages, generateText) {
191
- if (artifacts.length === 0) {
192
- return { descriptions: [], tokensUsed: 0 };
193
- }
194
- const artifactPrompts = artifacts.map((artifact, index) => {
195
- const contextMessages = findArtifactContext(artifact, messages);
196
- return `[ARTIFACT ${index + 1}]
197
- Type: ${artifact.type}${artifact.language ? ` | Language: ${artifact.language}` : ""}
198
- Code Preview:
199
- ${artifact.content.substring(0, 400)}${artifact.content.length > 400 ? "..." : ""}
200
-
201
- Context: ${contextMessages}
202
- `;
203
- });
204
- const batchPrompt = `You are analyzing artifacts from a technical conversation. For each artifact below, provide a concise 1-2 sentence description explaining what it does and why it's relevant.
205
-
206
- ${artifactPrompts.join("\n---\n")}
207
-
208
- Format your response as a numbered list matching the artifact numbers above. Each description should be:
209
- - Concise (1-2 sentences maximum)
210
- - Technical and specific
211
- - Focused on the purpose and functionality
212
-
213
- Example format:
214
- 1. [Description for artifact 1]
215
- 2. [Description for artifact 2]
216
- 3. [Description for artifact 3]
217
-
218
- Provide descriptions for all ${artifacts.length} artifacts:`;
219
- const text = await generateText(batchPrompt);
220
- const tokensUsed = estimateTokens(batchPrompt + text);
221
- const descriptions = parseNumberedListResponse(text, artifacts.length);
222
- return {
223
- descriptions,
224
- tokensUsed
225
- };
226
- }
227
- function parseNumberedListResponse(text, expectedCount) {
228
- const lines = text.split("\n").filter((line) => line.trim());
229
- const descriptions = [];
230
- for (const line of lines) {
231
- const match = line.match(/^\s*[\[\(]?\d+[\.\)\]]\s*(.+)$/);
232
- if (match && match[1]) {
233
- descriptions.push(match[1].trim());
234
- }
235
- }
236
- while (descriptions.length < expectedCount) {
237
- descriptions.push("Code artifact for technical implementation.");
238
- }
239
- return descriptions.slice(0, expectedCount);
240
- }
241
- function formatArtifactWithDescription(artifact, index, description) {
242
- const title = artifact.metadata?.title || `${formatArtifactTypeLabel(artifact.type)} #${index}`;
243
- let formattedArtifact = `#### ${index}. ${title}
244
-
245
- `;
246
- formattedArtifact += `*${description}*
247
-
248
- `;
249
- switch (artifact.type) {
250
- case CurationArtifactType.CODE:
251
- case CurationArtifactType.REACT:
252
- case CurationArtifactType.HTML:
253
- formattedArtifact += `\`\`\`${artifact.language || "text"}
254
- ${artifact.content}
255
- \`\`\``;
256
- break;
257
- case CurationArtifactType.MERMAID:
258
- formattedArtifact += `\`\`\`mermaid
259
- ${artifact.content}
260
- \`\`\``;
261
- break;
262
- case CurationArtifactType.RECHARTS:
263
- formattedArtifact += `\`\`\`json
264
- ${artifact.content}
265
- \`\`\``;
266
- break;
267
- case CurationArtifactType.SVG:
268
- formattedArtifact += `\`\`\`svg
269
- ${artifact.content}
270
- \`\`\``;
271
- break;
272
- default:
273
- formattedArtifact += artifact.content;
274
- }
275
- return formattedArtifact;
276
- }
277
- function generateExecutiveMetadata(session, messages, artifacts, tokensUsed) {
278
- const typeGroups = groupArtifactsByType(artifacts);
279
- const artifactCounts = Object.entries(typeGroups).map(([type, arts]) => `${formatArtifactTypeLabel(type)}: ${arts.length}`).join(", ");
280
- return `## Metadata
281
-
282
- - **Session ID:** ${session.id}
283
- - **Conversation Turns:** ${messages.length}
284
- - **Artifacts Generated:** ${artifacts.length}
285
- - **Artifact Breakdown:** ${artifactCounts || "None"}
286
- - **AI Analysis Tokens Used:** ~${tokensUsed} tokens
287
- - **Created:** ${session.firstCreated ? new Date(session.firstCreated).toISOString() : "Unknown"}
288
- - **Curated At:** ${(/* @__PURE__ */ new Date()).toISOString()}
289
- - **Curation Type:** AI-Powered Executive Summary
290
- - **Platform:** Bike4Mind Lumina v5
291
-
292
- ---
293
-
294
- *This document was automatically generated by Bike4Mind AI-Powered Notebook Curation.*
295
- *The executive summary, insights, and artifact descriptions were created using AI analysis.*`;
296
- }
297
- function sampleConversation(messages, maxChars) {
298
- const samples = [];
299
- let currentChars = 0;
300
- const indicesToSample = [
301
- 0,
302
- // First
303
- ...sampleIndices(messages.length, Math.floor(messages.length / 3)),
304
- // Middle samples
305
- messages.length - 1
306
- // Last
307
- ];
308
- for (const idx of indicesToSample) {
309
- if (idx >= messages.length)
310
- continue;
311
- const message = messages[idx];
312
- const userPrompt = message.prompt || "";
313
- const assistantReply = message.reply || message.questMasterReply || message.replies && message.replies[0] || "";
314
- const messageSample = `User: ${userPrompt}
315
-
316
- Assistant: ${assistantReply}`;
317
- if (currentChars + messageSample.length > maxChars)
318
- break;
319
- samples.push(messageSample);
320
- currentChars += messageSample.length;
321
- }
322
- return samples.join("\n\n---\n\n");
323
- }
324
- function sampleIndices(length, count) {
325
- const step = Math.floor(length / (count + 1));
326
- const indices = [];
327
- for (let i = 1; i <= count; i++) {
328
- indices.push(i * step);
329
- }
330
- return indices;
331
- }
332
- function findArtifactContext(artifact, messages) {
333
- const message = messages.find((m) => m.id === artifact.messageId || m._id?.toString() === artifact.messageId);
334
- if (!message)
335
- return "";
336
- const prompt = message.prompt || "";
337
- const reply = message.reply || message.questMasterReply || "";
338
- return `User: ${prompt.substring(0, 200)}...
339
-
340
- Assistant: ${reply.substring(0, 200)}...`;
341
- }
342
- function groupArtifactsByType(artifacts) {
343
- return artifacts.reduce((groups, artifact) => {
344
- const type = artifact.type;
345
- if (!groups[type]) {
346
- groups[type] = [];
347
- }
348
- groups[type].push(artifact);
349
- return groups;
350
- }, {});
351
- }
352
- function formatArtifactTypeLabel(type) {
353
- const labels = {
354
- [CurationArtifactType.CODE]: "Code Snippets",
355
- [CurationArtifactType.REACT]: "React Components",
356
- [CurationArtifactType.HTML]: "HTML Pages",
357
- [CurationArtifactType.MERMAID]: "Diagrams (Mermaid)",
358
- [CurationArtifactType.RECHARTS]: "Data Visualizations",
359
- [CurationArtifactType.SVG]: "SVG Graphics",
360
- [CurationArtifactType.QUESTMASTER_PLAN]: "QuestMaster Plans",
361
- [CurationArtifactType.DEEP_RESEARCH]: "Research Findings",
362
- [CurationArtifactType.IMAGE]: "Images"
363
- };
364
- return labels[type] || type;
365
- }
366
- function estimateTokens(text) {
367
- return Math.ceil(text.length / 4);
368
- }
369
- export {
370
- generateExecutiveSummaryMarkdown
371
- };
@@ -1,269 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- CurationArtifactType
4
- } from "./chunk-JW3JRHH7.js";
5
-
6
- // ../../b4m-core/packages/services/dist/src/notebookCurationService/markdownGenerator.js
7
- var DEFAULT_OPTIONS = {
8
- includeTimestamps: true,
9
- includeMetadata: true,
10
- includeTableOfContents: true,
11
- groupArtifactsByType: true
12
- };
13
- function generateTranscriptMarkdown(session, messages, artifacts, options = {}) {
14
- const opts = { ...DEFAULT_OPTIONS, ...options };
15
- const sections = [];
16
- sections.push(generateHeader(session, messages, artifacts));
17
- if (opts.includeTableOfContents) {
18
- sections.push(generateTableOfContents(artifacts));
19
- }
20
- if (session.summary) {
21
- sections.push(generateSummarySection(session));
22
- }
23
- sections.push(generateConversationSection(messages, opts));
24
- if (artifacts.length > 0) {
25
- if (opts.groupArtifactsByType) {
26
- sections.push(generateArtifactsSectionGrouped(artifacts));
27
- } else {
28
- sections.push(generateArtifactsSectionChronological(artifacts));
29
- }
30
- }
31
- if (opts.includeMetadata) {
32
- sections.push(generateMetadataFooter(session, messages, artifacts));
33
- }
34
- return sections.filter(Boolean).join("\n\n---\n\n");
35
- }
36
- function generateHeader(session, messages, artifacts) {
37
- const created = session.firstCreated ? new Date(session.firstCreated).toLocaleDateString() : "Unknown";
38
- const updated = session.lastUpdated ? new Date(session.lastUpdated).toLocaleDateString() : "Unknown";
39
- return `# ${session.name}
40
-
41
- **Curated Notebook Transcript**
42
-
43
- - **Created:** ${created}
44
- - **Last Updated:** ${updated}
45
- - **Messages:** ${messages.length}
46
- - **Artifacts:** ${artifacts.length}
47
- - **Language:** ${session.language || "en"}`;
48
- }
49
- function generateTableOfContents(artifacts) {
50
- const sections = ["## Table of Contents\n"];
51
- sections.push("- [Summary](#summary)");
52
- sections.push("- [Conversation](#conversation)");
53
- if (artifacts.length > 0) {
54
- sections.push("- [Artifacts](#artifacts)");
55
- const typeGroups = groupArtifactsByType(artifacts);
56
- Object.keys(typeGroups).forEach((type) => {
57
- const typeLabel = formatArtifactTypeLabel(type);
58
- const anchor = typeLabel.toLowerCase().replace(/\s+/g, "-");
59
- sections.push(` - [${typeLabel}](#${anchor})`);
60
- });
61
- }
62
- return sections.join("\n");
63
- }
64
- function generateSummarySection(session) {
65
- const summarizedDate = session.summaryAt ? new Date(session.summaryAt).toLocaleDateString() : "Unknown";
66
- return `## Summary
67
-
68
- *Generated on ${summarizedDate}*
69
-
70
- ${session.summary}`;
71
- }
72
- function generateConversationSection(messages, options) {
73
- const lines = ["## Conversation\n"];
74
- messages.forEach((message, index) => {
75
- const timestamp = message.timestamp ? new Date(message.timestamp).toLocaleString() : "";
76
- const showTimestamp = options.includeTimestamps && timestamp;
77
- if (message.prompt) {
78
- lines.push(`### ${index + 1}. User${showTimestamp ? ` (${timestamp})` : ""}
79
- `);
80
- lines.push(cleanMessageContent(message.prompt));
81
- lines.push("");
82
- }
83
- const reply = message.questMasterReply || message.reply || message.replies && message.replies[0];
84
- if (reply) {
85
- lines.push(`### ${index + 1}. Assistant${showTimestamp ? ` (${timestamp})` : ""}
86
- `);
87
- lines.push(cleanMessageContent(reply));
88
- lines.push("");
89
- }
90
- });
91
- return lines.join("\n");
92
- }
93
- function generateArtifactsSectionGrouped(artifacts) {
94
- const sections = ["## Artifacts\n"];
95
- const typeGroups = groupArtifactsByType(artifacts);
96
- const typePriority = {
97
- [CurationArtifactType.CODE]: 1,
98
- [CurationArtifactType.REACT]: 2,
99
- [CurationArtifactType.HTML]: 3,
100
- [CurationArtifactType.MERMAID]: 4,
101
- [CurationArtifactType.RECHARTS]: 5,
102
- [CurationArtifactType.SVG]: 6,
103
- [CurationArtifactType.QUESTMASTER_PLAN]: 7,
104
- [CurationArtifactType.DEEP_RESEARCH]: 8,
105
- [CurationArtifactType.IMAGE]: 9
106
- };
107
- const sortedTypes = Object.keys(typeGroups).sort((a, b) => (typePriority[a] || 99) - (typePriority[b] || 99));
108
- sortedTypes.forEach((type) => {
109
- const artifactType = type;
110
- const typeArtifacts = typeGroups[type];
111
- const typeLabel = formatArtifactTypeLabel(artifactType);
112
- sections.push(`### ${typeLabel}
113
- `);
114
- typeArtifacts.forEach((artifact, index) => {
115
- sections.push(formatArtifact(artifact, index + 1));
116
- sections.push("");
117
- });
118
- });
119
- return sections.join("\n");
120
- }
121
- function generateArtifactsSectionChronological(artifacts) {
122
- const sections = ["## Artifacts\n"];
123
- artifacts.forEach((artifact, index) => {
124
- sections.push(formatArtifact(artifact, index + 1));
125
- sections.push("");
126
- });
127
- return sections.join("\n");
128
- }
129
- function formatArtifact(artifact, index) {
130
- const title = artifact.metadata?.title || `${formatArtifactTypeLabel(artifact.type)} #${index}`;
131
- const timestamp = artifact.timestamp.toLocaleString();
132
- switch (artifact.type) {
133
- case CurationArtifactType.CODE:
134
- case CurationArtifactType.REACT:
135
- case CurationArtifactType.HTML:
136
- return `#### ${index}. ${title}
137
-
138
- *Type:* ${artifact.type} | *Language:* ${artifact.language || "unknown"} | *Created:* ${timestamp}
139
-
140
- \`\`\`${artifact.language || "text"}
141
- ${artifact.content}
142
- \`\`\``;
143
- case CurationArtifactType.MERMAID:
144
- return `#### ${index}. ${title}
145
-
146
- *Type:* Mermaid Diagram | *Created:* ${timestamp}
147
-
148
- \`\`\`mermaid
149
- ${artifact.content}
150
- \`\`\``;
151
- case CurationArtifactType.RECHARTS:
152
- return `#### ${index}. ${title}
153
-
154
- *Type:* Data Visualization | *Created:* ${timestamp}
155
-
156
- \`\`\`json
157
- ${artifact.content}
158
- \`\`\``;
159
- case CurationArtifactType.SVG:
160
- return `#### ${index}. ${title}
161
-
162
- *Type:* SVG Graphic | *Created:* ${timestamp}
163
-
164
- \`\`\`svg
165
- ${artifact.content}
166
- \`\`\``;
167
- case CurationArtifactType.QUESTMASTER_PLAN:
168
- return `#### ${index}. QuestMaster Plan
169
-
170
- *Plan ID:* ${artifact.metadata?.planId} | *Created:* ${timestamp}
171
-
172
- > This conversation included a QuestMaster plan (ID: ${artifact.metadata?.planId})`;
173
- case CurationArtifactType.DEEP_RESEARCH:
174
- return formatDeepResearchArtifact(artifact, index, timestamp);
175
- case CurationArtifactType.IMAGE:
176
- return `#### ${index}. Image
177
-
178
- *Path:* ${artifact.metadata?.path} | *Created:* ${timestamp}
179
-
180
- ![Image](${artifact.content})`;
181
- default:
182
- return `#### ${index}. ${title}
183
-
184
- ${artifact.content}`;
185
- }
186
- }
187
- function formatDeepResearchArtifact(artifact, index, timestamp) {
188
- const metadata = artifact.metadata || {};
189
- const research = JSON.parse(artifact.content);
190
- const sections = [
191
- `#### ${index}. Deep Research: ${metadata.topic || "Unknown Topic"}`,
192
- "",
193
- `*Findings:* ${metadata.findingsCount || 0} | *Sources:* ${metadata.sourcesCount || 0} | *Depth:* ${metadata.depth || 0} | *Created:* ${timestamp}`,
194
- ""
195
- ];
196
- if (research.findings && research.findings.length > 0) {
197
- sections.push("**Key Findings:**\n");
198
- research.findings.forEach((finding, i) => {
199
- sections.push(`${i + 1}. ${finding.text}`);
200
- if (finding.source) {
201
- sections.push(` *Source:* ${finding.source}`);
202
- }
203
- sections.push("");
204
- });
205
- }
206
- if (research.sources && research.sources.length > 0) {
207
- sections.push("**Sources:**\n");
208
- research.sources.forEach((source, i) => {
209
- sections.push(`${i + 1}. **${source.title}**`);
210
- sections.push(` - URL: ${source.url}`);
211
- if (source.description) {
212
- sections.push(` - ${source.description}`);
213
- }
214
- sections.push("");
215
- });
216
- }
217
- return sections.join("\n");
218
- }
219
- function generateMetadataFooter(session, messages, artifacts) {
220
- const typeGroups = groupArtifactsByType(artifacts);
221
- const artifactCounts = Object.entries(typeGroups).map(([type, arts]) => `${formatArtifactTypeLabel(type)}: ${arts.length}`).join(", ");
222
- return `## Metadata
223
-
224
- - **Session ID:** ${session.id}
225
- - **Total Messages:** ${messages.length}
226
- - **Total Artifacts:** ${artifacts.length}
227
- - **Artifact Breakdown:** ${artifactCounts || "None"}
228
- - **Created:** ${session.firstCreated ? new Date(session.firstCreated).toISOString() : "Unknown"}
229
- - **Last Updated:** ${session.lastUpdated ? new Date(session.lastUpdated).toISOString() : "Unknown"}
230
- - **Curated At:** ${(/* @__PURE__ */ new Date()).toISOString()}
231
- - **Platform:** Bike4Mind Lumina v5
232
-
233
- ---
234
-
235
- *This document was automatically generated by Bike4Mind Notebook Curation.*`;
236
- }
237
- function groupArtifactsByType(artifacts) {
238
- return artifacts.reduce((groups, artifact) => {
239
- const type = artifact.type;
240
- if (!groups[type]) {
241
- groups[type] = [];
242
- }
243
- groups[type].push(artifact);
244
- return groups;
245
- }, {});
246
- }
247
- function formatArtifactTypeLabel(type) {
248
- const labels = {
249
- [CurationArtifactType.CODE]: "Code Snippets",
250
- [CurationArtifactType.REACT]: "React Components",
251
- [CurationArtifactType.HTML]: "HTML Pages",
252
- [CurationArtifactType.MERMAID]: "Diagrams (Mermaid)",
253
- [CurationArtifactType.RECHARTS]: "Data Visualizations",
254
- [CurationArtifactType.SVG]: "SVG Graphics",
255
- [CurationArtifactType.QUESTMASTER_PLAN]: "QuestMaster Plans",
256
- [CurationArtifactType.DEEP_RESEARCH]: "Research Findings",
257
- [CurationArtifactType.IMAGE]: "Images"
258
- };
259
- return labels[type] || type;
260
- }
261
- function cleanMessageContent(content) {
262
- let cleaned = content.replace(/<artifact\s+.*?>([\s\S]*?)<\/artifact>/gi, "");
263
- cleaned = cleaned.replace(/<think>([\s\S]*?)<\/think>/gi, "");
264
- cleaned = cleaned.trim();
265
- return cleaned;
266
- }
267
- export {
268
- generateTranscriptMarkdown
269
- };
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- findMostSimilarMemento,
4
- getRelevantMementos
5
- } from "./chunk-WBE7SQUB.js";
6
- import "./chunk-EPIYC3LA.js";
7
- import "./chunk-PFBYGCOW.js";
8
- import "./chunk-JW3JRHH7.js";
9
- export {
10
- findMostSimilarMemento,
11
- getRelevantMementos
12
- };
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- NotificationDeduplicator,
4
- notificationDeduplicator
5
- } from "./chunk-PFBYGCOW.js";
6
- export {
7
- NotificationDeduplicator,
8
- notificationDeduplicator
9
- };