inspeffct 1.0.1 → 1.0.3
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/dist/bin.js +431 -712
- package/dist/bootloader.cjs +19 -101
- package/package.json +4 -4
package/dist/bootloader.cjs
CHANGED
|
@@ -57,46 +57,10 @@
|
|
|
57
57
|
|
|
58
58
|
// src/Encoder.ts
|
|
59
59
|
var constFailure2 = { _tag: "Failure" };
|
|
60
|
-
var formatBestEffort = (value) => {
|
|
61
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
62
|
-
const go = (input) => {
|
|
63
|
-
if (input === null) return "null";
|
|
64
|
-
switch (typeof input) {
|
|
65
|
-
case "string":
|
|
66
|
-
return JSON.stringify(input);
|
|
67
|
-
case "number":
|
|
68
|
-
case "boolean":
|
|
69
|
-
case "bigint":
|
|
70
|
-
return String(input);
|
|
71
|
-
case "undefined":
|
|
72
|
-
return "undefined";
|
|
73
|
-
case "symbol":
|
|
74
|
-
return String(input);
|
|
75
|
-
case "function":
|
|
76
|
-
return `[Function: ${input.name || "anonymous"}]`;
|
|
77
|
-
case "object": {
|
|
78
|
-
if (seen.has(input)) return "[Circular]";
|
|
79
|
-
seen.add(input);
|
|
80
|
-
if (Array.isArray(input)) {
|
|
81
|
-
return `[${input.map(go).join(", ")}]`;
|
|
82
|
-
}
|
|
83
|
-
if (input instanceof Error) {
|
|
84
|
-
return `${input.name}: ${input.message}`;
|
|
85
|
-
}
|
|
86
|
-
const entries = Object.keys(input).map((key) => `${key}: ${go(input[key])}`);
|
|
87
|
-
return `{ ${entries.join(", ")} }`;
|
|
88
|
-
}
|
|
89
|
-
default:
|
|
90
|
-
return String(input);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
return go(value);
|
|
94
|
-
};
|
|
95
60
|
var literal2 = (value) => (givenValue) => givenValue === value ? { _tag: "Success", value } : constFailure2;
|
|
96
61
|
var string2 = (value) => typeof value === "string" ? { _tag: "Success", value } : constFailure2;
|
|
97
62
|
var boolean = (value) => typeof value === "boolean" ? { _tag: "Success", value } : constFailure2;
|
|
98
63
|
var number = (value) => typeof value === "number" ? { _tag: "Success", value } : constFailure2;
|
|
99
|
-
var bigint = (value) => typeof value === "bigint" ? { _tag: "Success", value: globalThis.String(value) } : constFailure2;
|
|
100
64
|
var struct2 = (fields) => {
|
|
101
65
|
const fieldKeys = Object.keys(fields);
|
|
102
66
|
return (value) => {
|
|
@@ -140,14 +104,6 @@
|
|
|
140
104
|
return { _tag: "Success", value: result };
|
|
141
105
|
};
|
|
142
106
|
var unknown = (value) => ({ _tag: "Success", value });
|
|
143
|
-
var bestEffortAny = (value) => {
|
|
144
|
-
try {
|
|
145
|
-
return { _tag: "Success", value: JSON.parse(JSON.stringify(value)) };
|
|
146
|
-
} catch {
|
|
147
|
-
return { _tag: "Success", value: formatBestEffort(value) };
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
var lazy = (thunk) => (value) => thunk()(value);
|
|
151
107
|
|
|
152
108
|
// src/ProtocolEncoder.generated.ts
|
|
153
109
|
var ProtocolVersion2 = literal2(1);
|
|
@@ -155,23 +111,15 @@
|
|
|
155
111
|
var InitNotification = struct2({ _tag: literal2("InitNotification"), protocolVersion: ProtocolVersion2, instrumentationId: InstrumentationId2, inspectorURL: union2(string2, literal2(null)), waitingForDebugger: boolean });
|
|
156
112
|
var PingNotification = struct2({ _tag: literal2("PingNotification"), protocolVersion: ProtocolVersion2, instrumentationId: InstrumentationId2 });
|
|
157
113
|
var SpanAttributes = array2(tuple(string2, unknown));
|
|
158
|
-
var SpanStatusStarted = struct2({ _tag: literal2("Started"), startTime:
|
|
159
|
-
var
|
|
160
|
-
var
|
|
161
|
-
var Int = number;
|
|
162
|
-
var FiberIdRuntimeEncoded = struct2({ _tag: literal2("Runtime"), id: Int, startTimeMillis: Int });
|
|
163
|
-
var FiberIdCompositeEncoded = struct2({ _tag: literal2("Composite"), left: lazy(() => FiberIdEncoded), right: lazy(() => FiberIdEncoded) });
|
|
164
|
-
var FiberIdEncoded = union2(FiberIdNoneEncoded, FiberIdRuntimeEncoded, FiberIdCompositeEncoded);
|
|
165
|
-
var CauseEncoded3 = union2(struct2({ _tag: literal2("Empty") }), struct2({ _tag: literal2("Fail"), error: BestEffortAny }), struct2({ _tag: literal2("Die"), defect: BestEffortAny }), struct2({ _tag: literal2("Interrupt"), fiberId: FiberIdEncoded }), struct2({ _tag: literal2("Sequential"), left: lazy(() => CauseEncoded3), right: lazy(() => CauseEncoded3) }), struct2({ _tag: literal2("Parallel"), left: lazy(() => CauseEncoded3), right: lazy(() => CauseEncoded3) }));
|
|
166
|
-
var SpanExit = union2(struct2({ _tag: literal2("Failure"), cause: CauseEncoded3 }), struct2({ _tag: literal2("Success"), value: BestEffortAny }));
|
|
167
|
-
var SpanStatusEnded = struct2({ _tag: literal2("Ended"), startTime: bigint, endTime: bigint, exit: SpanExit });
|
|
114
|
+
var SpanStatusStarted = struct2({ _tag: literal2("Started"), startTime: string2 });
|
|
115
|
+
var SpanExit = union2(struct2({ _tag: literal2("Success"), value: unknown }), struct2({ _tag: literal2("Failure"), cause: array2(union2(struct2({ _tag: literal2("Fail"), error: unknown }), struct2({ _tag: literal2("Die"), defect: unknown }), struct2({ _tag: literal2("Interrupt"), fiberId: union2(number, literal2(null)) }))) }));
|
|
116
|
+
var SpanStatusEnded = struct2({ _tag: literal2("Ended"), startTime: string2, endTime: string2, exit: SpanExit });
|
|
168
117
|
var SpanStatus = union2(SpanStatusStarted, SpanStatusEnded);
|
|
169
|
-
var
|
|
170
|
-
var Span = struct2({ _tag: literal2("Span"), spanId: string2, traceId: string2, name: string2, sampled: boolean, attributes: SpanAttributes, status: SpanStatus, parent: union2(SpanAndTraceId, literal2(null)) });
|
|
118
|
+
var Span = struct2({ _tag: literal2("Span"), spanId: string2, traceId: string2, name: string2, sampled: boolean, attributes: SpanAttributes, status: SpanStatus, parentSpanId: union2(string2, literal2(null)) });
|
|
171
119
|
var ExternalSpan = struct2({ _tag: literal2("ExternalSpan"), spanId: string2, traceId: string2, sampled: boolean });
|
|
172
120
|
var AnySpan = union2(Span, ExternalSpan);
|
|
173
121
|
var TracerSpanNotification = struct2({ _tag: literal2("TracerSpanNotification"), protocolVersion: ProtocolVersion2, instrumentationId: InstrumentationId2, span: AnySpan });
|
|
174
|
-
var SpanEvent = struct2({ spanId: string2, traceId: string2, name: string2, time:
|
|
122
|
+
var SpanEvent = struct2({ spanId: string2, traceId: string2, name: string2, time: string2, attributes: SpanAttributes });
|
|
175
123
|
var TracerSpanEventNotification = struct2({ _tag: literal2("TracerSpanEventNotification"), protocolVersion: ProtocolVersion2, instrumentationId: InstrumentationId2, event: SpanEvent });
|
|
176
124
|
var SpanLink = struct2({ spanId: string2, traceId: string2, linkedSpanId: string2, linkedTraceId: string2, attributes: SpanAttributes });
|
|
177
125
|
var TracerSpanLinkNotification = struct2({ _tag: literal2("TracerSpanLinkNotification"), protocolVersion: ProtocolVersion2, instrumentationId: InstrumentationId2, link: SpanLink });
|
|
@@ -286,53 +234,20 @@
|
|
|
286
234
|
}
|
|
287
235
|
return result;
|
|
288
236
|
}
|
|
289
|
-
function serializeFiberId(fiberId) {
|
|
290
|
-
if (!fiberId || typeof fiberId !== "object" || !("_tag" in fiberId)) {
|
|
291
|
-
return { _tag: "None" };
|
|
292
|
-
}
|
|
293
|
-
const fid = fiberId;
|
|
294
|
-
switch (fid._tag) {
|
|
295
|
-
case "None":
|
|
296
|
-
return { _tag: "None" };
|
|
297
|
-
case "Runtime":
|
|
298
|
-
return {
|
|
299
|
-
_tag: "Runtime",
|
|
300
|
-
id: fid.id ?? 0,
|
|
301
|
-
startTimeMillis: fid.startTimeMillis ?? 0
|
|
302
|
-
};
|
|
303
|
-
case "Composite":
|
|
304
|
-
return {
|
|
305
|
-
_tag: "Composite",
|
|
306
|
-
left: fid.left ? serializeFiberId(fid.left) : { _tag: "None" },
|
|
307
|
-
right: fid.right ? serializeFiberId(fid.right) : { _tag: "None" }
|
|
308
|
-
};
|
|
309
|
-
default:
|
|
310
|
-
return { _tag: "None" };
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
237
|
function serializeCause(cause) {
|
|
314
|
-
|
|
238
|
+
return cause.reasons.map((reason) => {
|
|
315
239
|
switch (reason._tag) {
|
|
316
240
|
case "Fail":
|
|
317
241
|
return { _tag: "Fail", error: serializeToJson(reason.error) };
|
|
318
242
|
case "Die":
|
|
319
243
|
return { _tag: "Die", defect: serializeToJson(reason.defect) };
|
|
320
244
|
case "Interrupt":
|
|
321
|
-
return {
|
|
245
|
+
return {
|
|
246
|
+
_tag: "Interrupt",
|
|
247
|
+
fiberId: typeof reason.fiberId === "number" ? reason.fiberId : null
|
|
248
|
+
};
|
|
322
249
|
}
|
|
323
250
|
});
|
|
324
|
-
if (serializedReasons.length === 0) {
|
|
325
|
-
return { _tag: "Empty" };
|
|
326
|
-
}
|
|
327
|
-
let current = serializedReasons[0];
|
|
328
|
-
for (let i = 1; i < serializedReasons.length; i++) {
|
|
329
|
-
current = {
|
|
330
|
-
_tag: "Sequential",
|
|
331
|
-
left: current,
|
|
332
|
-
right: serializedReasons[i]
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
return current;
|
|
336
251
|
}
|
|
337
252
|
function serializeExit(exit) {
|
|
338
253
|
if (exit._tag === "Success") {
|
|
@@ -343,7 +258,7 @@
|
|
|
343
258
|
}
|
|
344
259
|
return {
|
|
345
260
|
_tag: "Failure",
|
|
346
|
-
cause: exit.cause ? serializeCause(exit.cause) :
|
|
261
|
+
cause: exit.cause ? serializeCause(exit.cause) : []
|
|
347
262
|
};
|
|
348
263
|
}
|
|
349
264
|
function addSetInterceptor(obj, property, interceptor) {
|
|
@@ -654,10 +569,13 @@ c.on("connect", () => {
|
|
|
654
569
|
}
|
|
655
570
|
});
|
|
656
571
|
} else {
|
|
657
|
-
const status = span.status._tag === "Started" ?
|
|
572
|
+
const status = span.status._tag === "Started" ? {
|
|
573
|
+
_tag: "Started",
|
|
574
|
+
startTime: span.status.startTime.toString()
|
|
575
|
+
} : {
|
|
658
576
|
_tag: "Ended",
|
|
659
|
-
startTime: span.status.startTime,
|
|
660
|
-
endTime: span.status.endTime,
|
|
577
|
+
startTime: span.status.startTime.toString(),
|
|
578
|
+
endTime: span.status.endTime.toString(),
|
|
661
579
|
exit: serializeExit(span.status.exit)
|
|
662
580
|
};
|
|
663
581
|
sendBack({
|
|
@@ -672,7 +590,7 @@ c.on("connect", () => {
|
|
|
672
590
|
sampled: span.sampled,
|
|
673
591
|
attributes: serializeAttributes(span.attributes),
|
|
674
592
|
status,
|
|
675
|
-
|
|
593
|
+
parentSpanId: span.parent._tag === "Some" && span.parent.value ? span.parent.value.spanId : null
|
|
676
594
|
}
|
|
677
595
|
});
|
|
678
596
|
}
|
|
@@ -686,7 +604,7 @@ c.on("connect", () => {
|
|
|
686
604
|
spanId: span.spanId,
|
|
687
605
|
traceId: span.traceId,
|
|
688
606
|
name,
|
|
689
|
-
time,
|
|
607
|
+
time: time.toString(),
|
|
690
608
|
attributes: serializeAttributes(attributes)
|
|
691
609
|
}
|
|
692
610
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inspeffct",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A CLI to help agents and humans inspect Effect applications",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
+
"@effect/platform-node": "4.0.0-beta.70",
|
|
15
|
+
"@effect/sql-sqlite-node": "4.0.0-beta.70",
|
|
14
16
|
"better-sqlite3": "^11.10.0",
|
|
17
|
+
"effect": "4.0.0-beta.70",
|
|
15
18
|
"undici": "^7.16.0",
|
|
16
19
|
"ws": "^8.18.3"
|
|
17
20
|
},
|
|
18
21
|
"devDependencies": {
|
|
19
|
-
"@effect/platform-node": "4.0.0-beta.70",
|
|
20
|
-
"@effect/sql-sqlite-node": "4.0.0-beta.70",
|
|
21
22
|
"@effect/vitest": "4.0.0-beta.70",
|
|
22
23
|
"@types/ws": "^8.18.1",
|
|
23
|
-
"effect": "4.0.0-beta.70",
|
|
24
24
|
"tsup": "^8.5.1"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|