@smthrs/std 1.0.0-rc.5 → 1.0.0-rc.6

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 (67) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ExaWebSearch.js +1 -1
  3. package/dist/cjs/ExaWebSearch.js.map +1 -1
  4. package/dist/cjs/Fetch.d.ts +1 -1
  5. package/dist/cjs/Fetch.d.ts.map +1 -1
  6. package/dist/cjs/Fetch.js +1 -1
  7. package/dist/cjs/Fetch.js.map +2 -2
  8. package/dist/cjs/HttpPost.d.ts +1 -1
  9. package/dist/cjs/HttpPost.d.ts.map +1 -1
  10. package/dist/cjs/HttpPost.js +1 -1
  11. package/dist/cjs/HttpPost.js.map +2 -2
  12. package/dist/cjs/Lsp.d.ts +1 -1
  13. package/dist/cjs/Manifest.d.ts +8 -8
  14. package/dist/cjs/NodeLanguageServer.js +1 -1
  15. package/dist/cjs/NodeLanguageServer.js.map +1 -1
  16. package/dist/cjs/WebFetch.d.ts.map +1 -1
  17. package/dist/cjs/WebFetch.js +1 -1
  18. package/dist/cjs/WebFetch.js.map +2 -2
  19. package/dist/cjs/internal/Exec.d.ts.map +1 -1
  20. package/dist/cjs/internal/Exec.js +1 -1
  21. package/dist/cjs/internal/Exec.js.map +2 -2
  22. package/dist/cjs/internal/Http.d.ts +1 -1
  23. package/dist/cjs/internal/Http.d.ts.map +1 -1
  24. package/dist/cjs/internal/Http.js +1 -1
  25. package/dist/cjs/internal/Http.js.map +2 -2
  26. package/dist/cjs/internal/HttpNetwork.d.ts +2 -2
  27. package/dist/cjs/internal/HttpNetwork.d.ts.map +1 -1
  28. package/dist/cjs/internal/HttpNetwork.js +3 -3
  29. package/dist/cjs/internal/HttpNetwork.js.map +1 -1
  30. package/dist/esm/ExaWebSearch.js +1 -1
  31. package/dist/esm/ExaWebSearch.js.map +1 -1
  32. package/dist/esm/Fetch.d.ts +1 -1
  33. package/dist/esm/Fetch.d.ts.map +1 -1
  34. package/dist/esm/Fetch.js +1 -1
  35. package/dist/esm/Fetch.js.map +1 -1
  36. package/dist/esm/HttpPost.d.ts +1 -1
  37. package/dist/esm/HttpPost.d.ts.map +1 -1
  38. package/dist/esm/HttpPost.js +1 -1
  39. package/dist/esm/HttpPost.js.map +1 -1
  40. package/dist/esm/Lsp.d.ts +1 -1
  41. package/dist/esm/Manifest.d.ts +8 -8
  42. package/dist/esm/NodeLanguageServer.js +1 -1
  43. package/dist/esm/NodeLanguageServer.js.map +1 -1
  44. package/dist/esm/WebFetch.d.ts.map +1 -1
  45. package/dist/esm/WebFetch.js +1 -1
  46. package/dist/esm/WebFetch.js.map +1 -1
  47. package/dist/esm/internal/Exec.d.ts.map +1 -1
  48. package/dist/esm/internal/Exec.js +1 -1
  49. package/dist/esm/internal/Exec.js.map +1 -1
  50. package/dist/esm/internal/Http.d.ts +1 -1
  51. package/dist/esm/internal/Http.d.ts.map +1 -1
  52. package/dist/esm/internal/Http.js +1 -1
  53. package/dist/esm/internal/Http.js.map +1 -1
  54. package/dist/esm/internal/HttpNetwork.d.ts +2 -2
  55. package/dist/esm/internal/HttpNetwork.d.ts.map +1 -1
  56. package/dist/esm/internal/HttpNetwork.js +3 -3
  57. package/dist/esm/internal/HttpNetwork.js.map +1 -1
  58. package/docs/installation.md +1 -1
  59. package/package.json +10 -10
  60. package/src/ExaWebSearch.ts +1 -1
  61. package/src/Fetch.ts +1 -1
  62. package/src/HttpPost.ts +1 -1
  63. package/src/NodeLanguageServer.ts +1 -1
  64. package/src/WebFetch.ts +1 -1
  65. package/src/internal/Exec.ts +1 -1
  66. package/src/internal/Http.ts +1 -1
  67. package/src/internal/HttpNetwork.ts +3 -3
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Release candidate scope, host requirements and compatibility review are defined in the [library support policy](https://github.com/smithersai/smithers/blob/main/RELEASE_SUPPORT.md).
4
4
 
5
- This package declares `effect` as an exact
6
- `4.0.0-rc.115` peer dependency. Keep the application on that version so
7
- all Smithers packages share one Effect runtime.
5
+ This package declares `effect` as a `^4.0.4` peer dependency. Install one
6
+ `effect` release in that range so all Smithers packages share one Effect
7
+ runtime.
8
8
 
9
9
  **Documentation:** https://std.smithers.sh
10
10
 
@@ -34,7 +34,7 @@ module.exports = __toCommonJS(ExaWebSearch_exports);
34
34
  var Credential = __toESM(require("@smthrs/control/Credential"), 1);
35
35
  var HttpClient = __toESM(require("@smthrs/kernel/HttpClient"), 1);
36
36
  var import_effect = require("effect");
37
- var HttpClientRequest = __toESM(require("effect/unstable/http/HttpClientRequest"), 1);
37
+ var HttpClientRequest = __toESM(require("effect/http/HttpClientRequest"), 1);
38
38
  var import_Http = require("./internal/Http.js");
39
39
  var StdError = __toESM(require("./StdError.js"), 1);
40
40
  var WebSearch = __toESM(require("./WebSearch.js"), 1);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ExaWebSearch.ts"],
4
- "sourcesContent": ["/**\n * The Exa provider for the `websearch` flow.\n *\n * {@link layer} binds `WebSearch.WebSearch` to the Exa search API. It reads the\n * API key from a named credential on every search, calls Exa through the\n * permission-checked `HttpClient`, and maps each hit onto `WebSearch.Result`.\n *\n * @since 1.0.0\n */\n\nimport * as Credential from \"@smthrs/control/Credential\"\nimport * as HttpClient from \"@smthrs/kernel/HttpClient\"\nimport { Clock, Effect, Layer, Redacted, Schema } from \"effect\"\nimport * as HttpClientRequest from \"effect/unstable/http/HttpClientRequest\"\nimport { header, readBounded } from \"./internal/Http.ts\"\nimport * as StdError from \"./StdError.ts\"\nimport * as WebSearch from \"./WebSearch.ts\"\n\nconst maxResults = 20\nconst requestTimeoutMs = 30_000\nconst ExaResult = Schema.Struct({\n title: Schema.optional(Schema.String),\n url: Schema.String,\n text: Schema.optional(Schema.String),\n publishedDate: Schema.optional(Schema.String)\n})\nconst ExaResponse = Schema.Struct({\n results: Schema.Array(ExaResult)\n})\nconst freshnessDays = {\n day: 1,\n week: 7,\n month: 31,\n year: 365\n} as const\n\nconst failure = (code: StdError.Code, message: string): StdError.StdError => new StdError.StdError({ code, message })\n\n/**\n * Provides {@link WebSearch.WebSearch} backed by the Exa API, reading its\n * key from the named credential.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layer = (\n credentialId: string\n): Layer.Layer<WebSearch.WebSearch, never, Credential.Credential | HttpClient.HttpClient> =>\n Layer.effect(\n WebSearch.WebSearch,\n Effect.gen(function*() {\n const credentials = yield* Credential.Credential\n const http = yield* HttpClient.HttpClient\n return WebSearch.make({\n search: (input): Effect.Effect<typeof WebSearch.Output.Type, StdError.StdError> =>\n Effect.gen(function*() {\n const reference = yield* credentials.get(credentialId).pipe(Effect.mapError(() =>\n new StdError.StdError({\n code: \"provider_unavailable\",\n message: \"Configured Exa credential is unavailable\"\n })\n ))\n const secret = yield* credentials.resolve(reference).pipe(Effect.mapError(() =>\n new StdError.StdError({\n code: \"provider_unavailable\",\n message: \"Configured Exa credential cannot be resolved\"\n })\n ))\n const now = yield* Clock.currentTimeMillis\n const request = HttpClientRequest.setHeaders(\n HttpClientRequest.bodyJsonUnsafe(HttpClientRequest.post(\"https://api.exa.ai/search\"), {\n query: input.query,\n numResults: Math.min(input.numResults ?? 8, maxResults),\n ...(input.freshness === undefined\n ? {}\n : { startPublishedDate: new Date(now - freshnessDays[input.freshness] * 86_400_000).toISOString() })\n }),\n { \"authorization\": `Bearer ${Redacted.value(secret)}`, \"content-type\": \"application/json\" }\n )\n const response = yield* http.execute(request).pipe(\n Effect.timeout(requestTimeoutMs),\n Effect.mapError((error) =>\n error._tag === \"TimeoutError\"\n ? failure(\"timeout\", \"Exa search request timed out\")\n : failure(\"request_failed\", \"Exa search request failed\")\n )\n )\n const retryAfter = header(response.headers, \"retry-after\")\n // Successful responses may carry pacing advice too; status decides refusal.\n const refused = response.status < 200 || response.status >= 300\n if (response.status === 429 || (refused && retryAfter !== undefined)) {\n const delay = retryAfter === undefined\n ? NaN\n : /^\\d+$/.test(retryAfter.trim())\n ? Number(retryAfter)\n : Math.max(0, Math.ceil((Date.parse(retryAfter) - (yield* Clock.currentTimeMillis)) / 1_000))\n return yield* Effect.fail(\n failure(\n \"rate_limited\",\n Number.isFinite(delay)\n ? `Exa search was throttled; retry after ${delay} seconds`\n : \"Exa search was throttled\"\n )\n )\n }\n if (response.status === 401 || response.status === 403) {\n return yield* Effect.fail(failure(\"provider_unavailable\", \"Exa search authentication was rejected\"))\n }\n if (response.status >= 500) {\n return yield* Effect.fail(failure(\"provider_unavailable\", `Exa search returned ${response.status}`))\n }\n if (response.status < 200 || response.status >= 300) {\n return yield* Effect.fail(failure(\"request_failed\", `Exa search returned ${response.status}`))\n }\n // Bound the body before decoding: an endpoint must not choose how\n // much of it the host buffers.\n const bytes = yield* readBounded(response.stream, \"https://api.exa.ai/search\").pipe(\n Effect.timeout(requestTimeoutMs),\n Effect.mapError((error) =>\n error._tag === \"TimeoutError\"\n ? failure(\"timeout\", \"Exa search response timed out\")\n : error instanceof StdError.StdError && error.code === \"response_too_large\"\n ? failure(\"response_too_large\", \"Exa search response exceeds the 5 MiB limit\")\n : failure(\"request_failed\", \"Exa search response was invalid\")\n )\n )\n const body = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(ExaResponse))(\n new TextDecoder().decode(bytes)\n ).pipe(\n Effect.mapError(() =>\n new StdError.StdError({ code: \"request_failed\", message: \"Exa search response was invalid\" })\n )\n )\n return {\n results: body.results.slice(0, Math.min(input.numResults ?? 8, maxResults)).map((result) => ({\n title: result.title ?? result.url,\n url: result.url,\n snippet: (result.text ?? \"\").slice(0, 2_000),\n ...(result.publishedDate === undefined ? {} : { publishedAt: result.publishedDate })\n }))\n }\n })\n })\n })\n )\n"],
4
+ "sourcesContent": ["/**\n * The Exa provider for the `websearch` flow.\n *\n * {@link layer} binds `WebSearch.WebSearch` to the Exa search API. It reads the\n * API key from a named credential on every search, calls Exa through the\n * permission-checked `HttpClient`, and maps each hit onto `WebSearch.Result`.\n *\n * @since 1.0.0\n */\n\nimport * as Credential from \"@smthrs/control/Credential\"\nimport * as HttpClient from \"@smthrs/kernel/HttpClient\"\nimport { Clock, Effect, Layer, Redacted, Schema } from \"effect\"\nimport * as HttpClientRequest from \"effect/http/HttpClientRequest\"\nimport { header, readBounded } from \"./internal/Http.ts\"\nimport * as StdError from \"./StdError.ts\"\nimport * as WebSearch from \"./WebSearch.ts\"\n\nconst maxResults = 20\nconst requestTimeoutMs = 30_000\nconst ExaResult = Schema.Struct({\n title: Schema.optional(Schema.String),\n url: Schema.String,\n text: Schema.optional(Schema.String),\n publishedDate: Schema.optional(Schema.String)\n})\nconst ExaResponse = Schema.Struct({\n results: Schema.Array(ExaResult)\n})\nconst freshnessDays = {\n day: 1,\n week: 7,\n month: 31,\n year: 365\n} as const\n\nconst failure = (code: StdError.Code, message: string): StdError.StdError => new StdError.StdError({ code, message })\n\n/**\n * Provides {@link WebSearch.WebSearch} backed by the Exa API, reading its\n * key from the named credential.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layer = (\n credentialId: string\n): Layer.Layer<WebSearch.WebSearch, never, Credential.Credential | HttpClient.HttpClient> =>\n Layer.effect(\n WebSearch.WebSearch,\n Effect.gen(function*() {\n const credentials = yield* Credential.Credential\n const http = yield* HttpClient.HttpClient\n return WebSearch.make({\n search: (input): Effect.Effect<typeof WebSearch.Output.Type, StdError.StdError> =>\n Effect.gen(function*() {\n const reference = yield* credentials.get(credentialId).pipe(Effect.mapError(() =>\n new StdError.StdError({\n code: \"provider_unavailable\",\n message: \"Configured Exa credential is unavailable\"\n })\n ))\n const secret = yield* credentials.resolve(reference).pipe(Effect.mapError(() =>\n new StdError.StdError({\n code: \"provider_unavailable\",\n message: \"Configured Exa credential cannot be resolved\"\n })\n ))\n const now = yield* Clock.currentTimeMillis\n const request = HttpClientRequest.setHeaders(\n HttpClientRequest.bodyJsonUnsafe(HttpClientRequest.post(\"https://api.exa.ai/search\"), {\n query: input.query,\n numResults: Math.min(input.numResults ?? 8, maxResults),\n ...(input.freshness === undefined\n ? {}\n : { startPublishedDate: new Date(now - freshnessDays[input.freshness] * 86_400_000).toISOString() })\n }),\n { \"authorization\": `Bearer ${Redacted.value(secret)}`, \"content-type\": \"application/json\" }\n )\n const response = yield* http.execute(request).pipe(\n Effect.timeout(requestTimeoutMs),\n Effect.mapError((error) =>\n error._tag === \"TimeoutError\"\n ? failure(\"timeout\", \"Exa search request timed out\")\n : failure(\"request_failed\", \"Exa search request failed\")\n )\n )\n const retryAfter = header(response.headers, \"retry-after\")\n // Successful responses may carry pacing advice too; status decides refusal.\n const refused = response.status < 200 || response.status >= 300\n if (response.status === 429 || (refused && retryAfter !== undefined)) {\n const delay = retryAfter === undefined\n ? NaN\n : /^\\d+$/.test(retryAfter.trim())\n ? Number(retryAfter)\n : Math.max(0, Math.ceil((Date.parse(retryAfter) - (yield* Clock.currentTimeMillis)) / 1_000))\n return yield* Effect.fail(\n failure(\n \"rate_limited\",\n Number.isFinite(delay)\n ? `Exa search was throttled; retry after ${delay} seconds`\n : \"Exa search was throttled\"\n )\n )\n }\n if (response.status === 401 || response.status === 403) {\n return yield* Effect.fail(failure(\"provider_unavailable\", \"Exa search authentication was rejected\"))\n }\n if (response.status >= 500) {\n return yield* Effect.fail(failure(\"provider_unavailable\", `Exa search returned ${response.status}`))\n }\n if (response.status < 200 || response.status >= 300) {\n return yield* Effect.fail(failure(\"request_failed\", `Exa search returned ${response.status}`))\n }\n // Bound the body before decoding: an endpoint must not choose how\n // much of it the host buffers.\n const bytes = yield* readBounded(response.stream, \"https://api.exa.ai/search\").pipe(\n Effect.timeout(requestTimeoutMs),\n Effect.mapError((error) =>\n error._tag === \"TimeoutError\"\n ? failure(\"timeout\", \"Exa search response timed out\")\n : error instanceof StdError.StdError && error.code === \"response_too_large\"\n ? failure(\"response_too_large\", \"Exa search response exceeds the 5 MiB limit\")\n : failure(\"request_failed\", \"Exa search response was invalid\")\n )\n )\n const body = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(ExaResponse))(\n new TextDecoder().decode(bytes)\n ).pipe(\n Effect.mapError(() =>\n new StdError.StdError({ code: \"request_failed\", message: \"Exa search response was invalid\" })\n )\n )\n return {\n results: body.results.slice(0, Math.min(input.numResults ?? 8, maxResults)).map((result) => ({\n title: result.title ?? result.url,\n url: result.url,\n snippet: (result.text ?? \"\").slice(0, 2_000),\n ...(result.publishedDate === undefined ? {} : { publishedAt: result.publishedDate })\n }))\n }\n })\n })\n })\n )\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,iBAA4B;AAC5B,iBAA4B;AAC5B,oBAAuD;AACvD,wBAAmC;AACnC,kBAAoC;AACpC,eAA0B;AAC1B,gBAA2B;AAE3B,MAAM,aAAa;AACnB,MAAM,mBAAmB;AACzB,MAAM,YAAY,qBAAO,OAAO;AAAA,EAC9B,OAAO,qBAAO,SAAS,qBAAO,MAAM;AAAA,EACpC,KAAK,qBAAO;AAAA,EACZ,MAAM,qBAAO,SAAS,qBAAO,MAAM;AAAA,EACnC,eAAe,qBAAO,SAAS,qBAAO,MAAM;AAC9C,CAAC;AACD,MAAM,cAAc,qBAAO,OAAO;AAAA,EAChC,SAAS,qBAAO,MAAM,SAAS;AACjC,CAAC;AACD,MAAM,gBAAgB;AAAA,EACpB,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AACR;AAEA,MAAM,UAAU,CAAC,MAAqB,YAAuC,IAAI,SAAS,SAAS,EAAE,MAAM,QAAQ,CAAC;AAS7G,MAAM,QAAQ,CACnB,iBAEA,oBAAM;AAAA,EACJ,UAAU;AAAA,EACV,qBAAO,IAAI,aAAY;AACrB,UAAM,cAAc,OAAO,WAAW;AACtC,UAAM,OAAO,OAAO,WAAW;AAC/B,WAAO,UAAU,KAAK;AAAA,MACpB,QAAQ,CAAC,UACP,qBAAO,IAAI,aAAY;AACrB,cAAM,YAAY,OAAO,YAAY,IAAI,YAAY,E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F,OAAO,OAAO,SAAS,OAAO;AAAA,YAC9B,KAAK,OAAO;AAAA,YACZ,UAAU,OAAO,QAAQ,IAAI,MAAM,GAAG,GAAK;AAAA,YAC3C,GAAI,OAAO,kBAAkB,SAAY,CAAC,IAAI,EAAE,aAAa,OAAO,cAAc;AAAA,UACpF,EAAE;AAAA,QACJ;AAAA,MACF,CAAC;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -126,5 +126,5 @@ export declare const run: (input: {
126
126
  readonly body: string;
127
127
  readonly truncated: boolean;
128
128
  readonly notice?: string | undefined;
129
- }, import("./StdError.ts").StdError, import("@smthrs/kernel/GrantStore").GrantStore | import("@smthrs/kernel/HttpClient").HttpClient>;
129
+ }, import("./StdError.ts").StdError, import("@smthrs/kernel/GrantStore").GrantStore | import("effect/http/HttpClient").HttpClient>;
130
130
  //# sourceMappingURL=Fetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Fetch.d.ts","sourceRoot":"","sources":["../../src/Fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAKvC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,UAAU,CAAA;AAE3B;;;;;GAKG;AACH,eAAO,MAAM,WAAW,kIACyG,CAAA;AAEjI;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;;EAQhB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;;EAAW,CAAA;AAE9B;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AAEvC;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,4CAAwE,CAAA;AAE5F;;;;;;;;GAQG;AACH,eAAO,MA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
  module.exports = __toCommonJS(Fetch_exports);
