@devilsdev/rag-pipeline-utils 2.6.1 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BENCHMARKS.md +7 -1
- package/CHANGELOG.md +135 -0
- package/README.md +37 -24
- package/dist/index.cjs +4164 -1825
- package/dist/index.d.ts +265 -256
- package/dist/index.mjs +1 -1
- package/dist/types/cache/memory-cache.d.ts +4 -1
- package/dist/types/cache/redis-cache.d.ts +4 -1
- package/dist/types/cli/services/instrument.d.ts +14 -0
- package/dist/types/cli/services/rag-service.d.ts +140 -0
- package/dist/types/cli/shared/config-context.d.ts +9 -0
- package/dist/types/config/component-factory.d.ts +57 -0
- package/dist/types/config/enhanced-ragrc-schema.d.ts +648 -0
- package/dist/types/config/load-config.d.ts +18 -0
- package/dist/types/config/normalize-config.d.ts +9 -0
- package/dist/types/core/observability/event-logger.d.ts +211 -0
- package/dist/types/core/observability/metrics.d.ts +585 -0
- package/dist/types/core/performance/parallel-processor.d.ts +92 -0
- package/dist/types/core/plugin-registry.d.ts +5 -0
- package/dist/types/dag/core/execution-scheduler.d.ts +3 -1
- package/dist/types/dag/dag-engine.d.ts +15 -2
- package/dist/types/dev/dev-server.d.ts +136 -0
- package/dist/types/dev/hot-reload.d.ts +226 -0
- package/dist/types/ecosystem/plugin-analytics-dashboard.d.ts +141 -0
- package/dist/types/ecosystem/plugin-hub.d.ts +161 -0
- package/dist/types/ecosystem/plugin-installer.d.ts +40 -0
- package/dist/types/ecosystem/plugin-probe.d.ts +21 -0
- package/dist/types/ecosystem/plugin-scanner.d.ts +30 -0
- package/dist/types/ecosystem/tar-extract.d.ts +24 -0
- package/dist/types/enterprise/audit-logging.d.ts +217 -0
- package/dist/types/evaluate/compare.d.ts +140 -0
- package/dist/types/evaluate/dataset.d.ts +43 -0
- package/dist/types/evaluate/evaluator.d.ts +14 -0
- package/dist/types/evaluate/report.d.ts +56 -0
- package/dist/types/evaluate/synthetic.d.ts +64 -0
- package/dist/types/loader/csv-loader.d.ts +10 -0
- package/dist/types/loader/document-reader.d.ts +18 -0
- package/dist/types/loader/html-loader.d.ts +21 -0
- package/dist/types/loader/markdown-loader.d.ts +21 -0
- package/dist/types/retrieval/bm25-search.d.ts +4 -0
- package/dist/types/retrieval/file-vector-store.d.ts +4 -1
- package/dist/types/retrieval/hybrid-retriever.d.ts +4 -0
- package/dist/types/retrieval/pgvector-retriever.d.ts +123 -0
- package/dist/types/retrieval/qdrant-retriever.d.ts +106 -0
- package/dist/types/security/validator.d.ts +11 -1
- package/dist/types/testing.d.ts +2 -0
- package/dist/types/utils/batch-processor.d.ts +205 -0
- package/dist/types/utils/connection-pool.d.ts +158 -0
- package/dist/types/utils/error-formatter.d.ts +312 -0
- package/dist/types/utils/logger.d.ts +29 -4
- package/dist/types/utils/rate-limiter.d.ts +13 -8
- package/dist/types/utils/retry.d.ts +10 -0
- package/package.json +13 -3
- package/src/cache/memory-cache.js +4 -1
- package/src/cache/redis-cache.js +4 -1
- package/src/cli/enhanced-cli-commands.js +79 -0
- package/src/cli/handlers/ai-handler.js +2 -2
- package/src/cli/handlers/eval-handler.js +201 -0
- package/src/cli/handlers/generate-handler.js +103 -0
- package/src/cli/services/benchmark.js +2 -2
- package/src/cli/services/rag-service.js +59 -10
- package/src/cli/shared/cli-utils.js +40 -1
- package/src/config/component-factory.js +32 -0
- package/src/connectors/local-embedder.js +20 -13
- package/src/core/observability/event-logger.js +135 -1
- package/src/core/observability/metrics.js +223 -5
- package/src/core/performance/parallel-processor.js +2 -0
- package/src/core/plugin-registry.js +5 -1
- package/src/dag/core/execution-scheduler.js +2 -0
- package/src/dag/dag-engine.js +13 -0
- package/src/dev/dev-server.js +6 -0
- package/src/ecosystem/plugin-hub.js +4 -0
- package/src/enterprise/audit-logging.js +5 -0
- package/src/evaluate/compare.js +395 -0
- package/src/evaluate/dataset.js +207 -0
- package/src/evaluate/report.js +350 -0
- package/src/evaluate/synthetic.js +246 -0
- package/src/index.js +17 -0
- package/src/retrieval/bm25-search.js +4 -0
- package/src/retrieval/file-vector-store.js +4 -1
- package/src/retrieval/hybrid-retriever.js +4 -0
- package/src/retrieval/pgvector-retriever.js +420 -0
- package/src/retrieval/qdrant-retriever.js +361 -0
- package/src/security/validator.js +8 -0
- package/src/testing.js +2 -0
- package/src/utils/batch-processor.js +7 -3
- package/src/utils/error-formatter.js +48 -20
- package/src/utils/logger.js +31 -1
- package/src/utils/rate-limiter.js +9 -4
- package/src/utils/retry.js +10 -1
|
@@ -2,8 +2,21 @@ export class DAG {
|
|
|
2
2
|
nodes: Map<any, any>;
|
|
3
3
|
scheduler: ExecutionScheduler;
|
|
4
4
|
errorContext: ErrorContext;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Adds a node. A source node receives the seed; a node with one input
|
|
7
|
+
* receives that node's result, and with several, an array of them.
|
|
8
|
+
* @param {string} id - Unique node id
|
|
9
|
+
* @param {function(*): *} fn - The node's work; may be async
|
|
10
|
+
* @param {Object} [options]
|
|
11
|
+
* @returns {DAGNode} The node; set `optional` or `retry` on it to change how failures are handled
|
|
12
|
+
*/
|
|
13
|
+
addNode(id: string, _fn: any, options?: any): DAGNode;
|
|
14
|
+
/**
|
|
15
|
+
* Adds an edge: `toId` runs after `fromId` and receives its result.
|
|
16
|
+
* @param {string} fromId
|
|
17
|
+
* @param {string} toId
|
|
18
|
+
*/
|
|
19
|
+
connect(fromId: string, toId: string): void;
|
|
7
20
|
/**
|
|
8
21
|
* Parse and normalize execute parameters
|
|
9
22
|
* @param {any} seedOrOptions - Seed data or options object
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Development Server
|
|
3
|
+
*
|
|
4
|
+
* Integrates hot reloading with a development workflow
|
|
5
|
+
*/
|
|
6
|
+
export class DevServer extends EventEmitter<[never]> {
|
|
7
|
+
constructor(options?: {});
|
|
8
|
+
options: {
|
|
9
|
+
port: any;
|
|
10
|
+
host: any;
|
|
11
|
+
watchPaths: any;
|
|
12
|
+
maxBodyBytes: any;
|
|
13
|
+
query: any;
|
|
14
|
+
configPath: any;
|
|
15
|
+
verbose: boolean;
|
|
16
|
+
autoReload: boolean;
|
|
17
|
+
notifyOnReload: boolean;
|
|
18
|
+
pluginRegistry: any;
|
|
19
|
+
pipeline: any;
|
|
20
|
+
};
|
|
21
|
+
hotReload: import("./hot-reload").HotReloadManager;
|
|
22
|
+
isRunning: boolean;
|
|
23
|
+
startTime: number;
|
|
24
|
+
/**
|
|
25
|
+
* Setup hot reload event handlers
|
|
26
|
+
*
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
private _setupHotReloadHandlers;
|
|
30
|
+
/**
|
|
31
|
+
* Start the development server
|
|
32
|
+
*
|
|
33
|
+
* @returns {Promise<void>}
|
|
34
|
+
*/
|
|
35
|
+
start(): Promise<void>;
|
|
36
|
+
server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
37
|
+
port: any;
|
|
38
|
+
/**
|
|
39
|
+
* Stop the development server
|
|
40
|
+
*
|
|
41
|
+
* @returns {Promise<void>}
|
|
42
|
+
*/
|
|
43
|
+
stop(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Get server status
|
|
46
|
+
*
|
|
47
|
+
* @returns {object} Server status
|
|
48
|
+
*/
|
|
49
|
+
getStatus(): object;
|
|
50
|
+
/**
|
|
51
|
+
* Get statistics dashboard
|
|
52
|
+
*
|
|
53
|
+
* @returns {string} Formatted statistics
|
|
54
|
+
*/
|
|
55
|
+
getStatistics(): string;
|
|
56
|
+
/**
|
|
57
|
+
* Manually trigger a reload
|
|
58
|
+
*
|
|
59
|
+
* @param {string} filePath - File path to reload
|
|
60
|
+
* @param {string} type - Type ('plugin' or 'config')
|
|
61
|
+
* @returns {Promise<void>}
|
|
62
|
+
*/
|
|
63
|
+
/** @returns {string} Base URL of the running server */
|
|
64
|
+
get url(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Route a request. Only GET /health and POST /query exist.
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
private _handleRequest;
|
|
70
|
+
/** @private */
|
|
71
|
+
private _isLoopbackHostHeader;
|
|
72
|
+
/**
|
|
73
|
+
* Answer with the custom `query` option, or the pipeline described by the
|
|
74
|
+
* config file (reloaded per request, so config edits apply immediately).
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
private _runQuery;
|
|
78
|
+
/** @private */
|
|
79
|
+
private _readJson;
|
|
80
|
+
/** @private */
|
|
81
|
+
private _send;
|
|
82
|
+
/**
|
|
83
|
+
* Reloads a plugin or the config now, as if the file had changed.
|
|
84
|
+
* @param {string} filePath
|
|
85
|
+
* @param {'plugin'|'config'} [type='plugin']
|
|
86
|
+
* @returns {Promise<void>}
|
|
87
|
+
*/
|
|
88
|
+
triggerReload(filePath: string, type?: "plugin" | "config"): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Register a lifecycle hook
|
|
91
|
+
*
|
|
92
|
+
* @param {string} hookName - Hook name
|
|
93
|
+
* @param {Function} callback - Hook callback
|
|
94
|
+
*/
|
|
95
|
+
registerHook(hookName: string, callback: Function): void;
|
|
96
|
+
/**
|
|
97
|
+
* Unregister a lifecycle hook
|
|
98
|
+
*
|
|
99
|
+
* @param {string} hookName - Hook name
|
|
100
|
+
* @param {Function} callback - Hook callback
|
|
101
|
+
*/
|
|
102
|
+
unregisterHook(hookName: string, callback: Function): void;
|
|
103
|
+
/**
|
|
104
|
+
* Log message
|
|
105
|
+
*
|
|
106
|
+
* @private
|
|
107
|
+
* @param {string} message - Log message
|
|
108
|
+
* @param {string} level - Log level
|
|
109
|
+
*/
|
|
110
|
+
private _log;
|
|
111
|
+
/**
|
|
112
|
+
* Send notification
|
|
113
|
+
*
|
|
114
|
+
* @private
|
|
115
|
+
* @param {string} message - Notification message
|
|
116
|
+
* @param {string} type - Notification type
|
|
117
|
+
*/
|
|
118
|
+
private _notify;
|
|
119
|
+
/**
|
|
120
|
+
* Format duration
|
|
121
|
+
*
|
|
122
|
+
* @private
|
|
123
|
+
* @param {number} ms - Duration in milliseconds
|
|
124
|
+
* @returns {string} Formatted duration
|
|
125
|
+
*/
|
|
126
|
+
private _formatDuration;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Create development server
|
|
130
|
+
*
|
|
131
|
+
* @param {object} options - Server options
|
|
132
|
+
* @returns {DevServer} Development server instance
|
|
133
|
+
*/
|
|
134
|
+
export function createDevServer(options?: object): DevServer;
|
|
135
|
+
import { EventEmitter } from "events";
|
|
136
|
+
import http = require("http");
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* chokidar 4 removed glob support, so glob strings in `ignored` were treated
|
|
3
|
+
* as literal paths and matched nothing. Convert them to one matcher function.
|
|
4
|
+
*
|
|
5
|
+
* @param {Array<string|RegExp|Function>} patterns
|
|
6
|
+
* @returns {(filePath: string) => boolean}
|
|
7
|
+
*/
|
|
8
|
+
export function toIgnoreMatcher(patterns: Array<string | RegExp | Function>): (filePath: string) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Hot Reload Manager
|
|
11
|
+
*
|
|
12
|
+
* Manages file watching and hot reloading of plugins and configuration.
|
|
13
|
+
*/
|
|
14
|
+
export class HotReloadManager extends EventEmitter<[never]> {
|
|
15
|
+
constructor(options?: {});
|
|
16
|
+
options: {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
watchPaths: any;
|
|
19
|
+
configPath: any;
|
|
20
|
+
debounceDelay: any;
|
|
21
|
+
preserveState: boolean;
|
|
22
|
+
verbose: any;
|
|
23
|
+
ignorePatterns: any;
|
|
24
|
+
};
|
|
25
|
+
watchers: any[];
|
|
26
|
+
pluginRegistry: any;
|
|
27
|
+
reloadQueue: Map<any, any>;
|
|
28
|
+
debounceTimers: Map<any, any>;
|
|
29
|
+
pluginState: Map<any, any>;
|
|
30
|
+
reloadHistory: any[];
|
|
31
|
+
isReloading: boolean;
|
|
32
|
+
stats: {
|
|
33
|
+
totalReloads: number;
|
|
34
|
+
successfulReloads: number;
|
|
35
|
+
failedReloads: number;
|
|
36
|
+
configReloads: number;
|
|
37
|
+
pluginReloads: number;
|
|
38
|
+
averageReloadTime: number;
|
|
39
|
+
};
|
|
40
|
+
hooks: {
|
|
41
|
+
beforeReload: any[];
|
|
42
|
+
afterReload: any[];
|
|
43
|
+
onError: any[];
|
|
44
|
+
onStatePreserve: any[];
|
|
45
|
+
onStateRestore: any[];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Start watching for file changes
|
|
49
|
+
*
|
|
50
|
+
* @returns {Promise<void>}
|
|
51
|
+
*/
|
|
52
|
+
start(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Stop watching for file changes
|
|
55
|
+
*
|
|
56
|
+
* @returns {Promise<void>}
|
|
57
|
+
*/
|
|
58
|
+
stop(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Watch plugin files
|
|
61
|
+
*
|
|
62
|
+
* @private
|
|
63
|
+
* @returns {Promise<void>}
|
|
64
|
+
*/
|
|
65
|
+
private _watchPlugins;
|
|
66
|
+
/**
|
|
67
|
+
* Watch configuration file
|
|
68
|
+
*
|
|
69
|
+
* @private
|
|
70
|
+
* @returns {Promise<void>}
|
|
71
|
+
*/
|
|
72
|
+
private _watchConfig;
|
|
73
|
+
/**
|
|
74
|
+
* Handle plugin file change
|
|
75
|
+
*
|
|
76
|
+
* @private
|
|
77
|
+
* @param {string} filePath - Changed file path
|
|
78
|
+
*/
|
|
79
|
+
private _handlePluginChange;
|
|
80
|
+
/**
|
|
81
|
+
* Handle configuration change
|
|
82
|
+
*
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
private _handleConfigChange;
|
|
86
|
+
/**
|
|
87
|
+
* Reload a plugin
|
|
88
|
+
*
|
|
89
|
+
* @private
|
|
90
|
+
* @param {string} filePath - Plugin file path
|
|
91
|
+
* @returns {Promise<void>}
|
|
92
|
+
*/
|
|
93
|
+
private _reloadPlugin;
|
|
94
|
+
/**
|
|
95
|
+
* Reload configuration
|
|
96
|
+
*
|
|
97
|
+
* @private
|
|
98
|
+
* @returns {Promise<void>}
|
|
99
|
+
*/
|
|
100
|
+
private _reloadConfig;
|
|
101
|
+
/**
|
|
102
|
+
* Handle plugin removal
|
|
103
|
+
*
|
|
104
|
+
* @private
|
|
105
|
+
* @param {string} filePath - Removed plugin path
|
|
106
|
+
*/
|
|
107
|
+
private _handlePluginRemoval;
|
|
108
|
+
/**
|
|
109
|
+
* Preserve plugin state before reload
|
|
110
|
+
*
|
|
111
|
+
* @private
|
|
112
|
+
* @param {string} filePath - Plugin file path
|
|
113
|
+
* @returns {Promise<any>} Preserved state
|
|
114
|
+
*/
|
|
115
|
+
private _preservePluginState;
|
|
116
|
+
/**
|
|
117
|
+
* Restore plugin state after reload
|
|
118
|
+
*
|
|
119
|
+
* @private
|
|
120
|
+
* @param {object} plugin - Reloaded plugin
|
|
121
|
+
* @param {any} state - Preserved state
|
|
122
|
+
* @returns {Promise<void>}
|
|
123
|
+
*/
|
|
124
|
+
private _restorePluginState;
|
|
125
|
+
/**
|
|
126
|
+
* Update plugin registry with reloaded plugin
|
|
127
|
+
*
|
|
128
|
+
* @private
|
|
129
|
+
* @param {string} filePath - Plugin file path
|
|
130
|
+
* @param {object} plugin - Reloaded plugin
|
|
131
|
+
* @returns {Promise<void>}
|
|
132
|
+
*/
|
|
133
|
+
private _updatePluginRegistry;
|
|
134
|
+
/**
|
|
135
|
+
* Process queued reloads
|
|
136
|
+
*
|
|
137
|
+
* @private
|
|
138
|
+
* @returns {Promise<void>}
|
|
139
|
+
*/
|
|
140
|
+
private _processReloadQueue;
|
|
141
|
+
/**
|
|
142
|
+
* Execute lifecycle hooks
|
|
143
|
+
*
|
|
144
|
+
* @private
|
|
145
|
+
* @param {string} hookName - Hook name
|
|
146
|
+
* @param {object} data - Hook data
|
|
147
|
+
* @returns {Promise<void>}
|
|
148
|
+
*/
|
|
149
|
+
private _executeHooks;
|
|
150
|
+
/**
|
|
151
|
+
* Record reload in history
|
|
152
|
+
*
|
|
153
|
+
* @private
|
|
154
|
+
* @param {object} record - Reload record
|
|
155
|
+
*/
|
|
156
|
+
private _recordReload;
|
|
157
|
+
/**
|
|
158
|
+
* Update average reload time
|
|
159
|
+
*
|
|
160
|
+
* @private
|
|
161
|
+
* @param {number} duration - Reload duration
|
|
162
|
+
*/
|
|
163
|
+
private _updateAverageReloadTime;
|
|
164
|
+
/**
|
|
165
|
+
* Handle errors
|
|
166
|
+
*
|
|
167
|
+
* @private
|
|
168
|
+
* @param {string} message - Error message
|
|
169
|
+
* @param {Error} error - Error object
|
|
170
|
+
*/
|
|
171
|
+
private _handleError;
|
|
172
|
+
/**
|
|
173
|
+
* Log message
|
|
174
|
+
*
|
|
175
|
+
* @private
|
|
176
|
+
* @param {string} message - Log message
|
|
177
|
+
* @param {boolean} isError - Whether this is an error
|
|
178
|
+
*/
|
|
179
|
+
private _log;
|
|
180
|
+
/**
|
|
181
|
+
* Register a lifecycle hook
|
|
182
|
+
*
|
|
183
|
+
* @param {string} hookName - Hook name (beforeReload, afterReload, onError, etc.)
|
|
184
|
+
* @param {Function} callback - Hook callback
|
|
185
|
+
*/
|
|
186
|
+
registerHook(hookName: string, callback: Function): void;
|
|
187
|
+
/**
|
|
188
|
+
* Unregister a lifecycle hook
|
|
189
|
+
*
|
|
190
|
+
* @param {string} hookName - Hook name
|
|
191
|
+
* @param {Function} callback - Hook callback
|
|
192
|
+
*/
|
|
193
|
+
unregisterHook(hookName: string, callback: Function): void;
|
|
194
|
+
/**
|
|
195
|
+
* Get reload statistics
|
|
196
|
+
*
|
|
197
|
+
* @returns {object} Reload statistics
|
|
198
|
+
*/
|
|
199
|
+
getStats(): object;
|
|
200
|
+
/**
|
|
201
|
+
* Get reload history
|
|
202
|
+
*
|
|
203
|
+
* @returns {Array<object>} Reload history
|
|
204
|
+
*/
|
|
205
|
+
getHistory(): Array<object>;
|
|
206
|
+
/**
|
|
207
|
+
* Clear reload history
|
|
208
|
+
*/
|
|
209
|
+
clearHistory(): void;
|
|
210
|
+
/**
|
|
211
|
+
* Manually trigger a reload
|
|
212
|
+
*
|
|
213
|
+
* @param {string} filePath - File path to reload
|
|
214
|
+
* @param {string} type - Type ('plugin' or 'config')
|
|
215
|
+
* @returns {Promise<void>}
|
|
216
|
+
*/
|
|
217
|
+
triggerReload(filePath: string, type?: string): Promise<void>;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Create hot reload manager
|
|
221
|
+
*
|
|
222
|
+
* @param {object} options - Manager options
|
|
223
|
+
* @returns {HotReloadManager} Hot reload manager instance
|
|
224
|
+
*/
|
|
225
|
+
export function createHotReloadManager(options?: object): HotReloadManager;
|
|
226
|
+
import { EventEmitter } from "events";
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export class PluginAnalyticsDashboard extends EventEmitter<[never]> {
|
|
2
|
+
constructor(_options?: {});
|
|
3
|
+
_config: {
|
|
4
|
+
port: any;
|
|
5
|
+
dataDir: any;
|
|
6
|
+
refreshInterval: any;
|
|
7
|
+
retentionDays: any;
|
|
8
|
+
};
|
|
9
|
+
metrics: Map<any, any>;
|
|
10
|
+
realTimeData: Map<any, any>;
|
|
11
|
+
subscribers: Set<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Initialize metric collectors
|
|
14
|
+
*/
|
|
15
|
+
initializeMetrics(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Start collecting analytics data
|
|
18
|
+
*/
|
|
19
|
+
startDataCollection(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Record plugin installation
|
|
22
|
+
*/
|
|
23
|
+
recordInstallation(pluginId: any, version: any, metadata?: {}): void;
|
|
24
|
+
/**
|
|
25
|
+
* Record plugin search
|
|
26
|
+
*/
|
|
27
|
+
recordSearch(query: any, results: any, latency: any): void;
|
|
28
|
+
/**
|
|
29
|
+
* Record plugin rating
|
|
30
|
+
*/
|
|
31
|
+
recordRating(pluginId: any, rating: any, review?: any): void;
|
|
32
|
+
/**
|
|
33
|
+
* Record security scan
|
|
34
|
+
*/
|
|
35
|
+
recordSecurityScan(pluginId: any, result: any): void;
|
|
36
|
+
/**
|
|
37
|
+
* Record certification request
|
|
38
|
+
*/
|
|
39
|
+
recordCertification(pluginId: any, level: any, result: any): void;
|
|
40
|
+
/**
|
|
41
|
+
* Get dashboard data
|
|
42
|
+
*/
|
|
43
|
+
getDashboardData(): {
|
|
44
|
+
timestamp: number;
|
|
45
|
+
metrics: any;
|
|
46
|
+
recentActivity: any[];
|
|
47
|
+
timeSeriesData: {
|
|
48
|
+
installs: any[];
|
|
49
|
+
searches: any[];
|
|
50
|
+
ratings: any[];
|
|
51
|
+
securityScans: any[];
|
|
52
|
+
};
|
|
53
|
+
topPlugins: any[];
|
|
54
|
+
performanceSummary: {
|
|
55
|
+
avgInstallTime: number;
|
|
56
|
+
p95InstallTime: any;
|
|
57
|
+
avgSearchLatency: number;
|
|
58
|
+
p95SearchLatency: any;
|
|
59
|
+
};
|
|
60
|
+
securityOverview: {
|
|
61
|
+
totalScans: number;
|
|
62
|
+
riskDistribution: {
|
|
63
|
+
low: number;
|
|
64
|
+
medium: number;
|
|
65
|
+
high: number;
|
|
66
|
+
};
|
|
67
|
+
totalIssues: number;
|
|
68
|
+
avgIssuesPerScan: number;
|
|
69
|
+
};
|
|
70
|
+
summary: {
|
|
71
|
+
totalInstalls: any;
|
|
72
|
+
totalSearches: any;
|
|
73
|
+
activePlugins: any;
|
|
74
|
+
certifiedPlugins: any;
|
|
75
|
+
avgRating: number;
|
|
76
|
+
securityScore: number;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Generate time series data for charts
|
|
81
|
+
*/
|
|
82
|
+
generateTimeSeriesData(): {
|
|
83
|
+
installs: any[];
|
|
84
|
+
searches: any[];
|
|
85
|
+
ratings: any[];
|
|
86
|
+
securityScans: any[];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Get top performing plugins
|
|
90
|
+
*/
|
|
91
|
+
getTopPlugins(): any[];
|
|
92
|
+
/**
|
|
93
|
+
* Get performance summary
|
|
94
|
+
*/
|
|
95
|
+
getPerformanceSummary(): {
|
|
96
|
+
avgInstallTime: number;
|
|
97
|
+
p95InstallTime: any;
|
|
98
|
+
avgSearchLatency: number;
|
|
99
|
+
p95SearchLatency: any;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Get security overview
|
|
103
|
+
*/
|
|
104
|
+
getSecurityOverview(): {
|
|
105
|
+
totalScans: number;
|
|
106
|
+
riskDistribution: {
|
|
107
|
+
low: number;
|
|
108
|
+
medium: number;
|
|
109
|
+
high: number;
|
|
110
|
+
};
|
|
111
|
+
totalIssues: number;
|
|
112
|
+
avgIssuesPerScan: number;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Generate HTML dashboard
|
|
116
|
+
*/
|
|
117
|
+
generateHTMLDashboard(): Promise<string>;
|
|
118
|
+
_generateHTMLHead(): string;
|
|
119
|
+
_generateHTMLStyles(): string;
|
|
120
|
+
_generateHTMLBody(data: any): string;
|
|
121
|
+
_generateDashboardHeader(data: any): string;
|
|
122
|
+
_generateMetricsGrid(data: any): string;
|
|
123
|
+
_generateChartsSection(): string;
|
|
124
|
+
_generateActivityFeed(data: any): string;
|
|
125
|
+
_generateHTMLScripts(data: any): string;
|
|
126
|
+
_generateActivityChartScript(data: any): string;
|
|
127
|
+
_generateTopPluginsChartScript(data: any): string;
|
|
128
|
+
incrementMetric(name: any, amount?: number): void;
|
|
129
|
+
recordHistogram(name: any, value: any): void;
|
|
130
|
+
calculateAverageRating(): number;
|
|
131
|
+
calculateSecurityScore(): number;
|
|
132
|
+
calculatePercentile(values: any, percentile: any): any;
|
|
133
|
+
getActivityStatus(activity: any): "error" | "warning" | "success";
|
|
134
|
+
formatActivityDescription(activity: any): string;
|
|
135
|
+
collectMetrics(): Promise<void>;
|
|
136
|
+
updateRealTimeData(): void;
|
|
137
|
+
notifySubscribers(): void;
|
|
138
|
+
cleanupOldData(): Promise<void>;
|
|
139
|
+
subscribe(callback: any): () => boolean;
|
|
140
|
+
}
|
|
141
|
+
import { EventEmitter } from "events";
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client for a plugin hub registry: search, inspect, install, publish and
|
|
3
|
+
* rate plugins.
|
|
4
|
+
*/
|
|
5
|
+
export class PluginHub extends EventEmitter<[never]> {
|
|
6
|
+
constructor(_options?: {});
|
|
7
|
+
_config: {
|
|
8
|
+
registryUrl: any;
|
|
9
|
+
localCacheDir: any;
|
|
10
|
+
apiKey: any;
|
|
11
|
+
userAgent: any;
|
|
12
|
+
timeout: any;
|
|
13
|
+
maxRetries: any;
|
|
14
|
+
fetch: any;
|
|
15
|
+
};
|
|
16
|
+
_fetch: any;
|
|
17
|
+
cache: Map<any, any>;
|
|
18
|
+
analytics: PluginAnalytics;
|
|
19
|
+
sandbox: PluginSandbox;
|
|
20
|
+
/**
|
|
21
|
+
* Search plugins in the community hub
|
|
22
|
+
*/
|
|
23
|
+
searchPlugins(query: any, _options?: {}): Promise<{
|
|
24
|
+
results: any;
|
|
25
|
+
total: any;
|
|
26
|
+
hasMore: any;
|
|
27
|
+
facets: any;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Get detailed plugin information
|
|
31
|
+
*/
|
|
32
|
+
getPluginInfo(pluginId: any): Promise<any>;
|
|
33
|
+
/**
|
|
34
|
+
* Install plugin from the hub
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Download a plugin from the registry and install it into a project
|
|
38
|
+
* (see ecosystem/plugin-installer.js): sha256 verified against the
|
|
39
|
+
* registry, static security scan (high-risk findings block unless
|
|
40
|
+
* allowRisky), stage contract check, files kept inside
|
|
41
|
+
* <project>/.rag/plugins, and `plugins.<stage>.<name>` added to the config.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} pluginId - Registry plugin id
|
|
44
|
+
* @param {string} [version='latest']
|
|
45
|
+
* @param {object} [_options]
|
|
46
|
+
* @param {string} [_options.configPath='.ragrc.json'] - Config to register the plugin in
|
|
47
|
+
* @param {boolean} [_options.requireCertified] - Refuse plugins the registry marks uncertified
|
|
48
|
+
* @param {string} [_options.stage] - Overrides package.json ragPipeline.stage
|
|
49
|
+
* @param {string} [_options.name] - Overrides package.json ragPipeline.name
|
|
50
|
+
* @param {boolean} [_options.force] - Replace an installed plugin
|
|
51
|
+
* @param {boolean} [_options.allowRisky] - Install despite high-risk findings
|
|
52
|
+
*/
|
|
53
|
+
installPlugin(pluginId: string, version?: string, _options?: {
|
|
54
|
+
configPath?: string;
|
|
55
|
+
requireCertified?: boolean;
|
|
56
|
+
stage?: string;
|
|
57
|
+
name?: string;
|
|
58
|
+
force?: boolean;
|
|
59
|
+
allowRisky?: boolean;
|
|
60
|
+
}): Promise<any>;
|
|
61
|
+
/**
|
|
62
|
+
* Publish plugin to the hub
|
|
63
|
+
*/
|
|
64
|
+
publishPlugin(pluginPath: any, _options?: {}): Promise<any>;
|
|
65
|
+
/**
|
|
66
|
+
* Rate and review a plugin
|
|
67
|
+
*/
|
|
68
|
+
ratePlugin(pluginId: any, rating: any, review?: any): Promise<any>;
|
|
69
|
+
/**
|
|
70
|
+
* Get plugin reviews and ratings
|
|
71
|
+
*/
|
|
72
|
+
getPluginReviews(pluginId: any, _options?: {}): Promise<any>;
|
|
73
|
+
/**
|
|
74
|
+
* Get trending plugins
|
|
75
|
+
*/
|
|
76
|
+
getTrendingPlugins(_options?: {}): Promise<any>;
|
|
77
|
+
/**
|
|
78
|
+
* Get user's installed plugins
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* Plugins registered in a project's config (see plugin-installer
|
|
82
|
+
* listInstalledPlugins).
|
|
83
|
+
* @param {string} [configPath='.ragrc.json']
|
|
84
|
+
*/
|
|
85
|
+
getInstalledPlugins(configPath?: string): Promise<{
|
|
86
|
+
stage: string;
|
|
87
|
+
name: string;
|
|
88
|
+
entry: string;
|
|
89
|
+
version: string | null;
|
|
90
|
+
installed: boolean;
|
|
91
|
+
inPipeline: boolean;
|
|
92
|
+
exists: boolean;
|
|
93
|
+
}[]>;
|
|
94
|
+
_makeRequest(method: any, endpoint: any, params?: {}): Promise<any>;
|
|
95
|
+
_normalizePluginInfo(plugin: any): {
|
|
96
|
+
id: any;
|
|
97
|
+
name: any;
|
|
98
|
+
version: any;
|
|
99
|
+
description: any;
|
|
100
|
+
author: any;
|
|
101
|
+
category: any;
|
|
102
|
+
tags: any;
|
|
103
|
+
rating: any;
|
|
104
|
+
reviewCount: any;
|
|
105
|
+
downloadCount: any;
|
|
106
|
+
certified: any;
|
|
107
|
+
certificationId: any;
|
|
108
|
+
verifiedPublisher: any;
|
|
109
|
+
lastUpdated: any;
|
|
110
|
+
createdAt: any;
|
|
111
|
+
homepage: any;
|
|
112
|
+
repository: any;
|
|
113
|
+
license: any;
|
|
114
|
+
dependencies: any;
|
|
115
|
+
compatibility: any;
|
|
116
|
+
screenshots: any;
|
|
117
|
+
documentation: any;
|
|
118
|
+
checksums: any;
|
|
119
|
+
};
|
|
120
|
+
_getDownloadUrl(pluginId: any, version: any): Promise<any>;
|
|
121
|
+
_downloadPlugin(url: any): Promise<any>;
|
|
122
|
+
_verifyPluginIntegrity(data: any, checksums: any): Promise<void>;
|
|
123
|
+
_validatePluginForPublish(pluginPath: any): Promise<any>;
|
|
124
|
+
_packagePlugin(pluginPath: any, pluginInfo: any): Promise<{
|
|
125
|
+
metadata: any;
|
|
126
|
+
files: any[];
|
|
127
|
+
}>;
|
|
128
|
+
_uploadPlugin(packageData: any, _options: any): Promise<any>;
|
|
129
|
+
_getInstalledVersion(pluginId: any, configPath?: string): Promise<string>;
|
|
130
|
+
}
|
|
131
|
+
export class PluginAnalytics {
|
|
132
|
+
constructor(_config: any);
|
|
133
|
+
_config: any;
|
|
134
|
+
_fetch: any;
|
|
135
|
+
events: any[];
|
|
136
|
+
flushInterval: NodeJS.Timeout;
|
|
137
|
+
trackSearch(query: any, resultCount: any): void;
|
|
138
|
+
trackPluginView(pluginId: any): void;
|
|
139
|
+
trackInstallation(pluginId: any, version: any, result: any): void;
|
|
140
|
+
trackReview(pluginId: any, rating: any): void;
|
|
141
|
+
getLastUsed(pluginId: any): Promise<number>;
|
|
142
|
+
_track(type: any, data: any): void;
|
|
143
|
+
_flush(): Promise<void>;
|
|
144
|
+
_getSessionId(): `${string}-${string}-${string}-${string}-${string}`;
|
|
145
|
+
sessionId: `${string}-${string}-${string}-${string}-${string}`;
|
|
146
|
+
}
|
|
147
|
+
export class PluginSandbox {
|
|
148
|
+
constructor(_config: any);
|
|
149
|
+
_config: any;
|
|
150
|
+
scanPlugin(pluginInfo: any): Promise<{
|
|
151
|
+
risk: string;
|
|
152
|
+
issues: any[];
|
|
153
|
+
recommendations: string[];
|
|
154
|
+
}>;
|
|
155
|
+
installPlugin(_pluginData: any, _options: any): Promise<any>;
|
|
156
|
+
_isSuspiciousDependency(dep: any): boolean;
|
|
157
|
+
_isHighRiskPermission(permission: any): boolean;
|
|
158
|
+
_generateRecommendations(risks: any, warnings: any): string[];
|
|
159
|
+
_runInSandbox(_sandboxId: any, fn: any, _options: any): Promise<any>;
|
|
160
|
+
}
|
|
161
|
+
import { EventEmitter } from "events";
|