@qwickapps/server 1.0.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/LICENSE +45 -0
- package/README.md +321 -0
- package/dist/core/control-panel.d.ts +21 -0
- package/dist/core/control-panel.d.ts.map +1 -0
- package/dist/core/control-panel.js +416 -0
- package/dist/core/control-panel.js.map +1 -0
- package/dist/core/gateway.d.ts +133 -0
- package/dist/core/gateway.d.ts.map +1 -0
- package/dist/core/gateway.js +270 -0
- package/dist/core/gateway.js.map +1 -0
- package/dist/core/health-manager.d.ts +52 -0
- package/dist/core/health-manager.d.ts.map +1 -0
- package/dist/core/health-manager.js +192 -0
- package/dist/core/health-manager.js.map +1 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +8 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/logging.d.ts +83 -0
- package/dist/core/logging.d.ts.map +1 -0
- package/dist/core/logging.js +191 -0
- package/dist/core/logging.js.map +1 -0
- package/dist/core/types.d.ts +195 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +7 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/config-plugin.d.ts +15 -0
- package/dist/plugins/config-plugin.d.ts.map +1 -0
- package/dist/plugins/config-plugin.js +96 -0
- package/dist/plugins/config-plugin.js.map +1 -0
- package/dist/plugins/diagnostics-plugin.d.ts +29 -0
- package/dist/plugins/diagnostics-plugin.d.ts.map +1 -0
- package/dist/plugins/diagnostics-plugin.js +142 -0
- package/dist/plugins/diagnostics-plugin.js.map +1 -0
- package/dist/plugins/health-plugin.d.ts +17 -0
- package/dist/plugins/health-plugin.d.ts.map +1 -0
- package/dist/plugins/health-plugin.js +25 -0
- package/dist/plugins/health-plugin.js.map +1 -0
- package/dist/plugins/index.d.ts +14 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +10 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/logs-plugin.d.ts +22 -0
- package/dist/plugins/logs-plugin.d.ts.map +1 -0
- package/dist/plugins/logs-plugin.js +242 -0
- package/dist/plugins/logs-plugin.js.map +1 -0
- package/dist-ui/assets/index-Bk7ypbI4.js +465 -0
- package/dist-ui/assets/index-Bk7ypbI4.js.map +1 -0
- package/dist-ui/assets/index-CiizQQnb.css +1 -0
- package/dist-ui/index.html +13 -0
- package/package.json +98 -0
- package/src/core/control-panel.ts +493 -0
- package/src/core/gateway.ts +421 -0
- package/src/core/health-manager.ts +227 -0
- package/src/core/index.ts +25 -0
- package/src/core/logging.ts +234 -0
- package/src/core/types.ts +218 -0
- package/src/index.ts +55 -0
- package/src/plugins/config-plugin.ts +117 -0
- package/src/plugins/diagnostics-plugin.ts +178 -0
- package/src/plugins/health-plugin.ts +35 -0
- package/src/plugins/index.ts +17 -0
- package/src/plugins/logs-plugin.ts +314 -0
- package/ui/index.html +12 -0
- package/ui/src/App.tsx +65 -0
- package/ui/src/api/controlPanelApi.ts +148 -0
- package/ui/src/config/AppConfig.ts +18 -0
- package/ui/src/index.css +29 -0
- package/ui/src/index.tsx +11 -0
- package/ui/src/pages/ConfigPage.tsx +199 -0
- package/ui/src/pages/DashboardPage.tsx +264 -0
- package/ui/src/pages/DiagnosticsPage.tsx +315 -0
- package/ui/src/pages/HealthPage.tsx +204 -0
- package/ui/src/pages/LogsPage.tsx +267 -0
- package/ui/src/pages/NotFoundPage.tsx +41 -0
- package/ui/tsconfig.json +19 -0
- package/ui/vite.config.ts +21 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diagnostics Plugin
|
|
3
|
+
*
|
|
4
|
+
* Provides AI-friendly diagnostic API for troubleshooting
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync } from 'fs';
|
|
9
|
+
import { resolve } from 'path';
|
|
10
|
+
/**
|
|
11
|
+
* Create a diagnostics plugin for AI agents
|
|
12
|
+
*/
|
|
13
|
+
export function createDiagnosticsPlugin(config = {}) {
|
|
14
|
+
const { include = { logs: { startup: 100, app: 200 }, health: true, config: true, system: true }, logPaths = { startup: './logs/startup.log', app: './logs/app.log' }, endpoint = '/diagnostics/full', } = config;
|
|
15
|
+
return {
|
|
16
|
+
name: 'diagnostics',
|
|
17
|
+
order: 40,
|
|
18
|
+
routes: [
|
|
19
|
+
{
|
|
20
|
+
method: 'get',
|
|
21
|
+
path: endpoint,
|
|
22
|
+
handler: (_req, res) => {
|
|
23
|
+
try {
|
|
24
|
+
const report = {
|
|
25
|
+
timestamp: new Date().toISOString(),
|
|
26
|
+
generated_for: 'AI Agent Diagnostics',
|
|
27
|
+
};
|
|
28
|
+
// System info
|
|
29
|
+
if (include.system) {
|
|
30
|
+
const memUsage = process.memoryUsage();
|
|
31
|
+
report.system = {
|
|
32
|
+
nodeVersion: process.version,
|
|
33
|
+
platform: process.platform,
|
|
34
|
+
arch: process.arch,
|
|
35
|
+
pid: process.pid,
|
|
36
|
+
cwd: process.cwd(),
|
|
37
|
+
uptime: process.uptime(),
|
|
38
|
+
memory: {
|
|
39
|
+
rss: formatBytes(memUsage.rss),
|
|
40
|
+
heapTotal: formatBytes(memUsage.heapTotal),
|
|
41
|
+
heapUsed: formatBytes(memUsage.heapUsed),
|
|
42
|
+
external: formatBytes(memUsage.external),
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// Environment check (not values, just presence)
|
|
47
|
+
if (include.config) {
|
|
48
|
+
const envCheck = {
|
|
49
|
+
NODE_ENV: !!process.env.NODE_ENV,
|
|
50
|
+
DATABASE_URI: !!process.env.DATABASE_URI,
|
|
51
|
+
PAYLOAD_SECRET: !!process.env.PAYLOAD_SECRET,
|
|
52
|
+
LOGFIRE_TOKEN: !!process.env.LOGFIRE_TOKEN,
|
|
53
|
+
};
|
|
54
|
+
report.envCheck = envCheck;
|
|
55
|
+
}
|
|
56
|
+
// Logs
|
|
57
|
+
if (include.logs) {
|
|
58
|
+
const logs = {};
|
|
59
|
+
if (include.logs.startup && logPaths.startup) {
|
|
60
|
+
logs.startup = readLastNLines(logPaths.startup, include.logs.startup);
|
|
61
|
+
}
|
|
62
|
+
if (include.logs.app && logPaths.app) {
|
|
63
|
+
logs.app = readLastNLines(logPaths.app, include.logs.app);
|
|
64
|
+
}
|
|
65
|
+
// Extract errors
|
|
66
|
+
const allLogs = [...(logs.startup || []), ...(logs.app || [])];
|
|
67
|
+
logs.errors = allLogs.filter((line) => {
|
|
68
|
+
const lower = line.toLowerCase();
|
|
69
|
+
return lower.includes('error') || lower.includes('fatal') || lower.includes('exception');
|
|
70
|
+
});
|
|
71
|
+
report.logs = logs;
|
|
72
|
+
}
|
|
73
|
+
res.json(report);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
res.status(500).json({
|
|
77
|
+
error: 'Failed to generate diagnostics',
|
|
78
|
+
message: error instanceof Error ? error.message : String(error),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
method: 'get',
|
|
85
|
+
path: '/diagnostics/summary',
|
|
86
|
+
handler: (_req, res) => {
|
|
87
|
+
try {
|
|
88
|
+
const memUsage = process.memoryUsage();
|
|
89
|
+
res.json({
|
|
90
|
+
status: 'ok',
|
|
91
|
+
timestamp: new Date().toISOString(),
|
|
92
|
+
uptime: process.uptime(),
|
|
93
|
+
memory: {
|
|
94
|
+
heapUsed: formatBytes(memUsage.heapUsed),
|
|
95
|
+
heapTotal: formatBytes(memUsage.heapTotal),
|
|
96
|
+
},
|
|
97
|
+
env: process.env.NODE_ENV || 'development',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
res.status(500).json({
|
|
102
|
+
status: 'error',
|
|
103
|
+
message: error instanceof Error ? error.message : String(error),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
async onInit(context) {
|
|
110
|
+
context.logger.info('[DiagnosticsPlugin] Initialized');
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Read last N lines from a file
|
|
116
|
+
*/
|
|
117
|
+
function readLastNLines(filePath, n) {
|
|
118
|
+
const resolvedPath = resolve(filePath);
|
|
119
|
+
if (!existsSync(resolvedPath)) {
|
|
120
|
+
return [`File not found: ${filePath}`];
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
const content = readFileSync(resolvedPath, 'utf-8');
|
|
124
|
+
const lines = content.split('\n').filter((line) => line.trim());
|
|
125
|
+
return lines.slice(-n);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
return [`Error reading file: ${error instanceof Error ? error.message : String(error)}`];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Format bytes to human readable
|
|
133
|
+
*/
|
|
134
|
+
function formatBytes(bytes) {
|
|
135
|
+
if (bytes === 0)
|
|
136
|
+
return '0 B';
|
|
137
|
+
const k = 1024;
|
|
138
|
+
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
139
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
140
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=diagnostics-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics-plugin.js","sourceRoot":"","sources":["../../src/plugins/diagnostics-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AA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,WAAW,CAAC,KAAa;IAChC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9B,MAAM,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,UAAU,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health Plugin
|
|
3
|
+
*
|
|
4
|
+
* Provides health check monitoring capabilities
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
7
|
+
*/
|
|
8
|
+
import type { ControlPanelPlugin, HealthCheck } from '../core/types.js';
|
|
9
|
+
export interface HealthPluginConfig {
|
|
10
|
+
checks: HealthCheck[];
|
|
11
|
+
aggregateEndpoint?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a health check plugin
|
|
15
|
+
*/
|
|
16
|
+
export declare function createHealthPlugin(config: HealthPluginConfig): ControlPanelPlugin;
|
|
17
|
+
//# sourceMappingURL=health-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/health-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAEvF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAgBjF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health Plugin
|
|
3
|
+
*
|
|
4
|
+
* Provides health check monitoring capabilities
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Create a health check plugin
|
|
10
|
+
*/
|
|
11
|
+
export function createHealthPlugin(config) {
|
|
12
|
+
return {
|
|
13
|
+
name: 'health',
|
|
14
|
+
order: 10,
|
|
15
|
+
async onInit(context) {
|
|
16
|
+
const { registerHealthCheck, logger } = context;
|
|
17
|
+
// Register all health checks
|
|
18
|
+
for (const check of config.checks) {
|
|
19
|
+
registerHealthCheck(check);
|
|
20
|
+
}
|
|
21
|
+
logger.info(`[HealthPlugin] Registered ${config.checks.length} health checks`);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=health-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-plugin.js","sourceRoot":"","sources":["../../src/plugins/health-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAA0B;IAC3D,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,EAAE;QAET,KAAK,CAAC,MAAM,CAAC,OAAsB;YACjC,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;YAEhD,6BAA6B;YAC7B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,6BAA6B,MAAM,CAAC,MAAM,CAAC,MAAM,gBAAgB,CAAC,CAAC;QACjF,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in plugins for @qwickapps/server
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
export { createHealthPlugin } from './health-plugin.js';
|
|
7
|
+
export type { HealthPluginConfig } from './health-plugin.js';
|
|
8
|
+
export { createLogsPlugin } from './logs-plugin.js';
|
|
9
|
+
export type { LogsPluginConfig } from './logs-plugin.js';
|
|
10
|
+
export { createConfigPlugin } from './config-plugin.js';
|
|
11
|
+
export type { ConfigPluginConfig } from './config-plugin.js';
|
|
12
|
+
export { createDiagnosticsPlugin } from './diagnostics-plugin.js';
|
|
13
|
+
export type { DiagnosticsPluginConfig } from './diagnostics-plugin.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in plugins for @qwickapps/server
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
5
|
+
*/
|
|
6
|
+
export { createHealthPlugin } from './health-plugin.js';
|
|
7
|
+
export { createLogsPlugin } from './logs-plugin.js';
|
|
8
|
+
export { createConfigPlugin } from './config-plugin.js';
|
|
9
|
+
export { createDiagnosticsPlugin } from './diagnostics-plugin.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs Plugin
|
|
3
|
+
*
|
|
4
|
+
* Provides log viewing capabilities from various sources.
|
|
5
|
+
* If no sources are configured, automatically uses the logging subsystem's log paths.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
import type { ControlPanelPlugin, LogSource } from '../core/types.js';
|
|
10
|
+
export interface LogsPluginConfig {
|
|
11
|
+
/** Log sources to display. If empty, uses default sources from logging subsystem */
|
|
12
|
+
sources?: LogSource[];
|
|
13
|
+
retention?: {
|
|
14
|
+
maxLines?: number;
|
|
15
|
+
autoRefresh?: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a logs plugin
|
|
20
|
+
*/
|
|
21
|
+
export declare function createLogsPlugin(config?: LogsPluginConfig): ControlPanelPlugin;
|
|
22
|
+
//# sourceMappingURL=logs-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/logs-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAiB,MAAM,kBAAkB,CAAC;AAGrF,MAAM,WAAW,gBAAgB;IAC/B,oFAAoF;IACpF,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE;QACV,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAsCD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,gBAAqB,GAAG,kBAAkB,CAoGlF"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs Plugin
|
|
3
|
+
*
|
|
4
|
+
* Provides log viewing capabilities from various sources.
|
|
5
|
+
* If no sources are configured, automatically uses the logging subsystem's log paths.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync, readFileSync, statSync } from 'fs';
|
|
10
|
+
import { resolve } from 'path';
|
|
11
|
+
import { getLoggingSubsystem } from '../core/logging.js';
|
|
12
|
+
/**
|
|
13
|
+
* Get default log sources from the logging subsystem
|
|
14
|
+
*/
|
|
15
|
+
function getDefaultSources() {
|
|
16
|
+
const loggingSubsystem = getLoggingSubsystem();
|
|
17
|
+
const logPaths = loggingSubsystem.getLogPaths();
|
|
18
|
+
return [
|
|
19
|
+
{ name: 'app', type: 'file', path: logPaths.appLog },
|
|
20
|
+
{ name: 'error', type: 'file', path: logPaths.errorLog },
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a logs plugin
|
|
25
|
+
*/
|
|
26
|
+
export function createLogsPlugin(config = {}) {
|
|
27
|
+
const maxLines = config.retention?.maxLines || 10000;
|
|
28
|
+
// Use provided sources or default to logging subsystem paths
|
|
29
|
+
const getSources = () => {
|
|
30
|
+
if (config.sources && config.sources.length > 0) {
|
|
31
|
+
return config.sources;
|
|
32
|
+
}
|
|
33
|
+
return getDefaultSources();
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
name: 'logs',
|
|
37
|
+
order: 20,
|
|
38
|
+
routes: [
|
|
39
|
+
{
|
|
40
|
+
method: 'get',
|
|
41
|
+
path: '/logs/sources',
|
|
42
|
+
handler: (_req, res) => {
|
|
43
|
+
const sources = getSources();
|
|
44
|
+
res.json({
|
|
45
|
+
sources: sources.map((s) => ({
|
|
46
|
+
name: s.name,
|
|
47
|
+
type: s.type,
|
|
48
|
+
})),
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
method: 'get',
|
|
54
|
+
path: '/logs',
|
|
55
|
+
handler: (req, res) => {
|
|
56
|
+
try {
|
|
57
|
+
const sources = getSources();
|
|
58
|
+
const sourceName = req.query.source || sources[0]?.name;
|
|
59
|
+
const limit = Math.min(parseInt(req.query.limit) || 100, maxLines);
|
|
60
|
+
const offset = parseInt(req.query.offset) || 0;
|
|
61
|
+
const level = req.query.level;
|
|
62
|
+
const search = req.query.search;
|
|
63
|
+
const order = req.query.order || 'desc';
|
|
64
|
+
const source = sources.find((s) => s.name === sourceName);
|
|
65
|
+
if (!source) {
|
|
66
|
+
return res.status(404).json({ error: `Source "${sourceName}" not found` });
|
|
67
|
+
}
|
|
68
|
+
if (source.type === 'file' && source.path) {
|
|
69
|
+
const logs = readLogsFromFile(source.path, { limit, offset, level, search, order });
|
|
70
|
+
return res.json(logs);
|
|
71
|
+
}
|
|
72
|
+
else if (source.type === 'api' && source.url) {
|
|
73
|
+
// Proxy to remote API
|
|
74
|
+
return res.status(501).json({ error: 'API source not yet implemented' });
|
|
75
|
+
}
|
|
76
|
+
return res.status(400).json({ error: 'Invalid source configuration' });
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
return res.status(500).json({
|
|
80
|
+
error: 'Failed to read logs',
|
|
81
|
+
message: error instanceof Error ? error.message : String(error),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
method: 'get',
|
|
88
|
+
path: '/logs/stats',
|
|
89
|
+
handler: (req, res) => {
|
|
90
|
+
try {
|
|
91
|
+
const sources = getSources();
|
|
92
|
+
const sourceName = req.query.source || sources[0]?.name;
|
|
93
|
+
const source = sources.find((s) => s.name === sourceName);
|
|
94
|
+
if (!source) {
|
|
95
|
+
return res.status(404).json({ error: `Source "${sourceName}" not found` });
|
|
96
|
+
}
|
|
97
|
+
if (source.type === 'file' && source.path) {
|
|
98
|
+
const stats = getLogStats(source.path);
|
|
99
|
+
return res.json(stats);
|
|
100
|
+
}
|
|
101
|
+
return res.status(400).json({ error: 'Stats only available for file sources' });
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
return res.status(500).json({
|
|
105
|
+
error: 'Failed to get log stats',
|
|
106
|
+
message: error instanceof Error ? error.message : String(error),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
async onInit(context) {
|
|
113
|
+
const sources = getSources();
|
|
114
|
+
context.logger.info(`Initialized with ${sources.length} sources`, {
|
|
115
|
+
sources: sources.map((s) => ({ name: s.name, type: s.type, path: s.path })),
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Read logs from a file
|
|
122
|
+
*/
|
|
123
|
+
function readLogsFromFile(filePath, options) {
|
|
124
|
+
const resolvedPath = resolve(filePath);
|
|
125
|
+
if (!existsSync(resolvedPath)) {
|
|
126
|
+
return { logs: [], total: 0 };
|
|
127
|
+
}
|
|
128
|
+
const content = readFileSync(resolvedPath, 'utf-8');
|
|
129
|
+
const lines = content.split('\n').filter((line) => line.trim());
|
|
130
|
+
let entries = [];
|
|
131
|
+
let id = 0;
|
|
132
|
+
for (const line of lines) {
|
|
133
|
+
// Try to parse as JSON log entry
|
|
134
|
+
try {
|
|
135
|
+
const parsed = JSON.parse(line);
|
|
136
|
+
if (parsed.msg || parsed.message) {
|
|
137
|
+
entries.push({
|
|
138
|
+
id: id++,
|
|
139
|
+
level: parsed.level || 'info',
|
|
140
|
+
timestamp: parsed.timestamp || parsed.time || new Date().toISOString(),
|
|
141
|
+
namespace: parsed.ns || parsed.name || 'unknown',
|
|
142
|
+
message: parsed.msg || parsed.message,
|
|
143
|
+
...parsed,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
// Try to parse as simple log format: "LEVEL [namespace] message"
|
|
149
|
+
const match = line.match(/^(\d{2}:\d{2}:\d{2})\s+\[([^\]]+)\]\s+(.*)$/);
|
|
150
|
+
if (match) {
|
|
151
|
+
entries.push({
|
|
152
|
+
id: id++,
|
|
153
|
+
level: 'info',
|
|
154
|
+
timestamp: match[1],
|
|
155
|
+
namespace: match[2],
|
|
156
|
+
message: match[3],
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// Filter by level
|
|
162
|
+
if (options.level && options.level !== 'all') {
|
|
163
|
+
entries = entries.filter((e) => e.level === options.level);
|
|
164
|
+
}
|
|
165
|
+
// Filter by search
|
|
166
|
+
if (options.search) {
|
|
167
|
+
const searchLower = options.search.toLowerCase();
|
|
168
|
+
entries = entries.filter((e) => e.message.toLowerCase().includes(searchLower) ||
|
|
169
|
+
e.namespace.toLowerCase().includes(searchLower));
|
|
170
|
+
}
|
|
171
|
+
const total = entries.length;
|
|
172
|
+
// Sort
|
|
173
|
+
if (options.order === 'desc') {
|
|
174
|
+
entries.reverse();
|
|
175
|
+
}
|
|
176
|
+
// Paginate
|
|
177
|
+
entries = entries.slice(options.offset, options.offset + options.limit);
|
|
178
|
+
return { logs: entries, total };
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Get log statistics from a file
|
|
182
|
+
*/
|
|
183
|
+
function getLogStats(filePath) {
|
|
184
|
+
const resolvedPath = resolve(filePath);
|
|
185
|
+
if (!existsSync(resolvedPath)) {
|
|
186
|
+
return {
|
|
187
|
+
totalLogs: 0,
|
|
188
|
+
byLevel: { debug: 0, info: 0, warn: 0, error: 0 },
|
|
189
|
+
fileSize: 0,
|
|
190
|
+
fileSizeFormatted: '0 B',
|
|
191
|
+
oldestLog: null,
|
|
192
|
+
newestLog: null,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
const stats = statSync(resolvedPath);
|
|
196
|
+
const content = readFileSync(resolvedPath, 'utf-8');
|
|
197
|
+
const lines = content.split('\n').filter((line) => line.trim());
|
|
198
|
+
const byLevel = { debug: 0, info: 0, warn: 0, error: 0 };
|
|
199
|
+
let oldestLog = null;
|
|
200
|
+
let newestLog = null;
|
|
201
|
+
for (const line of lines) {
|
|
202
|
+
try {
|
|
203
|
+
const parsed = JSON.parse(line);
|
|
204
|
+
const level = (parsed.level || 'info').toLowerCase();
|
|
205
|
+
if (level in byLevel) {
|
|
206
|
+
byLevel[level]++;
|
|
207
|
+
}
|
|
208
|
+
const timestamp = parsed.timestamp || parsed.time;
|
|
209
|
+
if (timestamp) {
|
|
210
|
+
if (!oldestLog || timestamp < oldestLog) {
|
|
211
|
+
oldestLog = timestamp;
|
|
212
|
+
}
|
|
213
|
+
if (!newestLog || timestamp > newestLog) {
|
|
214
|
+
newestLog = timestamp;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
byLevel.info++; // Count non-JSON lines as info
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
totalLogs: lines.length,
|
|
224
|
+
byLevel,
|
|
225
|
+
fileSize: stats.size,
|
|
226
|
+
fileSizeFormatted: formatBytes(stats.size),
|
|
227
|
+
oldestLog,
|
|
228
|
+
newestLog,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Format bytes to human readable
|
|
233
|
+
*/
|
|
234
|
+
function formatBytes(bytes) {
|
|
235
|
+
if (bytes === 0)
|
|
236
|
+
return '0 B';
|
|
237
|
+
const k = 1024;
|
|
238
|
+
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
239
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
240
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=logs-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs-plugin.js","sourceRoot":"","sources":["../../src/plugins/logs-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAkCzD;;GAEG;AACH,SAAS,iBAAiB;IACxB,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,WAAW,EAAE,CAAC;IAEhD,OAAO;QACL,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE;QACpD,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE;KACzD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,U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