42
42
  var Effect = __toESM(require("effect/Effect"), 1);
43
+ var HttpClientRequest = __toESM(require("effect/http/HttpClientRequest"), 1);
43
44
  var Schema = __toESM(require("effect/Schema"), 1);
44
- var HttpClientRequest = __toESM(require("effect/unstable/http/HttpClientRequest"), 1);
45
45
  var import_Declaration = require("./internal/Declaration.js");
46
46
  var import_Http = require("./internal/Http.js");
47
47
  const name = "fetch";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Fetch.ts"],
4
- "sourcesContent": ["/**\n * HTTP GET flow declaration and portable handler.\n *\n * @since 1.0.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as Schema from \"effect/Schema\"\nimport * as HttpClientRequest from \"effect/unstable/http/HttpClientRequest\"\nimport { capability, envelope } from \"./internal/Declaration.ts\"\nimport { execute, Response, Timeout } from \"./internal/Http.ts\"\n\n/**\n * Registry name for the fetch flow.\n *\n * @category identifiers\n * @since 1.0.0\n */\nexport const name = \"fetch\"\n\n/**\n * Model-facing description of the fetch flow.\n *\n * @category descriptions\n * @since 1.0.0\n */\nexport const description =\n \"Get an absolute URL and return its status and text body; long bodies are truncated with a notice. Use http-post to send data.\"\n\n/**\n * Input schema for the fetch flow.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Input = Schema.Struct({\n url: Schema.String.annotate({ description: \"Absolute http or https URL to retrieve\" }),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)).annotate({\n description: \"Additional request headers\"\n }),\n timeout: Schema.optional(Timeout).annotate({\n description: \"Total request and response body timeout in seconds; defaults to 30, capped at 120\"\n })\n})\n\n/**\n * Decoded input accepted by the `fetch` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Input = typeof Input.Type\n\n/**\n * Output schema for the fetch flow.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Output = Response\n\n/**\n * Decoded output returned by the `fetch` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Output = typeof Output.Type\n\n/**\n * Static effect envelope for the fetch flow.\n *\n * A retrieval leaves no durable state behind, so it is sealed even though it\n * leaves the machine.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effects = envelope({ tier: \"sealed\", mode: \"expected\", reads: [], writes: [] })\n\n/**\n * Narrows the fetch effect envelope for one decoded input.\n *\n * Network reach is expressed as a capability rather than a path envelope, so\n * a retrieval has nothing left to narrow.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effectsFor = (_input: typeof Input.Type) => effects\n\n/**\n * Capabilities required by the fetch flow.\n *\n * @category capabilities\n * @since 1.0.0\n */\nexport const capabilities = [capability(\"net:get\", \"*\")]\n\n/**\n * Declaration-only fetch flow.\n *\n * @category flows\n * @since 1.0.0\n */\nexport const flow = { name, description, input: Input, output: Output, capabilities, effects } as const\n\n/**\n * Retrieves a URL through the permission-aware kernel HTTP client.\n *\n * Error statuses are ordinary results; only transport, permission, and body\n * decoding failures use the typed error channel.\n *\n * @category handlers\n * @since 1.0.0\n */\nexport const run = Effect.fn(\"Fetch.run\")((input: Input) => execute(input, HttpClientRequest.get))\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,aAAwB;AACxB,aAAwB;AACxB,wBAAmC;AACnC,yBAAqC;AACrC,kBAA2C;AAQpC,MAAM,OAAO;AAQb,MAAM,cACX;AAQK,MAAM,QAAQ,OAAO,OAAO;AAAA,EACjC,KAAK,OAAO,OAAO,SAAS,EAAE,aAAa,yCAAyC,CAAC;AAAA,EACrF,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC,EAAE,SAAS;AAAA,IAC7E,aAAa;AAAA,EACf,CAAC;AAAA,EACD,SAAS,OAAO,SAAS,mBAAO,EAAE,SAAS;AAAA,IACzC,aAAa;AAAA,EACf,CAAC;AACH,CAAC;AAgBM,MAAM,SAAS;AAmBf,MAAM,cAAU,6BAAS,EAAE,MAAM,UAAU,MAAM,YAAY,OAAO,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;AAWpF,MAAM,aAAa,CAAC,WAA8B;AAQlD,MAAM,eAAe,KAAC,+BAAW,WAAW,GAAG,CAAC;AAQhD,MAAM,OAAO,EAAE,MAAM,aAAa,OAAO,OAAO,QAAQ,QAAQ,cAAc,QAAQ;AAWtF,MAAM,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC,cAAiB,qBAAQ,OAAO,kBAAkB,GAAG,CAAC;",
4
+ "sourcesContent": ["/**\n * HTTP GET flow declaration and portable handler.\n *\n * @since 1.0.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as HttpClientRequest from \"effect/http/HttpClientRequest\"\nimport * as Schema from \"effect/Schema\"\nimport { capability, envelope } from \"./internal/Declaration.ts\"\nimport { execute, Response, Timeout } from \"./internal/Http.ts\"\n\n/**\n * Registry name for the fetch flow.\n *\n * @category identifiers\n * @since 1.0.0\n */\nexport const name = \"fetch\"\n\n/**\n * Model-facing description of the fetch flow.\n *\n * @category descriptions\n * @since 1.0.0\n */\nexport const description =\n \"Get an absolute URL and return its status and text body; long bodies are truncated with a notice. Use http-post to send data.\"\n\n/**\n * Input schema for the fetch flow.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Input = Schema.Struct({\n url: Schema.String.annotate({ description: \"Absolute http or https URL to retrieve\" }),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)).annotate({\n description: \"Additional request headers\"\n }),\n timeout: Schema.optional(Timeout).annotate({\n description: \"Total request and response body timeout in seconds; defaults to 30, capped at 120\"\n })\n})\n\n/**\n * Decoded input accepted by the `fetch` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Input = typeof Input.Type\n\n/**\n * Output schema for the fetch flow.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Output = Response\n\n/**\n * Decoded output returned by the `fetch` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Output = typeof Output.Type\n\n/**\n * Static effect envelope for the fetch flow.\n *\n * A retrieval leaves no durable state behind, so it is sealed even though it\n * leaves the machine.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effects = envelope({ tier: \"sealed\", mode: \"expected\", reads: [], writes: [] })\n\n/**\n * Narrows the fetch effect envelope for one decoded input.\n *\n * Network reach is expressed as a capability rather than a path envelope, so\n * a retrieval has nothing left to narrow.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effectsFor = (_input: typeof Input.Type) => effects\n\n/**\n * Capabilities required by the fetch flow.\n *\n * @category capabilities\n * @since 1.0.0\n */\nexport const capabilities = [capability(\"net:get\", \"*\")]\n\n/**\n * Declaration-only fetch flow.\n *\n * @category flows\n * @since 1.0.0\n */\nexport const flow = { name, description, input: Input, output: Output, capabilities, effects } as const\n\n/**\n * Retrieves a URL through the permission-aware kernel HTTP client.\n *\n * Error statuses are ordinary results; only transport, permission, and body\n * decoding failures use the typed error channel.\n *\n * @category handlers\n * @since 1.0.0\n */\nexport const run = Effect.fn(\"Fetch.run\")((input: Input) => execute(input, HttpClientRequest.get))\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,aAAwB;AACxB,wBAAmC;AACnC,aAAwB;AACxB,yBAAqC;AACrC,kBAA2C;AAQpC,MAAM,OAAO;AAQb,MAAM,cACX;AAQK,MAAM,QAAQ,OAAO,OAAO;AAAA,EACjC,KAAK,OAAO,OAAO,SAAS,EAAE,aAAa,yCAAyC,CAAC;AAAA,EACrF,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC,EAAE,SAAS;AAAA,IAC7E,aAAa;AAAA,EACf,CAAC;AAAA,EACD,SAAS,OAAO,SAAS,mBAAO,EAAE,SAAS;AAAA,IACzC,aAAa;AAAA,EACf,CAAC;AACH,CAAC;AAgBM,MAAM,SAAS;AAmBf,MAAM,cAAU,6BAAS,EAAE,MAAM,UAAU,MAAM,YAAY,OAAO,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;AAWpF,MAAM,aAAa,CAAC,WAA8B;AAQlD,MAAM,eAAe,KAAC,+BAAW,WAAW,GAAG,CAAC;AAQhD,MAAM,OAAO,EAAE,MAAM,aAAa,OAAO,OAAO,QAAQ,QAAQ,cAAc,QAAQ;AAWtF,MAAM,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC,cAAiB,qBAAQ,OAAO,kBAAkB,GAAG,CAAC;",
6
6
  "names": []
7
7
  }
@@ -126,5 +126,5 @@ export declare const run: (input: {
126
126
  readonly body: string;
127
127
  readonly truncated: boolean;
128
128
  readonly notice?: string | undefined;
129
- }, import("./StdError.ts").StdError, import("@smthrs/kernel/GrantStore").GrantStore | import("@smthrs/kernel/HttpClient").HttpClient>;
129
+ }, import("./StdError.ts").StdError, import("@smthrs/kernel/GrantStore").GrantStore | import("effect/http/HttpClient").HttpClient>;
130
130
  //# sourceMappingURL=HttpPost.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HttpPost.d.ts","sourceRoot":"","sources":["../../src/HttpPost.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAKvC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,cAAc,CAAA;AAE/B;;;;;GAKG;AACH,eAAO,MAAM,WAAW,sIAC6G,CAAA;AAErI;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;;;;EAYhB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;;EAAW,CAAA;AAE9B;;;;;GAKG;AACH,MAAM,MAA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;;;;GAKG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;kIAKf,CAAA"}
@@ -40,8 +40,8 @@ __export(HttpPost_exports, {
40
40
  });
41
41
  module.exports = __toCommonJS(HttpPost_exports);
42
42
  var Effect = __toESM(require("effect/Effect"), 1);
43
+ var HttpClientRequest = __toESM(require("effect/http/HttpClientRequest"), 1);
43
44
  var Schema = __toESM(require("effect/Schema"), 1);
44
- var HttpClientRequest = __toESM(require("effect/unstable/http/HttpClientRequest"), 1);
45
45
  var import_Declaration = require("./internal/Declaration.js");
46
46
  var import_Http = require("./internal/Http.js");
47
47
  const name = "http-post";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/HttpPost.ts"],
4
- "sourcesContent": ["/**\n * HTTP POST flow declaration and portable handler.\n *\n * @since 1.0.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as Schema from \"effect/Schema\"\nimport * as HttpClientRequest from \"effect/unstable/http/HttpClientRequest\"\nimport { capability, envelope } from \"./internal/Declaration.ts\"\nimport { execute, Response, Timeout } from \"./internal/Http.ts\"\n\n/**\n * Registry name for the http-post flow.\n *\n * @category identifiers\n * @since 1.0.0\n */\nexport const name = \"http-post\"\n\n/**\n * Model-facing description of the http-post flow.\n *\n * @category descriptions\n * @since 1.0.0\n */\nexport const description =\n \"Post a text body to an absolute URL and return the response; this is irreversible because the remote side may already have acted.\"\n\n/**\n * Input schema for the http-post flow.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Input = Schema.Struct({\n url: Schema.String.annotate({ description: \"Absolute http or https URL to post to\" }),\n body: Schema.String.annotate({ description: \"Request body sent verbatim\" }),\n contentType: Schema.optional(Schema.String).annotate({\n description: \"Request content type; defaults to application/json\"\n }),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)).annotate({\n description: \"Additional request headers\"\n }),\n timeout: Schema.optional(Timeout).annotate({\n description: \"Total request and response body timeout in seconds; defaults to 30, capped at 120\"\n })\n})\n\n/**\n * Decoded input accepted by the `http-post` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Input = typeof Input.Type\n\n/**\n * Output schema for the http-post flow.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Output = Response\n\n/**\n * Decoded output returned by the `http-post` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Output = typeof Output.Type\n\n/**\n * Static effect envelope for the http-post flow.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effects = envelope({ tier: \"irreversible\", mode: \"expected\", reads: [], writes: [] })\n\n/**\n * Narrows the http-post effect envelope for one decoded input.\n *\n * Network reach is expressed as a capability rather than a path envelope, so\n * a post has nothing left to narrow.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effectsFor = (_input: typeof Input.Type) => effects\n\n/**\n * Capabilities required by the http-post flow.\n *\n * @category capabilities\n * @since 1.0.0\n */\nexport const capabilities = [capability(\"net:post\", \"*\")]\n\n/**\n * Declaration-only http-post flow.\n *\n * @category flows\n * @since 1.0.0\n */\nexport const flow = { name, description, input: Input, output: Output, capabilities, effects } as const\n\n/**\n * Posts a body through the permission-aware kernel HTTP client.\n *\n * @category handlers\n * @since 1.0.0\n */\nexport const run = Effect.fn(\"HttpPost.run\")((input: Input) =>\n execute(input, (url) =>\n HttpClientRequest.post(url).pipe(\n HttpClientRequest.bodyText(input.body, input.contentType ?? \"application/json\")\n ))\n)\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,aAAwB;AACxB,aAAwB;AACxB,wBAAmC;AACnC,yBAAqC;AACrC,kBAA2C;AAQpC,MAAM,OAAO;AAQb,MAAM,cACX;AAQK,MAAM,QAAQ,OAAO,OAAO;AAAA,EACjC,KAAK,OAAO,OAAO,SAAS,EAAE,aAAa,wCAAwC,CAAC;AAAA,EACpF,MAAM,OAAO,OAAO,SAAS,EAAE,aAAa,6BAA6B,CAAC;AAAA,EAC1E,aAAa,OAAO,SAAS,OAAO,MAAM,EAAE,SAAS;AAAA,IACnD,aAAa;AAAA,EACf,CAAC;AAAA,EACD,SAAS,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAAC,EAAE,SAAS;AAAA,IAC7E,aAAa;AAAA,EACf,CAAC;AAAA,EACD,SAAS,OAAO,SAAS,mBAAO,EAAE,SAAS;AAAA,IACzC,aAAa;AAAA,EACf,CAAC;AACH,CAAC;AAgBM,MAAM,SAAS;AAgBf,MAAM,cAAU,6BAAS,EAAE,MAAM,gBAAgB,MAAM,YAAY,OAAO,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;AAW1F,MAAM,aAAa,CAAC,WAA8B;AAQlD,MAAM,eAAe,KAAC,+BAAW,YAAY,GAAG,CAAC;AAQjD,MAAM,OAAO,EAAE,MAAM,aAAa,OAAO,OAAO,QAAQ,QAAQ,cAAc,QAAQ;AAQtF,MAAM,MAAM,OAAO,GAAG,cAAc;AAAA,EAAE,CAAC,cAC5C,qBAAQ,OAAO,CAAC,QACd,kBAAkB,KAAK,GAAG,EAAE;AAAA,IAC1B,kBAAkB,SAAS,MAAM,MAAM,MAAM,eAAe,kBAAkB;AAAA,EAChF,CAAC;AACL;",
4
+ "sourcesContent": ["/**\n * HTTP POST flow declaration and portable handler.\n *\n * @since 1.0.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as HttpClientRequest from \"effect/http/HttpClientRequest\"\nimport * as Schema from \"effect/Schema\"\nimport { capability, envelope } from \"./internal/Declaration.ts\"\nimport { execute, Response, Timeout } from \"./internal/Http.ts\"\n\n/**\n * Registry name for the http-post flow.\n *\n * @category identifiers\n * @since 1.0.0\n */\nexport const name = \"http-post\"\n\n/**\n * Model-facing description of the http-post flow.\n *\n * @category descriptions\n * @since 1.0.0\n */\nexport const description =\n \"Post a text body to an absolute URL and return the response; this is irreversible because the remote side may already have acted.\"\n\n/**\n * Input schema for the http-post flow.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Input = Schema.Struct({\n url: Schema.String.annotate({ description: \"Absolute http or https URL to post to\" }),\n body: Schema.String.annotate({ description: \"Request body sent verbatim\" }),\n contentType: Schema.optional(Schema.String).annotate({\n description: \"Request content type; defaults to application/json\"\n }),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)).annotate({\n description: \"Additional request headers\"\n }),\n timeout: Schema.optional(Timeout).annotate({\n description: \"Total request and response body timeout in seconds; defaults to 30, capped at 120\"\n })\n})\n\n/**\n * Decoded input accepted by the `http-post` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Input = typeof Input.Type\n\n/**\n * Output schema for the http-post flow.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Output = Response\n\n/**\n * Decoded output returned by the `http-post` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Output = typeof Output.Type\n\n/**\n * Static effect envelope for the http-post flow.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effects = envelope({ tier: \"irreversible\", mode: \"expected\", reads: [], writes: [] })\n\n/**\n * Narrows the http-post effect envelope for one decoded input.\n *\n * Network reach is expressed as a capability rather than a path envelope, so\n * a post has nothing left to narrow.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effectsFor = (_input: typeof Input.Type) => effects\n\n/**\n * Capabilities required by the http-post flow.\n *\n * @category capabilities\n * @since 1.0.0\n */\nexport const capabilities = [capability(\"net:post\", \"*\")]\n\n/**\n * Declaration-only http-post flow.\n *\n * @category flows\n * @since 1.0.0\n */\nexport const flow = { name, description, input: Input, output: Output, capabilities, effects } as const\n\n/**\n * Posts a body through the permission-aware kernel HTTP client.\n *\n * @category handlers\n * @since 1.0.0\n */\nexport const run = Effect.fn(\"HttpPost.run\")((input: Input) =>\n execute(input, (url) =>\n HttpClientRequest.post(url).pipe(\n HttpClientRequest.bodyText(input.body, input.contentType ?? \"application/json\")\n ))\n)\n"],
5
+ "mappings": ";;;;;;;;;;;;;;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 1.0.0
115
115
  */
116
116
  export declare const run: (input: {
117
- readonly operation: "hover" | "definition" | "references" | "implementation" | "documentSymbols" | "workspaceSymbols" | "prepareCallHierarchy" | "callHierarchyIncoming" | "callHierarchyOutgoing" | "diagnostics";
117
+ readonly operation: "references" | "hover" | "definition" | "implementation" | "documentSymbols" | "workspaceSymbols" | "prepareCallHierarchy" | "callHierarchyIncoming" | "callHierarchyOutgoing" | "diagnostics";
118
118
  readonly path?: string | undefined;
119
119
  readonly line?: number | undefined;
120
120
  readonly character?: number | undefined;
@@ -669,7 +669,7 @@ export declare const handlers: Readonly<{
669
669
  readonly message: string;
670
670
  } | undefined;
671
671
  readonly mutated?: boolean | undefined;
672
- }, import("./StdError.ts").StdError, import("@smthrs/kernel/ChildProcessSpawner").ChildProcessSpawner | import("effect/Path").Path>;
672
+ }, import("./StdError.ts").StdError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("effect/Path").Path>;
673
673
  test: (input: {
674
674
  readonly timeoutMs?: number | undefined;
675
675
  readonly selection?: readonly string[] | undefined;
@@ -708,7 +708,7 @@ export declare const handlers: Readonly<{
708
708
  } | undefined;
709
709
  readonly introduced?: readonly string[] | undefined;
710
710
  readonly preexisting?: readonly string[] | undefined;
711
- }, import("./StdError.ts").StdError, import("@smthrs/kernel/ChildProcessSpawner").ChildProcessSpawner | import("@smthrs/model/Evaluator").Evaluator | import("./TestRunner.ts").TestRunner>;
711
+ }, import("./StdError.ts").StdError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("@smthrs/model/Evaluator").Evaluator | import("./TestRunner.ts").TestRunner>;
712
712
  shell_command: (input: {
713
713
  readonly command: string;
714
714
  readonly workdir?: string | undefined;
@@ -716,7 +716,7 @@ export declare const handlers: Readonly<{
716
716
  }) => import("effect/Effect").Effect<{
717
717
  readonly output: string;
718
718
  readonly exitCode: number;
719
- }, import("./StdError.ts").StdError, import("@smthrs/kernel/ChildProcessSpawner").ChildProcessSpawner>;
719
+ }, import("./StdError.ts").StdError, import("effect/process/ChildProcessSpawner").ChildProcessSpawner>;
720
720
  apply_patch: (input: {
721
721
  readonly input: string;
722
722
  }) => import("effect/Effect").Effect<{
@@ -745,7 +745,7 @@ export declare const handlers: Readonly<{
745
745
  readonly body: string;
746
746
  readonly truncated: boolean;
747
747
  readonly notice?: string | undefined;
748
- }, import("./StdError.ts").StdError, import("@smthrs/kernel/GrantStore").GrantStore | import("@smthrs/kernel/HttpClient").HttpClient>;
748
+ }, import("./StdError.ts").StdError, import("@smthrs/kernel/GrantStore").GrantStore | import("effect/http/HttpClient").HttpClient>;
749
749
  "http-post": (input: {
750
750
  readonly body: string;
751
751
  readonly url: string;
@@ -759,7 +759,7 @@ export declare const handlers: Readonly<{
759
759
  readonly body: string;
760
760
  readonly truncated: boolean;
761
761
  readonly notice?: string | undefined;
762
- }, import("./StdError.ts").StdError, import("@smthrs/kernel/GrantStore").GrantStore | import("@smthrs/kernel/HttpClient").HttpClient>;
762
+ }, import("./StdError.ts").StdError, import("@smthrs/kernel/GrantStore").GrantStore | import("effect/http/HttpClient").HttpClient>;
763
763
  webfetch: (input: {
764
764
  readonly url: string;
765
765
  readonly timeout?: number | undefined;
@@ -771,7 +771,7 @@ export declare const handlers: Readonly<{
771
771
  readonly url: string;
772
772
  readonly truncated: boolean;
773
773
  readonly notice?: string | undefined;
774
- }, import("./StdError.ts").StdError, import("@smthrs/kernel/GrantStore").GrantStore | import("@smthrs/kernel/HttpClient").HttpClient>;
774
+ }, import("./StdError.ts").StdError, import("@smthrs/kernel/GrantStore").GrantStore | import("effect/http/HttpClient").HttpClient>;
775
775
  websearch: (input: {
776
776
  readonly query: string;
777
777
  readonly numResults?: number | undefined;
@@ -785,7 +785,7 @@ export declare const handlers: Readonly<{
785
785
  }[];
786
786
  }, import("./StdError.ts").StdError, WebSearch.WebSearch>;
787
787
  lsp: (input: {
788
- readonly operation: "hover" | "definition" | "references" | "implementation" | "documentSymbols" | "workspaceSymbols" | "prepareCallHierarchy" | "callHierarchyIncoming" | "callHierarchyOutgoing" | "diagnostics";
788
+ readonly operation: "references" | "hover" | "definition" | "implementation" | "documentSymbols" | "workspaceSymbols" | "prepareCallHierarchy" | "callHierarchyIncoming" | "callHierarchyOutgoing" | "diagnostics";
789
789
  readonly path?: string | undefined;
790
790
  readonly line?: number | undefined;
791
791
  readonly character?: number | undefined;
@@ -888,7 +888,7 @@ export declare const effectsFor: Readonly<{
888
888
  readonly freshness?: "day" | "week" | "month" | "year" | undefined;
889
889
  }) => import("@smthrs/plan/Effects").Declaration;
890
890
  lsp: (_input: {
891
- readonly operation: "hover" | "definition" | "references" | "implementation" | "documentSymbols" | "workspaceSymbols" | "prepareCallHierarchy" | "callHierarchyIncoming" | "callHierarchyOutgoing" | "diagnostics";
891
+ readonly operation: "references" | "hover" | "definition" | "implementation" | "documentSymbols" | "workspaceSymbols" | "prepareCallHierarchy" | "callHierarchyIncoming" | "callHierarchyOutgoing" | "diagnostics";
892
892
  readonly path?: string | undefined;
893
893
  readonly line?: number | undefined;
894
894
  readonly character?: number | undefined;
@@ -39,7 +39,7 @@ module.exports = __toCommonJS(NodeLanguageServer_exports);
39
39
  var ChildProcessEnvironment = __toESM(require("@smthrs/kernel/ChildProcessEnvironment"), 1);
40
40
  var ChildProcessSpawner = __toESM(require("@smthrs/kernel/ChildProcessSpawner"), 1);
41
41
  var import_effect = require("effect");
42
- var ChildProcess = __toESM(require("effect/unstable/process/ChildProcess"), 1);
42
+ var ChildProcess = __toESM(require("effect/process/ChildProcess"), 1);
43
43
  var import_node_crypto = require("node:crypto");
44
44
  var NodeFs = __toESM(require("node:fs"), 1);
45
45
  var NodePath = __toESM(require("node:path"), 1);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/NodeLanguageServer.ts"],
4
- "sourcesContent": ["/**\n * Host-backed Language Server Protocol client over the permission-checked\n * process spawner.\n *\n * LSP is framed JSON-RPC over ordinary stdio pipes, so the client spawns\n * through `@smthrs/kernel`'s `ChildProcessSpawner`; a terminal is never\n * involved.\n *\n * @since 1.0.0\n */\n\nimport * as ChildProcessEnvironment from \"@smthrs/kernel/ChildProcessEnvironment\"\nimport * as ChildProcessSpawner from \"@smthrs/kernel/ChildProcessSpawner\"\nimport { Clock, Deferred, Effect, Fiber, Layer, Option, Queue, type Scope, Semaphore, Stream } from \"effect\"\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\"\nimport { createHash } from \"node:crypto\"\nimport * as NodeFs from \"node:fs\"\nimport * as NodePath from \"node:path\"\nimport { fileURLToPath, pathToFileURL } from \"node:url\"\nimport * as LanguageServer from \"./LanguageServer.ts\"\nimport * as StdError from \"./StdError.ts\"\n\n/**\n * Maximum frames buffered for a language server's standard input.\n *\n * Bounded offers apply backpressure, and each offer uses the request timeout\n * so a server that stops reading produces a typed timeout instead of an\n * unbounded queue or a new hang.\n *\n * @category constants\n * @since 1.0.0\n */\nexport const MAX_QUEUED_FRAMES = 256\n\n/**\n * Maximum concurrent JSON-RPC requests awaiting a response.\n *\n * Every entry already has a timeout, and process exit or stdout closure fails\n * all entries. This cap is the last-resort bound for a host that fans out\n * requests without limit.\n *\n * @category constants\n * @since 1.0.0\n */\nexport const MAX_PENDING_REQUESTS = 512\n\nconst DEFAULT_SETTLE_MS = 5_000\nconst DEFAULT_QUIET_MS = 300\n\n/**\n * A request every server must refuse at once: the specification has a server\n * answer an unknown `$/` request with MethodNotFound.\n */\nconst BARRIER_METHOD = \"$/smithers/barrier\"\n/** A server that has not answered the barrier in this long is not asked again. */\nconst BARRIER_TIMEOUT_MS = 1_000\n\n/**\n * One host language-server process.\n *\n * Response headers may contain at most 8 KiB, and response bodies may contain\n * at most 8 MiB.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Config {\n /**\n * The file extensions this server answers for, such as `[\".ts\", \".tsx\"]`.\n * A server without `extensions` answers every file no other server claims.\n */\n readonly extensions?: ReadonlyArray<string> | undefined\n readonly command: string\n readonly args?: ReadonlyArray<string> | undefined\n readonly cwd: string\n readonly environment?: Readonly<Record<string, string>> | undefined\n /**\n * Sent as `initializationOptions` on `initialize`. A host pins where the\n * server loads its own code from here, for example\n * `{ tsserver: { path: \"<host copy>/tsserver.js\" } }` for\n * typescript-language-server, which otherwise runs the workspace's own\n * `node_modules/typescript`.\n */\n readonly initializationOptions?: unknown\n readonly timeoutMs?: number | undefined\n /**\n * How long `diagnostics` waits for a server without pull diagnostics to\n * publish for the latest synced text, then fails with `timeout`. Defaults to\n * 5 seconds. typescript-language-server publishes nothing for a change that\n * leaves a file with no problems, so such a change always waits this long.\n */\n readonly settleMs?: number | undefined\n /**\n * After a publish, how long `diagnostics` waits for a later one before\n * answering, within `settleMs`. A server may publish syntax errors before\n * semantic ones: typescript-language-server does on the first open of a\n * file. Defaults to 300 milliseconds.\n */\n readonly quietMs?: number | undefined\n}\n\ninterface JsonRpcMessage {\n readonly id?: unknown\n readonly method?: unknown\n readonly params?: unknown\n readonly result?: unknown\n readonly error?: unknown\n}\n\n/** JSON-RPC's code for a method the server does not implement. */\nconst METHOD_NOT_FOUND = -32601\n\nconst LANGUAGE_IDS: Readonly<Record<string, string>> = {\n \".ts\": \"typescript\",\n \".mts\": \"typescript\",\n \".cts\": \"typescript\",\n \".tsx\": \"typescriptreact\",\n \".js\": \"javascript\",\n \".mjs\": \"javascript\",\n \".cjs\": \"javascript\",\n \".jsx\": \"javascriptreact\",\n \".py\": \"python\",\n \".rs\": \"rust\",\n \".go\": \"go\",\n \".rb\": \"ruby\",\n \".sh\": \"shellscript\",\n \".md\": \"markdown\",\n \".yml\": \"yaml\",\n \".cc\": \"cpp\",\n \".cpp\": \"cpp\",\n \".hpp\": \"cpp\",\n \".cs\": \"csharp\"\n}\n\nconst extensionOf = (path: string): string => NodePath.extname(path).toLowerCase()\n\nconst languageId = (path: string): string => {\n const extension = extensionOf(path)\n return LANGUAGE_IDS[extension] ?? (extension.slice(1) || \"plaintext\")\n}\n\ninterface FrameDecoder {\n readonly push: (chunk: Uint8Array) => ReadonlyArray<FrameEvent>\n}\n\ntype FrameEvent =\n | { readonly _tag: \"Message\"; readonly value: unknown }\n | { readonly _tag: \"Failure\"; readonly error: StdError.StdError; readonly id?: number | undefined }\n\nconst failure = (code: StdError.Code, message: string): StdError.StdError => new StdError.StdError({ code, message })\n\nconst maximumHeaderBytes = 8 * 1024\nconst maximumFrameBytes = 8 * 1024 * 1024\nconst headerEnd = new Uint8Array([13, 10, 13, 10])\nconst contentLengthPrefix = new TextEncoder().encode(\"Content-Length:\")\n\nconst concatenate = (left: Uint8Array, right: Uint8Array): Uint8Array => {\n const combined = new Uint8Array(left.length + right.length)\n combined.set(left)\n combined.set(right, left.length)\n return combined\n}\n\ninterface ChunkBuffer {\n readonly length: number\n readonly push: (chunk: Uint8Array) => void\n readonly indexOf: (needle: Uint8Array) => number\n // Counts come from delimiter offsets or validated Content-Length values.\n // A reader can only be acquired for an available, nonnegative prefix.\n readonly prefix: (length: number) => {\n readonly take: () => Uint8Array\n readonly discard: () => void\n } | undefined\n}\n\nconst makeChunkBuffer = (): ChunkBuffer => {\n let chunks: Array<Uint8Array> = []\n let head = 0\n let headOffset = 0\n let length = 0\n\n const compact = (): void => {\n if (head === chunks.length) {\n chunks = []\n head = 0\n headOffset = 0\n } else if (head >= 64 && head * 2 >= chunks.length) {\n chunks = chunks.slice(head)\n head = 0\n }\n }\n\n const consume = (count: number, output?: Uint8Array): void => {\n let remaining = count\n let outputOffset = 0\n for (const chunk of chunks.slice(head)) {\n if (remaining === 0) break\n const available = chunk.byteLength - headOffset\n const consumed = Math.min(available, remaining)\n if (output !== undefined) {\n output.set(chunk.subarray(headOffset, headOffset + consumed), outputOffset)\n outputOffset += consumed\n }\n headOffset += consumed\n length -= consumed\n remaining -= consumed\n if (headOffset === chunk.byteLength) {\n head++\n headOffset = 0\n }\n }\n compact()\n }\n\n return {\n get length() {\n return length\n },\n push: (chunk) => {\n if (chunk.byteLength === 0) return\n // Own the bytes so caller mutation or resizing cannot change buffered lengths.\n chunks.push(chunk.slice())\n length += chunk.byteLength\n },\n indexOf: (needle) => {\n let absolute = 0\n let matched = 0\n for (let chunkIndex = head; chunkIndex < chunks.length; chunkIndex++) {\n const chunk = chunks[chunkIndex]!\n const start = chunkIndex === head ? headOffset : 0\n for (let index = start; index < chunk.byteLength; index++) {\n const byte = chunk[index]\n if (byte === needle[matched]) matched++\n else matched = byte === needle[0] ? 1 : 0\n if (matched === needle.byteLength) return absolute - needle.byteLength + 1\n absolute++\n }\n }\n return -1\n },\n prefix: (count) => {\n if (count > length) return undefined\n return {\n take: () => {\n const output = new Uint8Array(count)\n consume(count, output)\n return output\n },\n discard: () => consume(count)\n }\n }\n }\n}\n\nconst malformedId = (body: string): number | undefined => {\n const match = /\"id\"\\s*:\\s*(\\d+)/.exec(body)\n if (match === null) return undefined\n const id = Number(match[1])\n return Number.isSafeInteger(id) ? id : undefined\n}\n\nconst makeFrameDecoder = (): FrameDecoder => {\n const pending = makeChunkBuffer()\n let bodyLength: number | undefined\n let resynchronizing = false\n return {\n push: (chunk) => {\n pending.push(chunk)\n const events: Array<FrameEvent> = []\n while (pending.length > 0 || bodyLength === 0) {\n if (resynchronizing) {\n const nextHeader = pending.indexOf(contentLengthPrefix)\n if (nextHeader < 0) {\n pending.prefix(Math.max(0, pending.length - contentLengthPrefix.byteLength + 1))!.discard()\n break\n }\n pending.prefix(nextHeader)!.discard()\n resynchronizing = false\n }\n if (bodyLength !== undefined) {\n const reader = pending.prefix(bodyLength)\n if (reader === undefined) break\n const body = new TextDecoder().decode(reader.take())\n bodyLength = undefined\n try {\n events.push({ _tag: \"Message\", value: JSON.parse(body) as unknown })\n } catch {\n events.push({\n _tag: \"Failure\",\n error: failure(\"request_failed\", \"Language server returned malformed JSON\"),\n id: malformedId(body)\n })\n }\n continue\n }\n const delimiter = pending.indexOf(headerEnd)\n if (delimiter < 0) {\n if (pending.length > maximumHeaderBytes) {\n events.push({\n _tag: \"Failure\",\n error: failure(\n \"request_failed\",\n `Language server frame header exceeded ${maximumHeaderBytes} bytes`\n )\n })\n pending.prefix(1)!.discard()\n resynchronizing = true\n continue\n }\n break\n }\n if (delimiter > maximumHeaderBytes) {\n events.push({\n _tag: \"Failure\",\n error: failure(\"request_failed\", `Language server frame header exceeded ${maximumHeaderBytes} bytes`)\n })\n pending.prefix(delimiter + headerEnd.byteLength)!.discard()\n resynchronizing = true\n continue\n }\n const header = new TextDecoder().decode(pending.prefix(delimiter)!.take())\n pending.prefix(headerEnd.byteLength)!.discard()\n const match = /(?:^|\\r\\n)Content-Length:\\s*(\\d+)(?:\\r\\n|$)/i.exec(header)\n if (match === null) {\n events.push({\n _tag: \"Failure\",\n error: failure(\"request_failed\", \"Language server frame omitted Content-Length\")\n })\n resynchronizing = true\n continue\n }\n const length = Number(match[1])\n if (!Number.isSafeInteger(length) || length < 0 || length > maximumFrameBytes) {\n events.push({\n _tag: \"Failure\",\n error: failure(\"request_failed\", `Language server frame exceeded ${maximumFrameBytes} bytes`)\n })\n resynchronizing = true\n continue\n }\n bodyLength = length\n }\n return events\n }\n }\n}\n\nconst asMessage = (value: unknown): JsonRpcMessage | undefined =>\n typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? value\n : undefined\n\nconst frame = (message: unknown): Uint8Array => {\n const body = new TextEncoder().encode(JSON.stringify(message))\n const header = new TextEncoder().encode(`Content-Length: ${body.byteLength}\\r\\n\\r\\n`)\n return concatenate(header, body)\n}\n\nconst firstCallHierarchyItem = (value: unknown): unknown | undefined => Array.isArray(value) ? value[0] : undefined\n\nconst isFile = (path: string): boolean => {\n try {\n return NodeFs.statSync(path, { throwIfNoEntry: false })?.isFile() === true\n } catch {\n return false\n }\n}\n\n/** Whether anything, a file or a directory, exists at `path`. */\nconst exists = (path: string): boolean => {\n try {\n return NodeFs.statSync(path, { throwIfNoEntry: false }) !== undefined\n } catch {\n return false\n }\n}\n\nconst realPath = (path: string): string => {\n try {\n return NodeFs.realpathSync(path)\n } catch {\n return NodePath.resolve(path)\n }\n}\n\nconst isWithin = (root: string, path: string): boolean => {\n const relative = NodePath.relative(root, path)\n return relative === \"\" || (relative !== \"..\" && !relative.startsWith(`..${NodePath.sep}`) &&\n !NodePath.isAbsolute(relative))\n}\n\n/**\n * Resolves the program a spawn would execute: a command containing a path\n * separator against `cwd`, a bare name through the child's `PATH`, where an\n * empty or relative entry is relative to `cwd`.\n */\nconst resolveCommand = (command: string, cwd: string, path: string | undefined): string | undefined => {\n if (command.includes(\"/\") || command.includes(NodePath.sep)) {\n const candidate = NodePath.resolve(cwd, command)\n return isFile(candidate) ? candidate : undefined\n }\n for (const entry of (path ?? \"\").split(NodePath.delimiter)) {\n const candidate = NodePath.resolve(cwd, entry, command)\n if (!isFile(candidate)) continue\n try {\n NodeFs.accessSync(candidate, NodeFs.constants.X_OK)\n return candidate\n } catch {\n continue\n }\n }\n return undefined\n}\n\n/**\n * Refuses a server whose program or any file-naming argument lies in the\n * workspace. The server runs on the host as the host user, so a program the\n * workspace supplies (its `node_modules/.bin`, a `./` script, a symlink it\n * planted) would let workspace files choose what the host executes.\n */\n/**\n * Programs whose job is to run another program named in their arguments or\n * found in the working directory: shells, `env`, and package runners. Their\n * arguments are code or package names, not files, so the workspace check below\n * cannot see what they would execute (`sh -c node_modules/.bin/x`, `npx x`).\n */\nconst LAUNCHERS = new Set([\n \"sh\",\n \"bash\",\n \"zsh\",\n \"dash\",\n \"ksh\",\n \"fish\",\n \"csh\",\n \"tcsh\",\n \"env\",\n \"npx\",\n \"pnpx\",\n \"npm\",\n \"pnpm\",\n \"yarn\",\n \"bunx\",\n \"deno\",\n \"cmd\",\n \"powershell\",\n \"pwsh\"\n])\n\n/** Interpreter flags that take code or a module to load instead of a file path. */\nconst CODE_FLAGS = new Set([\"-e\", \"--eval\", \"-p\", \"--print\", \"-r\", \"--require\", \"--import\", \"--loader\"])\n\nconst launcher = (config: Config): string | undefined => {\n const name = NodePath.basename(config.command).toLowerCase().replace(/\\.(?:exe|cmd|bat|ps1)$/, \"\")\n if (LAUNCHERS.has(name)) return name\n if (name !== \"node\" && name !== \"bun\" && name !== \"nodejs\") return undefined\n const args = config.args ?? []\n if (name === \"bun\" && [\"x\", \"run\", \"exec\"].includes(args[0] ?? \"\")) return `bun ${args[0]}`\n const flag = args.find((argument) => CODE_FLAGS.has(argument.split(\"=\")[0]!) || argument === \"--experimental-loader\")\n return flag === undefined ? undefined : `${name} ${flag.split(\"=\")[0]}`\n}\n\nconst workspaceProgram = (\n config: Config,\n path: string | undefined\n): StdError.StdError | undefined => {\n const launching = launcher(config)\n if (launching !== undefined) {\n return failure(\n \"permission_denied\",\n `Language server command runs ${launching}, which executes a program its arguments or the workspace choose; name the server's own host binary instead`\n )\n }\n const lexicalRoot = NodePath.resolve(config.cwd)\n const realRoot = realPath(lexicalRoot)\n const inWorkspace = (file: string): boolean =>\n isWithin(lexicalRoot, file) || isWithin(realRoot, file) || isWithin(realRoot, realPath(file)) ||\n isWithin(lexicalRoot, realPath(file))\n const program = resolveCommand(config.command, lexicalRoot, path)\n if (program !== undefined && inWorkspace(program)) {\n return failure(\n \"permission_denied\",\n `Language server program ${program} is inside the workspace ${lexicalRoot}; run a host copy instead`\n )\n }\n for (const argument of config.args ?? []) {\n for (const value of [argument, argument.slice(argument.indexOf(\"=\") + 1)]) {\n if (value === \"\") continue\n const candidate = NodePath.resolve(lexicalRoot, value)\n // A directory counts: `node <dir>` runs `<dir>/index.js` or its package main.\n if (exists(candidate) && inWorkspace(candidate)) {\n return failure(\n \"permission_denied\",\n `Language server argument names ${candidate}, a path inside the workspace ${lexicalRoot}`\n )\n }\n }\n }\n return undefined\n}\n\ninterface PublishedDiagnostics {\n readonly version: number | undefined\n readonly sequence: number\n readonly diagnostics: ReadonlyArray<unknown>\n}\n\ninterface OpenDocument {\n readonly version: number\n /** The publish sequence number when this version was sent. */\n readonly sentAt: number\n /** The SHA-256 of the text last sent, so `refresh` resends only changed files. */\n readonly digest: string\n}\n\nconst digestOf = (text: string): string => createHash(\"sha256\").update(text).digest(\"hex\")\n\nconst makeClient = (\n config: Config\n): Effect.Effect<\n LanguageServer.LanguageServer,\n StdError.StdError,\n ChildProcessSpawner.ChildProcessSpawner | Scope.Scope\n> =>\n Effect.gen(function*() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner\n const timeoutMs = config.timeoutMs ?? 30_000\n const settleMs = config.settleMs ?? DEFAULT_SETTLE_MS\n const quietMs = config.quietMs ?? DEFAULT_QUIET_MS\n const env = ChildProcessEnvironment.make(process.env, config.environment)\n const refused = yield* Effect.sync(() => workspaceProgram(config, env.PATH))\n if (refused !== undefined) return yield* Effect.fail(refused)\n // The process's stdin is fed from this queue for the client's lifetime, so\n // each request is one offered frame and the pipe never closes between them.\n const input = yield* Queue.bounded<Uint8Array>(MAX_QUEUED_FRAMES)\n const handle = yield* spawner.spawn(\n ChildProcess.make(config.command, config.args ?? [], {\n cwd: config.cwd,\n env,\n extendEnv: false,\n stdin: { stream: Stream.fromQueue(input), endOnDone: false }\n })\n ).pipe(\n Effect.mapError((error) =>\n failure(\"provider_unavailable\", `Language server process could not be started: ${error.message}`)\n )\n )\n const pending = new Map<number, Deferred.Deferred<unknown, StdError.StdError>>()\n const decoder = makeFrameDecoder()\n let nextId = 1\n let terminalError: StdError.StdError | undefined\n\n // Keep draining stderr while requests run. Copy retained bytes so a small\n // tail never holds a larger backing buffer alive.\n const maximumStderrBytes = 64 * 1024\n let stderrTail: Uint8Array = new Uint8Array(0)\n const stderrFiber = yield* handle.stderr.pipe(\n Stream.runForEach((chunk) =>\n Effect.sync(() => {\n stderrTail = chunk.byteLength >= maximumStderrBytes\n ? chunk.slice(-maximumStderrBytes)\n : concatenate(\n stderrTail.slice(Math.max(0, stderrTail.byteLength + chunk.byteLength - maximumStderrBytes)),\n chunk\n )\n })\n ),\n Effect.catch((cause) => Effect.logWarning(\"Language server stderr stream failed\", cause)),\n Effect.forkScoped({ startImmediately: true })\n )\n const stderr = (): string => {\n let start = 0\n while (start < stderrTail.byteLength && start < 3 && (stderrTail[start]! & 0b1100_0000) === 0b1000_0000) start++\n return new TextDecoder().decode(stderrTail.subarray(start))\n }\n\n const failPending = (error: StdError.StdError): Effect.Effect<void> =>\n Effect.flatMap(\n Effect.sync(() => {\n const deferreds = [...pending.values()]\n pending.clear()\n return deferreds\n }),\n (deferreds) => Effect.forEach(deferreds, (deferred) => Deferred.fail(deferred, error), { discard: true })\n )\n\n const failRequest = (id: number, error: StdError.StdError): Effect.Effect<void> => {\n const deferred = pending.get(id)\n if (deferred === undefined) return Effect.void\n pending.delete(id)\n return Deferred.fail(deferred, error).pipe(Effect.asVoid)\n }\n\n const closeWith = (error: StdError.StdError): Effect.Effect<void> =>\n Effect.gen(function*() {\n // stdout EOF and process exit can arrive before the last stderr chunk.\n // A bounded grace also handles servers that close stdout but stay alive.\n yield* Fiber.await(stderrFiber).pipe(Effect.timeoutOption(100))\n terminalError ??= error\n yield* failPending(terminalError)\n })\n\n const uriOf = (path: string): string => pathToFileURL(NodePath.resolve(config.cwd, path)).href\n const documents = new Map<string, OpenDocument>()\n // Versions keep climbing across a close and reopen, so a late publish for\n // the closed text never passes for the reopened one.\n const versions = new Map<string, number>()\n const published = new Map<string, PublishedDiagnostics>()\n const listeners = new Map<string, Set<Deferred.Deferred<void>>>()\n let publishSequence = 0\n let pullUnsupported = false\n let pullSupported = false\n let versionedPublishes = false\n let barrierAnswered = true\n\n const publish = (params: unknown): Effect.Effect<void> => {\n const notification = asMessage(params) as {\n readonly uri?: unknown\n readonly version?: unknown\n readonly diagnostics?: unknown\n } | undefined\n if (typeof notification?.uri !== \"string\" || !Array.isArray(notification.diagnostics)) return Effect.void\n const uri = notification.uri\n const version = typeof notification.version === \"number\" ? notification.version : undefined\n if (version !== undefined) versionedPublishes = true\n const previous = published.get(uri)?.version\n // A late publish for an older version never replaces a newer one.\n if (version !== undefined && previous !== undefined && version < previous) return Effect.void\n published.set(uri, {\n version,\n sequence: ++publishSequence,\n diagnostics: notification.diagnostics\n })\n const waiting = listeners.get(uri)\n if (waiting === undefined) return Effect.void\n listeners.delete(uri)\n return Effect.forEach(waiting, (listener) => Deferred.succeed(listener, undefined), { discard: true })\n }\n\n const receive = (value: unknown): Effect.Effect<void> => {\n const message = asMessage(value)\n if (message?.method === \"textDocument/publishDiagnostics\") return publish(message.params)\n if (message === undefined || typeof message.id !== \"number\") return Effect.void\n const deferred = pending.get(message.id)\n if (deferred === undefined) return Effect.void\n pending.delete(message.id)\n if (message.error === undefined) return Deferred.succeed(deferred, message.result)\n const error = asMessage(message.error) as {\n readonly code?: unknown\n readonly message?: unknown\n readonly data?: unknown\n } | undefined\n return Deferred.fail(\n deferred,\n new StdError.StdError({\n code: \"request_failed\",\n message: typeof error?.message === \"string\" ? error.message : \"Language server returned a JSON-RPC error\",\n ...(typeof error?.code === \"number\" && typeof error.message === \"string\"\n ? {\n rpcError: {\n code: error.code,\n message: error.message,\n ...(error.data === undefined ? {} : { data: error.data })\n }\n }\n : {})\n })\n )\n }\n\n const receiveFrame = (event: FrameEvent): Effect.Effect<void> =>\n event._tag === \"Message\"\n ? receive(event.value)\n // A rejected frame has no trustworthy response id. Failing every\n // waiter prevents another request from hanging behind corrupt framing.\n : event.id === undefined\n ? failPending(event.error)\n : failRequest(event.id, event.error)\n\n yield* handle.stdout.pipe(\n Stream.runForEach((chunk) => Effect.forEach(decoder.push(chunk), receiveFrame, { discard: true })),\n Effect.matchEffect({\n onFailure: () => closeWith(failure(\"request_failed\", \"Language server output stream failed\")),\n onSuccess: () => closeWith(failure(\"request_failed\", \"Language server output stream closed\"))\n }),\n Effect.forkScoped({ startImmediately: true })\n )\n\n yield* handle.exitCode.pipe(\n Effect.flatMap((exitCode) =>\n closeWith(failure(\"request_failed\", `Language server process exited with code ${exitCode}`))\n ),\n Effect.catch(() => closeWith(failure(\"request_failed\", \"Language server process exited\"))),\n Effect.forkScoped({ startImmediately: true })\n )\n\n const send = (message: unknown): Effect.Effect<void, StdError.StdError> =>\n Effect.suspend(() =>\n terminalError === undefined\n ? Queue.offer(input, frame(message)).pipe(\n Effect.asVoid,\n Effect.timeout(timeoutMs),\n Effect.mapError(() =>\n failure(\n \"timeout\",\n `Language server stdin is not being drained; frame offer exceeded ${timeoutMs}ms`\n )\n )\n )\n : Effect.fail(terminalError)\n )\n\n const request = (\n method: string,\n params: unknown\n ): Effect.Effect<unknown, StdError.StdError> =>\n Effect.gen(function*() {\n const deferred = yield* Deferred.make<unknown, StdError.StdError>()\n const registered = yield* Effect.sync((): number | StdError.StdError => {\n if (terminalError !== undefined) return terminalError\n if (pending.size >= MAX_PENDING_REQUESTS) {\n return failure(\n \"request_failed\",\n `Language server reached the ${MAX_PENDING_REQUESTS} pending-request cap`\n )\n }\n const id = nextId++\n pending.set(id, deferred)\n return id\n })\n if (registered instanceof StdError.StdError) return yield* Effect.fail(registered)\n const id = registered\n return yield* Effect.gen(function*() {\n yield* send({ jsonrpc: \"2.0\", id, method, params })\n return yield* Deferred.await(deferred).pipe(\n Effect.timeout(timeoutMs),\n Effect.mapError((cause) =>\n cause instanceof StdError.StdError\n ? cause\n : failure(\"timeout\", `Language server request timed out: ${method}`)\n )\n )\n }).pipe(\n Effect.ensuring(\n Effect.sync(() => {\n pending.delete(id)\n })\n )\n )\n }).pipe(Effect.mapError((error) =>\n new StdError.StdError({\n ...error,\n method,\n message: error.rpcError === undefined ? error.message : `${method}: ${error.message}`,\n ...(stderrTail.byteLength === 0 ? {} : { stderr: stderr() })\n })\n ))\n\n const notify = (method: string, params: unknown): Effect.Effect<void, StdError.StdError> =>\n send({ jsonrpc: \"2.0\", method, params })\n\n yield* request(\"initialize\", {\n processId: null,\n rootUri: pathToFileURL(config.cwd).href,\n capabilities: {\n textDocument: {\n synchronization: { dynamicRegistration: false },\n publishDiagnostics: { versionSupport: true },\n diagnostic: { dynamicRegistration: false }\n }\n },\n ...(config.initializationOptions === undefined ? {} : { initializationOptions: config.initializationOptions })\n })\n yield* notify(\"initialized\", {})\n\n const positionParams = (position: LanguageServer.Position) => ({\n textDocument: { uri: uriOf(position.path) },\n position: { line: position.line, character: position.character }\n })\n\n // A publish without a version is read by arrival: it counts for the text\n // sent before it. Before each sync, a request the server answers at once\n // drains what it wrote earlier, such as the empty report\n // typescript-language-server publishes when a file closes, so that report\n // never passes for the reopened text. Unneeded once the server has pulled\n // or versioned a publish, and dropped if the server does not answer it.\n const barrier: Effect.Effect<void> = Effect.suspend(() =>\n pullSupported || versionedPublishes || !barrierAnswered\n ? Effect.void\n : request(BARRIER_METHOD, null).pipe(\n Effect.timeoutOption(Math.min(BARRIER_TIMEOUT_MS, timeoutMs)),\n Effect.flatMap((answer) =>\n Effect.sync(() => {\n if (Option.isNone(answer)) barrierAnswered = false\n })\n ),\n // The answer is MethodNotFound; any answer drains what came before it.\n Effect.ignore\n )\n )\n\n // One sync at a time, so versions reach the server in the order they are numbered.\n const syncLock = yield* Semaphore.make(1)\n const sync = (path: string, text: string): Effect.Effect<void, StdError.StdError> =>\n syncLock.withPermit(Effect.andThen(barrier, () => {\n const uri = uriOf(path)\n const open = documents.get(uri)\n const version = (versions.get(uri) ?? 0) + 1\n const sentAt = publishSequence\n const message = open === undefined\n ? notify(\"textDocument/didOpen\", {\n textDocument: { uri, languageId: languageId(path), version, text }\n })\n : notify(\"textDocument/didChange\", { textDocument: { uri, version }, contentChanges: [{ text }] })\n return message.pipe(\n Effect.tap(() =>\n Effect.sync(() => {\n versions.set(uri, version)\n documents.set(uri, { version, sentAt, digest: digestOf(text) })\n })\n )\n )\n }))\n\n const closeUri = (uri: string): Effect.Effect<void, StdError.StdError> =>\n Effect.suspend(() => {\n if (!documents.has(uri)) return Effect.void\n documents.delete(uri)\n published.delete(uri)\n return notify(\"textDocument/didClose\", { textDocument: { uri } })\n })\n\n const close = (path: string): Effect.Effect<void, StdError.StdError> => syncLock.withPermit(closeUri(uriOf(path)))\n\n // Re-reads every open document: a file changed on disk is resent, and a\n // file that is gone is closed. What changed it (a shell command, say) is\n // not something the server can see.\n const refresh: Effect.Effect<void, StdError.StdError> = Effect.suspend(() =>\n Effect.forEach([...documents], ([uri, open]) => {\n const path = fileURLToPath(uri)\n let text: string | undefined\n try {\n text = NodeFs.readFileSync(path, \"utf8\")\n } catch {\n text = undefined\n }\n if (text === undefined) return syncLock.withPermit(closeUri(uri))\n return digestOf(text) === open.digest ? Effect.void : sync(path, text)\n }, { discard: true })\n )\n\n /** What the server published for the document's latest synced text, if it has. */\n const current = (uri: string): PublishedDiagnostics | undefined => {\n const entry = published.get(uri)\n const open = documents.get(uri)\n if (entry === undefined || open === undefined) return undefined\n const fresh = entry.version === undefined ? entry.sequence > open.sentAt : entry.version >= open.version\n return fresh ? entry : undefined\n }\n\n /** The first publish for the latest synced text whose sequence is past `after`. */\n const awaitPublished = (uri: string, after = 0): Effect.Effect<PublishedDiagnostics> =>\n Effect.suspend(() => {\n const entry = current(uri)\n if (entry !== undefined && entry.sequence > after) return Effect.succeed(entry)\n return Effect.flatMap(Deferred.make<void>(), (listener) => {\n const waiting = listeners.get(uri) ?? new Set()\n waiting.add(listener)\n listeners.set(uri, waiting)\n return Deferred.await(listener).pipe(\n Effect.ensuring(Effect.sync(() => {\n listeners.get(uri)?.delete(listener)\n })),\n Effect.flatMap(() => awaitPublished(uri, after))\n )\n })\n })\n\n const pushedDiagnostics = (path: string): Effect.Effect<unknown, StdError.StdError> =>\n Effect.gen(function*() {\n const uri = uriOf(path)\n if (!documents.has(uri)) {\n // A push-only server publishes only for open documents.\n const text = yield* Effect.try({\n try: () => NodeFs.readFileSync(NodePath.resolve(config.cwd, path), \"utf8\"),\n catch: () => new StdError.StdError({ code: \"not_found\", message: `File not found: ${path}`, path })\n })\n yield* sync(path, text)\n }\n const started = yield* Clock.currentTimeMillis\n const entry = yield* awaitPublished(uri).pipe(Effect.timeoutOption(settleMs))\n if (Option.isNone(entry)) {\n return yield* Effect.fail(\n new StdError.StdError({\n code: \"timeout\",\n message: `Language server published no diagnostics for ${path} within ${settleMs}ms`,\n method: \"textDocument/publishDiagnostics\",\n path\n })\n )\n }\n // A later publish within the quiet window supersedes this one.\n let latest = entry.value\n for (;;) {\n const remaining = settleMs - ((yield* Clock.currentTimeMillis) - started)\n if (remaining <= 0) break\n const next = yield* awaitPublished(uri, latest.sequence).pipe(\n Effect.timeoutOption(Math.min(quietMs, remaining))\n )\n if (Option.isNone(next)) break\n latest = next.value\n }\n return { kind: \"full\", items: latest.diagnostics }\n })\n\n const diagnostics = (path: string): Effect.Effect<unknown, StdError.StdError> =>\n pullUnsupported\n ? pushedDiagnostics(path)\n : request(\"textDocument/diagnostic\", { textDocument: { uri: uriOf(path) } }).pipe(\n Effect.tap(() =>\n Effect.sync(() => {\n pullSupported = true\n })\n ),\n Effect.catchIf(\n (error) => error.rpcError?.code === METHOD_NOT_FOUND,\n () => {\n pullUnsupported = true\n return pushedDiagnostics(path)\n }\n )\n )\n\n const prepareCallHierarchy = (position: LanguageServer.Position) =>\n request(\"textDocument/prepareCallHierarchy\", positionParams(position))\n const callHierarchy = (\n method: \"callHierarchy/incomingCalls\" | \"callHierarchy/outgoingCalls\",\n position: LanguageServer.Position\n ): Effect.Effect<unknown, StdError.StdError> =>\n prepareCallHierarchy(position).pipe(\n Effect.flatMap((prepared) => {\n const item = firstCallHierarchyItem(prepared)\n return item === undefined ? Effect.succeed([]) : request(method, { item })\n })\n )\n\n return LanguageServer.make({\n hover: (position) => request(\"textDocument/hover\", positionParams(position)),\n definition: (position) => request(\"textDocument/definition\", positionParams(position)),\n references: (position) =>\n request(\"textDocument/references\", {\n ...positionParams(position),\n context: { includeDeclaration: true }\n }),\n implementation: (position) => request(\"textDocument/implementation\", positionParams(position)),\n documentSymbols: (path) => request(\"textDocument/documentSymbol\", { textDocument: { uri: uriOf(path) } }),\n workspaceSymbols: (query) => request(\"workspace/symbol\", { query }),\n prepareCallHierarchy,\n callHierarchyIncoming: (position) => callHierarchy(\"callHierarchy/incomingCalls\", position),\n callHierarchyOutgoing: (position) => callHierarchy(\"callHierarchy/outgoingCalls\", position),\n diagnostics,\n sync,\n close,\n refresh\n })\n })\n\nconst normalizeExtension = (extension: string): string =>\n (extension.startsWith(\".\") ? extension : `.${extension}`).toLowerCase()\n\n/**\n * Routes each request to the client for its file's extension. `client`\n * starts, or returns, the client at an index; `started` is that client only\n * if it already runs, so `refresh` never starts a server.\n */\nconst routed = (\n configs: ReadonlyArray<Config>,\n client: (index: number) => Effect.Effect<LanguageServer.LanguageServer, StdError.StdError>,\n started: (index: number) => LanguageServer.LanguageServer | undefined\n): LanguageServer.LanguageServer => {\n const claims = configs.map((entry) => entry.extensions?.map(normalizeExtension))\n const fallback = claims.findIndex((claimed) => claimed === undefined)\n const indexOf = (path: string): Effect.Effect<number, StdError.StdError> => {\n const extension = extensionOf(path)\n const claimed = claims.findIndex((entry) => entry?.includes(extension) === true)\n const index = claimed >= 0 ? claimed : fallback\n return index >= 0\n ? Effect.succeed(index)\n : Effect.fail(\n new StdError.StdError({\n code: \"unsupported\",\n message: `No language server is configured for ${extension || \"extensionless\"} files`,\n path\n })\n )\n }\n const route = (path: string): Effect.Effect<LanguageServer.LanguageServer, StdError.StdError> =>\n Effect.flatMap(indexOf(path), client)\n const byPosition = (\n method:\n | \"hover\"\n | \"definition\"\n | \"references\"\n | \"implementation\"\n | \"prepareCallHierarchy\"\n | \"callHierarchyIncoming\"\n | \"callHierarchyOutgoing\"\n ) =>\n (position: LanguageServer.Position) => Effect.flatMap(route(position.path), (server) => server[method](position))\n const indices = configs.map((_, index) => index)\n return LanguageServer.make({\n hover: byPosition(\"hover\"),\n definition: byPosition(\"definition\"),\n references: byPosition(\"references\"),\n implementation: byPosition(\"implementation\"),\n prepareCallHierarchy: byPosition(\"prepareCallHierarchy\"),\n callHierarchyIncoming: byPosition(\"callHierarchyIncoming\"),\n callHierarchyOutgoing: byPosition(\"callHierarchyOutgoing\"),\n documentSymbols: (path) => Effect.flatMap(route(path), (server) => server.documentSymbols(path)),\n diagnostics: (path) => Effect.flatMap(route(path), (server) => server.diagnostics(path)),\n sync: (path, text) => Effect.flatMap(route(path), (server) => server.sync(path, text)),\n // A server that never started holds no open file.\n close: (path) => Effect.flatMap(indexOf(path), (index) => started(index)?.close(path) ?? Effect.void),\n refresh: Effect.suspend(() =>\n Effect.forEach(indices, (index) => started(index)?.refresh ?? Effect.void, { discard: true })\n ),\n workspaceSymbols: (query) =>\n configs.length === 1 ?\n Effect.flatMap(client(0), (server) => server.workspaceSymbols(query)) :\n Effect.forEach(\n indices,\n (index) => Effect.flatMap(client(index), (server) => server.workspaceSymbols(query)),\n { concurrency: \"unbounded\" }\n ).pipe(\n Effect.map((answers) =>\n answers.flatMap((answer) => Array.isArray(answer) ? answer : answer == null ? [] : [answer])\n )\n )\n })\n}\n\nconst configList = (\n config: Config | ReadonlyArray<Config>\n): Effect.Effect<ReadonlyArray<Config>, StdError.StdError> => {\n const configs: ReadonlyArray<Config> = Array.isArray(config) ? config : [config as Config]\n return configs.length === 0\n ? Effect.fail(failure(\"invalid_input\", \"At least one language server must be configured\"))\n : Effect.succeed(configs)\n}\n\n/**\n * Constructs scoped host language-server clients, one process per config, and\n * routes each file to the server whose `extensions` include its extension, or\n * else to the server that declares none. `workspaceSymbols` asks every server\n * and concatenates their answers.\n *\n * Every client opens a file on its first `sync` and sends the full text on\n * each later one. `diagnostics` pulls `textDocument/diagnostic`; a server that\n * answers `MethodNotFound` is read from its `textDocument/publishDiagnostics`\n * notifications instead, waiting up to `settleMs` for the latest synced text.\n *\n * Fails with `permission_denied`, before spawning, when the resolved program or\n * a file or directory named by an argument lies under `config.cwd`, or when the command is a\n * launcher (a shell, `env`, a package runner such as `npx` or `pnpm`, or `node`\n * and `bun` given inline code or a preload) whose arguments choose what runs.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const make = (\n config: Config | ReadonlyArray<Config>\n): Effect.Effect<\n LanguageServer.LanguageServer,\n StdError.StdError,\n ChildProcessSpawner.ChildProcessSpawner | Scope.Scope\n> =>\n Effect.gen(function*() {\n const configs = yield* configList(config)\n const clients = yield* Effect.forEach(configs, makeClient)\n return routed(configs, (index) => Effect.succeed(clients[index]!), (index) => clients[index])\n })\n\n/**\n * {@link make}, starting each server when the first request for one of its\n * files arrives rather than up front, so a host can bind servers it may never\n * need. A server starts with the services and authority of the fiber that\n * built this service, not those of the request that first needs it. A server\n * that fails to start fails that request and every later one for its files.\n * `refresh` and `close` never start a server.\n *\n * The workspace-program refusals of {@link make} still apply up front.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const makeLazy = (\n config: Config | ReadonlyArray<Config>\n): Effect.Effect<\n LanguageServer.LanguageServer,\n StdError.StdError,\n ChildProcessSpawner.ChildProcessSpawner | Scope.Scope\n> =>\n Effect.gen(function*() {\n const configs = yield* configList(config)\n for (const entry of configs) {\n const refused = workspaceProgram(entry, ChildProcessEnvironment.make(process.env, entry.environment).PATH)\n if (refused !== undefined) return yield* Effect.fail(refused)\n }\n const clients: Array<LanguageServer.LanguageServer | undefined> = configs.map(() => undefined)\n // Each server starts in a fiber forked here, so it starts with the\n // services and authority of whoever built this service, never those of\n // the request that first needs it, and lives as long as this scope.\n const starts = yield* Effect.forEach(configs, (entry, index) =>\n Effect.gen(function*() {\n const wanted = yield* Deferred.make<void>()\n const ready = yield* Deferred.make<LanguageServer.LanguageServer, StdError.StdError>()\n yield* Deferred.await(wanted).pipe(\n Effect.andThen(makeClient(entry)),\n Effect.tap((client) => Effect.sync(() => void (clients[index] = client))),\n Effect.exit,\n Effect.flatMap((exit) => Deferred.done(ready, exit)),\n Effect.forkScoped({ startImmediately: true })\n )\n return Deferred.succeed(wanted, undefined).pipe(Effect.andThen(Deferred.await(ready)))\n }))\n return routed(configs, (index) => starts[index]!, (index) => clients[index])\n })\n\n/**\n * Provides a scoped host language-server implementation.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layer = (\n config: Config | ReadonlyArray<Config>\n): Layer.Layer<LanguageServer.LanguageServer, StdError.StdError, ChildProcessSpawner.ChildProcessSpawner> =>\n Layer.effect(LanguageServer.LanguageServer, make(config))\n\n/**\n * Provides {@link makeLazy}.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layerLazy = (\n config: Config | ReadonlyArray<Config>\n): Layer.Layer<LanguageServer.LanguageServer, StdError.StdError, ChildProcessSpawner.ChildProcessSpawner> =>\n Layer.effect(LanguageServer.LanguageServer, makeLazy(config))\n"],
4
+ "sourcesContent": ["/**\n * Host-backed Language Server Protocol client over the permission-checked\n * process spawner.\n *\n * LSP is framed JSON-RPC over ordinary stdio pipes, so the client spawns\n * through `@smthrs/kernel`'s `ChildProcessSpawner`; a terminal is never\n * involved.\n *\n * @since 1.0.0\n */\n\nimport * as ChildProcessEnvironment from \"@smthrs/kernel/ChildProcessEnvironment\"\nimport * as ChildProcessSpawner from \"@smthrs/kernel/ChildProcessSpawner\"\nimport { Clock, Deferred, Effect, Fiber, Layer, Option, Queue, type Scope, Semaphore, Stream } from \"effect\"\nimport * as ChildProcess from \"effect/process/ChildProcess\"\nimport { createHash } from \"node:crypto\"\nimport * as NodeFs from \"node:fs\"\nimport * as NodePath from \"node:path\"\nimport { fileURLToPath, pathToFileURL } from \"node:url\"\nimport * as LanguageServer from \"./LanguageServer.ts\"\nimport * as StdError from \"./StdError.ts\"\n\n/**\n * Maximum frames buffered for a language server's standard input.\n *\n * Bounded offers apply backpressure, and each offer uses the request timeout\n * so a server that stops reading produces a typed timeout instead of an\n * unbounded queue or a new hang.\n *\n * @category constants\n * @since 1.0.0\n */\nexport const MAX_QUEUED_FRAMES = 256\n\n/**\n * Maximum concurrent JSON-RPC requests awaiting a response.\n *\n * Every entry already has a timeout, and process exit or stdout closure fails\n * all entries. This cap is the last-resort bound for a host that fans out\n * requests without limit.\n *\n * @category constants\n * @since 1.0.0\n */\nexport const MAX_PENDING_REQUESTS = 512\n\nconst DEFAULT_SETTLE_MS = 5_000\nconst DEFAULT_QUIET_MS = 300\n\n/**\n * A request every server must refuse at once: the specification has a server\n * answer an unknown `$/` request with MethodNotFound.\n */\nconst BARRIER_METHOD = \"$/smithers/barrier\"\n/** A server that has not answered the barrier in this long is not asked again. */\nconst BARRIER_TIMEOUT_MS = 1_000\n\n/**\n * One host language-server process.\n *\n * Response headers may contain at most 8 KiB, and response bodies may contain\n * at most 8 MiB.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Config {\n /**\n * The file extensions this server answers for, such as `[\".ts\", \".tsx\"]`.\n * A server without `extensions` answers every file no other server claims.\n */\n readonly extensions?: ReadonlyArray<string> | undefined\n readonly command: string\n readonly args?: ReadonlyArray<string> | undefined\n readonly cwd: string\n readonly environment?: Readonly<Record<string, string>> | undefined\n /**\n * Sent as `initializationOptions` on `initialize`. A host pins where the\n * server loads its own code from here, for example\n * `{ tsserver: { path: \"<host copy>/tsserver.js\" } }` for\n * typescript-language-server, which otherwise runs the workspace's own\n * `node_modules/typescript`.\n */\n readonly initializationOptions?: unknown\n readonly timeoutMs?: number | undefined\n /**\n * How long `diagnostics` waits for a server without pull diagnostics to\n * publish for the latest synced text, then fails with `timeout`. Defaults to\n * 5 seconds. typescript-language-server publishes nothing for a change that\n * leaves a file with no problems, so such a change always waits this long.\n */\n readonly settleMs?: number | undefined\n /**\n * After a publish, how long `diagnostics` waits for a later one before\n * answering, within `settleMs`. A server may publish syntax errors before\n * semantic ones: typescript-language-server does on the first open of a\n * file. Defaults to 300 milliseconds.\n */\n readonly quietMs?: number | undefined\n}\n\ninterface JsonRpcMessage {\n readonly id?: unknown\n readonly method?: unknown\n readonly params?: unknown\n readonly result?: unknown\n readonly error?: unknown\n}\n\n/** JSON-RPC's code for a method the server does not implement. */\nconst METHOD_NOT_FOUND = -32601\n\nconst LANGUAGE_IDS: Readonly<Record<string, string>> = {\n \".ts\": \"typescript\",\n \".mts\": \"typescript\",\n \".cts\": \"typescript\",\n \".tsx\": \"typescriptreact\",\n \".js\": \"javascript\",\n \".mjs\": \"javascript\",\n \".cjs\": \"javascript\",\n \".jsx\": \"javascriptreact\",\n \".py\": \"python\",\n \".rs\": \"rust\",\n \".go\": \"go\",\n \".rb\": \"ruby\",\n \".sh\": \"shellscript\",\n \".md\": \"markdown\",\n \".yml\": \"yaml\",\n \".cc\": \"cpp\",\n \".cpp\": \"cpp\",\n \".hpp\": \"cpp\",\n \".cs\": \"csharp\"\n}\n\nconst extensionOf = (path: string): string => NodePath.extname(path).toLowerCase()\n\nconst languageId = (path: string): string => {\n const extension = extensionOf(path)\n return LANGUAGE_IDS[extension] ?? (extension.slice(1) || \"plaintext\")\n}\n\ninterface FrameDecoder {\n readonly push: (chunk: Uint8Array) => ReadonlyArray<FrameEvent>\n}\n\ntype FrameEvent =\n | { readonly _tag: \"Message\"; readonly value: unknown }\n | { readonly _tag: \"Failure\"; readonly error: StdError.StdError; readonly id?: number | undefined }\n\nconst failure = (code: StdError.Code, message: string): StdError.StdError => new StdError.StdError({ code, message })\n\nconst maximumHeaderBytes = 8 * 1024\nconst maximumFrameBytes = 8 * 1024 * 1024\nconst headerEnd = new Uint8Array([13, 10, 13, 10])\nconst contentLengthPrefix = new TextEncoder().encode(\"Content-Length:\")\n\nconst concatenate = (left: Uint8Array, right: Uint8Array): Uint8Array => {\n const combined = new Uint8Array(left.length + right.length)\n combined.set(left)\n combined.set(right, left.length)\n return combined\n}\n\ninterface ChunkBuffer {\n readonly length: number\n readonly push: (chunk: Uint8Array) => void\n readonly indexOf: (needle: Uint8Array) => number\n // Counts come from delimiter offsets or validated Content-Length values.\n // A reader can only be acquired for an available, nonnegative prefix.\n readonly prefix: (length: number) => {\n readonly take: () => Uint8Array\n readonly discard: () => void\n } | undefined\n}\n\nconst makeChunkBuffer = (): ChunkBuffer => {\n let chunks: Array<Uint8Array> = []\n let head = 0\n let headOffset = 0\n let length = 0\n\n const compact = (): void => {\n if (head === chunks.length) {\n chunks = []\n head = 0\n headOffset = 0\n } else if (head >= 64 && head * 2 >= chunks.length) {\n chunks = chunks.slice(head)\n head = 0\n }\n }\n\n const consume = (count: number, output?: Uint8Array): void => {\n let remaining = count\n let outputOffset = 0\n for (const chunk of chunks.slice(head)) {\n if (remaining === 0) break\n const available = chunk.byteLength - headOffset\n const consumed = Math.min(available, remaining)\n if (output !== undefined) {\n output.set(chunk.subarray(headOffset, headOffset + consumed), outputOffset)\n outputOffset += consumed\n }\n headOffset += consumed\n length -= consumed\n remaining -= consumed\n if (headOffset === chunk.byteLength) {\n head++\n headOffset = 0\n }\n }\n compact()\n }\n\n return {\n get length() {\n return length\n },\n push: (chunk) => {\n if (chunk.byteLength === 0) return\n // Own the bytes so caller mutation or resizing cannot change buffered lengths.\n chunks.push(chunk.slice())\n length += chunk.byteLength\n },\n indexOf: (needle) => {\n let absolute = 0\n let matched = 0\n for (let chunkIndex = head; chunkIndex < chunks.length; chunkIndex++) {\n const chunk = chunks[chunkIndex]!\n const start = chunkIndex === head ? headOffset : 0\n for (let index = start; index < chunk.byteLength; index++) {\n const byte = chunk[index]\n if (byte === needle[matched]) matched++\n else matched = byte === needle[0] ? 1 : 0\n if (matched === needle.byteLength) return absolute - needle.byteLength + 1\n absolute++\n }\n }\n return -1\n },\n prefix: (count) => {\n if (count > length) return undefined\n return {\n take: () => {\n const output = new Uint8Array(count)\n consume(count, output)\n return output\n },\n discard: () => consume(count)\n }\n }\n }\n}\n\nconst malformedId = (body: string): number | undefined => {\n const match = /\"id\"\\s*:\\s*(\\d+)/.exec(body)\n if (match === null) return undefined\n const id = Number(match[1])\n return Number.isSafeInteger(id) ? id : undefined\n}\n\nconst makeFrameDecoder = (): FrameDecoder => {\n const pending = makeChunkBuffer()\n let bodyLength: number | undefined\n let resynchronizing = false\n return {\n push: (chunk) => {\n pending.push(chunk)\n const events: Array<FrameEvent> = []\n while (pending.length > 0 || bodyLength === 0) {\n if (resynchronizing) {\n const nextHeader = pending.indexOf(contentLengthPrefix)\n if (nextHeader < 0) {\n pending.prefix(Math.max(0, pending.length - contentLengthPrefix.byteLength + 1))!.discard()\n break\n }\n pending.prefix(nextHeader)!.discard()\n resynchronizing = false\n }\n if (bodyLength !== undefined) {\n const reader = pending.prefix(bodyLength)\n if (reader === undefined) break\n const body = new TextDecoder().decode(reader.take())\n bodyLength = undefined\n try {\n events.push({ _tag: \"Message\", value: JSON.parse(body) as unknown })\n } catch {\n events.push({\n _tag: \"Failure\",\n error: failure(\"request_failed\", \"Language server returned malformed JSON\"),\n id: malformedId(body)\n })\n }\n continue\n }\n const delimiter = pending.indexOf(headerEnd)\n if (delimiter < 0) {\n if (pending.length > maximumHeaderBytes) {\n events.push({\n _tag: \"Failure\",\n error: failure(\n \"request_failed\",\n `Language server frame header exceeded ${maximumHeaderBytes} bytes`\n )\n })\n pending.prefix(1)!.discard()\n resynchronizing = true\n continue\n }\n break\n }\n if (delimiter > maximumHeaderBytes) {\n events.push({\n _tag: \"Failure\",\n error: failure(\"request_failed\", `Language server frame header exceeded ${maximumHeaderBytes} bytes`)\n })\n pending.prefix(delimiter + headerEnd.byteLength)!.discard()\n resynchronizing = true\n continue\n }\n const header = new TextDecoder().decode(pending.prefix(delimiter)!.take())\n pending.prefix(headerEnd.byteLength)!.discard()\n const match = /(?:^|\\r\\n)Content-Length:\\s*(\\d+)(?:\\r\\n|$)/i.exec(header)\n if (match === null) {\n events.push({\n _tag: \"Failure\",\n error: failure(\"request_failed\", \"Language server frame omitted Content-Length\")\n })\n resynchronizing = true\n continue\n }\n const length = Number(match[1])\n if (!Number.isSafeInteger(length) || length < 0 || length > maximumFrameBytes) {\n events.push({\n _tag: \"Failure\",\n error: failure(\"request_failed\", `Language server frame exceeded ${maximumFrameBytes} bytes`)\n })\n resynchronizing = true\n continue\n }\n bodyLength = length\n }\n return events\n }\n }\n}\n\nconst asMessage = (value: unknown): JsonRpcMessage | undefined =>\n typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? value\n : undefined\n\nconst frame = (message: unknown): Uint8Array => {\n const body = new TextEncoder().encode(JSON.stringify(message))\n const header = new TextEncoder().encode(`Content-Length: ${body.byteLength}\\r\\n\\r\\n`)\n return concatenate(header, body)\n}\n\nconst firstCallHierarchyItem = (value: unknown): unknown | undefined => Array.isArray(value) ? value[0] : undefined\n\nconst isFile = (path: string): boolean => {\n try {\n return NodeFs.statSync(path, { throwIfNoEntry: false })?.isFile() === true\n } catch {\n return false\n }\n}\n\n/** Whether anything, a file or a directory, exists at `path`. */\nconst exists = (path: string): boolean => {\n try {\n return NodeFs.statSync(path, { throwIfNoEntry: false }) !== undefined\n } catch {\n return false\n }\n}\n\nconst realPath = (path: string): string => {\n try {\n return NodeFs.realpathSync(path)\n } catch {\n return NodePath.resolve(path)\n }\n}\n\nconst isWithin = (root: string, path: string): boolean => {\n const relative = NodePath.relative(root, path)\n return relative === \"\" || (relative !== \"..\" && !relative.startsWith(`..${NodePath.sep}`) &&\n !NodePath.isAbsolute(relative))\n}\n\n/**\n * Resolves the program a spawn would execute: a command containing a path\n * separator against `cwd`, a bare name through the child's `PATH`, where an\n * empty or relative entry is relative to `cwd`.\n */\nconst resolveCommand = (command: string, cwd: string, path: string | undefined): string | undefined => {\n if (command.includes(\"/\") || command.includes(NodePath.sep)) {\n const candidate = NodePath.resolve(cwd, command)\n return isFile(candidate) ? candidate : undefined\n }\n for (const entry of (path ?? \"\").split(NodePath.delimiter)) {\n const candidate = NodePath.resolve(cwd, entry, command)\n if (!isFile(candidate)) continue\n try {\n NodeFs.accessSync(candidate, NodeFs.constants.X_OK)\n return candidate\n } catch {\n continue\n }\n }\n return undefined\n}\n\n/**\n * Refuses a server whose program or any file-naming argument lies in the\n * workspace. The server runs on the host as the host user, so a program the\n * workspace supplies (its `node_modules/.bin`, a `./` script, a symlink it\n * planted) would let workspace files choose what the host executes.\n */\n/**\n * Programs whose job is to run another program named in their arguments or\n * found in the working directory: shells, `env`, and package runners. Their\n * arguments are code or package names, not files, so the workspace check below\n * cannot see what they would execute (`sh -c node_modules/.bin/x`, `npx x`).\n */\nconst LAUNCHERS = new Set([\n \"sh\",\n \"bash\",\n \"zsh\",\n \"dash\",\n \"ksh\",\n \"fish\",\n \"csh\",\n \"tcsh\",\n \"env\",\n \"npx\",\n \"pnpx\",\n \"npm\",\n \"pnpm\",\n \"yarn\",\n \"bunx\",\n \"deno\",\n \"cmd\",\n \"powershell\",\n \"pwsh\"\n])\n\n/** Interpreter flags that take code or a module to load instead of a file path. */\nconst CODE_FLAGS = new Set([\"-e\", \"--eval\", \"-p\", \"--print\", \"-r\", \"--require\", \"--import\", \"--loader\"])\n\nconst launcher = (config: Config): string | undefined => {\n const name = NodePath.basename(config.command).toLowerCase().replace(/\\.(?:exe|cmd|bat|ps1)$/, \"\")\n if (LAUNCHERS.has(name)) return name\n if (name !== \"node\" && name !== \"bun\" && name !== \"nodejs\") return undefined\n const args = config.args ?? []\n if (name === \"bun\" && [\"x\", \"run\", \"exec\"].includes(args[0] ?? \"\")) return `bun ${args[0]}`\n const flag = args.find((argument) => CODE_FLAGS.has(argument.split(\"=\")[0]!) || argument === \"--experimental-loader\")\n return flag === undefined ? undefined : `${name} ${flag.split(\"=\")[0]}`\n}\n\nconst workspaceProgram = (\n config: Config,\n path: string | undefined\n): StdError.StdError | undefined => {\n const launching = launcher(config)\n if (launching !== undefined) {\n return failure(\n \"permission_denied\",\n `Language server command runs ${launching}, which executes a program its arguments or the workspace choose; name the server's own host binary instead`\n )\n }\n const lexicalRoot = NodePath.resolve(config.cwd)\n const realRoot = realPath(lexicalRoot)\n const inWorkspace = (file: string): boolean =>\n isWithin(lexicalRoot, file) || isWithin(realRoot, file) || isWithin(realRoot, realPath(file)) ||\n isWithin(lexicalRoot, realPath(file))\n const program = resolveCommand(config.command, lexicalRoot, path)\n if (program !== undefined && inWorkspace(program)) {\n return failure(\n \"permission_denied\",\n `Language server program ${program} is inside the workspace ${lexicalRoot}; run a host copy instead`\n )\n }\n for (const argument of config.args ?? []) {\n for (const value of [argument, argument.slice(argument.indexOf(\"=\") + 1)]) {\n if (value === \"\") continue\n const candidate = NodePath.resolve(lexicalRoot, value)\n // A directory counts: `node <dir>` runs `<dir>/index.js` or its package main.\n if (exists(candidate) && inWorkspace(candidate)) {\n return failure(\n \"permission_denied\",\n `Language server argument names ${candidate}, a path inside the workspace ${lexicalRoot}`\n )\n }\n }\n }\n return undefined\n}\n\ninterface PublishedDiagnostics {\n readonly version: number | undefined\n readonly sequence: number\n readonly diagnostics: ReadonlyArray<unknown>\n}\n\ninterface OpenDocument {\n readonly version: number\n /** The publish sequence number when this version was sent. */\n readonly sentAt: number\n /** The SHA-256 of the text last sent, so `refresh` resends only changed files. */\n readonly digest: string\n}\n\nconst digestOf = (text: string): string => createHash(\"sha256\").update(text).digest(\"hex\")\n\nconst makeClient = (\n config: Config\n): Effect.Effect<\n LanguageServer.LanguageServer,\n StdError.StdError,\n ChildProcessSpawner.ChildProcessSpawner | Scope.Scope\n> =>\n Effect.gen(function*() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner\n const timeoutMs = config.timeoutMs ?? 30_000\n const settleMs = config.settleMs ?? DEFAULT_SETTLE_MS\n const quietMs = config.quietMs ?? DEFAULT_QUIET_MS\n const env = ChildProcessEnvironment.make(process.env, config.environment)\n const refused = yield* Effect.sync(() => workspaceProgram(config, env.PATH))\n if (refused !== undefined) return yield* Effect.fail(refused)\n // The process's stdin is fed from this queue for the client's lifetime, so\n // each request is one offered frame and the pipe never closes between them.\n const input = yield* Queue.bounded<Uint8Array>(MAX_QUEUED_FRAMES)\n const handle = yield* spawner.spawn(\n ChildProcess.make(config.command, config.args ?? [], {\n cwd: config.cwd,\n env,\n extendEnv: false,\n stdin: { stream: Stream.fromQueue(input), endOnDone: false }\n })\n ).pipe(\n Effect.mapError((error) =>\n failure(\"provider_unavailable\", `Language server process could not be started: ${error.message}`)\n )\n )\n const pending = new Map<number, Deferred.Deferred<unknown, StdError.StdError>>()\n const decoder = makeFrameDecoder()\n let nextId = 1\n let terminalError: StdError.StdError | undefined\n\n // Keep draining stderr while requests run. Copy retained bytes so a small\n // tail never holds a larger backing buffer alive.\n const maximumStderrBytes = 64 * 1024\n let stderrTail: Uint8Array = new Uint8Array(0)\n const stderrFiber = yield* handle.stderr.pipe(\n Stream.runForEach((chunk) =>\n Effect.sync(() => {\n stderrTail = chunk.byteLength >= maximumStderrBytes\n ? chunk.slice(-maximumStderrBytes)\n : concatenate(\n stderrTail.slice(Math.max(0, stderrTail.byteLength + chunk.byteLength - maximumStderrBytes)),\n chunk\n )\n })\n ),\n Effect.catch((cause) => Effect.logWarning(\"Language server stderr stream failed\", cause)),\n Effect.forkScoped({ startImmediately: true })\n )\n const stderr = (): string => {\n let start = 0\n while (start < stderrTail.byteLength && start < 3 && (stderrTail[start]! & 0b1100_0000) === 0b1000_0000) start++\n return new TextDecoder().decode(stderrTail.subarray(start))\n }\n\n const failPending = (error: StdError.StdError): Effect.Effect<void> =>\n Effect.flatMap(\n Effect.sync(() => {\n const deferreds = [...pending.values()]\n pending.clear()\n return deferreds\n }),\n (deferreds) => Effect.forEach(deferreds, (deferred) => Deferred.fail(deferred, error), { discard: true })\n )\n\n const failRequest = (id: number, error: StdError.StdError): Effect.Effect<void> => {\n const deferred = pending.get(id)\n if (deferred === undefined) return Effect.void\n pending.delete(id)\n return Deferred.fail(deferred, error).pipe(Effect.asVoid)\n }\n\n const closeWith = (error: StdError.StdError): Effect.Effect<void> =>\n Effect.gen(function*() {\n // stdout EOF and process exit can arrive before the last stderr chunk.\n // A bounded grace also handles servers that close stdout but stay alive.\n yield* Fiber.await(stderrFiber).pipe(Effect.timeoutOption(100))\n terminalError ??= error\n yield* failPending(terminalError)\n })\n\n const uriOf = (path: string): string => pathToFileURL(NodePath.resolve(config.cwd, path)).href\n const documents = new Map<string, OpenDocument>()\n // Versions keep climbing across a close and reopen, so a late publish for\n // the closed text never passes for the reopened one.\n const versions = new Map<string, number>()\n const published = new Map<string, PublishedDiagnostics>()\n const listeners = new Map<string, Set<Deferred.Deferred<void>>>()\n let publishSequence = 0\n let pullUnsupported = false\n let pullSupported = false\n let versionedPublishes = false\n let barrierAnswered = true\n\n const publish = (params: unknown): Effect.Effect<void> => {\n const notification = asMessage(params) as {\n readonly uri?: unknown\n readonly version?: unknown\n readonly diagnostics?: unknown\n } | undefined\n if (typeof notification?.uri !== \"string\" || !Array.isArray(notification.diagnostics)) return Effect.void\n const uri = notification.uri\n const version = typeof notification.version === \"number\" ? notification.version : undefined\n if (version !== undefined) versionedPublishes = true\n const previous = published.get(uri)?.version\n // A late publish for an older version never replaces a newer one.\n if (version !== undefined && previous !== undefined && version < previous) return Effect.void\n published.set(uri, {\n version,\n sequence: ++publishSequence,\n diagnostics: notification.diagnostics\n })\n const waiting = listeners.get(uri)\n if (waiting === undefined) return Effect.void\n listeners.delete(uri)\n return Effect.forEach(waiting, (listener) => Deferred.succeed(listener, undefined), { discard: true })\n }\n\n const receive = (value: unknown): Effect.Effect<void> => {\n const message = asMessage(value)\n if (message?.method === \"textDocument/publishDiagnostics\") return publish(message.params)\n if (message === undefined || typeof message.id !== \"number\") return Effect.void\n const deferred = pending.get(message.id)\n if (deferred === undefined) return Effect.void\n pending.delete(message.id)\n if (message.error === undefined) return Deferred.succeed(deferred, message.result)\n const error = asMessage(message.error) as {\n readonly code?: unknown\n readonly message?: unknown\n readonly data?: unknown\n } | undefined\n return Deferred.fail(\n deferred,\n new StdError.StdError({\n code: \"request_failed\",\n message: typeof error?.message === \"string\" ? error.message : \"Language server returned a JSON-RPC error\",\n ...(typeof error?.code === \"number\" && typeof error.message === \"string\"\n ? {\n rpcError: {\n code: error.code,\n message: error.message,\n ...(error.data === undefined ? {} : { data: error.data })\n }\n }\n : {})\n })\n )\n }\n\n const receiveFrame = (event: FrameEvent): Effect.Effect<void> =>\n event._tag === \"Message\"\n ? receive(event.value)\n // A rejected frame has no trustworthy response id. Failing every\n // waiter prevents another request from hanging behind corrupt framing.\n : event.id === undefined\n ? failPending(event.error)\n : failRequest(event.id, event.error)\n\n yield* handle.stdout.pipe(\n Stream.runForEach((chunk) => Effect.forEach(decoder.push(chunk), receiveFrame, { discard: true })),\n Effect.matchEffect({\n onFailure: () => closeWith(failure(\"request_failed\", \"Language server output stream failed\")),\n onSuccess: () => closeWith(failure(\"request_failed\", \"Language server output stream closed\"))\n }),\n Effect.forkScoped({ startImmediately: true })\n )\n\n yield* handle.exitCode.pipe(\n Effect.flatMap((exitCode) =>\n closeWith(failure(\"request_failed\", `Language server process exited with code ${exitCode}`))\n ),\n Effect.catch(() => closeWith(failure(\"request_failed\", \"Language server process exited\"))),\n Effect.forkScoped({ startImmediately: true })\n )\n\n const send = (message: unknown): Effect.Effect<void, StdError.StdError> =>\n Effect.suspend(() =>\n terminalError === undefined\n ? Queue.offer(input, frame(message)).pipe(\n Effect.asVoid,\n Effect.timeout(timeoutMs),\n Effect.mapError(() =>\n failure(\n \"timeout\",\n `Language server stdin is not being drained; frame offer exceeded ${timeoutMs}ms`\n )\n )\n )\n : Effect.fail(terminalError)\n )\n\n const request = (\n method: string,\n params: unknown\n ): Effect.Effect<unknown, StdError.StdError> =>\n Effect.gen(function*() {\n const deferred = yield* Deferred.make<unknown, StdError.StdError>()\n const registered = yield* Effect.sync((): number | StdError.StdError => {\n if (terminalError !== undefined) return terminalError\n if (pending.size >= MAX_PENDING_REQUESTS) {\n return failure(\n \"request_failed\",\n `Language server reached the ${MAX_PENDING_REQUESTS} pending-request cap`\n )\n }\n const id = nextId++\n pending.set(id, deferred)\n return id\n })\n if (registered instanceof StdError.StdError) return yield* Effect.fail(registered)\n const id = registered\n return yield* Effect.gen(function*() {\n yield* send({ jsonrpc: \"2.0\", id, method, params })\n return yield* Deferred.await(deferred).pipe(\n Effect.timeout(timeoutMs),\n Effect.mapError((cause) =>\n cause instanceof StdError.StdError\n ? cause\n : failure(\"timeout\", `Language server request timed out: ${method}`)\n )\n )\n }).pipe(\n Effect.ensuring(\n Effect.sync(() => {\n pending.delete(id)\n })\n )\n )\n }).pipe(Effect.mapError((error) =>\n new StdError.StdError({\n ...error,\n method,\n message: error.rpcError === undefined ? error.message : `${method}: ${error.message}`,\n ...(stderrTail.byteLength === 0 ? {} : { stderr: stderr() })\n })\n ))\n\n const notify = (method: string, params: unknown): Effect.Effect<void, StdError.StdError> =>\n send({ jsonrpc: \"2.0\", method, params })\n\n yield* request(\"initialize\", {\n processId: null,\n rootUri: pathToFileURL(config.cwd).href,\n capabilities: {\n textDocument: {\n synchronization: { dynamicRegistration: false },\n publishDiagnostics: { versionSupport: true },\n diagnostic: { dynamicRegistration: false }\n }\n },\n ...(config.initializationOptions === undefined ? {} : { initializationOptions: config.initializationOptions })\n })\n yield* notify(\"initialized\", {})\n\n const positionParams = (position: LanguageServer.Position) => ({\n textDocument: { uri: uriOf(position.path) },\n position: { line: position.line, character: position.character }\n })\n\n // A publish without a version is read by arrival: it counts for the text\n // sent before it. Before each sync, a request the server answers at once\n // drains what it wrote earlier, such as the empty report\n // typescript-language-server publishes when a file closes, so that report\n // never passes for the reopened text. Unneeded once the server has pulled\n // or versioned a publish, and dropped if the server does not answer it.\n const barrier: Effect.Effect<void> = Effect.suspend(() =>\n pullSupported || versionedPublishes || !barrierAnswered\n ? Effect.void\n : request(BARRIER_METHOD, null).pipe(\n Effect.timeoutOption(Math.min(BARRIER_TIMEOUT_MS, timeoutMs)),\n Effect.flatMap((answer) =>\n Effect.sync(() => {\n if (Option.isNone(answer)) barrierAnswered = false\n })\n ),\n // The answer is MethodNotFound; any answer drains what came before it.\n Effect.ignore\n )\n )\n\n // One sync at a time, so versions reach the server in the order they are numbered.\n const syncLock = yield* Semaphore.make(1)\n const sync = (path: string, text: string): Effect.Effect<void, StdError.StdError> =>\n syncLock.withPermit(Effect.andThen(barrier, () => {\n const uri = uriOf(path)\n const open = documents.get(uri)\n const version = (versions.get(uri) ?? 0) + 1\n const sentAt = publishSequence\n const message = open === undefined\n ? notify(\"textDocument/didOpen\", {\n textDocument: { uri, languageId: languageId(path), version, text }\n })\n : notify(\"textDocument/didChange\", { textDocument: { uri, version }, contentChanges: [{ text }] })\n return message.pipe(\n Effect.tap(() =>\n Effect.sync(() => {\n versions.set(uri, version)\n documents.set(uri, { version, sentAt, digest: digestOf(text) })\n })\n )\n )\n }))\n\n const closeUri = (uri: string): Effect.Effect<void, StdError.StdError> =>\n Effect.suspend(() => {\n if (!documents.has(uri)) return Effect.void\n documents.delete(uri)\n published.delete(uri)\n return notify(\"textDocument/didClose\", { textDocument: { uri } })\n })\n\n const close = (path: string): Effect.Effect<void, StdError.StdError> => syncLock.withPermit(closeUri(uriOf(path)))\n\n // Re-reads every open document: a file changed on disk is resent, and a\n // file that is gone is closed. What changed it (a shell command, say) is\n // not something the server can see.\n const refresh: Effect.Effect<void, StdError.StdError> = Effect.suspend(() =>\n Effect.forEach([...documents], ([uri, open]) => {\n const path = fileURLToPath(uri)\n let text: string | undefined\n try {\n text = NodeFs.readFileSync(path, \"utf8\")\n } catch {\n text = undefined\n }\n if (text === undefined) return syncLock.withPermit(closeUri(uri))\n return digestOf(text) === open.digest ? Effect.void : sync(path, text)\n }, { discard: true })\n )\n\n /** What the server published for the document's latest synced text, if it has. */\n const current = (uri: string): PublishedDiagnostics | undefined => {\n const entry = published.get(uri)\n const open = documents.get(uri)\n if (entry === undefined || open === undefined) return undefined\n const fresh = entry.version === undefined ? entry.sequence > open.sentAt : entry.version >= open.version\n return fresh ? entry : undefined\n }\n\n /** The first publish for the latest synced text whose sequence is past `after`. */\n const awaitPublished = (uri: string, after = 0): Effect.Effect<PublishedDiagnostics> =>\n Effect.suspend(() => {\n const entry = current(uri)\n if (entry !== undefined && entry.sequence > after) return Effect.succeed(entry)\n return Effect.flatMap(Deferred.make<void>(), (listener) => {\n const waiting = listeners.get(uri) ?? new Set()\n waiting.add(listener)\n listeners.set(uri, waiting)\n return Deferred.await(listener).pipe(\n Effect.ensuring(Effect.sync(() => {\n listeners.get(uri)?.delete(listener)\n })),\n Effect.flatMap(() => awaitPublished(uri, after))\n )\n })\n })\n\n const pushedDiagnostics = (path: string): Effect.Effect<unknown, StdError.StdError> =>\n Effect.gen(function*() {\n const uri = uriOf(path)\n if (!documents.has(uri)) {\n // A push-only server publishes only for open documents.\n const text = yield* Effect.try({\n try: () => NodeFs.readFileSync(NodePath.resolve(config.cwd, path), \"utf8\"),\n catch: () => new StdError.StdError({ code: \"not_found\", message: `File not found: ${path}`, path })\n })\n yield* sync(path, text)\n }\n const started = yield* Clock.currentTimeMillis\n const entry = yield* awaitPublished(uri).pipe(Effect.timeoutOption(settleMs))\n if (Option.isNone(entry)) {\n return yield* Effect.fail(\n new StdError.StdError({\n code: \"timeout\",\n message: `Language server published no diagnostics for ${path} within ${settleMs}ms`,\n method: \"textDocument/publishDiagnostics\",\n path\n })\n )\n }\n // A later publish within the quiet window supersedes this one.\n let latest = entry.value\n for (;;) {\n const remaining = settleMs - ((yield* Clock.currentTimeMillis) - started)\n if (remaining <= 0) break\n const next = yield* awaitPublished(uri, latest.sequence).pipe(\n Effect.timeoutOption(Math.min(quietMs, remaining))\n )\n if (Option.isNone(next)) break\n latest = next.value\n }\n return { kind: \"full\", items: latest.diagnostics }\n })\n\n const diagnostics = (path: string): Effect.Effect<unknown, StdError.StdError> =>\n pullUnsupported\n ? pushedDiagnostics(path)\n : request(\"textDocument/diagnostic\", { textDocument: { uri: uriOf(path) } }).pipe(\n Effect.tap(() =>\n Effect.sync(() => {\n pullSupported = true\n })\n ),\n Effect.catchIf(\n (error) => error.rpcError?.code === METHOD_NOT_FOUND,\n () => {\n pullUnsupported = true\n return pushedDiagnostics(path)\n }\n )\n )\n\n const prepareCallHierarchy = (position: LanguageServer.Position) =>\n request(\"textDocument/prepareCallHierarchy\", positionParams(position))\n const callHierarchy = (\n method: \"callHierarchy/incomingCalls\" | \"callHierarchy/outgoingCalls\",\n position: LanguageServer.Position\n ): Effect.Effect<unknown, StdError.StdError> =>\n prepareCallHierarchy(position).pipe(\n Effect.flatMap((prepared) => {\n const item = firstCallHierarchyItem(prepared)\n return item === undefined ? Effect.succeed([]) : request(method, { item })\n })\n )\n\n return LanguageServer.make({\n hover: (position) => request(\"textDocument/hover\", positionParams(position)),\n definition: (position) => request(\"textDocument/definition\", positionParams(position)),\n references: (position) =>\n request(\"textDocument/references\", {\n ...positionParams(position),\n context: { includeDeclaration: true }\n }),\n implementation: (position) => request(\"textDocument/implementation\", positionParams(position)),\n documentSymbols: (path) => request(\"textDocument/documentSymbol\", { textDocument: { uri: uriOf(path) } }),\n workspaceSymbols: (query) => request(\"workspace/symbol\", { query }),\n prepareCallHierarchy,\n callHierarchyIncoming: (position) => callHierarchy(\"callHierarchy/incomingCalls\", position),\n callHierarchyOutgoing: (position) => callHierarchy(\"callHierarchy/outgoingCalls\", position),\n diagnostics,\n sync,\n close,\n refresh\n })\n })\n\nconst normalizeExtension = (extension: string): string =>\n (extension.startsWith(\".\") ? extension : `.${extension}`).toLowerCase()\n\n/**\n * Routes each request to the client for its file's extension. `client`\n * starts, or returns, the client at an index; `started` is that client only\n * if it already runs, so `refresh` never starts a server.\n */\nconst routed = (\n configs: ReadonlyArray<Config>,\n client: (index: number) => Effect.Effect<LanguageServer.LanguageServer, StdError.StdError>,\n started: (index: number) => LanguageServer.LanguageServer | undefined\n): LanguageServer.LanguageServer => {\n const claims = configs.map((entry) => entry.extensions?.map(normalizeExtension))\n const fallback = claims.findIndex((claimed) => claimed === undefined)\n const indexOf = (path: string): Effect.Effect<number, StdError.StdError> => {\n const extension = extensionOf(path)\n const claimed = claims.findIndex((entry) => entry?.includes(extension) === true)\n const index = claimed >= 0 ? claimed : fallback\n return index >= 0\n ? Effect.succeed(index)\n : Effect.fail(\n new StdError.StdError({\n code: \"unsupported\",\n message: `No language server is configured for ${extension || \"extensionless\"} files`,\n path\n })\n )\n }\n const route = (path: string): Effect.Effect<LanguageServer.LanguageServer, StdError.StdError> =>\n Effect.flatMap(indexOf(path), client)\n const byPosition = (\n method:\n | \"hover\"\n | \"definition\"\n | \"references\"\n | \"implementation\"\n | \"prepareCallHierarchy\"\n | \"callHierarchyIncoming\"\n | \"callHierarchyOutgoing\"\n ) =>\n (position: LanguageServer.Position) => Effect.flatMap(route(position.path), (server) => server[method](position))\n const indices = configs.map((_, index) => index)\n return LanguageServer.make({\n hover: byPosition(\"hover\"),\n definition: byPosition(\"definition\"),\n references: byPosition(\"references\"),\n implementation: byPosition(\"implementation\"),\n prepareCallHierarchy: byPosition(\"prepareCallHierarchy\"),\n callHierarchyIncoming: byPosition(\"callHierarchyIncoming\"),\n callHierarchyOutgoing: byPosition(\"callHierarchyOutgoing\"),\n documentSymbols: (path) => Effect.flatMap(route(path), (server) => server.documentSymbols(path)),\n diagnostics: (path) => Effect.flatMap(route(path), (server) => server.diagnostics(path)),\n sync: (path, text) => Effect.flatMap(route(path), (server) => server.sync(path, text)),\n // A server that never started holds no open file.\n close: (path) => Effect.flatMap(indexOf(path), (index) => started(index)?.close(path) ?? Effect.void),\n refresh: Effect.suspend(() =>\n Effect.forEach(indices, (index) => started(index)?.refresh ?? Effect.void, { discard: true })\n ),\n workspaceSymbols: (query) =>\n configs.length === 1 ?\n Effect.flatMap(client(0), (server) => server.workspaceSymbols(query)) :\n Effect.forEach(\n indices,\n (index) => Effect.flatMap(client(index), (server) => server.workspaceSymbols(query)),\n { concurrency: \"unbounded\" }\n ).pipe(\n Effect.map((answers) =>\n answers.flatMap((answer) => Array.isArray(answer) ? answer : answer == null ? [] : [answer])\n )\n )\n })\n}\n\nconst configList = (\n config: Config | ReadonlyArray<Config>\n): Effect.Effect<ReadonlyArray<Config>, StdError.StdError> => {\n const configs: ReadonlyArray<Config> = Array.isArray(config) ? config : [config as Config]\n return configs.length === 0\n ? Effect.fail(failure(\"invalid_input\", \"At least one language server must be configured\"))\n : Effect.succeed(configs)\n}\n\n/**\n * Constructs scoped host language-server clients, one process per config, and\n * routes each file to the server whose `extensions` include its extension, or\n * else to the server that declares none. `workspaceSymbols` asks every server\n * and concatenates their answers.\n *\n * Every client opens a file on its first `sync` and sends the full text on\n * each later one. `diagnostics` pulls `textDocument/diagnostic`; a server that\n * answers `MethodNotFound` is read from its `textDocument/publishDiagnostics`\n * notifications instead, waiting up to `settleMs` for the latest synced text.\n *\n * Fails with `permission_denied`, before spawning, when the resolved program or\n * a file or directory named by an argument lies under `config.cwd`, or when the command is a\n * launcher (a shell, `env`, a package runner such as `npx` or `pnpm`, or `node`\n * and `bun` given inline code or a preload) whose arguments choose what runs.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const make = (\n config: Config | ReadonlyArray<Config>\n): Effect.Effect<\n LanguageServer.LanguageServer,\n StdError.StdError,\n ChildProcessSpawner.ChildProcessSpawner | Scope.Scope\n> =>\n Effect.gen(function*() {\n const configs = yield* configList(config)\n const clients = yield* Effect.forEach(configs, makeClient)\n return routed(configs, (index) => Effect.succeed(clients[index]!), (index) => clients[index])\n })\n\n/**\n * {@link make}, starting each server when the first request for one of its\n * files arrives rather than up front, so a host can bind servers it may never\n * need. A server starts with the services and authority of the fiber that\n * built this service, not those of the request that first needs it. A server\n * that fails to start fails that request and every later one for its files.\n * `refresh` and `close` never start a server.\n *\n * The workspace-program refusals of {@link make} still apply up front.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const makeLazy = (\n config: Config | ReadonlyArray<Config>\n): Effect.Effect<\n LanguageServer.LanguageServer,\n StdError.StdError,\n ChildProcessSpawner.ChildProcessSpawner | Scope.Scope\n> =>\n Effect.gen(function*() {\n const configs = yield* configList(config)\n for (const entry of configs) {\n const refused = workspaceProgram(entry, ChildProcessEnvironment.make(process.env, entry.environment).PATH)\n if (refused !== undefined) return yield* Effect.fail(refused)\n }\n const clients: Array<LanguageServer.LanguageServer | undefined> = configs.map(() => undefined)\n // Each server starts in a fiber forked here, so it starts with the\n // services and authority of whoever built this service, never those of\n // the request that first needs it, and lives as long as this scope.\n const starts = yield* Effect.forEach(configs, (entry, index) =>\n Effect.gen(function*() {\n const wanted = yield* Deferred.make<void>()\n const ready = yield* Deferred.make<LanguageServer.LanguageServer, StdError.StdError>()\n yield* Deferred.await(wanted).pipe(\n Effect.andThen(makeClient(entry)),\n Effect.tap((client) => Effect.sync(() => void (clients[index] = client))),\n Effect.exit,\n Effect.flatMap((exit) => Deferred.done(ready, exit)),\n Effect.forkScoped({ startImmediately: true })\n )\n return Deferred.succeed(wanted, undefined).pipe(Effect.andThen(Deferred.await(ready)))\n }))\n return routed(configs, (index) => starts[index]!, (index) => clients[index])\n })\n\n/**\n * Provides a scoped host language-server implementation.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layer = (\n config: Config | ReadonlyArray<Config>\n): Layer.Layer<LanguageServer.LanguageServer, StdError.StdError, ChildProcessSpawner.ChildProcessSpawner> =>\n Layer.effect(LanguageServer.LanguageServer, make(config))\n\n/**\n * Provides {@link makeLazy}.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layerLazy = (\n config: Config | ReadonlyArray<Config>\n): Layer.Layer<LanguageServer.LanguageServer, StdError.StdError, ChildProcessSpawner.ChildProcessSpawner> =>\n Layer.effect(LanguageServer.LanguageServer, makeLazy(config))\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,8BAAyC;AACzC,0BAAqC;AACrC,oBAAoG;AACpG,mBAA8B;AAC9B,yBAA2B;AAC3B,aAAwB;AACxB,eAA0B;AAC1B,sBAA6C;AAC7C,qBAAgC;AAChC,eAA0B;AAYnB,MAAM,oBAAoB;AAY1B,MAAM,uBAAuB;AAEpC,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AAMzB,MAAM,iBAAiB;AAEvB,MAAM,qBAAqB;AAuD3B,MAAM,mBAAmB;AAEzB,MAAM,eAAiD;AAAA,EACrD,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO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M,UAAU,GAAI,QAAQ,OAAO,KAAK,CAAC,IAAI,+CAAY,CAAA;AAChE;;;;;GAKG;AACH,eAAO,MAAM,YAAY,UAA+B,CAAA;AACxD;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;CAAsF,CAAA;AAIvG;;;;;GAKG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;yDA0EsD,CAAA"}
@@ -41,8 +41,8 @@ __export(WebFetch_exports, {
41
41
  module.exports = __toCommonJS(WebFetch_exports);
42
42
  var HttpClient = __toESM(require("@smthrs/kernel/HttpClient"), 1);
43
43
  var Effect = __toESM(require("effect/Effect"), 1);
44
+ var HttpClientRequest = __toESM(require("effect/http/HttpClientRequest"), 1);
44
45
  var Schema = __toESM(require("effect/Schema"), 1);
45
- var HttpClientRequest = __toESM(require("effect/unstable/http/HttpClientRequest"), 1);
46
46
  var import_Declaration = require("./internal/Declaration.js");
47
47
  var import_Html = require("./internal/Html.js");
48
48
  var import_Http = require("./internal/Http.js");