yt-embeddings-strapi-plugin 0.0.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 (65) hide show
  1. package/README.md +531 -0
  2. package/dist/_chunks/App-Cv1cdLAr.js +587 -0
  3. package/dist/_chunks/App-bN58O1bN.mjs +583 -0
  4. package/dist/_chunks/en-B4KWt_jN.js +4 -0
  5. package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
  6. package/dist/_chunks/index-BAfBs5PQ.js +172 -0
  7. package/dist/_chunks/index-K6X5FM2O.mjs +173 -0
  8. package/dist/admin/index.js +4 -0
  9. package/dist/admin/index.mjs +5 -0
  10. package/dist/admin/src/components/Initializer.d.ts +5 -0
  11. package/dist/admin/src/components/PluginIcon.d.ts +2 -0
  12. package/dist/admin/src/components/custom/BackLink.d.ts +5 -0
  13. package/dist/admin/src/components/custom/ChatModal.d.ts +1 -0
  14. package/dist/admin/src/components/custom/EmbeddingsModal.d.ts +1 -0
  15. package/dist/admin/src/components/custom/EmbeddingsWidget.d.ts +1 -0
  16. package/dist/admin/src/components/custom/Illo.d.ts +1 -0
  17. package/dist/admin/src/components/custom/Markdown.d.ts +5 -0
  18. package/dist/admin/src/components/custom/RobotIcon.d.ts +6 -0
  19. package/dist/admin/src/index.d.ts +12 -0
  20. package/dist/admin/src/pages/App.d.ts +2 -0
  21. package/dist/admin/src/pages/EmbeddingDetails.d.ts +1 -0
  22. package/dist/admin/src/pages/HomePage.d.ts +1 -0
  23. package/dist/admin/src/pluginId.d.ts +1 -0
  24. package/dist/admin/src/utils/api.d.ts +81 -0
  25. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  26. package/dist/server/index.js +2220 -0
  27. package/dist/server/index.mjs +2203 -0
  28. package/dist/server/src/bootstrap.d.ts +5 -0
  29. package/dist/server/src/config/index.d.ts +38 -0
  30. package/dist/server/src/content-types/index.d.ts +2 -0
  31. package/dist/server/src/controllers/controller.d.ts +13 -0
  32. package/dist/server/src/controllers/index.d.ts +30 -0
  33. package/dist/server/src/controllers/mcp.d.ts +18 -0
  34. package/dist/server/src/controllers/yt-controller.d.ts +13 -0
  35. package/dist/server/src/destroy.d.ts +5 -0
  36. package/dist/server/src/index.d.ts +280 -0
  37. package/dist/server/src/mcp/index.d.ts +6 -0
  38. package/dist/server/src/mcp/schemas/index.d.ts +55 -0
  39. package/dist/server/src/mcp/server.d.ts +8 -0
  40. package/dist/server/src/mcp/tools/get-video-transcript-range.d.ts +33 -0
  41. package/dist/server/src/mcp/tools/get-yt-video-summary.d.ts +23 -0
  42. package/dist/server/src/mcp/tools/index.d.ts +38 -0
  43. package/dist/server/src/mcp/tools/list-yt-videos.d.ts +28 -0
  44. package/dist/server/src/mcp/tools/search-yt-knowledge.d.ts +51 -0
  45. package/dist/server/src/middlewares/index.d.ts +2 -0
  46. package/dist/server/src/migrations/002-yt-tables.d.ts +2 -0
  47. package/dist/server/src/plugin-manager.d.ts +81 -0
  48. package/dist/server/src/policies/index.d.ts +2 -0
  49. package/dist/server/src/register.d.ts +5 -0
  50. package/dist/server/src/routes/admin.d.ts +14 -0
  51. package/dist/server/src/routes/content-api.d.ts +20 -0
  52. package/dist/server/src/routes/index.d.ts +41 -0
  53. package/dist/server/src/services/ai-tools.d.ts +127 -0
  54. package/dist/server/src/services/index.d.ts +185 -0
  55. package/dist/server/src/services/yt-embeddings.d.ts +68 -0
  56. package/dist/server/src/services/yt-metadata.d.ts +12 -0
  57. package/dist/server/src/tools/get-video-transcript-range.d.ts +32 -0
  58. package/dist/server/src/tools/get-yt-video-summary.d.ts +36 -0
  59. package/dist/server/src/tools/index.d.ts +126 -0
  60. package/dist/server/src/tools/list-yt-videos.d.ts +25 -0
  61. package/dist/server/src/tools/search-yt-knowledge.d.ts +35 -0
  62. package/dist/server/src/utils/chunking.d.ts +44 -0
  63. package/dist/server/src/utils/preprocessing.d.ts +26 -0
  64. package/dist/server/src/utils/yt-chunker.d.ts +16 -0
  65. package/package.json +106 -0
