@deslop/scope 0.1.1204 → 0.1.1206
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 +69 -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)
|
|
@@ -71316,6 +71354,8 @@ const User = Struct({
|
|
|
71316
71354
|
name: NonEmptyString
|
|
71317
71355
|
});
|
|
71318
71356
|
const Resource$1 = Literals([
|
|
71357
|
+
"https://gateway.mp281x.xyz",
|
|
71358
|
+
"https://gateway.mp281x.xyz/mcp",
|
|
71319
71359
|
"https://stash.mp281x.xyz",
|
|
71320
71360
|
"https://stash.mp281x.xyz/mcp",
|
|
71321
71361
|
"https://opm.mp281x.xyz",
|
|
@@ -71428,11 +71468,11 @@ const previewAuth = fnUntraced(function* (resource, issuerUrl, client) {
|
|
|
71428
71468
|
if (next.origin !== origin || next.username !== "" || next.password !== "") return yield* expired();
|
|
71429
71469
|
if (isNone(address(request.headers))) {
|
|
71430
71470
|
if (request.headers["host"] !== new URL(resource).host) return yield* expired();
|
|
71431
|
-
return redirect(`${AUTH_URL}
|
|
71471
|
+
return redirect(`${AUTH_URL}/?${new URLSearchParams({ next: next.href })}`);
|
|
71432
71472
|
}
|
|
71433
71473
|
const callback = `${origin}/auth/callback`;
|
|
71434
71474
|
const registration = yield* pipe(post(`${issuerUrl}/api/auth/oauth2/register`), bodyJson({
|
|
71435
|
-
client_name: `${new URL(resource).hostname}
|
|
71475
|
+
client_name: `${capitalize(headNonEmpty(split(new URL(resource).hostname, ".")))} preview`,
|
|
71436
71476
|
redirect_uris: [callback],
|
|
71437
71477
|
token_endpoint_auth_method: "none"
|
|
71438
71478
|
}), flatMap$1((value) => client.execute(value)), flatMap$1(schemaBodyJson$1(ClientRegistration)), timeout("10 seconds"));
|
|
@@ -71673,7 +71713,7 @@ const layerNodeHttpServer = layerConfig(createServer, {
|
|
|
71673
71713
|
port: pipe(Port("PORT"), withDefault(5e3))
|
|
71674
71714
|
});
|
|
71675
71715
|
// package.json
|
|
71676
|
-
var version = "0.1.
|
|
71716
|
+
var version = "0.1.1206";
|
|
71677
71717
|
// src/services/telemetry/schema.ts
|
|
71678
71718
|
var TelemetryError = class extends TaggedError()("TelemetryError", {
|
|
71679
71719
|
cause: optional$6(Defect()),
|
|
@@ -71766,7 +71806,10 @@ const Query = Struct({
|
|
|
71766
71806
|
maximum: 1e3,
|
|
71767
71807
|
minimum: 1
|
|
71768
71808
|
}))),
|
|
71769
|
-
offset:
|
|
71809
|
+
offset: pipe(Int, check(isBetween({
|
|
71810
|
+
maximum: 1e5,
|
|
71811
|
+
minimum: 0
|
|
71812
|
+
}))),
|
|
71770
71813
|
operation: String$2,
|
|
71771
71814
|
runs: Literals(["current", "all"]),
|
|
71772
71815
|
service: String$2,
|
|
@@ -71857,13 +71900,12 @@ const Filters = Struct({
|
|
|
71857
71900
|
text: pipe(Query.fields.text, withDecodingDefaultTypeKey(succeed$4("")), annotateEncoded({ description: "Case-insensitive text in the span name, log message or attributes." })),
|
|
71858
71901
|
traceId: pipe(Query.fields.traceId, withDecodingDefaultTypeKey(succeed$4("")), annotateEncoded({ description: "Only entries of this trace." }))
|
|
71859
71902
|
});
|
|
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
71903
|
const SortFilters = Struct({
|
|
71866
|
-
...
|
|
71904
|
+
...Struct({
|
|
71905
|
+
...Filters.fields,
|
|
71906
|
+
limit: pipe(Query.fields.limit, withDecodingDefaultTypeKey(succeed$4(20)), annotateEncoded({ description: "Page size, 1 to 1000." })),
|
|
71907
|
+
offset: pipe(Query.fields.offset, withDecodingDefaultTypeKey(succeed$4(0)), annotateEncoded({ description: "Entries to skip, for the next page." }))
|
|
71908
|
+
}).fields,
|
|
71867
71909
|
sort: pipe(Query.fields.sort, withDecodingDefaultTypeKey(succeed$4("recent")), annotateEncoded({ description: "\"recent\" puts the newest first, \"slowest\" the longest first." }))
|
|
71868
71910
|
});
|
|
71869
71911
|
// src/services/telemetry/lib/utils.ts
|
|
@@ -72190,31 +72232,28 @@ var Telemetry = class extends Service$2()("@deslop/scope/services/telemetry/serv
|
|
|
72190
72232
|
};
|
|
72191
72233
|
// src/tools/contracts.ts
|
|
72192
72234
|
const Tools = make$6(make$7("list_services", {
|
|
72193
|
-
description: "
|
|
72235
|
+
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
72236
|
failure: TelemetryError,
|
|
72195
72237
|
success: IngestionStatus
|
|
72196
|
-
}).annotate(Readonly, true), make$7("
|
|
72197
|
-
description: "Find traces
|
|
72238
|
+
}).annotate(Readonly, true), make$7("find", {
|
|
72239
|
+
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
72240
|
failure: TelemetryError,
|
|
72199
|
-
parameters:
|
|
72200
|
-
|
|
72241
|
+
parameters: Struct({
|
|
72242
|
+
...SortFilters.fields,
|
|
72243
|
+
kind: Literals([
|
|
72244
|
+
"traces",
|
|
72245
|
+
"spans",
|
|
72246
|
+
"logs"
|
|
72247
|
+
]).annotate({ description: "What to find." })
|
|
72248
|
+
}),
|
|
72249
|
+
success: Union([TracesPage, Page])
|
|
72201
72250
|
}).annotate(Readonly, true), make$7("read_trace", {
|
|
72202
|
-
description: "
|
|
72251
|
+
description: "One trace whole: every span in order with its depth, offset, duration and logs.",
|
|
72203
72252
|
failure: TelemetryError,
|
|
72204
|
-
parameters: Struct({ id: pipe(TraceId, annotateEncoded({ description: "The 32-character id from
|
|
72253
|
+
parameters: Struct({ id: pipe(TraceId, annotateEncoded({ description: "The 32-character id from find." })) }),
|
|
72205
72254
|
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
72255
|
}).annotate(Readonly, true), make$7("measure_latency", {
|
|
72217
|
-
description: "Count, errors and p50, p95 and max
|
|
72256
|
+
description: "Count, errors and p50, p95 and max milliseconds of the matching spans; run it before and after a change to compare.",
|
|
72218
72257
|
failure: TelemetryError,
|
|
72219
72258
|
parameters: Filters,
|
|
72220
72259
|
success: Stats
|
|
@@ -72234,9 +72273,7 @@ const query = fnUntraced(function* (filters) {
|
|
|
72234
72273
|
const ToolHandlers = Tools.toLayer(gen(function* () {
|
|
72235
72274
|
const telemetry = yield* Telemetry;
|
|
72236
72275
|
return Tools.of({
|
|
72237
|
-
|
|
72238
|
-
find_spans: (filters) => flatMap$1(query(filters), telemetry.spans),
|
|
72239
|
-
find_traces: (filters) => flatMap$1(query(filters), telemetry.traces),
|
|
72276
|
+
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
72277
|
list_services: () => telemetry.services(),
|
|
72241
72278
|
measure_latency: (filters) => flatMap$1(query(filters), telemetry.stats),
|
|
72242
72279
|
read_trace: (input) => telemetry.trace(input.id)
|
|
@@ -72285,7 +72322,7 @@ const observe = make$27((app) => pipe(app, onExit$1((exit) => gen(function* () {
|
|
|
72285
72322
|
});
|
|
72286
72323
|
}))));
|
|
72287
72324
|
const mcp = layerMcp({
|
|
72288
|
-
instructions: "Scope is the debugger for the user's Effect apps
|
|
72325
|
+
instructions: "Scope is the debugger for the user's Effect apps: their traces, spans and logs.",
|
|
72289
72326
|
name: "scope",
|
|
72290
72327
|
registrations: pipe(toolkit(Tools), provide$2(ToolHandlers)),
|
|
72291
72328
|
version
|