@deslop/scope 0.1.1204 → 0.1.1205
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/README.md +1 -3
- package/dist/server.js +67 -32
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,9 +23,7 @@ The public `/.well-known/oauth-protected-resource/mcp` document names the author
|
|
|
23
23
|
| Tool | Returns |
|
|
24
24
|
| ----------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
25
25
|
| `list_services` | Every stored service's latest run, runtime, last event time and entry count, plus rejected-export counters |
|
|
26
|
-
| `
|
|
27
|
-
| `find_spans` | Matching spans with their original OTLP fields |
|
|
28
|
-
| `find_logs` | Matching logs, standalone or attached to a span |
|
|
26
|
+
| `find` | Matching traces, spans with their OTLP fields, or logs, newest or slowest first, with the total count |
|
|
29
27
|
| `measure_latency` | Span count, errors and p50, p95 and max latency over the whole window |
|
|
30
28
|
| `read_trace` | One stored trace whole, including earlier runs, with parent order, offsets and logs |
|
|
31
29
|
|
package/dist/server.js
CHANGED
|
@@ -14421,6 +14421,23 @@ globalThis.String;
|
|
|
14421
14421
|
*/
|
|
14422
14422
|
const isString$1 = isString$2;
|
|
14423
14423
|
/**
|
|
14424
|
+
* Converts a string to uppercase.
|
|
14425
|
+
*
|
|
14426
|
+
* **Example** (Converting strings to uppercase)
|
|
14427
|
+
*
|
|
14428
|
+
* ```ts import.meta.vitest
|
|
14429
|
+
* import { pipe, String } from "effect"
|
|
14430
|
+
*
|
|
14431
|
+
* pipe("a", String.toUpperCase) // => "A"
|
|
14432
|
+
* String.toUpperCase("hello") // => "HELLO"
|
|
14433
|
+
* ```
|
|
14434
|
+
*
|
|
14435
|
+
* @stability stable
|
|
14436
|
+
* @category transforming
|
|
14437
|
+
* @since 2.0.0
|
|
14438
|
+
*/
|
|
14439
|
+
const toUpperCase = (self) => self.toUpperCase();
|
|
14440
|
+
/**
|
|
14424
14441
|
* Converts a string to lowercase.
|
|
14425
14442
|
*
|
|
14426
14443
|
* **Example** (Converting strings to lowercase)
|
|
@@ -14438,6 +14455,27 @@ const isString$1 = isString$2;
|
|
|
14438
14455
|
*/
|
|
14439
14456
|
const toLowerCase = (self) => self.toLowerCase();
|
|
14440
14457
|
/**
|
|
14458
|
+
* Capitalizes the first character (Unicode code point) of a string.
|
|
14459
|
+
*
|
|
14460
|
+
* **Example** (Capitalizing a string)
|
|
14461
|
+
*
|
|
14462
|
+
* ```ts import.meta.vitest
|
|
14463
|
+
* import { pipe, String } from "effect"
|
|
14464
|
+
*
|
|
14465
|
+
* pipe("abc", String.capitalize) // => "Abc"
|
|
14466
|
+
* String.capitalize("hello") // => "Hello"
|
|
14467
|
+
* String.capitalize("𐐨foo") // => "𐐀foo"
|
|
14468
|
+
* ```
|
|
14469
|
+
*
|
|
14470
|
+
* @stability stable
|
|
14471
|
+
* @category transforming
|
|
14472
|
+
* @since 2.0.0
|
|
14473
|
+
*/
|
|
14474
|
+
const capitalize = (self) => {
|
|
14475
|
+
const [first = ""] = self;
|
|
14476
|
+
return toUpperCase(first) + self.slice(first.length);
|
|
14477
|
+
};
|
|
14478
|
+
/**
|
|
14441
14479
|
* Checks whether a `string` is non-empty.
|
|
14442
14480
|
*
|
|
14443
14481
|
* **Example** (Checking for non-empty strings)
|
|
@@ -71428,11 +71466,11 @@ const previewAuth = fnUntraced(function* (resource, issuerUrl, client) {
|
|
|
71428
71466
|
if (next.origin !== origin || next.username !== "" || next.password !== "") return yield* expired();
|
|
71429
71467
|
if (isNone(address(request.headers))) {
|
|
71430
71468
|
if (request.headers["host"] !== new URL(resource).host) return yield* expired();
|
|
71431
|
-
return redirect(`${AUTH_URL}
|
|
71469
|
+
return redirect(`${AUTH_URL}/?${new URLSearchParams({ next: next.href })}`);
|
|
71432
71470
|
}
|
|
71433
71471
|
const callback = `${origin}/auth/callback`;
|
|
71434
71472
|
const registration = yield* pipe(post(`${issuerUrl}/api/auth/oauth2/register`), bodyJson({
|
|
71435
|
-
client_name: `${new URL(resource).hostname}
|
|
71473
|
+
client_name: `${capitalize(headNonEmpty(split(new URL(resource).hostname, ".")))} preview`,
|
|
71436
71474
|
redirect_uris: [callback],
|
|
71437
71475
|
token_endpoint_auth_method: "none"
|
|
71438
71476
|
}), flatMap$1((value) => client.execute(value)), flatMap$1(schemaBodyJson$1(ClientRegistration)), timeout("10 seconds"));
|
|
@@ -71673,7 +71711,7 @@ const layerNodeHttpServer = layerConfig(createServer, {
|
|
|
71673
71711
|
port: pipe(Port("PORT"), withDefault(5e3))
|
|
71674
71712
|
});
|
|
71675
71713
|
// package.json
|
|
71676
|
-
var version = "0.1.
|
|
71714
|
+
var version = "0.1.1205";
|
|
71677
71715
|
// src/services/telemetry/schema.ts
|
|
71678
71716
|
var TelemetryError = class extends TaggedError()("TelemetryError", {
|
|
71679
71717
|
cause: optional$6(Defect()),
|
|
@@ -71766,7 +71804,10 @@ const Query = Struct({
|
|
|
71766
71804
|
maximum: 1e3,
|
|
71767
71805
|
minimum: 1
|
|
71768
71806
|
}))),
|
|
71769
|
-
offset:
|
|
71807
|
+
offset: pipe(Int, check(isBetween({
|
|
71808
|
+
maximum: 1e5,
|
|
71809
|
+
minimum: 0
|
|
71810
|
+
}))),
|
|
71770
71811
|
operation: String$2,
|
|
71771
71812
|
runs: Literals(["current", "all"]),
|
|
71772
71813
|
service: String$2,
|
|
@@ -71857,13 +71898,12 @@ const Filters = Struct({
|
|
|
71857
71898
|
text: pipe(Query.fields.text, withDecodingDefaultTypeKey(succeed$4("")), annotateEncoded({ description: "Case-insensitive text in the span name, log message or attributes." })),
|
|
71858
71899
|
traceId: pipe(Query.fields.traceId, withDecodingDefaultTypeKey(succeed$4("")), annotateEncoded({ description: "Only entries of this trace." }))
|
|
71859
71900
|
});
|
|
71860
|
-
const PageFilters = Struct({
|
|
71861
|
-
...Filters.fields,
|
|
71862
|
-
limit: pipe(Query.fields.limit, withDecodingDefaultTypeKey(succeed$4(20)), annotateEncoded({ description: "Page size, 1 to 1000." })),
|
|
71863
|
-
offset: pipe(Query.fields.offset, withDecodingDefaultTypeKey(succeed$4(0)), annotateEncoded({ description: "Entries to skip, for the next page." }))
|
|
71864
|
-
});
|
|
71865
71901
|
const SortFilters = Struct({
|
|
71866
|
-
...
|
|
71902
|
+
...Struct({
|
|
71903
|
+
...Filters.fields,
|
|
71904
|
+
limit: pipe(Query.fields.limit, withDecodingDefaultTypeKey(succeed$4(20)), annotateEncoded({ description: "Page size, 1 to 1000." })),
|
|
71905
|
+
offset: pipe(Query.fields.offset, withDecodingDefaultTypeKey(succeed$4(0)), annotateEncoded({ description: "Entries to skip, for the next page." }))
|
|
71906
|
+
}).fields,
|
|
71867
71907
|
sort: pipe(Query.fields.sort, withDecodingDefaultTypeKey(succeed$4("recent")), annotateEncoded({ description: "\"recent\" puts the newest first, \"slowest\" the longest first." }))
|
|
71868
71908
|
});
|
|
71869
71909
|
// src/services/telemetry/lib/utils.ts
|
|
@@ -72190,31 +72230,28 @@ var Telemetry = class extends Service$2()("@deslop/scope/services/telemetry/serv
|
|
|
72190
72230
|
};
|
|
72191
72231
|
// src/tools/contracts.ts
|
|
72192
72232
|
const Tools = make$6(make$7("list_services", {
|
|
72193
|
-
description: "
|
|
72233
|
+
description: "Start here: each service with its latest run, last event and entry count, plus rejected exports. A service missing here sent nothing in the last three days.",
|
|
72194
72234
|
failure: TelemetryError,
|
|
72195
72235
|
success: IngestionStatus
|
|
72196
|
-
}).annotate(Readonly, true), make$7("
|
|
72197
|
-
description: "Find traces
|
|
72236
|
+
}).annotate(Readonly, true), make$7("find", {
|
|
72237
|
+
description: "Find traces (one request or action each), single spans with their attributes, or logs, newest or slowest first; searches the latest run of each service unless runs is \"all\". Open a trace with read_trace.",
|
|
72198
72238
|
failure: TelemetryError,
|
|
72199
|
-
parameters:
|
|
72200
|
-
|
|
72239
|
+
parameters: Struct({
|
|
72240
|
+
...SortFilters.fields,
|
|
72241
|
+
kind: Literals([
|
|
72242
|
+
"traces",
|
|
72243
|
+
"spans",
|
|
72244
|
+
"logs"
|
|
72245
|
+
]).annotate({ description: "What to find." })
|
|
72246
|
+
}),
|
|
72247
|
+
success: Union([TracesPage, Page])
|
|
72201
72248
|
}).annotate(Readonly, true), make$7("read_trace", {
|
|
72202
|
-
description: "
|
|
72249
|
+
description: "One trace whole: every span in order with its depth, offset, duration and logs.",
|
|
72203
72250
|
failure: TelemetryError,
|
|
72204
|
-
parameters: Struct({ id: pipe(TraceId, annotateEncoded({ description: "The 32-character id from
|
|
72251
|
+
parameters: Struct({ id: pipe(TraceId, annotateEncoded({ description: "The 32-character id from find." })) }),
|
|
72205
72252
|
success: Trace
|
|
72206
|
-
}).annotate(Readonly, true), make$7("find_logs", {
|
|
72207
|
-
description: "Find what the apps logged, newest first, with or without a span; errors: true keeps only failures. Call it to see what happened during a reproduced bug.",
|
|
72208
|
-
failure: TelemetryError,
|
|
72209
|
-
parameters: PageFilters,
|
|
72210
|
-
success: Page
|
|
72211
|
-
}).annotate(Readonly, true), make$7("find_spans", {
|
|
72212
|
-
description: "Find single spans with their original OTLP attributes and events, when one operation matters more than its trace, such as every failed call to one endpoint.",
|
|
72213
|
-
failure: TelemetryError,
|
|
72214
|
-
parameters: SortFilters,
|
|
72215
|
-
success: Page
|
|
72216
72253
|
}).annotate(Readonly, true), make$7("measure_latency", {
|
|
72217
|
-
description: "Count, errors and p50, p95 and max
|
|
72254
|
+
description: "Count, errors and p50, p95 and max milliseconds of the matching spans; run it before and after a change to compare.",
|
|
72218
72255
|
failure: TelemetryError,
|
|
72219
72256
|
parameters: Filters,
|
|
72220
72257
|
success: Stats
|
|
@@ -72234,9 +72271,7 @@ const query = fnUntraced(function* (filters) {
|
|
|
72234
72271
|
const ToolHandlers = Tools.toLayer(gen(function* () {
|
|
72235
72272
|
const telemetry = yield* Telemetry;
|
|
72236
72273
|
return Tools.of({
|
|
72237
|
-
|
|
72238
|
-
find_spans: (filters) => flatMap$1(query(filters), telemetry.spans),
|
|
72239
|
-
find_traces: (filters) => flatMap$1(query(filters), telemetry.traces),
|
|
72274
|
+
find: (input) => flatMap$1(query(input), (filters) => pipe(value(input.kind), when("traces", () => telemetry.traces(filters)), when("spans", () => telemetry.spans(filters)), when("logs", () => telemetry.logs(filters)), exhaustive)),
|
|
72240
72275
|
list_services: () => telemetry.services(),
|
|
72241
72276
|
measure_latency: (filters) => flatMap$1(query(filters), telemetry.stats),
|
|
72242
72277
|
read_trace: (input) => telemetry.trace(input.id)
|
|
@@ -72285,7 +72320,7 @@ const observe = make$27((app) => pipe(app, onExit$1((exit) => gen(function* () {
|
|
|
72285
72320
|
});
|
|
72286
72321
|
}))));
|
|
72287
72322
|
const mcp = layerMcp({
|
|
72288
|
-
instructions: "Scope is the debugger for the user's Effect apps
|
|
72323
|
+
instructions: "Scope is the debugger for the user's Effect apps: their traces, spans and logs.",
|
|
72289
72324
|
name: "scope",
|
|
72290
72325
|
registrations: pipe(toolkit(Tools), provide$2(ToolHandlers)),
|
|
72291
72326
|
version
|