@agimon-ai/log-sink-mcp 0.2.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 +52 -0
- package/README.md +755 -0
- package/dist/cli.cjs +879 -0
- package/dist/cli.mjs +564 -0
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/dist/stdio-J2VirkcY.mjs +70 -0
- package/dist/stdio-c5IGefy2.cjs +70 -0
- package/package.json +69 -0
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,879 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const e=require(`./stdio-c5IGefy2.cjs`);let t=require(`node:fs`),n=require(`node:path`);n=e.f(n);let r=require(`node:url`),i=require(`commander`),a=require(`@agimon-ai/foundation-port-registry`),o=require(`@hono/node-server`),s=require(`node:fs/promises`);s=e.f(s);let c=require(`node:os`),l=require(`hono`),u=require(`hono/cors`),d=require(`hono-rate-limiter`),f=require(`zod`),p=require(`hono/html`),m=require(`hono/jsx/jsx-runtime`),h=function(e){return e.TRACE=`trace`,e.DEBUG=`debug`,e.INFO=`info`,e.WARN=`warn`,e.ERROR=`error`,e.FATAL=`fatal`,e}({});const g=f.z.object({service:f.z.string().optional(),level:f.z.string().optional(),traceId:f.z.string().optional(),search:f.z.string().optional(),limit:f.z.coerce.number().min(1).max(1e3).default(25),offset:f.z.coerce.number().min(0).default(0)});function _(t){let n=new l.Hono,r=t.get(e.d.LogQueryService),i=t.get(e.d.LogSearchService);return n.get(`/logs`,async e=>{try{let{service:t,level:n,traceId:a,search:o,limit:s,offset:c}=g.parse({service:e.req.query(`service`),level:e.req.query(`level`),traceId:e.req.query(`traceId`),search:e.req.query(`search`),limit:e.req.query(`limit`),offset:e.req.query(`offset`)}),l,u=0;if(o){let e={};t&&(e.service=t),n&&(e.level=n);let r=await i.searchLogsPaginated(o,{...e,offset:c},s);l=r.results,u=r.total}else{let e=n?n.split(`,`):[h.INFO,h.WARN,h.ERROR,h.FATAL],i=await r.queryLogs({level:e,service:t||void 0,traceId:a||void 0,limit:s,offset:c});l=i.logs,u=i.total}return e.json({logs:l,total:u,hasMore:c+s<u})}catch(t){return console.error(`Failed to query logs:`,t),e.json({error:`Failed to query logs`,message:t instanceof Error?t.message:String(t)},500)}}),n.get(`/services`,async e=>{try{let t=await r.getActiveServices();return e.json({services:t,total:t.length})}catch(t){return console.error(`Failed to get services:`,t),e.json({error:`Failed to get services`,message:t instanceof Error?t.message:String(t)},500)}}),n.get(`/stats`,async e=>{try{let t=await r.getStatistics(),n=t.reduce((e,t)=>e+t.count,0),i=t.filter(e=>e.level===`error`||e.level===`fatal`).reduce((e,t)=>e+t.count,0),a=new Set(t.map(e=>e.service)).size;return e.json({totalLogs:n,errors:i,services:a,breakdown:t})}catch(t){return console.error(`Failed to get statistics:`,t),e.json({error:`Failed to get statistics`,message:t instanceof Error?t.message:String(t)},500)}}),n}function v(e){return e.toLocaleString(`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}const ee=`dashboard-container`,te=`dashboard-header`,y=`controls-section`,ne=`input-field`,re=`select-field`,ie=`btn`,ae=`table-container`,b=`log-table`,x=`level-trace`,S=`level-debug`,C=`level-info`,w=`level-warn`,T=`level-error`,E=`level-fatal`,oe=`stats-container`,D=`stat-card`,O=`trace-link`,k=`timestamp-cell`,A=`service-cell`,se=`pagination-container`,j=`pagination-btn`,ce=`page-info`,M=`log-entry-group`,N=`metadata-row`,P=`message-row`,F=`message-full-cell`,I=`attributes-cell`,le=`
|
|
3
|
+
* {
|
|
4
|
+
margin: 0;
|
|
5
|
+
padding: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
body {
|
|
10
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
line-height: 1.5;
|
|
13
|
+
color: #333;
|
|
14
|
+
background-color: #f5f5f5;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
h1, h2, h3 {
|
|
18
|
+
margin-bottom: 1rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.dashboard-container {
|
|
22
|
+
max-width: 1400px;
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
padding: 2rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dashboard-header {
|
|
28
|
+
background-color: #fff;
|
|
29
|
+
padding: 1.5rem;
|
|
30
|
+
margin-bottom: 1.5rem;
|
|
31
|
+
border-radius: 8px;
|
|
32
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.controls-section {
|
|
36
|
+
background-color: #fff;
|
|
37
|
+
padding: 1rem;
|
|
38
|
+
margin-bottom: 1rem;
|
|
39
|
+
border-radius: 8px;
|
|
40
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
41
|
+
display: flex;
|
|
42
|
+
gap: 1rem;
|
|
43
|
+
align-items: center;
|
|
44
|
+
flex-wrap: wrap;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.input-field {
|
|
48
|
+
padding: 0.5rem 0.75rem;
|
|
49
|
+
border: 1px solid #ddd;
|
|
50
|
+
border-radius: 4px;
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
flex: 1;
|
|
53
|
+
min-width: 200px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.input-field:focus {
|
|
57
|
+
outline: none;
|
|
58
|
+
border-color: #2196f3;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.select-field {
|
|
62
|
+
padding: 0.5rem 0.75rem;
|
|
63
|
+
border: 1px solid #ddd;
|
|
64
|
+
border-radius: 4px;
|
|
65
|
+
font-size: 14px;
|
|
66
|
+
background-color: #fff;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.select-field:focus {
|
|
71
|
+
outline: none;
|
|
72
|
+
border-color: #2196f3;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.btn {
|
|
76
|
+
padding: 0.5rem 1rem;
|
|
77
|
+
border: none;
|
|
78
|
+
border-radius: 4px;
|
|
79
|
+
font-size: 14px;
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
background-color: #2196f3;
|
|
82
|
+
color: white;
|
|
83
|
+
transition: background-color 0.2s;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.btn:hover {
|
|
87
|
+
background-color: #1976d2;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.btn:disabled {
|
|
91
|
+
background-color: #ccc;
|
|
92
|
+
cursor: not-allowed;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.table-container {
|
|
96
|
+
background-color: #fff;
|
|
97
|
+
border-radius: 8px;
|
|
98
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.log-table {
|
|
103
|
+
width: 100%;
|
|
104
|
+
border-collapse: collapse;
|
|
105
|
+
table-layout: fixed;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.log-table th {
|
|
109
|
+
background-color: #f8f9fa;
|
|
110
|
+
padding: 0.75rem;
|
|
111
|
+
text-align: left;
|
|
112
|
+
font-weight: 600;
|
|
113
|
+
border-bottom: 2px solid #dee2e6;
|
|
114
|
+
position: sticky;
|
|
115
|
+
top: 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.log-table th:nth-child(1) {
|
|
119
|
+
width: 18%;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.log-table th:nth-child(2) {
|
|
123
|
+
width: 10%;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.log-table th:nth-child(3) {
|
|
127
|
+
width: 22%;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.log-table th:nth-child(4) {
|
|
131
|
+
width: 50%;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.log-table td {
|
|
135
|
+
padding: 0.75rem;
|
|
136
|
+
border-bottom: 1px solid #dee2e6;
|
|
137
|
+
vertical-align: top;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.log-table tr:hover {
|
|
141
|
+
background-color: #f8f9fa;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.level-trace {
|
|
145
|
+
color: #9e9e9e;
|
|
146
|
+
font-weight: 600;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.level-debug {
|
|
150
|
+
color: #2196f3;
|
|
151
|
+
font-weight: 600;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.level-info {
|
|
155
|
+
color: #4caf50;
|
|
156
|
+
font-weight: 600;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.level-warn {
|
|
160
|
+
color: #ff9800;
|
|
161
|
+
font-weight: 600;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.level-error {
|
|
165
|
+
color: #f44336;
|
|
166
|
+
font-weight: 600;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.level-fatal {
|
|
170
|
+
color: #d32f2f;
|
|
171
|
+
font-weight: 600;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.stats-container {
|
|
175
|
+
display: flex;
|
|
176
|
+
gap: 1.5rem;
|
|
177
|
+
margin-bottom: 1rem;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.stat-card {
|
|
181
|
+
background-color: #fff;
|
|
182
|
+
padding: 1rem;
|
|
183
|
+
border-radius: 8px;
|
|
184
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
185
|
+
flex: 1;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.stat-card h3 {
|
|
189
|
+
font-size: 0.875rem;
|
|
190
|
+
color: #666;
|
|
191
|
+
margin-bottom: 0.5rem;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.stat-card .value {
|
|
195
|
+
font-size: 1.5rem;
|
|
196
|
+
font-weight: 700;
|
|
197
|
+
color: #333;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.trace-link {
|
|
201
|
+
color: #2196f3;
|
|
202
|
+
text-decoration: underline;
|
|
203
|
+
cursor: pointer;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.trace-link:hover {
|
|
207
|
+
color: #1976d2;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.message-cell {
|
|
211
|
+
max-width: 600px;
|
|
212
|
+
word-wrap: break-word;
|
|
213
|
+
white-space: pre-wrap;
|
|
214
|
+
font-family: 'Courier New', monospace;
|
|
215
|
+
font-size: 13px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.timestamp-cell {
|
|
219
|
+
white-space: nowrap;
|
|
220
|
+
font-size: 12px;
|
|
221
|
+
color: #666;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.service-cell {
|
|
225
|
+
font-weight: 500;
|
|
226
|
+
color: #555;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* Pagination styles */
|
|
230
|
+
.pagination-container {
|
|
231
|
+
display: flex;
|
|
232
|
+
justify-content: center;
|
|
233
|
+
align-items: center;
|
|
234
|
+
gap: 1rem;
|
|
235
|
+
padding: 1rem;
|
|
236
|
+
background-color: #f8f9fa;
|
|
237
|
+
border-top: 1px solid #dee2e6;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.pagination-btn {
|
|
241
|
+
padding: 0.5rem 1rem;
|
|
242
|
+
border: 1px solid #ddd;
|
|
243
|
+
border-radius: 4px;
|
|
244
|
+
font-size: 14px;
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
background-color: #fff;
|
|
247
|
+
color: #333;
|
|
248
|
+
transition: background-color 0.2s, border-color 0.2s;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.pagination-btn:hover:not(:disabled) {
|
|
252
|
+
background-color: #e9ecef;
|
|
253
|
+
border-color: #adb5bd;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.pagination-btn:disabled {
|
|
257
|
+
background-color: #f8f9fa;
|
|
258
|
+
color: #adb5bd;
|
|
259
|
+
cursor: not-allowed;
|
|
260
|
+
border-color: #dee2e6;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.page-info {
|
|
264
|
+
font-size: 14px;
|
|
265
|
+
color: #666;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/* Two-row log entry styles */
|
|
269
|
+
.log-entry-group {
|
|
270
|
+
border-bottom: 2px solid #dee2e6;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.log-entry-group:last-child {
|
|
274
|
+
border-bottom: none;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.metadata-row td {
|
|
278
|
+
padding: 0.5rem 0.75rem;
|
|
279
|
+
padding-bottom: 0.25rem;
|
|
280
|
+
border-bottom: none;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.message-row td {
|
|
284
|
+
padding: 0.25rem 0.75rem;
|
|
285
|
+
padding-bottom: 0.75rem;
|
|
286
|
+
border-bottom: none;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.message-full-cell {
|
|
290
|
+
font-family: 'Courier New', monospace;
|
|
291
|
+
font-size: 13px;
|
|
292
|
+
white-space: pre-wrap;
|
|
293
|
+
word-wrap: break-word;
|
|
294
|
+
background-color: #f8f9fa;
|
|
295
|
+
padding: 0.5rem 0.75rem;
|
|
296
|
+
border-radius: 4px;
|
|
297
|
+
color: #333;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.attributes-row td {
|
|
301
|
+
padding: 0.25rem 0.75rem;
|
|
302
|
+
padding-bottom: 0.75rem;
|
|
303
|
+
border-bottom: none;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.attributes-cell {
|
|
307
|
+
font-family: 'Courier New', monospace;
|
|
308
|
+
font-size: 12px;
|
|
309
|
+
white-space: pre-wrap;
|
|
310
|
+
word-wrap: break-word;
|
|
311
|
+
background-color: #e8f4fc;
|
|
312
|
+
padding: 0.5rem 0.75rem;
|
|
313
|
+
border-radius: 4px;
|
|
314
|
+
color: #555;
|
|
315
|
+
margin-top: 0.25rem;
|
|
316
|
+
}
|
|
317
|
+
`;function ue(e){let t=e.toLowerCase();return t===`trace`?x:t===`debug`?S:t===`info`?C:t===`warn`?w:t===`error`?T:t===`fatal`?E:``}function de(e){if(!e||typeof e!=`object`)return null;let t=e,n={};for(let[e,r]of Object.entries(t))e===`trace.id`||e===`span.id`||(n[e]=r);return Object.keys(n).length>0?n:null}function fe({logs:e}){return(0,m.jsx)(`div`,{class:`table-container`,children:(0,m.jsxs)(`table`,{class:b,children:[(0,m.jsx)(`thead`,{children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{children:`Timestamp`}),(0,m.jsx)(`th`,{children:`Level`}),(0,m.jsx)(`th`,{children:`Service`}),(0,m.jsx)(`th`,{children:`Trace ID`})]})}),e.map(e=>{let t=de(e.metadata);return(0,m.jsxs)(`tbody`,{class:M,children:[(0,m.jsxs)(`tr`,{class:N,children:[(0,m.jsx)(`td`,{class:k,children:v(e.timestamp)}),(0,m.jsx)(`td`,{class:ue(e.level),children:e.level.toUpperCase()}),(0,m.jsx)(`td`,{class:A,children:e.service}),(0,m.jsx)(`td`,{children:e.traceId?(0,m.jsxs)(`span`,{class:O,onclick:`dashboard.filterByTrace('${e.traceId}')`,children:[e.traceId.slice(0,8),`...`]}):(0,m.jsx)(`span`,{children:`-`})})]}),(0,m.jsx)(`tr`,{class:P,children:(0,m.jsxs)(`td`,{colspan:4,class:F,children:[(0,m.jsx)(`div`,{children:e.message}),t&&(0,m.jsx)(`pre`,{class:I,children:JSON.stringify(t,null,2)})]})})]},e.id)})]})})}function pe(){return(0,m.jsx)(`input`,{id:`search-input`,type:`text`,class:`input-field`,placeholder:`Search logs...`,oninput:`dashboard.handleSearchInput(event)`})}function me({services:e}){return(0,m.jsxs)(`select`,{id:`service-select`,class:`select-field`,onchange:`dashboard.handleServiceChange(event)`,children:[(0,m.jsx)(`option`,{value:``,children:`All Services`}),e.map(e=>(0,m.jsx)(`option`,{value:e,children:e},e))]})}function he({stats:e}){return(0,m.jsxs)(`div`,{class:`stats-container`,children:[(0,m.jsxs)(`div`,{class:D,children:[(0,m.jsx)(`h3`,{children:`Total Logs`}),(0,m.jsx)(`div`,{class:`value`,children:e.totalLogs.toLocaleString()})]}),(0,m.jsxs)(`div`,{class:D,children:[(0,m.jsx)(`h3`,{children:`Errors`}),(0,m.jsx)(`div`,{class:`value`,children:e.errors.toLocaleString()})]}),(0,m.jsxs)(`div`,{class:D,children:[(0,m.jsx)(`h3`,{children:`Services`}),(0,m.jsx)(`div`,{class:`value`,children:e.services})]})]})}function L({initialLogs:e,services:t,stats:n}){return(0,m.jsxs)(`div`,{class:`dashboard-container`,children:[(0,m.jsxs)(`div`,{class:`dashboard-header`,children:[(0,m.jsx)(`h1`,{children:`Log Dashboard`}),(0,m.jsx)(`p`,{children:`Real-time log streaming with auto-refresh (3 seconds)`})]}),(0,m.jsx)(he,{stats:n}),(0,m.jsxs)(`div`,{class:`controls-section`,children:[(0,m.jsx)(pe,{}),(0,m.jsx)(me,{services:t}),(0,m.jsx)(`button`,{id:`refresh-btn`,class:`btn`,onclick:`dashboard.manualRefresh()`,children:`Refresh Now`})]}),(0,m.jsx)(fe,{logs:e}),(0,m.jsxs)(`div`,{id:`pagination-controls`,class:`pagination-container`,children:[(0,m.jsx)(`button`,{id:`prev-btn`,class:j,onclick:`dashboard.prevPage()`,disabled:!0,children:`Previous`}),(0,m.jsx)(`span`,{id:`page-info`,class:`page-info`,children:`Page 1`}),(0,m.jsx)(`button`,{id:`next-btn`,class:j,onclick:`dashboard.nextPage()`,children:`Next`})]}),(0,m.jsx)(`script`,{children:(0,p.raw)(`
|
|
318
|
+
class DashboardManager {
|
|
319
|
+
constructor() {
|
|
320
|
+
this.filters = {
|
|
321
|
+
search: '',
|
|
322
|
+
service: '',
|
|
323
|
+
traceId: '',
|
|
324
|
+
level: '',
|
|
325
|
+
};
|
|
326
|
+
this.searchDebounceTimer = null;
|
|
327
|
+
this.autoRefreshInterval = null;
|
|
328
|
+
this.isRefreshing = false;
|
|
329
|
+
|
|
330
|
+
// Pagination state
|
|
331
|
+
this.currentPage = 1;
|
|
332
|
+
this.pageSize = 25;
|
|
333
|
+
this.totalLogs = 0;
|
|
334
|
+
this.hasMore = false;
|
|
335
|
+
|
|
336
|
+
this.startAutoRefresh();
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
startAutoRefresh() {
|
|
340
|
+
// Poll every 3 seconds
|
|
341
|
+
this.autoRefreshInterval = setInterval(() => {
|
|
342
|
+
this.fetchLogs();
|
|
343
|
+
}, 3000);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
stopAutoRefresh() {
|
|
347
|
+
if (this.autoRefreshInterval) {
|
|
348
|
+
clearInterval(this.autoRefreshInterval);
|
|
349
|
+
this.autoRefreshInterval = null;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
async fetchLogs() {
|
|
354
|
+
if (this.isRefreshing) return;
|
|
355
|
+
|
|
356
|
+
this.isRefreshing = true;
|
|
357
|
+
|
|
358
|
+
try {
|
|
359
|
+
const params = new URLSearchParams();
|
|
360
|
+
if (this.filters.search) params.set('search', this.filters.search);
|
|
361
|
+
if (this.filters.service) params.set('service', this.filters.service);
|
|
362
|
+
if (this.filters.traceId) params.set('traceId', this.filters.traceId);
|
|
363
|
+
if (this.filters.level) params.set('level', this.filters.level);
|
|
364
|
+
|
|
365
|
+
// Pagination parameters
|
|
366
|
+
const offset = (this.currentPage - 1) * this.pageSize;
|
|
367
|
+
params.set('limit', String(this.pageSize));
|
|
368
|
+
params.set('offset', String(offset));
|
|
369
|
+
|
|
370
|
+
const response = await fetch('/api/logs?' + params.toString());
|
|
371
|
+
const data = await response.json();
|
|
372
|
+
|
|
373
|
+
// Update pagination state
|
|
374
|
+
this.totalLogs = data.total || 0;
|
|
375
|
+
this.hasMore = data.hasMore || false;
|
|
376
|
+
|
|
377
|
+
this.updateLogTable(data.logs);
|
|
378
|
+
this.updatePaginationUI();
|
|
379
|
+
} catch (error) {
|
|
380
|
+
console.error('Failed to fetch logs:', error);
|
|
381
|
+
} finally {
|
|
382
|
+
this.isRefreshing = false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
updateLogTable(logs) {
|
|
387
|
+
const table = document.querySelector('.${b}');
|
|
388
|
+
if (!table) return;
|
|
389
|
+
|
|
390
|
+
// Remove existing tbody elements (except thead)
|
|
391
|
+
const existingTbodies = table.querySelectorAll('tbody');
|
|
392
|
+
existingTbodies.forEach(tbody => tbody.remove());
|
|
393
|
+
|
|
394
|
+
// Add new two-row layout for each log entry
|
|
395
|
+
logs.forEach(log => {
|
|
396
|
+
const levelClass = this.getLevelClass(log.level);
|
|
397
|
+
const timestamp = this.formatTimestamp(log.timestamp);
|
|
398
|
+
const traceIdHtml = log.traceId
|
|
399
|
+
? \`<span class="${O}" onclick="dashboard.filterByTrace('\${log.traceId}')">\${log.traceId.slice(0, 8)}...</span>\`
|
|
400
|
+
: '<span>-</span>';
|
|
401
|
+
|
|
402
|
+
// Get display attributes (filter out trace/span IDs)
|
|
403
|
+
const displayAttrs = this.getDisplayAttributes(log.metadata);
|
|
404
|
+
const attrsHtml = displayAttrs
|
|
405
|
+
? \`<pre class="${I}">\${this.escapeHtml(JSON.stringify(displayAttrs, null, 2))}</pre>\`
|
|
406
|
+
: '';
|
|
407
|
+
|
|
408
|
+
const tbody = document.createElement('tbody');
|
|
409
|
+
tbody.className = '${M}';
|
|
410
|
+
tbody.innerHTML = \`
|
|
411
|
+
<tr class="${N}">
|
|
412
|
+
<td class="${k}">\${timestamp}</td>
|
|
413
|
+
<td class="\${levelClass}">\${log.level.toUpperCase()}</td>
|
|
414
|
+
<td class="${A}">\${log.service}</td>
|
|
415
|
+
<td>\${traceIdHtml}</td>
|
|
416
|
+
</tr>
|
|
417
|
+
<tr class="${P}">
|
|
418
|
+
<td colspan="4" class="${F}">
|
|
419
|
+
<div>\${this.escapeHtml(log.message)}</div>
|
|
420
|
+
\${attrsHtml}
|
|
421
|
+
</td>
|
|
422
|
+
</tr>
|
|
423
|
+
\`;
|
|
424
|
+
table.appendChild(tbody);
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
getDisplayAttributes(metadata) {
|
|
429
|
+
if (!metadata || typeof metadata !== 'object') return null;
|
|
430
|
+
const filtered = {};
|
|
431
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
432
|
+
// Skip trace context fields (already shown in table)
|
|
433
|
+
if (key === 'trace.id' || key === 'span.id') continue;
|
|
434
|
+
filtered[key] = value;
|
|
435
|
+
}
|
|
436
|
+
return Object.keys(filtered).length > 0 ? filtered : null;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
escapeHtml(str) {
|
|
440
|
+
if (typeof str !== 'string') return str;
|
|
441
|
+
return str
|
|
442
|
+
.replace(/&/g, '&')
|
|
443
|
+
.replace(/</g, '<')
|
|
444
|
+
.replace(/>/g, '>')
|
|
445
|
+
.replace(/"/g, '"')
|
|
446
|
+
.replace(/'/g, ''');
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
getLevelClass(level) {
|
|
450
|
+
const classes = {
|
|
451
|
+
trace: '${x}',
|
|
452
|
+
debug: '${S}',
|
|
453
|
+
info: '${C}',
|
|
454
|
+
warn: '${w}',
|
|
455
|
+
error: '${T}',
|
|
456
|
+
fatal: '${E}',
|
|
457
|
+
};
|
|
458
|
+
return classes[level.toLowerCase()] || '';
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
formatTimestamp(timestamp) {
|
|
462
|
+
const date = new Date(timestamp);
|
|
463
|
+
return date.toLocaleString('en-US', {
|
|
464
|
+
year: 'numeric',
|
|
465
|
+
month: '2-digit',
|
|
466
|
+
day: '2-digit',
|
|
467
|
+
hour: '2-digit',
|
|
468
|
+
minute: '2-digit',
|
|
469
|
+
second: '2-digit',
|
|
470
|
+
hour12: false,
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
handleSearchInput(event) {
|
|
475
|
+
clearTimeout(this.searchDebounceTimer);
|
|
476
|
+
|
|
477
|
+
this.searchDebounceTimer = setTimeout(() => {
|
|
478
|
+
this.filters.search = event.target.value;
|
|
479
|
+
this.filters.traceId = ''; // Clear traceId when searching
|
|
480
|
+
this.currentPage = 1; // Reset to first page
|
|
481
|
+
this.fetchLogs();
|
|
482
|
+
}, 300);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
handleServiceChange(event) {
|
|
486
|
+
this.filters.service = event.target.value;
|
|
487
|
+
this.filters.traceId = ''; // Clear traceId when changing service
|
|
488
|
+
this.currentPage = 1; // Reset to first page
|
|
489
|
+
this.fetchLogs();
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
filterByTrace(traceId) {
|
|
493
|
+
this.filters.traceId = traceId;
|
|
494
|
+
this.filters.search = ''; // Clear search when filtering by trace
|
|
495
|
+
this.filters.service = ''; // Clear service when filtering by trace
|
|
496
|
+
this.currentPage = 1; // Reset to first page
|
|
497
|
+
|
|
498
|
+
// Update UI
|
|
499
|
+
const searchInput = document.getElementById('search-input');
|
|
500
|
+
const serviceSelect = document.getElementById('service-select');
|
|
501
|
+
if (searchInput) searchInput.value = '';
|
|
502
|
+
if (serviceSelect) serviceSelect.value = '';
|
|
503
|
+
|
|
504
|
+
this.fetchLogs();
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
manualRefresh() {
|
|
508
|
+
this.fetchLogs();
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// Pagination methods
|
|
512
|
+
goToPage(page) {
|
|
513
|
+
if (page < 1) return;
|
|
514
|
+
this.currentPage = page;
|
|
515
|
+
this.fetchLogs();
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
nextPage() {
|
|
519
|
+
if (this.hasMore) {
|
|
520
|
+
this.currentPage++;
|
|
521
|
+
this.fetchLogs();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
prevPage() {
|
|
526
|
+
if (this.currentPage > 1) {
|
|
527
|
+
this.currentPage--;
|
|
528
|
+
this.fetchLogs();
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
updatePaginationUI() {
|
|
533
|
+
const prevBtn = document.getElementById('prev-btn');
|
|
534
|
+
const nextBtn = document.getElementById('next-btn');
|
|
535
|
+
const pageInfo = document.getElementById('page-info');
|
|
536
|
+
|
|
537
|
+
if (prevBtn) {
|
|
538
|
+
prevBtn.disabled = this.currentPage <= 1;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
if (nextBtn) {
|
|
542
|
+
nextBtn.disabled = !this.hasMore;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (pageInfo) {
|
|
546
|
+
const totalPages = Math.ceil(this.totalLogs / this.pageSize) || 1;
|
|
547
|
+
pageInfo.textContent = \`Page \${this.currentPage} of \${totalPages}\`;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// Initialize dashboard
|
|
553
|
+
const dashboard = new DashboardManager();
|
|
554
|
+
|
|
555
|
+
// Cleanup on page unload
|
|
556
|
+
window.addEventListener('beforeunload', () => {
|
|
557
|
+
dashboard.stopAutoRefresh();
|
|
558
|
+
});
|
|
559
|
+
`)})]})}function R({title:e,children:t}){return(0,m.jsxs)(`html`,{lang:`en`,children:[(0,m.jsxs)(`head`,{children:[(0,m.jsx)(`meta`,{charset:`UTF-8`}),(0,m.jsx)(`meta`,{name:`viewport`,content:`width=device-width, initial-scale=1.0`}),(0,m.jsx)(`title`,{children:e}),(0,m.jsx)(`style`,{children:(0,p.raw)(`
|
|
560
|
+
* {
|
|
561
|
+
margin: 0;
|
|
562
|
+
padding: 0;
|
|
563
|
+
box-sizing: border-box;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
body {
|
|
567
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
568
|
+
font-size: 14px;
|
|
569
|
+
line-height: 1.5;
|
|
570
|
+
color: #333;
|
|
571
|
+
background-color: #f5f5f5;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
h1, h2, h3 {
|
|
575
|
+
margin-bottom: 1rem;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.dashboard-container {
|
|
579
|
+
max-width: 1400px;
|
|
580
|
+
margin: 0 auto;
|
|
581
|
+
padding: 2rem;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.dashboard-header {
|
|
585
|
+
background-color: #fff;
|
|
586
|
+
padding: 1.5rem;
|
|
587
|
+
margin-bottom: 1.5rem;
|
|
588
|
+
border-radius: 8px;
|
|
589
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.controls-section {
|
|
593
|
+
background-color: #fff;
|
|
594
|
+
padding: 1rem;
|
|
595
|
+
margin-bottom: 1rem;
|
|
596
|
+
border-radius: 8px;
|
|
597
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
598
|
+
display: flex;
|
|
599
|
+
gap: 1rem;
|
|
600
|
+
align-items: center;
|
|
601
|
+
flex-wrap: wrap;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
.input-field {
|
|
605
|
+
padding: 0.5rem 0.75rem;
|
|
606
|
+
border: 1px solid #ddd;
|
|
607
|
+
border-radius: 4px;
|
|
608
|
+
font-size: 14px;
|
|
609
|
+
flex: 1;
|
|
610
|
+
min-width: 200px;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.input-field:focus {
|
|
614
|
+
outline: none;
|
|
615
|
+
border-color: #2196f3;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.select-field {
|
|
619
|
+
padding: 0.5rem 0.75rem;
|
|
620
|
+
border: 1px solid #ddd;
|
|
621
|
+
border-radius: 4px;
|
|
622
|
+
font-size: 14px;
|
|
623
|
+
background-color: #fff;
|
|
624
|
+
cursor: pointer;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.select-field:focus {
|
|
628
|
+
outline: none;
|
|
629
|
+
border-color: #2196f3;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
.btn {
|
|
633
|
+
padding: 0.5rem 1rem;
|
|
634
|
+
border: none;
|
|
635
|
+
border-radius: 4px;
|
|
636
|
+
font-size: 14px;
|
|
637
|
+
cursor: pointer;
|
|
638
|
+
background-color: #2196f3;
|
|
639
|
+
color: white;
|
|
640
|
+
transition: background-color 0.2s;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.btn:hover {
|
|
644
|
+
background-color: #1976d2;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
.btn:disabled {
|
|
648
|
+
background-color: #ccc;
|
|
649
|
+
cursor: not-allowed;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
.table-container {
|
|
653
|
+
background-color: #fff;
|
|
654
|
+
border-radius: 8px;
|
|
655
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
656
|
+
overflow: hidden;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.log-table {
|
|
660
|
+
width: 100%;
|
|
661
|
+
border-collapse: collapse;
|
|
662
|
+
table-layout: fixed;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.log-table th {
|
|
666
|
+
background-color: #f8f9fa;
|
|
667
|
+
padding: 0.75rem;
|
|
668
|
+
text-align: left;
|
|
669
|
+
font-weight: 600;
|
|
670
|
+
border-bottom: 2px solid #dee2e6;
|
|
671
|
+
position: sticky;
|
|
672
|
+
top: 0;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
.log-table th:nth-child(1) {
|
|
676
|
+
width: 18%;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
.log-table th:nth-child(2) {
|
|
680
|
+
width: 10%;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
.log-table th:nth-child(3) {
|
|
684
|
+
width: 22%;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
.log-table th:nth-child(4) {
|
|
688
|
+
width: 50%;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
.log-table td {
|
|
692
|
+
padding: 0.75rem;
|
|
693
|
+
border-bottom: 1px solid #dee2e6;
|
|
694
|
+
vertical-align: top;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
.log-table tr:hover {
|
|
698
|
+
background-color: #f8f9fa;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.level-trace {
|
|
702
|
+
color: #9e9e9e;
|
|
703
|
+
font-weight: 600;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
.level-debug {
|
|
707
|
+
color: #2196f3;
|
|
708
|
+
font-weight: 600;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
.level-info {
|
|
712
|
+
color: #4caf50;
|
|
713
|
+
font-weight: 600;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
.level-warn {
|
|
717
|
+
color: #ff9800;
|
|
718
|
+
font-weight: 600;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
.level-error {
|
|
722
|
+
color: #f44336;
|
|
723
|
+
font-weight: 600;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
.level-fatal {
|
|
727
|
+
color: #d32f2f;
|
|
728
|
+
font-weight: 600;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
.stats-container {
|
|
732
|
+
display: flex;
|
|
733
|
+
gap: 1.5rem;
|
|
734
|
+
margin-bottom: 1rem;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
.stat-card {
|
|
738
|
+
background-color: #fff;
|
|
739
|
+
padding: 1rem;
|
|
740
|
+
border-radius: 8px;
|
|
741
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
742
|
+
flex: 1;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
.stat-card h3 {
|
|
746
|
+
font-size: 0.875rem;
|
|
747
|
+
color: #666;
|
|
748
|
+
margin-bottom: 0.5rem;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
.stat-card .value {
|
|
752
|
+
font-size: 1.5rem;
|
|
753
|
+
font-weight: 700;
|
|
754
|
+
color: #333;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
.trace-link {
|
|
758
|
+
color: #2196f3;
|
|
759
|
+
text-decoration: underline;
|
|
760
|
+
cursor: pointer;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
.trace-link:hover {
|
|
764
|
+
color: #1976d2;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
.message-cell {
|
|
768
|
+
max-width: 600px;
|
|
769
|
+
word-wrap: break-word;
|
|
770
|
+
white-space: pre-wrap;
|
|
771
|
+
font-family: 'Courier New', monospace;
|
|
772
|
+
font-size: 13px;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
.timestamp-cell {
|
|
776
|
+
white-space: nowrap;
|
|
777
|
+
font-size: 12px;
|
|
778
|
+
color: #666;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
.service-cell {
|
|
782
|
+
font-weight: 500;
|
|
783
|
+
color: #555;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
/* Pagination styles */
|
|
787
|
+
.pagination-container {
|
|
788
|
+
display: flex;
|
|
789
|
+
justify-content: center;
|
|
790
|
+
align-items: center;
|
|
791
|
+
gap: 1rem;
|
|
792
|
+
padding: 1rem;
|
|
793
|
+
background-color: #f8f9fa;
|
|
794
|
+
border-top: 1px solid #dee2e6;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
.pagination-btn {
|
|
798
|
+
padding: 0.5rem 1rem;
|
|
799
|
+
border: 1px solid #ddd;
|
|
800
|
+
border-radius: 4px;
|
|
801
|
+
font-size: 14px;
|
|
802
|
+
cursor: pointer;
|
|
803
|
+
background-color: #fff;
|
|
804
|
+
color: #333;
|
|
805
|
+
transition: background-color 0.2s, border-color 0.2s;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
.pagination-btn:hover:not(:disabled) {
|
|
809
|
+
background-color: #e9ecef;
|
|
810
|
+
border-color: #adb5bd;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
.pagination-btn:disabled {
|
|
814
|
+
background-color: #f8f9fa;
|
|
815
|
+
color: #adb5bd;
|
|
816
|
+
cursor: not-allowed;
|
|
817
|
+
border-color: #dee2e6;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
.page-info {
|
|
821
|
+
font-size: 14px;
|
|
822
|
+
color: #666;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/* Two-row log entry styles */
|
|
826
|
+
.log-entry-group {
|
|
827
|
+
border-bottom: 2px solid #dee2e6;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
.log-entry-group:last-child {
|
|
831
|
+
border-bottom: none;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
.metadata-row td {
|
|
835
|
+
padding: 0.5rem 0.75rem;
|
|
836
|
+
padding-bottom: 0.25rem;
|
|
837
|
+
border-bottom: none;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
.message-row td {
|
|
841
|
+
padding: 0.25rem 0.75rem;
|
|
842
|
+
padding-bottom: 0.75rem;
|
|
843
|
+
border-bottom: none;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
.message-full-cell {
|
|
847
|
+
font-family: 'Courier New', monospace;
|
|
848
|
+
font-size: 13px;
|
|
849
|
+
white-space: pre-wrap;
|
|
850
|
+
word-wrap: break-word;
|
|
851
|
+
background-color: #f8f9fa;
|
|
852
|
+
padding: 0.5rem 0.75rem;
|
|
853
|
+
border-radius: 4px;
|
|
854
|
+
color: #333;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
.attributes-row td {
|
|
858
|
+
padding: 0.25rem 0.75rem;
|
|
859
|
+
padding-bottom: 0.75rem;
|
|
860
|
+
border-bottom: none;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
.attributes-cell {
|
|
864
|
+
font-family: 'Courier New', monospace;
|
|
865
|
+
font-size: 12px;
|
|
866
|
+
white-space: pre-wrap;
|
|
867
|
+
word-wrap: break-word;
|
|
868
|
+
background-color: #e8f4fc;
|
|
869
|
+
padding: 0.5rem 0.75rem;
|
|
870
|
+
border-radius: 4px;
|
|
871
|
+
color: #555;
|
|
872
|
+
margin-top: 0.25rem;
|
|
873
|
+
}
|
|
874
|
+
`)})]}),(0,m.jsx)(`body`,{children:t})]})}function z(t){let n=new l.Hono,r=t.get(e.d.LogQueryService);return n.get(`/`,async e=>{try{let t=await r.getActiveServices(),n=await r.getStatistics(),i=await r.filterByLevel([h.INFO,h.WARN,h.ERROR,h.FATAL],100),a={totalLogs:n.reduce((e,t)=>e+t.count,0),errors:n.filter(e=>e.level===`error`||e.level===`fatal`).reduce((e,t)=>e+t.count,0),services:new Set(n.map(e=>e.service)).size};return e.html((0,m.jsx)(R,{title:`Log Dashboard`,children:(0,m.jsx)(L,{initialLogs:i,services:t,stats:a})}))}catch(t){return console.error(`Failed to render dashboard:`,t),e.html((0,m.jsx)(R,{title:`Log Dashboard - Error`,children:(0,m.jsxs)(`div`,{style:`padding: 2rem; text-align: center;`,children:[(0,m.jsx)(`h1`,{children:`Failed to load dashboard`}),(0,m.jsx)(`p`,{children:t instanceof Error?t.message:String(t)}),(0,m.jsx)(`a`,{href:`/`,style:`color: #2196f3; text-decoration: underline;`,children:`Retry`})]})}),500)}}),n}const B=5*1024*1024,ge=1e3,V=2e3,_e=200,H=8e3,ve=f.z.object({timestamp:f.z.string().datetime().optional(),level:f.z.enum([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]),message:f.z.string().min(1).max(H),traceId:f.z.string().regex(/^[0-9a-f]{32}$/i,`traceId must be 32 hex characters`).optional(),spanId:f.z.string().regex(/^[0-9a-f]{16}$/i,`spanId must be 16 hex characters`).optional(),parentSpanId:f.z.string().regex(/^[0-9a-f]{16}$/i,`parentSpanId must be 16 hex characters`).optional(),service:f.z.string().min(1).max(200),hostname:f.z.string().max(255).optional(),pid:f.z.number().int().nonnegative().optional(),metadata:f.z.record(f.z.string(),f.z.unknown()).optional(),errorType:f.z.string().max(255).optional(),errorMessage:f.z.string().max(8e3).optional(),errorStack:f.z.string().max(32e3).optional()}),ye=f.z.object({logs:f.z.array(ve).min(1).max(1e3)});function U(e){if(!e||!/^\d+$/.test(e))throw Error(`OTLP timestamp must be a numeric unix-nanoseconds string`);let t=Number(BigInt(e)/BigInt(1e6));return new Date(t)}function W(e,t){return typeof e==`string`&&RegExp(`^[0-9a-f]{${t}}$`,`i`).test(e)}function G(e){if(!e)return null;let t=Number(e);return!Number.isFinite(t)||t<=0?null:t>B?`Request body exceeds ${B} bytes`:null}async function K(e){try{return await e.req.json()}catch(e){throw Error(`Invalid JSON body: ${e instanceof Error?e.message:String(e)}`)}}function be(e){if(!Array.isArray(e.resourceSpans)||e.resourceSpans.length===0)throw Error(`Invalid OTLP trace request: missing resourceSpans`);let t=0;for(let n of e.resourceSpans){if(!Array.isArray(n.scopeSpans))throw Error(`Invalid OTLP trace request: scopeSpans must be an array`);for(let e of n.scopeSpans){if(!Array.isArray(e.spans))throw Error(`Invalid OTLP trace request: spans must be an array`);for(let n of e.spans){if(t+=1,t>V)throw Error(`OTLP trace request exceeds ${V} spans`);if(!W(n.traceId,32))throw Error(`Invalid OTLP trace request: traceId must be 32 hex characters`);if(!W(n.spanId,16))throw Error(`Invalid OTLP trace request: spanId must be 16 hex characters`);if(n.parentSpanId&&!W(n.parentSpanId,16))throw Error(`Invalid OTLP trace request: parentSpanId must be 16 hex characters`);if(!n.name||n.name.length>H)throw Error(`Invalid OTLP trace request: span name is missing or too long`);U(n.startTimeUnixNano)}}}}function xe(e){if(!Array.isArray(e.resourceLogs)||e.resourceLogs.length===0)throw Error(`Invalid OTLP logs request: missing resourceLogs`);let t=0;for(let n of e.resourceLogs){if(!Array.isArray(n.scopeLogs))throw Error(`Invalid OTLP logs request: scopeLogs must be an array`);for(let e of n.scopeLogs){if(!Array.isArray(e.logRecords))throw Error(`Invalid OTLP logs request: logRecords must be an array`);for(let n of e.logRecords){if(t+=1,t>V)throw Error(`OTLP logs request exceeds ${V} log records`);if(n.traceId&&!W(n.traceId,32))throw Error(`Invalid OTLP logs request: traceId must be 32 hex characters`);if(n.spanId&&!W(n.spanId,16))throw Error(`Invalid OTLP logs request: spanId must be 16 hex characters`);if(n.severityText&&n.severityText.length>32)throw Error(`Invalid OTLP logs request: severityText is too long`);U(n.timeUnixNano)}}}}function Se(e){return(e.resource?.attributes?.find(e=>e.key===`service.name`))?.value?.stringValue||`unknown-service`}function q(e,t){let n=e?.find(e=>e.key===t);if(!n)return;let{value:r}=n;if(r.stringValue!==void 0)return r.stringValue;if(r.intValue!==void 0)return r.intValue;if(r.doubleValue!==void 0)return String(r.doubleValue);if(r.boolValue!==void 0)return String(r.boolValue)}function Ce(e){return(e.resource?.attributes?.find(e=>e.key===`service.name`))?.value?.stringValue||`unknown-service`}function we(e){return e===void 0?`info`:e<=4?`trace`:e<=8?`debug`:e<=12?`info`:e<=16?`warn`:e<=20?`error`:`fatal`}function Te(e,t){let n=U(e.timeUnixNano),r=e.severityText?.toLowerCase()||we(e.severityNumber),i=``;if(e.body?.stringValue)i=e.body.stringValue;else if(e.body?.kvlistValue){let t={};for(let n of e.body.kvlistValue.values){let e=n.value.stringValue??n.value.intValue??n.value.doubleValue??n.value.boolValue;t[n.key]=e}i=JSON.stringify(t)}let a={},o=null,s=null,c=null;if(e.attributes)for(let t of e.attributes){let e=t.value.stringValue??t.value.intValue??t.value.doubleValue??t.value.boolValue;t.key===`exception.type`?o=String(e):t.key===`exception.message`?s=String(e):t.key===`exception.stacktrace`?c=String(e):a[t.key]=e}return{timestamp:n,level:r,message:i||`[LOG] ${t}`,traceId:e.traceId??null,spanId:e.spanId??null,parentSpanId:null,service:t,hostname:null,pid:null,metadata:Object.keys(a).length>0?a:null,errorType:o,errorMessage:s,errorStack:c}}function Ee(e,t){let n=U(e.startTimeUnixNano),r=e.status?.code,i=`info`;r===2?i=`error`:r===1&&(i=`info`);let a=q(e.attributes,`exception.type`),o=q(e.attributes,`exception.message`),s=q(e.attributes,`exception.stacktrace`),c={};if(e.attributes)for(let t of e.attributes){let e=t.value.stringValue??t.value.intValue??t.value.doubleValue??t.value.boolValue;c[t.key]=e}return c.spanName=e.name,c.spanKind=e.kind,e.status?.message&&(c.statusMessage=e.status.message),{timestamp:n,level:i,message:`[SPAN] ${e.name}`,traceId:e.traceId,spanId:e.spanId,parentSpanId:e.parentSpanId??null,service:t,hostname:null,pid:null,metadata:c,errorType:a??null,errorMessage:o??null,errorStack:s??null}}function De(t){let n=new l.Hono,r=t.get(e.d.LogStorageService);n.use(`*`,(0,u.cors)({origin:e=>e??null,credentials:!0,allowMethods:[`GET`,`POST`,`OPTIONS`],allowHeaders:[`Content-Type`,`Accept`,`Authorization`]})),n.get(`/health`,async e=>{try{return e.json({status:`healthy`,service:`log-sink-mcp-http`,serviceName:`log-sink-mcp-http`,timestamp:new Date().toISOString()})}catch(t){return e.json({status:`unhealthy`,error:t instanceof Error?t.message:String(t)},503)}});let i=(0,d.rateLimiter)({windowMs:60*1e3,limit:100,standardHeaders:`draft-6`,keyGenerator:e=>e.req.header(`x-forwarded-for`)||e.req.header(`x-real-ip`)||`unknown`});n.post(`/logs`,i,async e=>{try{let t=G(e.req.header(`content-length`));if(t)return e.json({success:!1,error:t},413);let n=await K(e),i=ye.safeParse(n);if(!i.success)return e.json({success:!1,error:`Validation failed`,details:i.error.issues},400);let{logs:a}=i.data,o=a.map(e=>({...e,timestamp:e.timestamp?new Date(e.timestamp):new Date})),s=await r.insertBatch(o);return e.json({success:!0,count:s.length,message:`Successfully inserted ${s.length} logs`},201)}catch(t){let n=t instanceof Error?t.message:String(t);return n.startsWith(`Invalid JSON body`)?e.json({success:!1,error:n},400):(console.error(`Failed to insert logs:`,t),e.json({success:!1,error:`Failed to insert logs`},500))}}),n.post(`/v1/traces`,i,async e=>{try{let t=G(e.req.header(`content-length`));if(t)return e.json({success:!1,error:t},413);let n=await K(e);be(n);let i=[];for(let e of n.resourceSpans){let t=Se(e);for(let n of e.scopeSpans)for(let e of n.spans){let n=Ee(e,t);i.push(n)}}let a=await r.insertBatch(i);return e.json({success:!0,count:a.length,message:`Successfully inserted ${a.length} trace spans as logs`},201)}catch(t){let n=t instanceof Error?t.message:String(t);return n.startsWith(`Invalid JSON body`)||n.startsWith(`Invalid OTLP`)||n.startsWith(`OTLP`)?e.json({success:!1,error:n},400):(console.error(`Failed to insert OTLP traces:`,t),e.json({success:!1,error:`Failed to insert OTLP traces`},500))}}),n.post(`/v1/logs`,i,async e=>{try{let t=G(e.req.header(`content-length`));if(t)return e.json({success:!1,error:t},413);let n=await K(e);xe(n);let i=[];for(let e of n.resourceLogs){let t=Ce(e);for(let n of e.scopeLogs)for(let e of n.logRecords){let n=Te(e,t);i.push(n)}}let a=await r.insertBatch(i);return e.json({success:!0,count:a.length,message:`Successfully inserted ${a.length} OTLP logs`},201)}catch(t){let n=t instanceof Error?t.message:String(t);return n.startsWith(`Invalid JSON body`)||n.startsWith(`Invalid OTLP`)||n.startsWith(`OTLP`)?e.json({success:!1,error:n},400):(console.error(`Failed to insert OTLP logs:`,t),e.json({success:!1,error:`Failed to insert OTLP logs`},500))}});let a=_(t);n.route(`/api`,a);let o=z(t);return n.route(`/`,o),n}const Oe=`3100`,ke=`./logs/session.db`,Ae=[`pnpm-workspace.yaml`,`nx.json`,`.git`];function je(e=process.cwd()){let r=n.default.resolve(e);for(;;){for(let e of Ae)if((0,t.existsSync)(n.default.join(r,e)))return r;let e=n.default.dirname(r);if(e===r)return process.cwd();r=e}}const Me=new i.Command(`http-serve`).description(`Start HTTP server for log ingestion with configurable port, database path, and in-memory mode`).option(`-p, --port <port>`,`Port to listen on`,`3100`).option(`--db-path <path>`,`Path to SQLite database file`,`./logs/session.db`).option(`--in-memory`,`Use in-memory database (for testing)`,!1).option(`--registry-path <path>`,`Custom registry path or directory for service discovery`).action(async t=>{try{let n=parseInt(t.port,10),r={min:3e3,max:Math.max(4999,n)},i=process.env.NODE_ENV||`development`,s=je(process.cwd()),c=`log-sink-mcp-http`;t.registryPath&&(process.env.PORT_REGISTRY_PATH=t.registryPath);let l=new a.PortRegistryService(process.env.PORT_REGISTRY_PATH);console.log(`🚀 Starting HTTP server for log ingestion...`),console.log(` Port: ${n}`),console.log(` Database: ${t.inMemory?`In-Memory`:t.dbPath}`),console.log(` Registry path: ${process.env.PORT_REGISTRY_PATH??`${process.env.HOME}/.port-registry/ports.json`}`);let u=e.u(),d=u.get(e.d.LogStorageService);await d.initializeDatabase(t.dbPath,t.inMemory),console.log(`✓ Database initialized`);let f=De(u),p=await l.reservePort({repositoryPath:s,serviceName:c,serviceType:`tool`,environment:i,preferredPort:n,pid:process.pid,host:`127.0.0.1`,force:!0,portRange:r,metadata:{healthCheckUrl:`http://localhost:${n}/health`,dbPath:t.dbPath}});if(!p.success||!p.record)throw Error(p.error||`Failed to reserve service in global registry`);let m=p.record.port;if(m!==n){let e=await l.reservePort({repositoryPath:s,serviceName:c,serviceType:`tool`,environment:i,preferredPort:m,pid:process.pid,host:`127.0.0.1`,force:!0,portRange:r,metadata:{healthCheckUrl:`http://localhost:${m}/health`,dbPath:t.dbPath}});if(!e.success||!e.record)throw Error(e.error||`Failed to update service metadata in registry`);p=e}if(!p.record)throw Error(`Port reservation lost before startup`);let h=p.record,g=h.port,_=`http://localhost:${g}/health`,v;try{v=(0,o.serve)({fetch:f.fetch,port:g})}catch(e){try{await l.releasePort({repositoryPath:s,serviceName:c,serviceType:`tool`,environment:i,pid:process.pid})}catch{}throw e}console.log(`✓ HTTP server listening on http://localhost:${g}`),console.log(` Health check: ${_}`),console.log(` Log ingestion: POST http://localhost:${g}/logs`);let ee=h.port,te=h.serviceName||c;console.log(`✓ Service registered: ${te} on ${ee}`),console.log(`
|
|
875
|
+
Press Ctrl+C to stop the server`);let y=async e=>{console.log(`\n\n${e} received. Shutting down gracefully...`);try{v.close(),console.log(`✓ Server closed`);try{await l.releasePort({repositoryPath:s,serviceName:c,serviceType:`tool`,environment:i,pid:process.pid}),console.log(`✓ Service deregistered`)}catch{}await d.disconnect(),console.log(`✓ Database disconnected`),console.log(`Goodbye! 👋`),process.exit(0)}catch(e){console.error(`Error during shutdown:`,e),process.exit(1)}};process.on(`SIGINT`,()=>y(`SIGINT`)),process.on(`SIGTERM`,()=>y(`SIGTERM`))}catch(e){console.error(`Error starting HTTP server:`,e),process.exit(1)}}),Ne=`./logs/session.db`,J=new Set(Object.values(h)),Pe=new Set([`level`,`service`,`both`]),Fe={stdout:e=>console.log(e),stderr:e=>console.error(e)};function Y(e){let t=Number.parseInt(e,10);if(!Number.isInteger(t)||t<=0)throw new i.InvalidArgumentError(`Expected a positive integer.`);return t}function Ie(e){if(!Pe.has(e))throw new i.InvalidArgumentError(`Expected one of: 'level', 'service', 'both'.`);return e}function X(e){if(!(!e||e.length===0))return e.map(e=>{if(!J.has(e))throw new i.InvalidArgumentError(`Invalid log level '${e}'. Expected one of: ${Array.from(J).join(`, `)}`);return e})}function Le(e){return e.content.map(e=>e.type===`text`?e.text:JSON.stringify(e)).join(`
|
|
876
|
+
`)}function Z(e){return e.option(`--db-path <path>`,`Path to SQLite database file`,`./logs/session.db`).option(`--in-memory`,`Use in-memory database`,!1)}async function Re(t,n){let r=e.u(),i=r.get(e.d.LogStorageService);await i.initializeDatabase(t.dbPath,t.inMemory);try{return await n(r)}finally{await i.disconnect()}}async function ze(e,t,n,r=Fe){try{let i=await Re(e,async e=>t(e).execute(n)),a=Le(i);return i.isError?(r.stderr(a),1):(r.stdout(a),0)}catch(e){return r.stderr(`Error executing logs command: ${e instanceof Error?e.message:String(e)}`),1}}async function Q(e,t,n){let r=await ze(e,t,n);r!==0&&process.exit(r)}function Be(e,t){if(!(!e&&!t)){if(!e||!t)throw new i.InvalidArgumentError(`Provide both --start-time and --end-time together.`);return{start:e,end:t}}}function Ve(){let t=new i.Command(`logs`).description(`Run log analysis commands that mirror MCP tool capabilities`),n=Z(new i.Command(`query`).alias(`query-logs`).description(`Query and filter log entries by level, trace ID, service, or time range`).option(`--level <level...>`,`Log level(s) to filter by`).option(`--trace-id <traceId>`,`Trace ID to filter by`).option(`--service <service...>`,`Service name(s) to filter by`).option(`--start-time <iso8601>`,`Start time for log range (ISO 8601)`).option(`--end-time <iso8601>`,`End time for log range (ISO 8601)`).option(`--limit <number>`,`Maximum number of log entries to return`,Y).action(async t=>{await Q(t,t=>new e.i(t),{level:X(t.level),traceId:t.traceId,service:t.service,startTime:t.startTime,endTime:t.endTime,limit:t.limit})})),r=Z(new i.Command(`search`).alias(`search-logs`).description(`Search log entries with full-text search and optional filters`).argument(`<search-query>`,`FTS5 search query`).option(`--service <service...>`,`Service name(s) to filter by`).option(`--level <level...>`,`Log level(s) to filter by`).option(`--start-time <iso8601>`,`Start time for log range (ISO 8601)`).option(`--end-time <iso8601>`,`End time for log range (ISO 8601)`).option(`--limit <number>`,`Maximum number of search results to return`,Y).action(async(t,n)=>{await Q(n,t=>new e.r(t),{searchQuery:t,service:n.service,level:X(n.level),startTime:n.startTime,endTime:n.endTime,limit:n.limit})})),a=Z(new i.Command(`trace`).alias(`get-trace-timeline`).description(`Get the complete trace timeline for a trace ID`).argument(`<trace-id>`,`Trace ID to inspect`).action(async(t,n)=>{await Q(n,t=>new e.a(t),{traceId:t})})),o=Z(new i.Command(`analyze-errors`).alias(`errors`).description(`Analyze error patterns and group similar errors`).option(`--trace-id <traceId>`,`Optional trace ID to scope the analysis`).option(`--start-time <iso8601>`,`Start time for error analysis (ISO 8601)`).option(`--end-time <iso8601>`,`End time for error analysis (ISO 8601)`).option(`--limit <number>`,`Maximum number of error entries to analyze`,Y).action(async t=>{await Q(t,t=>new e.l(t),{traceId:t.traceId,timeRange:Be(t.startTime,t.endTime),limit:t.limit})})),s=Z(new i.Command(`stats`).alias(`get-log-stats`).description(`Get aggregated log statistics grouped by level, service, or both`).option(`--start-time <iso8601>`,`Start time for statistics (ISO 8601)`).option(`--end-time <iso8601>`,`End time for statistics (ISO 8601)`).option(`--group-by <groupBy>`,`Group statistics by level, service, or both`,Ie).action(async t=>{await Q(t,t=>new e.s(t),{startTime:t.startTime,endTime:t.endTime,groupBy:t.groupBy})})),c=Z(new i.Command(`services`).alias(`get-services`).description(`Get the list of unique services present in the log database`).action(async t=>{await Q(t,t=>new e.o(t),{})})),l=Z(new i.Command(`clear`).alias(`clear-logs`).description(`Clear all logs from the database`).action(async t=>{await Q(t,t=>new e.c(t),{})}));return t.addCommand(n).addCommand(r).addCommand(a).addCommand(o).addCommand(s).addCommand(c).addCommand(l)}const $=Ve();function He(){return(0,n.join)((0,c.tmpdir)(),`log-sink-mcp`,`session.db`)}const Ue=new i.Command(`mcp-serve`).description(`Start MCP server with stdio transport`).option(`--cleanup`,`Stop HTTP server on MCP server shutdown`,!1).option(`--db-path <path>`,`Path to SQLite database file`,He()).option(`--in-memory`,`Use in-memory database (for testing)`,!1).option(`--registry-path <path>`,`Custom registry path or directory for service discovery`).option(`--registry-dir <path>`,`Custom registry directory for service discovery`).action(async t=>{try{let n=t.registryPath||t.registryDir;n&&(process.env.PORT_REGISTRY_PATH=n);let r=e.u(),i=r.get(e.d.LogStorageService),a=r.get(e.d.HttpServerManager);await i.initializeDatabase(t.dbPath,t.inMemory);let o=await a.ensureRunning(3100,t.dbPath);o.running||console.error(`Warning: HTTP server failed to start: ${o.error}`);let s=new e.t(e.n(r)),c=async e=>{console.error(`\nReceived ${e}, shutting down gracefully...`);try{await s.stop(),t.cleanup&&o.running&&(await a.stop(),console.error(`HTTP server stopped`)),await i.disconnect(),process.exit(0)}catch(e){console.error(`Error during shutdown:`,e),process.exit(1)}};process.on(`SIGINT`,()=>c(`SIGINT`)),process.on(`SIGTERM`,()=>c(`SIGTERM`)),await s.start()}catch(e){console.error(`Failed to start MCP server:`,e),process.exit(1)}}),We=new i.Command(`start`).description(`Start HTTP and/or MCP servers with singleton coordination`).option(`--mcp-only`,`Start only the MCP server (stdio transport)`,!1).option(`--http-only`,`Start only the HTTP server`,!1).option(`-p, --port <port>`,`Port for HTTP server`,`3100`).option(`--db-path <path>`,`Path to SQLite database file`,`./logs/session.db`).option(`--in-memory`,`Use in-memory database (for testing)`,!1).option(`--registry-path <path>`,`Custom registry path or directory for service discovery`).option(`--registry-dir <path>`,`Custom registry directory for service discovery`).action(async t=>{try{let n=t.registryPath||t.registryDir;n&&(process.env.PORT_REGISTRY_PATH=n);let r=e.u(),i=r.get(e.d.LogStorageService);await i.initializeDatabase(t.dbPath,t.inMemory);let a=parseInt(t.port,10),o=!t.mcpOnly,s=!t.httpOnly;if(console.log(`🚀 Starting log-sink-mcp services...`),console.log(` Database: ${t.inMemory?`In-Memory`:t.dbPath}`),o){let n=await r.get(e.d.HttpServerManager).ensureRunning(a,t.dbPath);n.running?(console.log(`✓ HTTP Server: Running on http://localhost:${n.port} (PID: ${n.pid})`),console.log(` Health check: http://localhost:${n.port}/health`),console.log(` Log ingestion: POST http://localhost:${n.port}/logs`)):(console.error(`✗ HTTP Server failed to start: ${n.error}`),s||process.exit(1))}if(s){console.log(`✓ MCP Server: Starting with stdio transport...`);let t=new e.t(e.n(r));await t.start(),console.log(`✓ MCP Server: Ready for connections`);let n=async n=>{console.log(`\n\n${n} received. Shutting down gracefully...`);try{await t.stop(),console.log(`✓ MCP server stopped`),o&&(await r.get(e.d.HttpServerManager).stop(),console.log(`✓ HTTP server stopped`)),await i.disconnect(),console.log(`✓ Database disconnected`),console.log(`Goodbye! 👋`),process.exit(0)}catch(e){console.error(`Error during shutdown:`,e),process.exit(1)}};process.on(`SIGINT`,()=>n(`SIGINT`)),process.on(`SIGTERM`,()=>n(`SIGTERM`)),console.log(`
|
|
877
|
+
Press Ctrl+C to stop the server`)}else console.log(`
|
|
878
|
+
✓ HTTP server started in background`),console.log(`Use "log-sink-mcp stop" to stop the HTTP server`),process.exit(0)}catch(e){console.error(`Error starting services:`,e),process.exit(1)}}),Ge=new i.Command(`status`).description(`Show status of HTTP server and diagnostics`).action(async()=>{try{console.log(`📊 log-sink-mcp Status
|
|
879
|
+
`),console.log(`─`.repeat(50));let t=await e.u().get(e.d.HttpServerManager).getStatus();t.running?(console.log(`HTTP Server: 🟢 Running`),console.log(` PID: ${t.pid}`),console.log(` Port: ${t.port}`),console.log(` Health: http://localhost:${t.port}/health`)):(console.log(`HTTP Server: 🔴 Not Running`),t.error&&console.log(` Error: ${t.error}`)),console.log(``);try{let e=`./logs/session.db`,t=((await s.stat(e)).size/1024/1024).toFixed(2);console.log(`Database: ${e} (${t} MB)`)}catch{console.log(`Database: Not found or not accessible`)}console.log(`─`.repeat(50)),process.exit(0)}catch(e){console.error(`Error getting status:`,e),process.exit(1)}}),Ke=new i.Command(`stop`).description(`Stop HTTP server and clean up registry/PID files`).action(async()=>{try{console.log(`🛑 Stopping log-sink-mcp services...`),await e.u().get(e.d.HttpServerManager).stop()?(console.log(`✓ HTTP server stopped`),console.log(`✓ Registry and PID files cleaned up`)):console.log(`ℹ No HTTP server was running`),console.log(`Done! 👋`),process.exit(0)}catch(e){console.error(`Error stopping services:`,e),process.exit(1)}}),qe=(0,n.dirname)((0,r.fileURLToPath)(require(`url`).pathToFileURL(__filename).href)),Je=JSON.parse((0,t.readFileSync)((0,n.join)(qe,`../package.json`),`utf-8`));async function Ye(){let e=new i.Command;e.name(`log-sink-mcp`).description(`Log sink MCP server with HTTP ingestion and AI analysis`).version(Je.version),e.addCommand(We),e.addCommand(Ke),e.addCommand(Ge),e.addCommand(Me),e.addCommand(Ue),e.addCommand($),await e.parseAsync(process.argv)}Ye();
|