noverload-mcp 0.6.0 → 0.7.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 (123) hide show
  1. package/dist/client.d.ts +8 -0
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +77 -0
  4. package/dist/client.js.map +1 -1
  5. package/dist/index.js +13 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/llm-instructions.d.ts +87 -0
  8. package/dist/llm-instructions.d.ts.map +1 -0
  9. package/dist/llm-instructions.js +257 -0
  10. package/dist/llm-instructions.js.map +1 -0
  11. package/dist/tools/helpers/connections.d.ts +7 -0
  12. package/dist/tools/helpers/connections.d.ts.map +1 -0
  13. package/dist/tools/helpers/connections.js +85 -0
  14. package/dist/tools/helpers/connections.js.map +1 -0
  15. package/dist/tools/helpers/content-processing.d.ts +7 -0
  16. package/dist/tools/helpers/content-processing.d.ts.map +1 -0
  17. package/dist/tools/helpers/content-processing.js +136 -0
  18. package/dist/tools/helpers/content-processing.js.map +1 -0
  19. package/dist/tools/helpers/insights.d.ts +2 -0
  20. package/dist/tools/helpers/insights.d.ts.map +1 -0
  21. package/dist/tools/helpers/insights.js +62 -0
  22. package/dist/tools/helpers/insights.js.map +1 -0
  23. package/dist/tools/implementations/actions.d.ts +4 -0
  24. package/dist/tools/implementations/actions.d.ts.map +1 -0
  25. package/dist/tools/implementations/actions.js +73 -0
  26. package/dist/tools/implementations/actions.js.map +1 -0
  27. package/dist/tools/implementations/batch-get.d.ts +3 -0
  28. package/dist/tools/implementations/batch-get.d.ts.map +1 -0
  29. package/dist/tools/implementations/batch-get.js +102 -0
  30. package/dist/tools/implementations/batch-get.js.map +1 -0
  31. package/dist/tools/implementations/build-narrative.d.ts +3 -0
  32. package/dist/tools/implementations/build-narrative.d.ts.map +1 -0
  33. package/dist/tools/implementations/build-narrative.js +352 -0
  34. package/dist/tools/implementations/build-narrative.js.map +1 -0
  35. package/dist/tools/implementations/estimate-tokens.d.ts +3 -0
  36. package/dist/tools/implementations/estimate-tokens.d.ts.map +1 -0
  37. package/dist/tools/implementations/estimate-tokens.js +54 -0
  38. package/dist/tools/implementations/estimate-tokens.js.map +1 -0
  39. package/dist/tools/implementations/expand-search.d.ts +3 -0
  40. package/dist/tools/implementations/expand-search.d.ts.map +1 -0
  41. package/dist/tools/implementations/expand-search.js +223 -0
  42. package/dist/tools/implementations/expand-search.js.map +1 -0
  43. package/dist/tools/implementations/explore-topic.d.ts +3 -0
  44. package/dist/tools/implementations/explore-topic.d.ts.map +1 -0
  45. package/dist/tools/implementations/explore-topic.js +137 -0
  46. package/dist/tools/implementations/explore-topic.js.map +1 -0
  47. package/dist/tools/implementations/extract-frameworks.d.ts +3 -0
  48. package/dist/tools/implementations/extract-frameworks.d.ts.map +1 -0
  49. package/dist/tools/implementations/extract-frameworks.js +192 -0
  50. package/dist/tools/implementations/extract-frameworks.js.map +1 -0
  51. package/dist/tools/implementations/extract-insights.d.ts +3 -0
  52. package/dist/tools/implementations/extract-insights.d.ts.map +1 -0
  53. package/dist/tools/implementations/extract-insights.js +130 -0
  54. package/dist/tools/implementations/extract-insights.js.map +1 -0
  55. package/dist/tools/implementations/find-connections.d.ts +3 -0
  56. package/dist/tools/implementations/find-connections.d.ts.map +1 -0
  57. package/dist/tools/implementations/find-connections.js +106 -0
  58. package/dist/tools/implementations/find-connections.js.map +1 -0
  59. package/dist/tools/implementations/find-examples.d.ts +3 -0
  60. package/dist/tools/implementations/find-examples.d.ts.map +1 -0
  61. package/dist/tools/implementations/find-examples.js +242 -0
  62. package/dist/tools/implementations/find-examples.js.map +1 -0
  63. package/dist/tools/implementations/get-content.d.ts +3 -0
  64. package/dist/tools/implementations/get-content.d.ts.map +1 -0
  65. package/dist/tools/implementations/get-content.js +96 -0
  66. package/dist/tools/implementations/get-content.js.map +1 -0
  67. package/dist/tools/implementations/goals.d.ts +3 -0
  68. package/dist/tools/implementations/goals.d.ts.map +1 -0
  69. package/dist/tools/implementations/goals.js +22 -0
  70. package/dist/tools/implementations/goals.js.map +1 -0
  71. package/dist/tools/implementations/instructions.d.ts +3 -0
  72. package/dist/tools/implementations/instructions.d.ts.map +1 -0
  73. package/dist/tools/implementations/instructions.js +88 -0
  74. package/dist/tools/implementations/instructions.js.map +1 -0
  75. package/dist/tools/implementations/knowledge-graph.d.ts +3 -0
  76. package/dist/tools/implementations/knowledge-graph.d.ts.map +1 -0
  77. package/dist/tools/implementations/knowledge-graph.js +278 -0
  78. package/dist/tools/implementations/knowledge-graph.js.map +1 -0
  79. package/dist/tools/implementations/list-content.d.ts +3 -0
  80. package/dist/tools/implementations/list-content.d.ts.map +1 -0
  81. package/dist/tools/implementations/list-content.js +87 -0
  82. package/dist/tools/implementations/list-content.js.map +1 -0
  83. package/dist/tools/implementations/plan-query.d.ts +3 -0
  84. package/dist/tools/implementations/plan-query.d.ts.map +1 -0
  85. package/dist/tools/implementations/plan-query.js +63 -0
  86. package/dist/tools/implementations/plan-query.js.map +1 -0
  87. package/dist/tools/implementations/raw-content.d.ts +3 -0
  88. package/dist/tools/implementations/raw-content.d.ts.map +1 -0
  89. package/dist/tools/implementations/raw-content.js +208 -0
  90. package/dist/tools/implementations/raw-content.js.map +1 -0
  91. package/dist/tools/implementations/save-content.d.ts +3 -0
  92. package/dist/tools/implementations/save-content.d.ts.map +1 -0
  93. package/dist/tools/implementations/save-content.js +33 -0
  94. package/dist/tools/implementations/save-content.js.map +1 -0
  95. package/dist/tools/implementations/search.d.ts +3 -0
  96. package/dist/tools/implementations/search.d.ts.map +1 -0
  97. package/dist/tools/implementations/search.js +245 -0
  98. package/dist/tools/implementations/search.js.map +1 -0
  99. package/dist/tools/implementations/similar-content.d.ts +3 -0
  100. package/dist/tools/implementations/similar-content.d.ts.map +1 -0
  101. package/dist/tools/implementations/similar-content.js +64 -0
  102. package/dist/tools/implementations/similar-content.js.map +1 -0
  103. package/dist/tools/implementations/smart-sections.d.ts +3 -0
  104. package/dist/tools/implementations/smart-sections.d.ts.map +1 -0
  105. package/dist/tools/implementations/smart-sections.js +347 -0
  106. package/dist/tools/implementations/smart-sections.js.map +1 -0
  107. package/dist/tools/implementations/synthesize.d.ts +3 -0
  108. package/dist/tools/implementations/synthesize.d.ts.map +1 -0
  109. package/dist/tools/implementations/synthesize.js +148 -0
  110. package/dist/tools/implementations/synthesize.js.map +1 -0
  111. package/dist/tools/implementations/timeline.d.ts +3 -0
  112. package/dist/tools/implementations/timeline.d.ts.map +1 -0
  113. package/dist/tools/implementations/timeline.js +191 -0
  114. package/dist/tools/implementations/timeline.js.map +1 -0
  115. package/dist/tools/index.d.ts +25 -14
  116. package/dist/tools/index.d.ts.map +1 -1
  117. package/dist/tools/index.js +57 -1079
  118. package/dist/tools/index.js.map +1 -1
  119. package/dist/tools/types.d.ts +22 -0
  120. package/dist/tools/types.d.ts.map +1 -0
  121. package/dist/tools/types.js +2 -0
  122. package/dist/tools/types.js.map +1 -0
  123. package/package.json +5 -5
