@ycodium-ai/plugin-trace-diagnostics 0.2.2984 → 0.2.2990

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +137 -133
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,5 +1,142 @@
1
1
  // src/index.ts
2
2
  import { definePlugin } from "@ycodium-ai/plugin-api";
3
+
4
+ // src/summarySchema.ts
5
+ var SUMMARY_PAYLOAD_SCHEMA = { type: "object", additionalProperties: false };
6
+ var SPAN_SUMMARY_SCHEMA = {
7
+ type: "object",
8
+ required: [
9
+ "name",
10
+ "count",
11
+ "failureCount",
12
+ "totalDurationMs",
13
+ "averageDurationMs",
14
+ "maxDurationMs"
15
+ ],
16
+ additionalProperties: false,
17
+ properties: {
18
+ name: { type: "string" },
19
+ count: { type: "integer" },
20
+ failureCount: { type: "integer" },
21
+ totalDurationMs: { type: "number" },
22
+ averageDurationMs: { type: "number" },
23
+ maxDurationMs: { type: "number" }
24
+ }
25
+ };
26
+ var SPAN_OCCURRENCE_SCHEMA = {
27
+ type: "object",
28
+ required: ["name", "durationMs", "endedAt", "traceId", "spanId"],
29
+ additionalProperties: false,
30
+ properties: {
31
+ name: { type: "string" },
32
+ durationMs: { type: "number" },
33
+ endedAt: { type: "string" },
34
+ traceId: { type: "string" },
35
+ spanId: { type: "string" }
36
+ }
37
+ };
38
+ var FAILURE_SUMMARY_SCHEMA = {
39
+ type: "object",
40
+ required: ["name", "cause", "count", "lastSeenAt", "traceId", "spanId"],
41
+ additionalProperties: false,
42
+ properties: {
43
+ name: { type: "string" },
44
+ cause: { type: "string" },
45
+ count: { type: "integer" },
46
+ lastSeenAt: { type: "string" },
47
+ traceId: { type: "string" },
48
+ spanId: { type: "string" }
49
+ }
50
+ };
51
+ var RECENT_FAILURE_SCHEMA = {
52
+ type: "object",
53
+ required: ["name", "cause", "durationMs", "endedAt", "traceId", "spanId"],
54
+ additionalProperties: false,
55
+ properties: {
56
+ name: { type: "string" },
57
+ cause: { type: "string" },
58
+ durationMs: { type: "number" },
59
+ endedAt: { type: "string" },
60
+ traceId: { type: "string" },
61
+ spanId: { type: "string" }
62
+ }
63
+ };
64
+ var LOG_EVENT_SCHEMA = {
65
+ type: "object",
66
+ required: ["spanName", "level", "message", "seenAt", "traceId", "spanId"],
67
+ additionalProperties: false,
68
+ properties: {
69
+ spanName: { type: "string" },
70
+ level: { type: "string" },
71
+ message: { type: "string" },
72
+ seenAt: { type: "string" },
73
+ traceId: { type: "string" },
74
+ spanId: { type: "string" }
75
+ }
76
+ };
77
+ var SUMMARY_RESULT_SCHEMA = {
78
+ type: "object",
79
+ required: [
80
+ "traceFilePath",
81
+ "scannedFilePaths",
82
+ "readAt",
83
+ "recordCount",
84
+ "parseErrorCount",
85
+ "firstSpanAt",
86
+ "lastSpanAt",
87
+ "failureCount",
88
+ "interruptionCount",
89
+ "slowSpanThresholdMs",
90
+ "slowSpanCount",
91
+ "logLevelCounts",
92
+ "topSpansByCount",
93
+ "slowestSpans",
94
+ "commonFailures",
95
+ "latestFailures",
96
+ "latestWarningAndErrorLogs",
97
+ "partialFailure",
98
+ "error"
99
+ ],
100
+ additionalProperties: false,
101
+ properties: {
102
+ traceFilePath: { type: "string" },
103
+ scannedFilePaths: { type: "array", items: { type: "string" } },
104
+ readAt: { type: "string" },
105
+ recordCount: { type: "integer" },
106
+ parseErrorCount: { type: "integer" },
107
+ firstSpanAt: { type: ["string", "null"] },
108
+ lastSpanAt: { type: ["string", "null"] },
109
+ failureCount: { type: "integer" },
110
+ interruptionCount: { type: "integer" },
111
+ slowSpanThresholdMs: { type: "number" },
112
+ slowSpanCount: { type: "integer" },
113
+ logLevelCounts: { type: "object", additionalProperties: { type: "integer" } },
114
+ topSpansByCount: { type: "array", items: SPAN_SUMMARY_SCHEMA },
115
+ slowestSpans: { type: "array", items: SPAN_OCCURRENCE_SCHEMA },
116
+ commonFailures: { type: "array", items: FAILURE_SUMMARY_SCHEMA },
117
+ latestFailures: { type: "array", items: RECENT_FAILURE_SCHEMA },
118
+ latestWarningAndErrorLogs: { type: "array", items: LOG_EVENT_SCHEMA },
119
+ partialFailure: { type: "boolean" },
120
+ // 读成功是 null,读失败是完整的 { kind, message }:两支写成 oneOf,
121
+ // 半个错误对象(只有 kind)到不了调用方。
122
+ error: {
123
+ oneOf: [
124
+ { type: "null" },
125
+ {
126
+ type: "object",
127
+ required: ["kind", "message"],
128
+ additionalProperties: false,
129
+ properties: {
130
+ kind: { enum: ["trace-file-not-found", "trace-file-read-failed"] },
131
+ message: { type: "string" }
132
+ }
133
+ }
134
+ ]
135
+ }
136
+ }
137
+ };
138
+
139
+ // src/index.ts
3
140
  var DEFAULT_MAX_FILES = 10;