@@ -0,0 +1,126 @@
1
+ import { searchYtKnowledgeTool } from './search-yt-knowledge';
2
+ import { getVideoTranscriptRangeTool } from './get-video-transcript-range';
3
+ import { listYtVideosTool } from './list-yt-videos';
4
+ import { getYtVideoSummaryTool } from './get-yt-video-summary';
5
+ export declare const tools: ({
6
+ name: string;
7
+ description: string;
8
+ schema: import("zod").ZodObject<{
9
+ query: import("zod").ZodString;
10
+ limit: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
11
+ videoId: import("zod").ZodOptional<import("zod").ZodString>;
12
+ topics: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
13
+ contextWindowSeconds: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
14
+ minSimilarity: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
15
+ }, "strip", import("zod").ZodTypeAny, {
16
+ query?: string;
17
+ limit?: number;
18
+ videoId?: string;
19
+ topics?: string[];
20
+ contextWindowSeconds?: number;
21
+ minSimilarity?: number;
22
+ }, {
23
+ query?: string;
24
+ limit?: number;
25
+ videoId?: string;
26
+ topics?: string[];
27
+ contextWindowSeconds?: number;
28
+ minSimilarity?: number;
29
+ }>;
30
+ execute: (args: unknown, strapi: import("@strapi/types/dist/core").Strapi) => Promise<{
31
+ results: any[];
32
+ message: string;
33
+ } | {
34
+ results: any;
35
+ message?: undefined;
36
+ }>;
37
+ publicSafe: boolean;
38
+ } | {
39
+ name: string;
40
+ description: string;
41
+ schema: import("zod").ZodObject<{
42
+ videoId: import("zod").ZodString;
43
+ startSeconds: import("zod").ZodNumber;
44
+ endSeconds: import("zod").ZodNumber;
45
+ }, "strip", import("zod").ZodTypeAny, {
46
+ videoId?: string;
47
+ startSeconds?: number;
48
+ endSeconds?: number;
49
+ }, {
50
+ videoId?: string;
51
+ startSeconds?: number;
52
+ endSeconds?: number;
53
+ }>;
54
+ execute: (args: unknown, strapi: import("@strapi/types/dist/core").Strapi) => Promise<{
55
+ transcript: any;
56
+ message: string;
57
+ videoId?: undefined;
58
+ range?: undefined;
59
+ deepLink?: undefined;
60
+ } | {
61
+ videoId: string;
62
+ range: string;
63
+ transcript: any;
64
+ deepLink: string;
65
+ message?: undefined;
66
+ }>;
67
+ publicSafe: boolean;
68
+ } | {
69
+ name: string;
70
+ description: string;
71
+ schema: import("zod").ZodObject<{
72
+ page: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
73
+ pageSize: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
74
+ }, "strip", import("zod").ZodTypeAny, {
75
+ page?: number;
76
+ pageSize?: number;
77
+ }, {
78
+ page?: number;
79
+ pageSize?: number;
80
+ }>;
81
+ execute: (args: unknown, strapi: import("@strapi/types/dist/core").Strapi) => Promise<{
82
+ videos: any;
83
+ pagination: {
84
+ page: any;
85
+ pageSize: any;
86
+ total: any;
87
+ pageCount: number;
88
+ };
89
+ }>;
90
+ publicSafe: boolean;
91
+ } | {
92
+ name: string;
93
+ description: string;
94
+ schema: import("zod").ZodObject<{
95
+ videoId: import("zod").ZodString;
96
+ }, "strip", import("zod").ZodTypeAny, {
97
+ videoId?: string;
98
+ }, {
99
+ videoId?: string;
100
+ }>;
101
+ execute: (args: unknown, strapi: import("@strapi/types/dist/core").Strapi) => Promise<{
102
+ error: boolean;
103
+ message: string;
104
+ videoId?: undefined;
105
+ title?: undefined;
106
+ topics?: undefined;
107
+ summary?: undefined;
108
+ chunkCount?: undefined;
109
+ embeddingStatus?: undefined;
110
+ watchLink?: undefined;
111
+ keyMoments?: undefined;
112
+ } | {
113
+ videoId: any;
114
+ title: any;
115
+ topics: any;
116
+ summary: any;
117
+ chunkCount: any;
118
+ embeddingStatus: any;
119
+ watchLink: string;
120
+ keyMoments: any;
121
+ error?: undefined;
122
+ message?: undefined;
123
+ }>;
124
+ publicSafe: boolean;
125
+ })[];
126
+ export { searchYtKnowledgeTool, getVideoTranscriptRangeTool, listYtVideosTool, getYtVideoSummaryTool, };
@@ -0,0 +1,25 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ export declare const listYtVideosTool: {
3
+ name: string;
4
+ description: string;
5
+ schema: import("zod").ZodObject<{
6
+ page: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
7
+ pageSize: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
8
+ }, "strip", import("zod").ZodTypeAny, {
9
+ page?: number;
10
+ pageSize?: number;
11
+ }, {
12
+ page?: number;
13
+ pageSize?: number;
14
+ }>;
15
+ execute: (args: unknown, strapi: Core.Strapi) => Promise<{
16
+ videos: any;
17
+ pagination: {
18
+ page: any;
19
+ pageSize: any;
20
+ total: any;
21
+ pageCount: number;
22
+ };
23
+ }>;
24
+ publicSafe: boolean;
25
+ };
@@ -0,0 +1,35 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ export declare const searchYtKnowledgeTool: {
3
+ name: string;
4
+ description: string;
5
+ schema: import("zod").ZodObject<{
6
+ query: import("zod").ZodString;
7
+ limit: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
8
+ videoId: import("zod").ZodOptional<import("zod").ZodString>;
9
+ topics: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
10
+ contextWindowSeconds: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
11
+ minSimilarity: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
12
+ }, "strip", import("zod").ZodTypeAny, {
13
+ query?: string;
14
+ limit?: number;
15
+ videoId?: string;
16
+ topics?: string[];
17
+ contextWindowSeconds?: number;
18
+ minSimilarity?: number;
19
+ }, {
20
+ query?: string;
21
+ limit?: number;
22
+ videoId?: string;
23
+ topics?: string[];
24
+ contextWindowSeconds?: number;
25
+ minSimilarity?: number;
26
+ }>;
27
+ execute: (args: unknown, strapi: Core.Strapi) => Promise<{
28
+ results: any[];
29
+ message: string;
30
+ } | {
31
+ results: any;
32
+ message?: undefined;
33
+ }>;
34
+ publicSafe: boolean;
35
+ };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Text chunking utilities for splitting large content into embeddable chunks
3
+ */
4
+ export interface ChunkOptions {
5
+ /** Maximum characters per chunk (default: 4000, roughly ~1000 tokens) */
6
+ chunkSize?: number;
7
+ /** Number of characters to overlap between chunks (default: 200) */
8
+ chunkOverlap?: number;
9
+ /** Separator to use when splitting (default: splits on paragraphs, sentences, then words) */
10
+ separators?: string[];
11
+ }
12
+ export interface TextChunk {
13
+ /** The chunk text content */
14
+ text: string;
15
+ /** Zero-based chunk index */
16
+ chunkIndex: number;
17
+ /** Total number of chunks */
18
+ totalChunks: number;
19
+ /** Character offset in original text */
20
+ startOffset: number;
21
+ /** Character end offset in original text */
22
+ endOffset: number;
23
+ }
24
+ /**
25
+ * Estimate token count from character count
26
+ * OpenAI models average ~4 characters per token for English text
27
+ */
28
+ export declare function estimateTokens(text: string): number;
29
+ /**
30
+ * Check if content exceeds the recommended chunk size
31
+ */
32
+ export declare function needsChunking(content: string, maxChars?: number): boolean;
33
+ /**
34
+ * Split content into chunks suitable for embedding
35
+ *
36
+ * @param content - The text content to split
37
+ * @param options - Chunking options
38
+ * @returns Array of TextChunk objects
39
+ */
40
+ export declare function chunkContent(content: string, options?: ChunkOptions): TextChunk[];
41
+ /**
42
+ * Format chunk title with index information
43
+ */
44
+ export declare function formatChunkTitle(baseTitle: string, chunkIndex: number, totalChunks: number): string;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Content preprocessing utilities for cleaning text before embedding
3
+ * Handles HTML stripping, markdown conversion, and text normalization
4
+ */
5
+ export interface PreprocessOptions {
6
+ /** Strip HTML tags from content (default: true) */
7
+ stripHtml?: boolean;
8
+ /** Strip markdown syntax from content (default: true) */
9
+ stripMarkdown?: boolean;
10
+ /** Normalize whitespace (collapse multiple spaces/newlines) (default: true) */
11
+ normalizeWhitespace?: boolean;
12
+ }
13
+ /**
14
+ * Preprocess content for embedding
15
+ * Strips HTML, markdown, and normalizes whitespace
16
+ *
17
+ * @param content - The raw content to preprocess
18
+ * @param options - Preprocessing options
19
+ * @returns Cleaned plain text ready for embedding
20
+ */
21
+ export declare function preprocessContent(content: string, options?: PreprocessOptions): string;
22
+ /**
23
+ * Check if content needs preprocessing
24
+ * Returns true if content contains HTML or Markdown
25
+ */
26
+ export declare function needsPreprocessing(content: string): boolean;
@@ -0,0 +1,16 @@
1
+ export interface Segment {
2
+ text: string;
3
+ start: number;
4
+ end: number;
5
+ duration: number;
6
+ }
7
+ export interface YtChunk {
8
+ text: string;
9
+ startSeconds: number;
10
+ endSeconds: number;
11
+ durationSeconds: number;
12
+ chunkIndex: number;
13
+ segments: Segment[];
14
+ tokens: number;
15
+ }
16
+ export declare function chunkTranscript(segments: Segment[]): YtChunk[];
package/package.json ADDED
@@ -0,0 +1,106 @@
1
+ {
2
+ "name": "yt-embeddings-strapi-plugin",
3
+ "version": "0.0.1",
4
+ "description": "Strapi v5 plugin for vector embeddings with OpenAI and Neon PostgreSQL. Enables semantic search, RAG chat, and MCP (Model Context Protocol) integration.",
5
+ "keywords": [
6
+ "strapi",
7
+ "strapi-plugin",
8
+ "embeddings",
9
+ "vector-search",
10
+ "rag",
11
+ "openai",
12
+ "neon",
13
+ "pgvector",
14
+ "mcp",
15
+ "semantic-search"
16
+ ],
17
+ "license": "MIT",
18
+ "author": "Paul Bratslavsky <codingafterthirty@gmail.com>",
19
+ "homepage": "https://github.com/PaulBrats662/strapi-content-embeddings#readme",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/PaulBratslavsky/strapi-content-embeddings.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/PaulBratslavsky/strapi-content-embeddings/issues"
26
+ },
27
+ "type": "commonjs",
28
+ "overrides": {
29
+ "@langchain/core": "^1.1.31"
30
+ },
31
+ "exports": {
32
+ "./package.json": "./package.json",
33
+ "./strapi-admin": {
34
+ "types": "./dist/admin/src/index.d.tsx",
35
+ "source": "./admin/src/index.tsx",
36
+ "import": "./dist/admin/index.mjs",
37
+ "require": "./dist/admin/index.js",
38
+ "default": "./dist/admin/index.js"
39
+ },
40
+ "./strapi-server": {
41
+ "types": "./dist/server/src/index.d.ts",
42
+ "source": "./server/src/index.ts",
43
+ "import": "./dist/server/index.mjs",
44
+ "require": "./dist/server/index.js",
45
+ "default": "./dist/server/index.js"
46
+ }
47
+ },
48
+ "files": [
49
+ "dist"
50
+ ],
51
+ "scripts": {
52
+ "build": "strapi-plugin build",
53
+ "setup-db": "node scripts/setup-db.js",
54
+ "test:ts:back": "run -T tsc -p server/tsconfig.json",
55
+ "test:ts:front": "run -T tsc -p admin/tsconfig.json",
56
+ "verify": "strapi-plugin verify",
57
+ "watch": "strapi-plugin watch",
58
+ "watch:link": "strapi-plugin watch:link"
59
+ },
60
+ "dependencies": {
61
+ "@langchain/community": "^1.1.2",
62
+ "@langchain/core": "^1.1.31",
63
+ "@langchain/openai": "^1.2.1",
64
+ "@mdxeditor/editor": "^3.52.3",
65
+ "@modelcontextprotocol/sdk": "^1.12.0",
66
+ "@strapi/design-system": "^2.0.0-rc.12",
67
+ "@strapi/icons": "^2.0.0-rc.12",
68
+ "html-to-text": "^9.0.5",
69
+ "langchain": "^1.2.4",
70
+ "pg": "^8.13.1",
71
+ "remove-markdown": "^0.5.5",
72
+ "qs": "^6.13.1",
73
+ "react-intl": "^6.8.4",
74
+ "react-markdown": "^10.1.0",
75
+ "zod": "^3.24.0"
76
+ },
77
+ "devDependencies": {
78
+ "@strapi/sdk-plugin": "^5.2.7",
79
+ "@strapi/strapi": "^5.2.0",
80
+ "@strapi/typescript-utils": "^5.2.0",
81
+ "@types/pg": "^8.11.10",
82
+ "@types/qs": "^6.9.17",
83
+ "@types/react": "^18.3.12",
84
+ "@types/react-dom": "^18.3.1",
85
+ "prettier": "^3.3.3",
86
+ "react": "^18.3.1",
87
+ "react-dom": "^18.3.1",
88
+ "react-router-dom": "^6.27.0",
89
+ "styled-components": "^6.1.13",
90
+ "typescript": "^5.6.3"
91
+ },
92
+ "peerDependencies": {
93
+ "@strapi/sdk-plugin": "^5.2.7",
94
+ "@strapi/strapi": "^5.2.0",
95
+ "react": "^18.3.1",
96
+ "react-dom": "^18.3.1",
97
+ "react-router-dom": "^6.27.0",
98
+ "styled-components": "^6.1.13"
99
+ },
100
+ "strapi": {
101
+ "kind": "plugin",
102
+ "name": "yt-embeddings-strapi-plugin",
103
+ "displayName": "YT Embeddings",
104
+ "description": "YouTube transcript vector embeddings with semantic search, RAG chat, and MCP integration."
105
+ }
106
+ }