@orkestrel/probe 0.0.10 → 0.0.11
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/src/core/index.cjs +101 -2
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +90 -0
- package/dist/src/core/index.d.ts +90 -0
- package/dist/src/core/index.js +97 -3
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +38 -13
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +5 -4
- package/dist/src/server/index.d.ts +5 -4
- package/dist/src/server/index.js +41 -16
- package/dist/src/server/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -267,10 +267,11 @@ export declare function isRefusedName(file: string, error: unknown): boolean;
|
|
|
267
267
|
*
|
|
268
268
|
* @remarks
|
|
269
269
|
* Construction starts the target workspace's Oxlint binary with its Language Server Protocol mode
|
|
270
|
-
* and hands the conversation to `@orkestrel/lsp`: `
|
|
271
|
-
* its bytes, and `createLSPClient` owns the framing, the request correlation, the
|
|
272
|
-
* stage advertises, and the choice between pulled and pushed diagnostics. This
|
|
273
|
-
* workspace, the candidate identity, and the projection from a diagnostic to an
|
|
270
|
+
* and hands the conversation to `@orkestrel/lsp`: `createStdioClientTransport` owns the child
|
|
271
|
+
* process and its bytes, and `createLSPClient` owns the framing, the request correlation, the
|
|
272
|
+
* capabilities this stage advertises, and the choice between pulled and pushed diagnostics. This
|
|
273
|
+
* stage owns the workspace, the candidate identity, and the projection from a diagnostic to an
|
|
274
|
+
* `Issue`.
|
|
274
275
|
*
|
|
275
276
|
* Each inspection opens the supplied text by URI, waits for the client's diagnostics, and closes the
|
|
276
277
|
* document without writing it to disk. The caller's own signal is what bounds that wait, so a server
|
|
@@ -267,10 +267,11 @@ export declare function isRefusedName(file: string, error: unknown): boolean;
|
|
|
267
267
|
*
|
|
268
268
|
* @remarks
|
|
269
269
|
* Construction starts the target workspace's Oxlint binary with its Language Server Protocol mode
|
|
270
|
-
* and hands the conversation to `@orkestrel/lsp`: `
|
|
271
|
-
* its bytes, and `createLSPClient` owns the framing, the request correlation, the
|
|
272
|
-
* stage advertises, and the choice between pulled and pushed diagnostics. This
|
|
273
|
-
* workspace, the candidate identity, and the projection from a diagnostic to an
|
|
270
|
+
* and hands the conversation to `@orkestrel/lsp`: `createStdioClientTransport` owns the child
|
|
271
|
+
* process and its bytes, and `createLSPClient` owns the framing, the request correlation, the
|
|
272
|
+
* capabilities this stage advertises, and the choice between pulled and pushed diagnostics. This
|
|
273
|
+
* stage owns the workspace, the candidate identity, and the projection from a diagnostic to an
|
|
274
|
+
* `Issue`.
|
|
274
275
|
*
|
|
275
276
|
* Each inspection opens the supplied text by URI, waits for the client's diagnostics, and closes the
|
|
276
277
|
* document without writing it to disk. The caller's own signal is what bounds that wait, so a server
|
package/dist/src/server/index.js
CHANGED
|
@@ -4,15 +4,15 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
4
4
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
6
|
import { attempt, compileGuard, compileSchema, isArray, isRecord, schemaToParameters } from "@orkestrel/contract";
|
|
7
|
-
import { CLAIM_SHAPE, ProbeError, computeReceipt, createDestroyedError, formatCheck, formatSpecification, formatVerdict, isClaim, isDraft, isProbeError, isVerdict, matchesSpecification } from "../core/index.js";
|
|
7
|
+
import { CLAIM_SHAPE, LINT_DEADLINE, PROBE_DEADLINE, PROBE_KEYS, ProbeError, computeReceipt, createDestroyedError, formatCheck, formatReceipt, formatSpecification, formatVerdict, isClaim, isDraft, isProbeError, isVerdict, matchesSpecification } from "../core/index.js";
|
|
8
8
|
import { Emitter } from "@orkestrel/emitter";
|
|
9
9
|
import { createQueue } from "@orkestrel/queue";
|
|
10
10
|
import { createTimeout } from "@orkestrel/timeout";
|
|
11
11
|
import { createLSPClient } from "@orkestrel/lsp";
|
|
12
|
-
import {
|
|
12
|
+
import { createStdioClientTransport } from "@orkestrel/lsp/server";
|
|
13
13
|
import { PassThrough } from "node:stream";
|
|
14
14
|
import { setTimeout } from "node:timers/promises";
|
|
15
|
-
import { createMCPLegacy, createMCPServer } from "@orkestrel/mcp";
|
|
15
|
+
import { createMCPLegacy, createMCPServer, isBoundedJSON } from "@orkestrel/mcp";
|
|
16
16
|
import { createStdioServer } from "@orkestrel/mcp/server";
|
|
17
17
|
import { createTool, createToolManager } from "@orkestrel/tool";
|
|
18
18
|
//#region src/server/helpers.ts
|
|
@@ -823,7 +823,7 @@ var Overlay = class {
|
|
|
823
823
|
};
|
|
824
824
|
//#endregion
|
|
825
825
|
//#region package.json
|
|
826
|
-
var version = "0.0.
|
|
826
|
+
var version = "0.0.11";
|
|
827
827
|
var peerDependencies = {
|
|
828
828
|
"oxlint": "^1.77.0",
|
|
829
829
|
"typescript": "^6.0.0",
|
|
@@ -836,10 +836,11 @@ var peerDependencies = {
|
|
|
836
836
|
*
|
|
837
837
|
* @remarks
|
|
838
838
|
* Construction starts the target workspace's Oxlint binary with its Language Server Protocol mode
|
|
839
|
-
* and hands the conversation to `@orkestrel/lsp`: `
|
|
840
|
-
* its bytes, and `createLSPClient` owns the framing, the request correlation, the
|
|
841
|
-
* stage advertises, and the choice between pulled and pushed diagnostics. This
|
|
842
|
-
* workspace, the candidate identity, and the projection from a diagnostic to an
|
|
839
|
+
* and hands the conversation to `@orkestrel/lsp`: `createStdioClientTransport` owns the child
|
|
840
|
+
* process and its bytes, and `createLSPClient` owns the framing, the request correlation, the
|
|
841
|
+
* capabilities this stage advertises, and the choice between pulled and pushed diagnostics. This
|
|
842
|
+
* stage owns the workspace, the candidate identity, and the projection from a diagnostic to an
|
|
843
|
+
* `Issue`.
|
|
843
844
|
*
|
|
844
845
|
* Each inspection opens the supplied text by URI, waits for the client's diagnostics, and closes the
|
|
845
846
|
* document without writing it to disk. The caller's own signal is what bounds that wait, so a server
|
|
@@ -869,7 +870,6 @@ var peerDependencies = {
|
|
|
869
870
|
*/
|
|
870
871
|
var LintStage = class {
|
|
871
872
|
#workspace;
|
|
872
|
-
#deadline = 2e3;
|
|
873
873
|
#documents = /* @__PURE__ */ new Set();
|
|
874
874
|
#warmth;
|
|
875
875
|
#client;
|
|
@@ -927,7 +927,7 @@ var LintStage = class {
|
|
|
927
927
|
async #warm() {
|
|
928
928
|
const binary = resolveWorkspaceBinary(this.#workspace, "oxlint");
|
|
929
929
|
const client = createLSPClient({
|
|
930
|
-
transport:
|
|
930
|
+
transport: createStdioClientTransport({
|
|
931
931
|
server: {
|
|
932
932
|
command: [
|
|
933
933
|
process.execPath,
|
|
@@ -936,10 +936,10 @@ var LintStage = class {
|
|
|
936
936
|
],
|
|
937
937
|
directory: this.#workspace
|
|
938
938
|
},
|
|
939
|
-
grace:
|
|
939
|
+
grace: LINT_DEADLINE / 2
|
|
940
940
|
}),
|
|
941
941
|
workspace: pathToFileURL(this.#workspace).href,
|
|
942
|
-
timeout:
|
|
942
|
+
timeout: LINT_DEADLINE
|
|
943
943
|
});
|
|
944
944
|
this.#client = client;
|
|
945
945
|
client.emitter.on("exit", (exit) => this.#retire(exit));
|
|
@@ -2067,7 +2067,7 @@ var Probe = class {
|
|
|
2067
2067
|
*/
|
|
2068
2068
|
constructor(options) {
|
|
2069
2069
|
this.#workspace = options?.workspace ?? process.cwd();
|
|
2070
|
-
this.#deadline = createTimeout({ ms: options?.deadline ??
|
|
2070
|
+
this.#deadline = createTimeout({ ms: options?.deadline ?? PROBE_DEADLINE }).ms;
|
|
2071
2071
|
this.#emitter = new Emitter({
|
|
2072
2072
|
...options?.on === void 0 ? {} : { on: options.on },
|
|
2073
2073
|
...options?.error === void 0 ? {} : { error: options.error }
|
|
@@ -2504,6 +2504,7 @@ var ProbeServer = class {
|
|
|
2504
2504
|
#close;
|
|
2505
2505
|
#error;
|
|
2506
2506
|
#signal;
|
|
2507
|
+
#server;
|
|
2507
2508
|
#owns;
|
|
2508
2509
|
#closing;
|
|
2509
2510
|
/**
|
|
@@ -2514,7 +2515,8 @@ var ProbeServer = class {
|
|
|
2514
2515
|
constructor(options) {
|
|
2515
2516
|
this.#probe = new Probe(options);
|
|
2516
2517
|
this.#stream = new PassThrough();
|
|
2517
|
-
this.#
|
|
2518
|
+
this.#server = this.#publish();
|
|
2519
|
+
this.#transport = createStdioServer(createMCPLegacy(this.#server), { input: this.#stream });
|
|
2518
2520
|
this.#data = this.#receive.bind(this);
|
|
2519
2521
|
this.#close = this.#finish.bind(this);
|
|
2520
2522
|
this.#error = this.#fail.bind(this);
|
|
@@ -2579,6 +2581,7 @@ var ProbeServer = class {
|
|
|
2579
2581
|
version
|
|
2580
2582
|
},
|
|
2581
2583
|
tools,
|
|
2584
|
+
limit: { keys: PROBE_KEYS },
|
|
2582
2585
|
execution: this.#execute.bind(this)
|
|
2583
2586
|
});
|
|
2584
2587
|
}
|
|
@@ -2601,13 +2604,35 @@ var ProbeServer = class {
|
|
|
2601
2604
|
code: "malformed",
|
|
2602
2605
|
context: { value: result.value }
|
|
2603
2606
|
});
|
|
2604
|
-
|
|
2607
|
+
const record = result.value;
|
|
2608
|
+
const limit = this.#server.limit;
|
|
2609
|
+
const bounds = {
|
|
2610
|
+
bytes: limit.content,
|
|
2611
|
+
keys: limit.keys,
|
|
2612
|
+
depth: limit.depth
|
|
2613
|
+
};
|
|
2614
|
+
const rendered = {
|
|
2615
|
+
resultType: "complete",
|
|
2616
|
+
content: [{
|
|
2617
|
+
type: "text",
|
|
2618
|
+
text: formatVerdict(record)
|
|
2619
|
+
}]
|
|
2620
|
+
};
|
|
2621
|
+
const minimal = {
|
|
2605
2622
|
resultType: "complete",
|
|
2606
2623
|
content: [{
|
|
2607
2624
|
type: "text",
|
|
2608
|
-
text:
|
|
2625
|
+
text: formatReceipt(record)
|
|
2609
2626
|
}]
|
|
2610
2627
|
};
|
|
2628
|
+
return (isBoundedJSON(record, bounds) ? [
|
|
2629
|
+
{
|
|
2630
|
+
...rendered,
|
|
2631
|
+
structuredContent: record
|
|
2632
|
+
},
|
|
2633
|
+
rendered,
|
|
2634
|
+
minimal
|
|
2635
|
+
] : [rendered, minimal]).find((arm) => isBoundedJSON(arm, bounds)) ?? minimal;
|
|
2611
2636
|
}
|
|
2612
2637
|
};
|
|
2613
2638
|
//#endregion
|