@@ -0,0 +1,7 @@
1
+ export declare function analyzeConnections(contents: any[], connectionType: string): any[];
2
+ export declare function findConnection(content1: any, content2: any, type: string): any;
3
+ export declare function groupConnectionsByType(connections: any[]): Record<string, any[]>;
4
+ export declare function getConnectionTypeEmoji(type: string): string;
5
+ export declare function getStrengthIndicator(strength: number): string;
6
+ export declare function calculateNetworkStats(connections: any[], contents: any[]): any;
7
+ //# sourceMappingURL=connections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/connections.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,MAAM,GAAG,GAAG,EAAE,CAcjF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAmB9E;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAYhF;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS3D;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM7D;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,GAAG,CAuB9E"}
@@ -0,0 +1,85 @@
1
+ // Helper functions for analyzing connections between content
2
+ export function analyzeConnections(contents, connectionType) {
3
+ const connections = [];
4
+ // Analyze pairs of content
5
+ for (let i = 0; i < contents.length; i++) {
6
+ for (let j = i + 1; j < contents.length; j++) {
7
+ const conn = findConnection(contents[i], contents[j], connectionType);
8
+ if (conn) {
9
+ connections.push(conn);
10
+ }
11
+ }
12
+ }
13
+ return connections;
14
+ }
15
+ export function findConnection(content1, content2, type) {
16
+ // Simple connection detection based on shared concepts
17
+ const tags1 = new Set(content1.tags || []);
18
+ const tags2 = new Set(content2.tags || []);
19
+ const sharedTags = Array.from(tags1).filter(t => tags2.has(t));
20
+ if (sharedTags.length === 0 && type !== "contradictory") {
21
+ return null;
22
+ }
23
+ return {
24
+ source1: { id: content1.id, title: content1.title || "Untitled" },
25
+ source2: { id: content2.id, title: content2.title || "Untitled" },
26
+ type: sharedTags.length > 2 ? "strong" : "weak",
27
+ relationship: sharedTags.length > 0 ? "complementary" : "independent",
28
+ strength: sharedTags.length / Math.max(tags1.size, tags2.size),
29
+ sharedConcepts: sharedTags,
30
+ explanation: `Share ${sharedTags.length} common concepts`,
31
+ };
32
+ }
33
+ export function groupConnectionsByType(connections) {
34
+ const grouped = {};
35
+ connections.forEach(conn => {
36
+ const type = conn.relationship || "unknown";
37
+ if (!grouped[type]) {
38
+ grouped[type] = [];
39
+ }
40
+ grouped[type].push(conn);
41
+ });
42
+ return grouped;
43
+ }
44
+ export function getConnectionTypeEmoji(type) {
45
+ const emojis = {
46
+ complementary: "🤝",
47
+ contradictory: "⚡",
48
+ causal: "➡️",
49
+ sequential: "📅",
50
+ independent: "🔀",
51
+ };
52
+ return emojis[type] || "🔗";
53
+ }
54
+ export function getStrengthIndicator(strength) {
55
+ if (strength > 0.8)
56
+ return "🟢🟢🟢 Very Strong";
57
+ if (strength > 0.6)
58
+ return "🟢🟢 Strong";
59
+ if (strength > 0.4)
60
+ return "🟡 Moderate";
61
+ if (strength > 0.2)
62
+ return "🟠 Weak";
63
+ return "🔴 Very Weak";
64
+ }
65
+ export function calculateNetworkStats(connections, contents) {
66
+ const connectionCounts = new Map();
67
+ connections.forEach(conn => {
68
+ const id1 = conn.source1.id;
69
+ const id2 = conn.source2.id;
70
+ connectionCounts.set(id1, (connectionCounts.get(id1) || 0) + 1);
71
+ connectionCounts.set(id2, (connectionCounts.get(id2) || 0) + 1);
72
+ });
73
+ const mostConnectedId = Array.from(connectionCounts.entries())
74
+ .sort((a, b) => b[1] - a[1])[0]?.[0];
75
+ const mostConnected = contents.find(c => c.id === mostConnectedId) || contents[0];
76
+ return {
77
+ mostConnected: {
78
+ title: mostConnected?.title || "Unknown",
79
+ connectionCount: connectionCounts.get(mostConnectedId) || 0,
80
+ },
81
+ centralTheme: connections[0]?.sharedConcepts?.[0] || "Unknown",
82
+ density: connections.length > 0 ? "High" : "Low",
83
+ };
84
+ }
85
+ //# sourceMappingURL=connections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connections.js","sourceRoot":"","sources":["../../../src/tools/helpers/connections.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,MAAM,UAAU,kBAAkB,CAAC,QAAe,EAAE,cAAsB;IACxE,MAAM,WAAW,GAAG,EAAE,CAAC;IAEvB,2BAA2B;IAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC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AW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK;KACjD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function chunkContent(text: string, targetTokenSize: number, maxTokens?: number): any[];
2
+ export declare function detectSections(text: string, contentType: string): any[];
3
+ export declare function extractKeyConceptsFromSearch(results: any[], topic: string): string[];
4
+ export declare function groupByPerspective(results: any[]): Record<string, any[]>;
5
+ export declare function createTopicTimeline(results: any[]): any[];
6
+ export declare function createLearningPath(results: any[], topic: string): any[];
7
+ //# sourceMappingURL=content-processing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-processing.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/content-processing.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,GAAG,EAAE,CA4B7F;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,GAAG,EAAE,CAgCvE;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA8BpF;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAaxE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAazD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,CAgCvE"}
@@ -0,0 +1,136 @@
1
+ // Helper functions for content processing
2
+ export function chunkContent(text, targetTokenSize, maxTokens) {
3
+ const words = text.split(/\s+/);
4
+ const wordsPerChunk = Math.floor(targetTokenSize / 1.3); // Rough token estimation
5
+ const chunks = [];
6
+ let totalTokens = 0;
7
+ for (let i = 0; i < words.length; i += wordsPerChunk) {
8
+ const chunkWords = words.slice(i, i + wordsPerChunk);
9
+ const chunkText = chunkWords.join(' ');
10
+ const chunkTokens = Math.ceil(chunkWords.length * 1.3);
11
+ // Stop if we've reached the max token limit
12
+ if (maxTokens && totalTokens + chunkTokens > maxTokens) {
13
+ break;
14
+ }
15
+ chunks.push({
16
+ index: chunks.length,
17
+ text: chunkText,
18
+ tokenCount: chunkTokens,
19
+ startOffset: i,
20
+ endOffset: Math.min(i + wordsPerChunk, words.length),
21
+ });
22
+ totalTokens += chunkTokens;
23
+ }
24
+ return chunks;
25
+ }
26
+ export function detectSections(text, contentType) {
27
+ const sections = [];
28
+ // Simple section detection based on headers and paragraphs
29
+ const lines = text.split('\n');
30
+ let currentSection = { title: "Introduction", text: "", type: "intro", tokenCount: 0 };
31
+ for (const line of lines) {
32
+ // Detect headers (various formats)
33
+ if (line.match(/^#{1,6}\s+/) || line.match(/^[A-Z][^.!?]*:$/) || (line.length < 100 && line.match(/^[A-Z]/))) {
34
+ if (currentSection.text) {
35
+ currentSection.tokenCount = Math.ceil(currentSection.text.split(/\s+/).length * 1.3);
36
+ sections.push(currentSection);
37
+ }
38
+ currentSection = {
39
+ title: line.replace(/^#+\s+/, '').replace(/:$/, ''),
40
+ text: "",
41
+ type: "section",
42
+ tokenCount: 0,
43
+ };
44
+ }
45
+ else {
46
+ currentSection.text += line + "\n";
47
+ }
48
+ }
49
+ // Add the last section
50
+ if (currentSection.text) {
51
+ currentSection.tokenCount = Math.ceil(currentSection.text.split(/\s+/).length * 1.3);
52
+ sections.push(currentSection);
53
+ }
54
+ return sections;
55
+ }
56
+ export function extractKeyConceptsFromSearch(results, topic) {
57
+ const concepts = new Map();
58
+ results.forEach(result => {
59
+ // Extract from tags
60
+ if (result.tags) {
61
+ result.tags.forEach((tag) => {
62
+ concepts.set(tag, (concepts.get(tag) || 0) + 2);
63
+ });
64
+ }
65
+ // Extract from summary
66
+ if (result.summary) {
67
+ const summary = typeof result.summary === 'string' ? result.summary : result.summary.one_sentence;
68
+ if (summary) {
69
+ // Simple concept extraction from summary
70
+ const words = summary.toLowerCase().split(/\s+/);
71
+ const importantWords = words.filter((w) => w.length > 5 && !['about', 'through', 'between', 'during'].includes(w));
72
+ importantWords.forEach((word) => {
73
+ concepts.set(word, (concepts.get(word) || 0) + 1);
74
+ });
75
+ }
76
+ }
77
+ });
78
+ // Sort by frequency and return top concepts
79
+ return Array.from(concepts.entries())
80
+ .sort((a, b) => b[1] - a[1])
81
+ .map(([concept]) => concept)
82
+ .filter(concept => concept.toLowerCase() !== topic.toLowerCase());
83
+ }
84
+ export function groupByPerspective(results) {
85
+ const perspectives = {};
86
+ results.forEach(result => {
87
+ // Group by content type as a simple perspective grouping
88
+ const perspective = result.contentType || 'general';
89
+ if (!perspectives[perspective]) {
90
+ perspectives[perspective] = [];
91
+ }
92
+ perspectives[perspective].push(result);
93
+ });
94
+ return perspectives;
95
+ }
96
+ export function createTopicTimeline(results) {
97
+ // Sort by date and create timeline
98
+ const sorted = results
99
+ .filter(r => r.createdAt)
100
+ .sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
101
+ return sorted.slice(0, 5).map(result => ({
102
+ date: new Date(result.createdAt).toLocaleDateString(),
103
+ title: result.title || "Untitled",
104
+ insight: typeof result.summary === 'string'
105
+ ? result.summary.slice(0, 100)
106
+ : result.summary?.one_sentence?.slice(0, 100) || "No summary",
107
+ }));
108
+ }
109
+ export function createLearningPath(results, topic) {
110
+ // Create a simple learning path based on content
111
+ const path = [];
112
+ // Find introductory content
113
+ const intro = results.find(r => r.title?.toLowerCase().includes('introduction') ||
114
+ r.title?.toLowerCase().includes('basics') ||
115
+ r.title?.toLowerCase().includes('beginner'));
116
+ if (intro) {
117
+ path.push({
118
+ title: intro.title || "Introduction",
119
+ reason: "Start with foundational concepts",
120
+ id: intro.id,
121
+ });
122
+ }
123
+ // Add the most relevant content
124
+ results
125
+ .filter(r => r.id !== intro?.id)
126
+ .slice(0, 3)
127
+ .forEach(result => {
128
+ path.push({
129
+ title: result.title || "Untitled",
130
+ reason: "Build on core concepts",
131
+ id: result.id,
132
+ });
133
+ });
134
+ return path;
135
+ }
136
+ //# sourceMappingURL=content-processing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-processing.js","sourceRoot":"","sources":["../../../src/tools/helpers/content-processing.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAE1C,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,eAAuB,EAAE,SAAkB;IACpF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,CAAC,CAAC,yBAAyB;IAClF,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,aAAa,EAAE,CAAC;QACrD,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC;QACrD,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;QAEvD,4CAA4C;QAC5C,IAAI,SAAS,IAAI,WAAW,GAAG,WAAW,GAAG,SAAS,EAAE,CAAC;YACvD,MAAM;QACR,CAAC;QAED,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,MAAM,CAAC,MAAM;YACpB,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,WAAW;YACvB,WAAW,EAAE,CAAC;YACd,SAAS,EAAE,IAAI,CAAC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CAAC;IAEF,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,CAAC,IAAI,CAAC;YACR,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,cAAc;YACpC,MAAM,EAAE,kCAAkC;YAC1C,EAAE,EAAE,KAAK,CAAC,EAAE;SACb,CAAC,CAAC;IACL,CAAC;IAED,gCAAgC;IAChC,OAAO;SACJ,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,EAAE,EAAE,CAAC;SAC/B,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACX,OAAO,CAAC,MAAM,CAAC,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC;YACR,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,UAAU;YACjC,MAAM,EAAE,wBAAwB;YAChC,EAAE,EAAE,MAAM,CAAC,EAAE;SACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEL,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function extractTypedInsights(results: any[], query: string, type: string, minConfidence: number): any[];
2
+ //# sourceMappingURL=insights.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/insights.ts"],"names":[],"mappings":"AAEA,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,GAAG,EAAE,CA+D9G"}
@@ -0,0 +1,62 @@
1
+ // Helper functions for extracting insights
2
+ export function extractTypedInsights(results, query, type, minConfidence) {
3
+ // Simplified insight extraction
4
+ const insights = [];
5
+ switch (type) {
6
+ case "patterns":
7
+ // Find recurring themes
8
+ const themes = new Map();
9
+ results.forEach(result => {
10
+ if (result.tags) {
11
+ result.tags.forEach((tag) => {
12
+ if (!themes.has(tag))
13
+ themes.set(tag, []);
14
+ themes.get(tag).push(result);
15
+ });
16
+ }
17
+ });
18
+ Array.from(themes.entries())
19
+ .filter(([_, sources]) => sources.length >= 2)
20
+ .forEach(([theme, sources]) => {
21
+ insights.push({
22
+ pattern: theme,
23
+ frequency: sources.length,
24
+ confidence: sources.length / results.length,
25
+ examples: sources.slice(0, 3).map(s => ({
26
+ text: s.title || "Untitled",
27
+ source: s.contentType,
28
+ })),
29
+ });
30
+ });
31
+ break;
32
+ case "actionable":
33
+ // Extract actionable items from summaries
34
+ results.forEach(result => {
35
+ if (result.summary && typeof result.summary === 'object' && result.summary.actionable_takeaways) {
36
+ result.summary.actionable_takeaways.forEach((action) => {
37
+ insights.push({
38
+ action,
39
+ reasoning: "Extracted from content analysis",
40
+ priority: "medium",
41
+ sources: [result],
42
+ confidence: 0.8,
43
+ });
44
+ });
45
+ }
46
+ });
47
+ break;
48
+ default:
49
+ // Generic insight extraction
50
+ results.slice(0, 5).forEach(result => {
51
+ if (result.summary) {
52
+ insights.push({
53
+ text: typeof result.summary === 'string' ? result.summary : result.summary.one_sentence,
54
+ source: result.title || "Untitled",
55
+ confidence: 0.75,
56
+ });
57
+ }
58
+ });
59
+ }
60
+ return insights.filter((i) => i.confidence >= minConfidence);
61
+ }
62
+ //# sourceMappingURL=insights.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insights.js","sourceRoot":"","sources":["../../../src/tools/helpers/insights.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,MAAM,UAAU,oBAAoB,CAAC,OAAc,EAAE,KAAa,EAAE,IAAY,EAAE,aAAqB;IACrG,gCAAgC;IAChC,MAAM,QAAQ,GAAU,EAAE,CAAC;IAE3B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,UAAU;YACb,wBAAwB;YACxB,MAAM,MAAM,GAAG,IAAI,GAAG,EAAiB,CAAC;YACxC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACvB,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;oBAChB,MAAM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AC,OAAO,CAAC,CAAC,MAAc,EAAE,EAAE;wBAC7D,QAAQ,CAAC,IAAI,CAAC;4BACZ,MAAM;4BACN,SAAS,EAAE,iCAAiC;4BAC5C,QAAQ,EAAE,QAAQ;4BAClB,OAAO,EAAE,CAAC,MAAM,CAAC;4BACjB,UAAU,EAAE,GAAG;yBAChB,CAAC,CAAC;oBACL,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC,CAAC;YACH,MAAM;QAER;YACE,6BAA6B;YAC7B,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACnC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;oBACnB,QAAQ,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY;wBACvF,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,UAAU;wBAClC,UAAU,EAAE,IAAI;qBACjB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC,CAAC;IACP,CAAC;IAED,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,aAAa,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Tool } from "../types.js";
2
+ export declare const listActionsTool: Tool;
3
+ export declare const completeActionTool: Tool;
4
+ //# sourceMappingURL=actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/tools/implementations/actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,eAAO,MAAM,eAAe,EAAE,IAuC7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,IA8BhC,CAAC"}
@@ -0,0 +1,73 @@
1
+ import { z } from "zod";
2
+ export const listActionsTool = {
3
+ name: "list_actions",
4
+ description: "List action items extracted from saved content",
5
+ inputSchema: {
6
+ type: "object",
7
+ properties: {
8
+ contentId: {
9
+ type: "string",
10
+ description: "Filter by content ID",
11
+ },
12
+ goalId: {
13
+ type: "string",
14
+ description: "Filter by goal ID",
15
+ },
16
+ completed: {
17
+ type: "boolean",
18
+ description: "Filter by completion status",
19
+ },
20
+ },
21
+ },
22
+ modifies: false,
23
+ handler: async (client, args) => {
24
+ const schema = z.object({
25
+ contentId: z.string().optional(),
26
+ goalId: z.string().optional(),
27
+ completed: z.boolean().optional(),
28
+ });
29
+ const params = schema.parse(args);
30
+ const actions = await client.listActions(params);
31
+ return {
32
+ content: [
33
+ {
34
+ type: "text",
35
+ text: `Found ${actions.length} actions`,
36
+ },
37
+ ],
38
+ data: actions,
39
+ };
40
+ },
41
+ };
42
+ export const completeActionTool = {
43
+ name: "complete_action",
44
+ description: "Mark an action item as completed",
45
+ inputSchema: {
46
+ type: "object",
47
+ properties: {
48
+ actionId: {
49
+ type: "string",
50
+ description: "The ID of the action to complete",
51
+ },
52
+ },
53
+ required: ["actionId"],
54
+ },
55
+ modifies: true,
56
+ handler: async (client, args) => {
57
+ const schema = z.object({
58
+ actionId: z.string(),
59
+ });
60
+ const { actionId } = schema.parse(args);
61
+ const action = await client.completeAction(actionId);
62
+ return {
63
+ content: [
64
+ {
65
+ type: "text",
66
+ text: `Completed action: ${action.title}`,
67
+ },
68
+ ],
69
+ data: action,
70
+ };
71
+ },
72
+ };
73
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/tools/implementations/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,eAAe,GAAS;IACnC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,gDA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,EAAE,IAAI;IACd,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;YACtB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;SACrB,CAAC,CAAC;QACH,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,qBAAqB,MAAM,CAAC,KAAK,EAAE;iBAC1C;aACF;YACD,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Tool } from "../types.js";
2
+ export declare const batchGetContentTool: Tool;
3
+ //# sourceMappingURL=batch-get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-get.d.ts","sourceRoot":"","sources":["../../../src/tools/implementations/batch-get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,eAAO,MAAM,mBAAmB,EAAE,IAkGjC,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { z } from "zod";
2
+ export const batchGetContentTool = {
3
+ name: "batch_get_content",
4
+ description: "Fetch multiple content items in a single request. Efficient for bulk operations.",
5
+ inputSchema: {
6
+ type: "object",
7
+ properties: {
8
+ ids: {
9
+ type: "array",
10
+ items: {
11
+ type: "string",
12
+ },
13
+ description: "Array of content IDs to fetch",
14
+ },
15
+ includeFullContent: {
16
+ type: "boolean",
17
+ description: "Include full text content (warning: may use many tokens)",
18
+ default: false,
19
+ },
20
+ },
21
+ required: ["ids"],
22
+ },
23
+ modifies: false,
24
+ handler: async (client, args) => {
25
+ const schema = z.object({
26
+ ids: z.array(z.string()).min(1).max(50),
27
+ includeFullContent: z.boolean().optional().default(false),
28
+ });
29
+ const params = schema.parse(args);
30
+ const result = await client.batchGetContent(params.ids, params.includeFullContent);
31
+ let responseText = `# Batch Content Fetch\n\n`;
32
+ responseText += `Requested: ${params.ids.length} items\n`;
33
+ responseText += `Found: ${result.metadata?.found || 0} items\n`;
34
+ // Calculate and warn about total tokens
35
+ let totalTokens = 0;
36
+ if (result.results && result.results.length > 0) {
37
+ result.results.forEach((item) => {
38
+ if (item.tokenCount)
39
+ totalTokens += item.tokenCount;
40
+ });
41
+ }
42
+ if (params.includeFullContent && totalTokens > 0) {
43
+ responseText += `\n⚠️ **Full Content Included - Total Size: ${totalTokens.toLocaleString()} tokens**`;
44
+ if (totalTokens > 100000) {
45
+ responseText += ` 🚨 EXTREMELY LARGE!\n`;
46
+ responseText += `WARNING: This WILL consume most or all of your context window!\n`;
47
+ responseText += `Consider setting includeFullContent: false to just get summaries.\n`;
48
+ }
49
+ else if (totalTokens > 50000) {
50
+ responseText += ` 🚨 VERY LARGE!\n`;
51
+ responseText += `This is consuming significant context. Use with caution.\n`;
52
+ }
53
+ else if (totalTokens > 10000) {
54
+ responseText += ` ⚠️\n`;
55
+ }
56
+ else {
57
+ responseText += `\n`;
58
+ }
59
+ }
60
+ else if (!params.includeFullContent && totalTokens > 0) {
61
+ responseText += `\n💡 **Showing summaries only.** Total content available: ~${totalTokens.toLocaleString()} tokens.\n`;
62
+ responseText += `Rich metadata (summaries, tags, insights) included with minimal token usage.\n`;
63
+ }
64
+ responseText += `\n`;
65
+ if (result.results && result.results.length > 0) {
66
+ result.results.forEach((item, idx) => {
67
+ if (item.error) {
68
+ responseText += `## ${idx + 1}. Error: ${item.id}\n`;
69
+ responseText += `${item.error}\n\n`;
70
+ }
71
+ else {
72
+ responseText += `## ${idx + 1}. ${item.title || "Untitled"}\n`;
73
+ responseText += `**ID:** ${item.id}\n`;
74
+ responseText += `**Type:** ${item.contentType} | **URL:** ${item.url}\n`;
75
+ if (item.tokenCount) {
76
+ responseText += `**Tokens:** ${item.tokenCount.toLocaleString()}`;
77
+ if (item.tokenCount > 10000)
78
+ responseText += ` ⚠️`;
79
+ responseText += `\n`;
80
+ }
81
+ if (item.summary) {
82
+ responseText += `**Summary:** ${typeof item.summary === "string" ? item.summary : item.summary.one_sentence || "N/A"}\n`;
83
+ }
84
+ if (params.includeFullContent && item.fullContent) {
85
+ responseText += `**Content Length:** ${item.metadata?.contentLength || 0} characters\n`;
86
+ }
87
+ responseText += `\n`;
88
+ }
89
+ });
90
+ }
91
+ return {
92
+ content: [
93
+ {
94
+ type: "text",
95
+ text: responseText,
96
+ },
97
+ ],
98
+ data: result,
99
+ };
100
+ },
101
+ };
102
+ //# sourceMappingURL=batch-get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-get.js","sourceRoot":"","sources":["../../../src/tools/implementations/batch-get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,mBAAmB,GAAS;IACvC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,kFAAkF;IAC/F,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,GAAG,EAAE;gBACH,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,WAAW,EAAE,+BAA+B;aAC7C;YACD,kBAAkB,EAAE;gBAClB,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,0DAA0D;gBACvE,OAAO,EAAE,KAAK;aACf;SACF;QACD,QAAQ,EAAE,CAAC,KAAK,CAAC;KAClB;IACD,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;YACtB,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAA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C;oBACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;wBACjB,YAAY,IAAI,gBAAgB,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,KAAK,IAAI,CAAC;oBAC3H,CAAC;oBACD,IAAI,MAAM,CAAC,kBAAkB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;wBAClD,YAAY,IAAI,uBAAuB,IAAI,CAAC,QAAQ,EAAE,aAAa,IAAI,CAAC,eAAe,CAAC;oBAC1F,CAAC;oBACD,YAAY,IAAI,IAAI,CAAC;gBACvB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,YAAY;iBACnB;aACF;YACD,IAAI,EAAE,MAAM;SACb,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Tool } from "../types.js";
2
+ export declare const buildNarrativeTool: Tool;
3
+ //# sourceMappingURL=build-narrative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-narrative.d.ts","sourceRoot":"","sources":["../../../src/tools/implementations/build-narrative.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAsCnC,eAAO,MAAM,kBAAkB,EAAE,IA0OhC,CAAC"}