4
141
  var DEFAULT_SLOW_SPAN_THRESHOLD_MS = 1e3;
5
142
  var TOP_LIMIT = 10;
@@ -288,139 +425,6 @@ async function streamCandidateFiles(fs, candidates, onLine) {
288
425
  }
289
426
  return { foundFile, readFailure };
290
427
  }
291
- var SUMMARY_PAYLOAD_SCHEMA = { type: "object", additionalProperties: false };
292
- var SPAN_SUMMARY_SCHEMA = {
293
- type: "object",
294
- required: [
295
- "name",
296
- "count",
297
- "failureCount",
298
- "totalDurationMs",
299
- "averageDurationMs",
300
- "maxDurationMs"
301
- ],
302
- additionalProperties: false,
303
- properties: {
304
- name: { type: "string" },
305
- count: { type: "integer" },
306
- failureCount: { type: "integer" },
307
- totalDurationMs: { type: "number" },
308
- averageDurationMs: { type: "number" },
309
- maxDurationMs: { type: "number" }
310
- }
311
- };
312
- var SPAN_OCCURRENCE_SCHEMA = {
313
- type: "object",
314
- required: ["name", "durationMs", "endedAt", "traceId", "spanId"],
315
- additionalProperties: false,
316
- properties: {
317
- name: { type: "string" },
318
- durationMs: { type: "number" },
319
- endedAt: { type: "string" },
320
- traceId: { type: "string" },
321
- spanId: { type: "string" }
322
- }
323
- };
324
- var FAILURE_SUMMARY_SCHEMA = {
325
- type: "object",
326
- required: ["name", "cause", "count", "lastSeenAt", "traceId", "spanId"],
327
- additionalProperties: false,
328
- properties: {
329
- name: { type: "string" },
330
- cause: { type: "string" },
331
- count: { type: "integer" },
332
- lastSeenAt: { type: "string" },
333
- traceId: { type: "string" },
334
- spanId: { type: "string" }
335
- }
336
- };
337
- var RECENT_FAILURE_SCHEMA = {
338
- type: "object",
339
- required: ["name", "cause", "durationMs", "endedAt", "traceId", "spanId"],
340
- additionalProperties: false,
341
- properties: {
342
- name: { type: "string" },
343
- cause: { type: "string" },
344
- durationMs: { type: "number" },
345
- endedAt: { type: "string" },
346
- traceId: { type: "string" },
347
- spanId: { type: "string" }
348
- }
349
- };
350
- var LOG_EVENT_SCHEMA = {
351
- type: "object",
352
- required: ["spanName", "level", "message", "seenAt", "traceId", "spanId"],
353
- additionalProperties: false,
354
- properties: {
355
- spanName: { type: "string" },
356
- level: { type: "string" },
357
- message: { type: "string" },
358
- seenAt: { type: "string" },
359
- traceId: { type: "string" },
360
- spanId: { type: "string" }
361
- }
362
- };
363
- var SUMMARY_RESULT_SCHEMA = {
364
- type: "object",
365
- required: [
366
- "traceFilePath",
367
- "scannedFilePaths",
368
- "readAt",
369
- "recordCount",
370
- "parseErrorCount",
371
- "firstSpanAt",
372
- "lastSpanAt",
373
- "failureCount",
374
- "interruptionCount",
375
- "slowSpanThresholdMs",
376
- "slowSpanCount",
377
- "logLevelCounts",
378
- "topSpansByCount",
379
- "slowestSpans",
380
- "commonFailures",
381
- "latestFailures",
382
- "latestWarningAndErrorLogs",
383
- "partialFailure",
384
- "error"
385
- ],
386
- additionalProperties: false,
387
- properties: {
388
- traceFilePath: { type: "string" },
389
- scannedFilePaths: { type: "array", items: { type: "string" } },
390
- readAt: { type: "string" },
391
- recordCount: { type: "integer" },
392
- parseErrorCount: { type: "integer" },
393
- firstSpanAt: { type: ["string", "null"] },
394
- lastSpanAt: { type: ["string", "null"] },
395
- failureCount: { type: "integer" },
396
- interruptionCount: { type: "integer" },
397
- slowSpanThresholdMs: { type: "number" },
398
- slowSpanCount: { type: "integer" },
399
- logLevelCounts: { type: "object", additionalProperties: { type: "integer" } },
400
- topSpansByCount: { type: "array", items: SPAN_SUMMARY_SCHEMA },
401
- slowestSpans: { type: "array", items: SPAN_OCCURRENCE_SCHEMA },
402
- commonFailures: { type: "array", items: FAILURE_SUMMARY_SCHEMA },
403
- latestFailures: { type: "array", items: RECENT_FAILURE_SCHEMA },
404
- latestWarningAndErrorLogs: { type: "array", items: LOG_EVENT_SCHEMA },
405
- partialFailure: { type: "boolean" },
406
- // 读成功是 null,读失败是完整的 { kind, message }:两支写成 oneOf,
407
- // 半个错误对象(只有 kind)到不了调用方。
408
- error: {
409
- oneOf: [
410
- { type: "null" },
411
- {
412
- type: "object",
413
- required: ["kind", "message"],
414
- additionalProperties: false,
415
- properties: {
416
- kind: { enum: ["trace-file-not-found", "trace-file-read-failed"] },
417
- message: { type: "string" }
418
- }
419
- }
420
- ]
421
- }
422
- }
423
- };
424
428
  var traceDiagnosticsPlugin = definePlugin({
425
429
  id: "trace-diagnostics",
426
430
  apiVersion: 5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-trace-diagnostics",
3
- "version": "0.2.2984",
3
+ "version": "0.2.2990",
4
4
  "description": "Reads this machine's trace files for the diagnostics page.",
5
5
  "keywords": [
6
6
  "diagnostics",
@@ -20,7 +20,7 @@
20
20
  "@effect/vitest": "4.0.0-beta.103",
21
21
  "esbuild": "0.28.1",
22
22
  "vite-plus": "0.2.2",
23
- "@ycodium-ai/plugin-api": "0.2.2984"
23
+ "@ycodium-ai/plugin-api": "0.2.2990"
24
24
  },
25
25
  "ycodium": {
26
26
  "plugin": "./dist/index.js",