@askdkc/dsh-lsp-server 0.1.16 → 0.1.18

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 (35) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +10 -4
  3. package/docs/usage.md +8 -4
  4. package/lib/{code-intelligence-BUs39chK.js → code-intelligence-BbjV-vXG.js} +244 -32
  5. package/lib/code-intelligence-BbjV-vXG.js.map +1 -0
  6. package/lib/code-intelligence.js +1 -1
  7. package/lib/extra-tool.js +15 -11
  8. package/lib/extra-tool.js.map +1 -1
  9. package/lib/grammars/manifest.json +180 -0
  10. package/lib/grammars/tree-sitter-bash.wasm +0 -0
  11. package/lib/grammars/tree-sitter-c.wasm +0 -0
  12. package/lib/grammars/tree-sitter-c_sharp.wasm +0 -0
  13. package/lib/grammars/tree-sitter-cpp.wasm +0 -0
  14. package/lib/grammars/tree-sitter-css.wasm +0 -0
  15. package/lib/grammars/tree-sitter-go.wasm +0 -0
  16. package/lib/grammars/tree-sitter-haskell.wasm +0 -0
  17. package/lib/grammars/tree-sitter-html.wasm +0 -0
  18. package/lib/grammars/tree-sitter-java.wasm +0 -0
  19. package/lib/grammars/tree-sitter-json.wasm +0 -0
  20. package/lib/grammars/tree-sitter-julia.wasm +0 -0
  21. package/lib/grammars/tree-sitter-ocaml.wasm +0 -0
  22. package/lib/grammars/tree-sitter-ocaml_interface.wasm +0 -0
  23. package/lib/grammars/tree-sitter-python.wasm +0 -0
  24. package/lib/grammars/tree-sitter-ql_dbscheme.wasm +0 -0
  25. package/lib/grammars/tree-sitter-ruby.wasm +0 -0
  26. package/lib/grammars/tree-sitter-rust.wasm +0 -0
  27. package/lib/grammars/tree-sitter-scala.wasm +0 -0
  28. package/lib/parser-worker.mjs +18 -0
  29. package/lib/provider.js +70 -2
  30. package/lib/provider.js.map +1 -1
  31. package/lib/types/extra-tool.d.ts +2 -1
  32. package/lib/types/servers/typescript-diagnostics.d.ts +3 -0
  33. package/lib/types/structure/types.d.ts +1 -1
  34. package/package.json +58 -30
  35. package/lib/code-intelligence-BUs39chK.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Wait for all TypeScript diagnostic passes via correlated tsserver responses instead of accepting an early empty push notification. Update TypeScript Language Server to 4.4.1 for its read-only tsserver request API.
6
+ - Update bundled LSP packages and development services to DSH `0.2.2-rc.1`, Cordis 4.1, and Schemastery 3.19; require Node.js 24.9+.
7
+ - Preserve patched Undici 8.12.3 and Zod 4.6.7 in this repository’s dependency resolution when upstream pins older versions.
8
+ - Follow DSH’s effective session working directory for diagnostics, completion, snapshots, structure, and semantic queries, including directory recovery.
9
+ - Exercise the current native tool executor, working-directory changes, and packed bundle against DSH `0.2.2-rc.1`; older host versions are no longer covered.
10
+
11
+ - Expand bundled Tree-sitter structure support from 4 grammars to 21: Bash, C, C#, C++, CSS, Go, Haskell,
12
+ HTML, Java, JSON, Julia, OCaml, OCaml interface, Python, QL DBScheme, Ruby, Rust, and Scala, alongside the
13
+ existing JavaScript, TypeScript, TSX, and PHP. Each grammar is pinned by version, upstream commit, ABI, and
14
+ SHA-256, and registers `declarations` queries with selective `imports`/`calls` coverage.
5
15
  - Align the LSP service, tool, host peers, and development dependencies with DSH `0.2.0-rc.2` so the plugin loads on that runtime.
6
16
  - Require Node.js 22.19+ or 24+ to match DSH 0.2.0.
7
17
  - Use the same DSH launcher for plugin installation and Web startup.
package/README.md CHANGED
@@ -6,16 +6,22 @@ Markdown and other unsupported documents return an explicit `skipped` diagnostic
6
6
 
7
7
  ## Read-only code structure
8
8
 
9
- The provider also bundles Tree-sitter WASM grammars for JavaScript, TypeScript, TSX, and PHP. Svelte instance and module scripts reuse the JavaScript/TypeScript grammars, with ranges mapped back to the component snapshot. Through `lsp_extra`, open a workspace-relative snapshot, use its opaque handle with `structure` (`outline`, `enclosing`, `query`, or bounded `span`) or `semantic` operations, then release the snapshot. Structure and semantic positions use zero-based UTF-16 coordinates; completion keeps its existing one-based coordinates. Only registered query IDs (`declarations`, `calls`, `imports`) are accepted. No edits or arbitrary Tree-sitter queries are exposed.
9
+ The provider also bundles 21 Tree-sitter WASM grammars: Bash, C, C#, C++, CSS, Go, Haskell, HTML, Java,
10
+ JavaScript, JSON, Julia, OCaml (implementation and interface), PHP, Python, QL DBScheme, Ruby, Rust,
11
+ Scala, TypeScript, and TSX. Every grammar is pinned by npm version, upstream commit, license, ABI version,
12
+ and SHA-256 in `src/structure/grammars/manifest.json`; the build fails if an asset does not match. Svelte instance and module scripts reuse the JavaScript/TypeScript grammars, with ranges mapped back to the component snapshot. Through `lsp_extra`, open a workspace-relative snapshot, use its opaque handle with `structure` (`outline`, `enclosing`, `query`, or bounded `span`) or `semantic` operations, then release the snapshot. Structure and semantic positions use zero-based UTF-16 coordinates; completion keeps its existing one-based coordinates. Only registered query IDs (`declarations`, `calls`, `imports`) are accepted. No edits or arbitrary Tree-sitter queries are exposed.
10
13
 
11
14
  For example, inspect parser availability, open `src/index.ts` with `operation: "snapshot", action: "open", file_path: "src/index.ts"`, pass the returned handle to `operation: "structure", action: "outline"`, and release it with `operation: "snapshot", action: "release"`. Snapshot documents are capped at 2 MiB; outline/query results, source spans, responses, and evaluation budgets are bounded. Unsupported languages or unavailable semantic servers are reported explicitly rather than treated as empty successful results. Tree-sitter cache entries are bounded and released with their snapshots or worker lifetime.
12
15
 
13
- PHP supports `declarations` (named classes, functions, and methods) and the corresponding outline, enclosing, and span operations without PHPantom. Svelte supports the registered JavaScript/TypeScript queries inside top-level `<script>` blocks, including `lang="ts"`, `module`, and `context="module"`; markup and styles are not code declarations. Positions and spans refer to the original component snapshot, not extracted scripts (DSH may normalize line endings and strip a UTF-8 BOM when reading text). Blade, HTML, CSS, and Rust structural grammars are not included; their existing LSP routing does not imply structural-parser support.
16
+ PHP supports `declarations` (named classes, functions, and methods) and the corresponding outline, enclosing, and span operations without PHPantom. Svelte supports the registered JavaScript/TypeScript queries inside top-level `<script>` blocks, including `lang="ts"`, `module`, and `context="module"`; markup and styles are not code declarations. Positions and spans refer to the original component snapshot, not extracted scripts (DSH may normalize line endings and strip a UTF-8 BOM when reading text). Blade templates and Markdown are intentionally not parsed: Blade mixes template syntax that is not PHP, and
17
+ Markdown is prose rather than code structure. Their existing LSP routing does not imply structural-parser support.
18
+ Run `lsp_extra` with `operation: "status"` or `operation: "capabilities"` to list the grammars, their file
19
+ extensions, ABI versions, and current availability.
14
20
 
15
21
  ## Requirements
16
22
 
17
- - Node.js 22.19+ (22.x) or 24+
18
- - DSH providing the `fs`, `subprocess`, `tools`, and `systemPrompt` services
23
+ - Node.js 24.9+
24
+ - DSH `0.2.2-rc.1`, providing `fs`, `subprocess`, `tools`, `systemPrompt`, and `workingDirectory`, with a tool executor registered
19
25
  - PHPantom for PHP/Blade support (`phpantom_lsp` must be in `PATH`)
20
26
 
21
27
  This plugin imposes no DSH version range at startup: imports and initialization report actual failures. This does not guarantee compatibility with every future DSH API.
package/docs/usage.md CHANGED
@@ -26,9 +26,9 @@ pnpm dsh plugin --profile web list @askdkc/dsh-lsp-server --depth 0
26
26
 
27
27
  pnpm may warn about missing DSH peer packages because the profile has peer auto-installation disabled. DSH resolves those host services from its own installation; do not add duplicate host packages to the profile just to silence pnpm. Older releases with exact host peers may still be skipped; install the updated release to remove that version gate.
28
28
 
29
- The bundle adds `lsp`, `lsp-webstack-provider`, `tool-lsp`, and `tool-lsp-extra` rows. Its `@deepseek-ai/dsh-lsp` and `@deepseek-ai/dsh-tool-lsp` dependencies are installed automatically; do not install them separately. The harness still provides the profile's `fs`, `subprocess`, `tools`, and `systemPrompt` services and the shared Cordis instance. Installing this package does not install the harness itself.
29
+ The bundle adds `lsp`, `lsp-webstack-provider`, `tool-lsp`, and `tool-lsp-extra` rows. Its `@deepseek-ai/dsh-lsp` and `@deepseek-ai/dsh-tool-lsp` dependencies are installed automatically; do not install them separately. The harness still provides the profile's `fs`, `subprocess`, `tools`, `systemPrompt`, and `workingDirectory` services and the shared Cordis instance. Installing this package does not install the harness itself.
30
30
 
31
- The four DSH host peers use `*`, including prereleases in DSH's compatibility evaluator. All four bundle rows resolve through this package's own entry points; `/lsp` and `/tool-lsp` re-export the upstream implementations without catching import or initialization errors. The LSP dependencies and development host packages remain pinned to `0.2.0-rc.2` for reproducible builds and tests; those pins do not restrict the host version at startup. Future API compatibility is not guaranteed.
31
+ The five DSH host peers use `*`, including prereleases in DSH's compatibility evaluator. All four bundle rows resolve through this package's own entry points; `/lsp` and `/tool-lsp` re-export the upstream implementations without catching import or initialization errors. The LSP dependencies and development host packages are pinned to `0.2.2-rc.1` for reproducible builds and tests; those pins do not restrict the host version at startup. Cordis and Schemastery follow the current host (`~4.1.0` and `~3.19.0`). Node.js 24.9+ and a registered tool executor are required. Older DSH runtimes are no longer covered by this release; future API compatibility is not guaranteed.
32
32
 
33
33
  DSH may stop `plugin add` with `ERR_PNPM_IGNORED_BUILDS` for `core-js`, a dependency of the bundled HTML/CSS server. Decide whether to allow its build script in DSH's plugin manager. To **deny** the script from the CLI, set `allowBuilds.core-js: false` in the selected profile's `pnpm-workspace.yaml` before adding this bundle:
34
34
 
@@ -62,10 +62,12 @@ Additional tool calls:
62
62
  {"operation":"completion","file_path":"src/app.ts","line":12,"character":8}
63
63
  ```
64
64
 
65
- Both tools obtain the workspace from the **calling session**. Completion's line and character are **one-based UTF-16**; diagnostic/output ranges are **zero-based UTF-16**. The model cannot supply a different workspace root. The underlying service API uses zero-based positions.
65
+ Both tools obtain the effective workspace from DSH’s **workingDirectory service for the calling session**, including directory changes and recovery when the current directory disappears. Snapshot handles remain scoped to their owner, session, and workspace; they cannot be used from a different current workspace. Completion's line and character are **one-based UTF-16**; diagnostic/output ranges are **zero-based UTF-16**. The model cannot supply a different workspace root. The underlying service API uses zero-based positions.
66
66
 
67
67
  Diagnostics on existing unsupported documents such as `PLAN.md` return `{"diagnostics":[],"skipped":{"reason":"unsupported_file_type","filePath":"PLAN.md"}}`. This means no static check was performed; use document content and structure checks instead. Missing files, workspace escapes, read-limit failures, and failures from a supported primary server remain errors. `status.supportedFileSuffixes` describes routing support, while `servers` separately describes enabled/available servers.
68
68
 
69
+ Bundled TypeScript diagnostics wait for the syntax, semantic, and suggestion passes through TypeScript Language Server's `typescript.tsserverRequest` command. An early empty push notification is not treated as a completed check. Failed, timed-out, or malformed diagnostic responses remain errors.
70
+
69
71
  Hover and completion can include Tailwind results. Completion ranks the typed prefix before truncating large catalogs. Diagnostics report omitted auxiliary servers; no publication before the deadline is a failure, not a clean-file result. Unsupported navigation returns `LSP_UNSUPPORTED_OPERATION`.
70
72
 
71
73
  For servers that publish diagnostics as notifications, each diagnostic query starts a fresh process if the previous process was already used. This prevents delayed notifications from an earlier document close from being mistaken for a clean result. It adds server startup and project indexing cost to repeated diagnostic queries. Servers supporting `textDocument/diagnostic` reuse their process because responses are associated with request IDs.
@@ -123,10 +125,12 @@ pnpm test:e2e # real TS/JS, HTML, CSS, Svelte, Tailwind v3/v4
123
125
  PHPANTOM_E2E=1 pnpm test:e2e # additionally tests installed PHPantom with PHP and Blade
124
126
  ```
125
127
 
126
- The packed-artifact test installs the archive into a fresh consumer with DSH's hoisted layout, peer auto-installation disabled, and dependency scripts disabled. It provides the host service packages but does not preinstall either LSP package, then verifies official profile composition and preflight, bundle imports, both tool registrations, and real TypeScript, HTML, and CSS queries on DSH `0.2.0-rc.2` and `0.2.1-alpha.1`. It also checks that import and initialization errors retain their original cause. It also checks declaration paths and the executable doctor. The consumer install prefers cached packages but needs registry access for uncached packages or metadata. E2E needs working OS file watchers; sandboxed macOS watchers may fail with `EMFILE`.
128
+ The packed-artifact test installs the archive into a fresh consumer with DSH's hoisted layout, peer auto-installation disabled, and dependency scripts disabled. It provides the host service packages but does not preinstall either LSP package, then verifies official profile composition and preflight, bundle imports, both tool registrations, and real TypeScript, HTML, and CSS queries on DSH `0.2.2-rc.1` through its native tool executor. It also checks that import and initialization errors retain their original cause. It also checks declaration paths and the executable doctor. The consumer install prefers cached packages but needs registry access for uncached packages or metadata. E2E needs working OS file watchers; sandboxed macOS watchers may fail with `EMFILE`.
127
129
 
128
130
  Integration tests run against the published DSH service/tool packages and Cordis versions recorded in the lockfile. The packed consumers use the published DSH runtimes named above. Future versions (`0.3.0-alpha.1` and `1.0.0`) are simulated only as version inputs to the official compatibility evaluator, not tested APIs. The full Web UI and a source-built upstream application are not exercised here.
129
131
 
132
+ Repository overrides retain patched Undici 8.12.3 and Zod 4.6.7 for local development and CI. Dependency overrides do not propagate from an installed plugin into its host; the packed-consumer test uses the official host dependency versions without these overrides.
133
+
130
134
  ### Dependency security
131
135
 
132
136
  This repository pins Vite to 6.4.3 (which uses patched esbuild 0.25.x) and overrides the Svelte Language Server's fallback compiler to Svelte 5.55.7. These versions address [Vite's Windows path bypass](https://github.com/advisories/GHSA-fx2h-pf6j-xcff) and the [Svelte SSR](https://github.com/advisories/GHSA-pr6f-5x2q-rwfp) / [DOM clobbering](https://github.com/advisories/GHSA-rcqx-6q8c-2c42) advisories. Run `pnpm audit` from this repository root after dependency updates. The Svelte E2E tests exercise fallback compilation with both legacy and rune syntax, including diagnostics after edits.
@@ -18,7 +18,47 @@ const EXTENSION_LANGUAGE = {
18
18
  ".cts": "typescript",
19
19
  ".tsx": "tsx",
20
20
  ".php": "php",
21
- ".svelte": "svelte"
21
+ ".svelte": "svelte",
22
+ ".sh": "bash",
23
+ ".bash": "bash",
24
+ ".zsh": "bash",
25
+ ".ksh": "bash",
26
+ ".c": "c",
27
+ ".h": "c",
28
+ ".cc": "cpp",
29
+ ".cpp": "cpp",
30
+ ".cxx": "cpp",
31
+ ".hpp": "cpp",
32
+ ".hh": "cpp",
33
+ ".hxx": "cpp",
34
+ ".c++": "cpp",
35
+ ".h++": "cpp",
36
+ ".cs": "c_sharp",
37
+ ".csx": "c_sharp",
38
+ ".css": "css",
39
+ ".go": "go",
40
+ ".hs": "haskell",
41
+ ".hsc": "haskell",
42
+ ".html": "html",
43
+ ".htm": "html",
44
+ ".xhtml": "html",
45
+ ".java": "java",
46
+ ".json": "json",
47
+ ".jsonc": "json",
48
+ ".jl": "julia",
49
+ ".ml": "ocaml",
50
+ ".mli": "ocaml_interface",
51
+ ".py": "python",
52
+ ".pyi": "python",
53
+ ".pyw": "python",
54
+ ".dbscheme": "ql_dbscheme",
55
+ ".rb": "ruby",
56
+ ".rake": "ruby",
57
+ ".gemspec": "ruby",
58
+ ".rs": "rust",
59
+ ".scala": "scala",
60
+ ".sc": "scala",
61
+ ".sbt": "scala"
22
62
  };
23
63
  var DocumentSnapshotStore = class {
24
64
  records = /* @__PURE__ */ new Map();
@@ -259,6 +299,15 @@ function isBetweenSurrogatePair(text, index) {
259
299
 
260
300
  //#endregion
261
301
  //#region src/structure/queries.ts
302
+ const TS_DECLARATIONS = [
303
+ "(function_declaration name: (_) @name) @declaration",
304
+ "(class_declaration name: (_) @name) @declaration",
305
+ "(interface_declaration name: (_) @name) @declaration",
306
+ "(type_alias_declaration name: (_) @name) @declaration",
307
+ "(enum_declaration name: (_) @name) @declaration",
308
+ "(method_definition name: (_) @name) @declaration",
309
+ "(variable_declarator name: (_) @name) @declaration"
310
+ ];
262
311
  const declarations = {
263
312
  php: [
264
313
  "(class_declaration name: (_) @name) @declaration",
@@ -271,34 +320,122 @@ const declarations = {
271
320
  "(method_definition name: (_) @name) @declaration",
272
321
  "(variable_declarator name: (_) @name) @declaration"
273
322
  ],
274
- typescript: [
275
- "(function_declaration name: (_) @name) @declaration",
276
- "(class_declaration name: (_) @name) @declaration",
277
- "(interface_declaration name: (_) @name) @declaration",
278
- "(type_alias_declaration name: (_) @name) @declaration",
279
- "(enum_declaration name: (_) @name) @declaration",
280
- "(method_definition name: (_) @name) @declaration",
281
- "(variable_declarator name: (_) @name) @declaration"
323
+ typescript: TS_DECLARATIONS,
324
+ tsx: TS_DECLARATIONS,
325
+ bash: ["(function_definition name: (word) @name) @declaration"],
326
+ c: [
327
+ "(function_definition declarator: (function_declarator declarator: (identifier) @name)) @declaration",
328
+ "(struct_specifier name: (type_identifier) @name) @declaration",
329
+ "(union_specifier name: (type_identifier) @name) @declaration",
330
+ "(enum_specifier name: (type_identifier) @name) @declaration"
282
331
  ],
283
- tsx: [
284
- "(function_declaration name: (_) @name) @declaration",
285
- "(class_declaration name: (_) @name) @declaration",
286
- "(interface_declaration name: (_) @name) @declaration",
287
- "(type_alias_declaration name: (_) @name) @declaration",
288
- "(enum_declaration name: (_) @name) @declaration",
289
- "(method_definition name: (_) @name) @declaration",
290
- "(variable_declarator name: (_) @name) @declaration"
332
+ cpp: [
333
+ "(class_specifier name: (type_identifier) @name) @declaration",
334
+ "(struct_specifier name: (type_identifier) @name) @declaration",
335
+ "(union_specifier name: (type_identifier) @name) @declaration",
336
+ "(enum_specifier name: (type_identifier) @name) @declaration",
337
+ "(namespace_definition name: (namespace_identifier) @name) @declaration",
338
+ "(function_definition declarator: (function_declarator declarator: [(identifier) (field_identifier) (qualified_identifier)] @name)) @declaration"
339
+ ],
340
+ c_sharp: [
341
+ "(class_declaration name: (identifier) @name) @declaration",
342
+ "(interface_declaration name: (identifier) @name) @declaration",
343
+ "(struct_declaration name: (identifier) @name) @declaration",
344
+ "(enum_declaration name: (identifier) @name) @declaration",
345
+ "(record_declaration name: (identifier) @name) @declaration",
346
+ "(method_declaration name: (identifier) @name) @declaration"
347
+ ],
348
+ css: ["(rule_set (selectors) @name) @declaration"],
349
+ go: [
350
+ "(function_declaration name: (identifier) @name) @declaration",
351
+ "(method_declaration name: (field_identifier) @name) @declaration",
352
+ "(type_spec name: (type_identifier) @name) @declaration"
353
+ ],
354
+ haskell: [
355
+ "(signature name: (variable) @name) @declaration",
356
+ "(function name: (variable) @name) @declaration",
357
+ "(data_type name: (name) @name) @declaration",
358
+ "(newtype name: (name) @name) @declaration",
359
+ "(type_synomym name: (name) @name) @declaration",
360
+ "(class name: (name) @name) @declaration"
361
+ ],
362
+ html: ["(element (start_tag (tag_name) @name)) @declaration"],
363
+ java: [
364
+ "(class_declaration name: (identifier) @name) @declaration",
365
+ "(interface_declaration name: (identifier) @name) @declaration",
366
+ "(enum_declaration name: (identifier) @name) @declaration",
367
+ "(record_declaration name: (identifier) @name) @declaration",
368
+ "(annotation_type_declaration name: (identifier) @name) @declaration",
369
+ "(method_declaration name: (identifier) @name) @declaration"
370
+ ],
371
+ json: ["(pair key: (string) @name) @declaration"],
372
+ julia: [
373
+ "(function_definition (signature (call_expression (identifier) @name))) @declaration",
374
+ "(struct_definition (type_head (identifier) @name)) @declaration",
375
+ "(abstract_definition (type_head (identifier) @name)) @declaration",
376
+ "(macro_definition (signature (call_expression (identifier) @name))) @declaration"
377
+ ],
378
+ ocaml: [
379
+ "(value_definition (let_binding pattern: (value_name) @name)) @declaration",
380
+ "(type_definition (type_binding name: (type_constructor) @name)) @declaration",
381
+ "(module_definition (module_binding (module_name) @name)) @declaration"
382
+ ],
383
+ ocaml_interface: [
384
+ "(value_specification (value_name) @name) @declaration",
385
+ "(type_definition (type_binding name: (type_constructor) @name)) @declaration",
386
+ "(module_definition (module_binding (module_name) @name)) @declaration"
387
+ ],
388
+ python: ["(class_definition name: (identifier) @name) @declaration", "(function_definition name: (identifier) @name) @declaration"],
389
+ ql_dbscheme: ["(table tableName: (tableName) @name) @declaration"],
390
+ ruby: [
391
+ "(class name: (constant) @name) @declaration",
392
+ "(module name: (constant) @name) @declaration",
393
+ "(method name: (identifier) @name) @declaration",
394
+ "(singleton_method name: (identifier) @name) @declaration"
395
+ ],
396
+ rust: [
397
+ "(function_item name: (identifier) @name) @declaration",
398
+ "(struct_item name: (type_identifier) @name) @declaration",
399
+ "(enum_item name: (type_identifier) @name) @declaration",
400
+ "(trait_item name: (type_identifier) @name) @declaration",
401
+ "(mod_item name: (identifier) @name) @declaration",
402
+ "(type_item name: (type_identifier) @name) @declaration"
403
+ ],
404
+ scala: [
405
+ "(class_definition name: (identifier) @name) @declaration",
406
+ "(object_definition name: (identifier) @name) @declaration",
407
+ "(trait_definition name: (identifier) @name) @declaration",
408
+ "(function_definition name: (identifier) @name) @declaration"
291
409
  ]
292
410
  };
293
411
  const imports = {
294
412
  javascript: ["(import_statement) @import", "(export_statement) @export"],
295
413
  typescript: ["(import_statement) @import", "(export_statement) @export"],
296
- tsx: ["(import_statement) @import", "(export_statement) @export"]
414
+ tsx: ["(import_statement) @import", "(export_statement) @export"],
415
+ python: ["(import_statement) @import", "(import_from_statement) @import"],
416
+ go: ["(import_declaration) @import"],
417
+ rust: ["(use_declaration) @import"],
418
+ java: ["(import_declaration) @import"],
419
+ c_sharp: ["(using_directive) @import"],
420
+ cpp: ["(preproc_include) @import"],
421
+ c: ["(preproc_include) @import"],
422
+ scala: ["(import_declaration) @import"],
423
+ julia: ["(import_statement) @import", "(using_statement) @import"]
297
424
  };
298
425
  const calls = {
299
426
  javascript: ["(call_expression function: (_) @call) @callsite"],
300
427
  typescript: ["(call_expression function: (_) @call) @callsite"],
301
- tsx: ["(call_expression function: (_) @call) @callsite"]
428
+ tsx: ["(call_expression function: (_) @call) @callsite"],
429
+ python: ["(call function: (_) @call) @callsite"],
430
+ go: ["(call_expression function: (_) @call) @callsite"],
431
+ rust: ["(call_expression function: (_) @call) @callsite"],
432
+ java: ["(method_invocation name: (_) @call) @callsite"],
433
+ c_sharp: ["(invocation_expression function: (_) @call) @callsite"],
434
+ cpp: ["(call_expression function: (_) @call) @callsite"],
435
+ c: ["(call_expression function: (_) @call) @callsite"],
436
+ ruby: ["(call method: (_) @call) @callsite"],
437
+ scala: ["(call_expression function: (_) @call) @callsite"],
438
+ julia: ["(call_expression (identifier) @call) @callsite"]
302
439
  };
303
440
  function getRegisteredQuery(language, queryId) {
304
441
  return (queryId === "declarations" ? declarations[language] : queryId === "calls" ? calls[language] : queryId === "imports" ? imports[language] : void 0)?.join("\n");
@@ -629,7 +766,55 @@ var StructureEngine = class {
629
766
  ], 14),
630
767
  this.capability("tsx", [".tsx"], 14),
631
768
  this.capability("php", [".php"], 15),
632
- this.capability("svelte", [".svelte"], null)
769
+ this.capability("svelte", [".svelte"], null),
770
+ this.capability("bash", [
771
+ ".sh",
772
+ ".bash",
773
+ ".zsh",
774
+ ".ksh"
775
+ ], 15),
776
+ this.capability("c", [".c", ".h"], 15),
777
+ this.capability("cpp", [
778
+ ".cc",
779
+ ".cpp",
780
+ ".cxx",
781
+ ".hpp",
782
+ ".hh",
783
+ ".hxx",
784
+ ".c++",
785
+ ".h++"
786
+ ], 14),
787
+ this.capability("c_sharp", [".cs", ".csx"], 15),
788
+ this.capability("css", [".css"], 15),
789
+ this.capability("go", [".go"], 15),
790
+ this.capability("haskell", [".hs", ".hsc"], 14),
791
+ this.capability("html", [
792
+ ".html",
793
+ ".htm",
794
+ ".xhtml"
795
+ ], 14),
796
+ this.capability("java", [".java"], 14),
797
+ this.capability("json", [".json", ".jsonc"], 14),
798
+ this.capability("julia", [".jl"], 14),
799
+ this.capability("ocaml", [".ml"], 14),
800
+ this.capability("ocaml_interface", [".mli"], 14),
801
+ this.capability("python", [
802
+ ".py",
803
+ ".pyi",
804
+ ".pyw"
805
+ ], 15),
806
+ this.capability("ql_dbscheme", [".dbscheme"], 14),
807
+ this.capability("ruby", [
808
+ ".rb",
809
+ ".rake",
810
+ ".gemspec"
811
+ ], 14),
812
+ this.capability("rust", [".rs"], 14),
813
+ this.capability("scala", [
814
+ ".scala",
815
+ ".sc",
816
+ ".sbt"
817
+ ], 14)
633
818
  ];
634
819
  }
635
820
  async dispose() {
@@ -729,18 +914,45 @@ function positiveLimit(value, maximum, label) {
729
914
  function publicErrors(errors) {
730
915
  return { ...errors };
731
916
  }
917
+ const PUBLIC_NODE_KINDS = {
918
+ function_declaration: "function",
919
+ function_definition: "function",
920
+ function_item: "function",
921
+ class_declaration: "class",
922
+ class_definition: "class",
923
+ class_specifier: "class",
924
+ struct_declaration: "struct",
925
+ struct_item: "struct",
926
+ struct_specifier: "struct",
927
+ struct_definition: "struct",
928
+ interface_declaration: "interface",
929
+ trait_definition: "interface",
930
+ type_alias_declaration: "type",
931
+ type_definition: "type",
932
+ type_item: "type",
933
+ type_spec: "type",
934
+ type_binding: "type",
935
+ type_synomym: "type",
936
+ enum_declaration: "enum",
937
+ enum_item: "enum",
938
+ enum_specifier: "enum",
939
+ method_definition: "method",
940
+ method_declaration: "method",
941
+ variable_declarator: "variable",
942
+ value_definition: "variable",
943
+ value_specification: "value",
944
+ module_definition: "module",
945
+ mod_item: "module",
946
+ namespace_definition: "module",
947
+ namespace_declaration: "module",
948
+ data_type: "data",
949
+ newtype: "data",
950
+ abstract_definition: "abstract",
951
+ record_declaration: "record",
952
+ annotation_type_declaration: "annotation"
953
+ };
732
954
  function publicNodeKind(kind) {
733
- return {
734
- function_declaration: "function",
735
- function_definition: "function",
736
- class_declaration: "class",
737
- interface_declaration: "interface",
738
- type_alias_declaration: "type",
739
- enum_declaration: "enum",
740
- method_definition: "method",
741
- method_declaration: "method",
742
- variable_declarator: "variable"
743
- }[kind] ?? kind;
955
+ return PUBLIC_NODE_KINDS[kind] ?? kind;
744
956
  }
745
957
 
746
958
  //#endregion
@@ -915,4 +1127,4 @@ function limitSemanticResult(result, limit) {
915
1127
 
916
1128
  //#endregion
917
1129
  export { DocumentSnapshotStore, createCodeIntelligenceToolServiceV1 };
918
- //# sourceMappingURL=code-intelligence-BUs39chK.js.map
1130
+ //# sourceMappingURL=code-intelligence-BbjV-vXG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-intelligence-BbjV-vXG.js","names":["EXTENSION_LANGUAGE: Record<string, StructureLanguage>","readSource: SnapshotReader","maxDocumentBytes: number","descriptor: SnapshotDescriptor","record: SnapshotRecord","text: string","declarations: Partial<Record<StructureLanguage, string[]>>","imports: Partial<Record<StructureLanguage, string[]>>","calls: Partial<Record<StructureLanguage, string[]>>","task: PendingTask","slot: WorkerSlot","declarations: StructureNode[]","declarations","captures: StructureCapture[]","PUBLIC_NODE_KINDS: Record<string, string>","value: SemanticResult","record: Awaited<ReturnType<DocumentSnapshotStore['current']>>"],"sources":["../src/structure/snapshots.ts","../src/structure/coordinates.ts","../src/structure/queries.ts","../src/structure/worker-pool.ts","../src/structure/engine.ts","../src/structure/code-intelligence.ts"],"sourcesContent":["import { createHash, randomUUID } from 'node:crypto'\nimport { isAbsolute } from 'node:path'\nimport { WebstackLspError } from '../errors.js'\nimport type { HostSource } from '../host/dsh.js'\nimport type { SnapshotDescriptor, SnapshotScope, StructureLanguage } from './types.js'\n\nexport const SNAPSHOT_TTL_MS = 5 * 60_000\nexport const SNAPSHOT_MAX_DOCUMENTS = 32\nexport const SNAPSHOT_MAX_BYTES = 32 * 1024 * 1024\nexport const STRUCTURE_MAX_DOCUMENT_BYTES = 2 * 1024 * 1024\n\nexport interface SnapshotRecord {\n readonly descriptor: SnapshotDescriptor\n readonly scopeKey: string\n readonly source: HostSource\n readonly previousSnapshotHandle?: string\n readonly openedAt: number\n lastUsedAt: number\n}\n\ninterface VersionRecord { hash: string; version: number; scopeKey: string }\n\nexport type SnapshotReader = (workspaceRoot: string, filePath: string, maxBytes: number, signal?: AbortSignal) => Promise<HostSource>\n\nconst EXTENSION_LANGUAGE: Record<string, StructureLanguage> = {\n '.js': 'javascript', '.jsx': 'javascript', '.mjs': 'javascript', '.cjs': 'javascript',\n '.ts': 'typescript', '.mts': 'typescript', '.cts': 'typescript',\n '.tsx': 'tsx',\n '.php': 'php', '.svelte': 'svelte',\n '.sh': 'bash', '.bash': 'bash', '.zsh': 'bash', '.ksh': 'bash',\n '.c': 'c', '.h': 'c',\n '.cc': 'cpp', '.cpp': 'cpp', '.cxx': 'cpp', '.hpp': 'cpp', '.hh': 'cpp', '.hxx': 'cpp', '.c++': 'cpp', '.h++': 'cpp',\n '.cs': 'c_sharp', '.csx': 'c_sharp',\n '.css': 'css',\n '.go': 'go',\n '.hs': 'haskell', '.hsc': 'haskell',\n '.html': 'html', '.htm': 'html', '.xhtml': 'html',\n '.java': 'java',\n '.json': 'json', '.jsonc': 'json',\n '.jl': 'julia',\n '.ml': 'ocaml', '.mli': 'ocaml_interface',\n '.py': 'python', '.pyi': 'python', '.pyw': 'python',\n '.dbscheme': 'ql_dbscheme',\n '.rb': 'ruby', '.rake': 'ruby', '.gemspec': 'ruby',\n '.rs': 'rust',\n '.scala': 'scala', '.sc': 'scala', '.sbt': 'scala',\n}\n\nexport class DocumentSnapshotStore {\n private readonly records = new Map<string, SnapshotRecord>()\n private readonly versions = new Map<string, VersionRecord>()\n\n constructor(private readonly readSource: SnapshotReader, private readonly maxDocumentBytes: number) {}\n\n async open(scope: SnapshotScope, filePath: string, signal?: AbortSignal): Promise<SnapshotRecord> {\n validateScope(scope)\n const normalizedPath = normalizeRelativePath(filePath)\n signal?.throwIfAborted()\n const first = await this.readSource(scope.workspaceRoot, normalizedPath, Math.min(this.maxDocumentBytes, STRUCTURE_MAX_DOCUMENT_BYTES), signal)\n signal?.throwIfAborted()\n const second = await this.readSource(scope.workspaceRoot, normalizedPath, Math.min(this.maxDocumentBytes, STRUCTURE_MAX_DOCUMENT_BYTES), signal)\n if (hashText(first.text) !== hashText(second.text) || first.uri !== second.uri || first.key !== second.key)\n throw new WebstackLspError('LSP_STALE_SNAPSHOT', 'document changed while opening the snapshot')\n\n const ownerKey = scopeKey(scope)\n const hash = hashText(second.text)\n const fileKey = JSON.stringify([ownerKey, second.key, second.uri])\n const version = this.rememberVersion(fileKey, scope, hash)\n const sourceBytes = Buffer.byteLength(second.text, 'utf8')\n this.evictExpired()\n if (this.records.size >= SNAPSHOT_MAX_DOCUMENTS || this.totalBytes() + sourceBytes > SNAPSHOT_MAX_BYTES)\n throw new WebstackLspError('LSP_SNAPSHOT_LIMIT', 'snapshot capacity is full; release an existing snapshot and retry')\n\n const descriptor: SnapshotDescriptor = {\n handle: randomUUID(), version, filePath: normalizedPath,\n language: languageForPath(normalizedPath), sourceKind: 'disk', contentHash: hash, sourceBytes,\n }\n const previous = [...this.records.values()]\n .filter(item => item.scopeKey === ownerKey && item.source.key === second.key && item.source.uri === second.uri)\n .sort((a, b) => b.openedAt - a.openedAt)[0]\n const record: SnapshotRecord = {\n descriptor, scopeKey: ownerKey, source: second, openedAt: Date.now(), lastUsedAt: Date.now(),\n ...(previous ? { previousSnapshotHandle: previous.descriptor.handle } : {}),\n }\n this.records.set(descriptor.handle, record)\n return record\n }\n\n async current(scope: SnapshotScope, handle: string, signal?: AbortSignal): Promise<SnapshotRecord> {\n validateScope(scope)\n signal?.throwIfAborted()\n const record = this.records.get(handle)\n if (!record || record.scopeKey !== scopeKey(scope)) throw staleSnapshot()\n if (Date.now() - record.openedAt > SNAPSHOT_TTL_MS) {\n this.records.delete(handle)\n throw staleSnapshot()\n }\n const current = await this.readSource(scope.workspaceRoot, record.descriptor.filePath, Math.min(this.maxDocumentBytes, STRUCTURE_MAX_DOCUMENT_BYTES), signal)\n signal?.throwIfAborted()\n if (current.uri !== record.source.uri || current.key !== record.source.key || hashText(current.text) !== record.descriptor.contentHash) {\n this.records.delete(handle)\n throw staleSnapshot()\n }\n record.lastUsedAt = Date.now()\n return record\n }\n\n async readFresh(scope: SnapshotScope, filePath: string, signal?: AbortSignal): Promise<HostSource> {\n validateScope(scope)\n signal?.throwIfAborted()\n const source = await this.readSource(scope.workspaceRoot, filePath, this.maxDocumentBytes, signal)\n signal?.throwIfAborted()\n const fileKey = JSON.stringify([scopeKey(scope), source.key, source.uri])\n this.rememberVersion(fileKey, scope, hashText(source.text))\n return source\n }\n\n release(scope: SnapshotScope, handle: string): boolean {\n validateScope(scope)\n const record = this.records.get(handle)\n if (!record || record.scopeKey !== scopeKey(scope)) return false\n return this.records.delete(handle)\n }\n\n releaseOwner(scope: SnapshotScope): number {\n validateScope(scope)\n const owner = scopeKey(scope)\n let released = 0\n for (const [handle, record] of this.records) {\n if (record.scopeKey === owner) { this.records.delete(handle); released++ }\n }\n for (const [key, version] of this.versions) if (version.scopeKey === owner) this.versions.delete(key)\n return released\n }\n\n clear(): void { this.records.clear(); this.versions.clear() }\n get size(): number { return this.records.size }\n get documentByteLimit(): number { return this.maxDocumentBytes }\n\n private totalBytes(): number {\n let bytes = 0\n for (const record of this.records.values()) bytes += record.descriptor.sourceBytes\n return bytes\n }\n\n private rememberVersion(fileKey: string, scope: SnapshotScope, hash: string): number {\n const owner = scopeKey(scope), previous = this.versions.get(fileKey)\n const version = previous ? (previous.hash === hash ? previous.version : previous.version + 1) : 1\n this.versions.delete(fileKey)\n this.versions.set(fileKey, { hash, version, scopeKey: owner })\n while (this.versions.size > 4096) this.versions.delete(this.versions.keys().next().value!)\n return version\n }\n\n private evictExpired(): void {\n const now = Date.now()\n for (const [handle, record] of this.records) if (now - record.openedAt > SNAPSHOT_TTL_MS) this.records.delete(handle)\n }\n}\n\nexport function languageForPath(filePath: string): StructureLanguage | null {\n // Blade's PHP-like suffix does not make its template syntax a PHP document.\n if (filePath.toLowerCase().endsWith('.blade.php')) return null\n const suffix = filePath.slice(filePath.lastIndexOf('.')).toLowerCase()\n return EXTENSION_LANGUAGE[suffix] ?? null\n}\n\nexport function validateScope(scope: SnapshotScope): void {\n if (!scope || typeof scope !== 'object' || !scope.ownerId?.trim() || !scope.sessionId?.trim() || !scope.workspaceRoot?.trim() || !isAbsolute(scope.workspaceRoot) || /[\\u0000-\\u001f\\u007f]/u.test(`${scope.ownerId}${scope.sessionId}${scope.workspaceRoot}`))\n throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'trusted owner, session and absolute workspace root are required')\n}\n\nexport function normalizeRelativePath(filePath: string): string {\n if (typeof filePath !== 'string' || !filePath.trim() || filePath.length > 4096 || /[\\u0000-\\u001f\\u007f]/u.test(filePath) || isAbsolute(filePath))\n throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'file path must be a relative workspace path')\n const segments = filePath.replaceAll('\\\\', '/').split('/')\n if (segments.some(segment => segment === '..' || segment === '')) throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'file path contains an invalid segment')\n return segments.filter(segment => segment !== '.').join('/')\n}\n\nexport function scopeIdentity(scope: SnapshotScope): string { return JSON.stringify([scope.ownerId, scope.sessionId, scope.workspaceRoot]) }\nfunction scopeKey(scope: SnapshotScope): string { return scopeIdentity(scope) }\nfunction hashText(text: string): string { return createHash('sha256').update(text, 'utf8').digest('hex') }\nfunction staleSnapshot(): WebstackLspError { return new WebstackLspError('LSP_STALE_SNAPSHOT', 'snapshot is stale, expired or belongs to another owner') }\n","import type { LspPosition, LspRange } from '../service.js'\n\ninterface Line { start: number; end: number }\n\n/** web-tree-sitter 0.27.1 exposes JS-string indices as UTF-16 code-unit offsets. */\nexport class Utf16Coordinates {\n private readonly lines: Line[]\n\n constructor(private readonly text: string) {\n this.lines = []\n let start = 0\n for (let index = 0; index < text.length;) {\n const char = text[index]!\n if (char !== '\\r' && char !== '\\n') { index++; continue }\n this.lines.push({ start, end: index })\n if (char === '\\r' && text[index + 1] === '\\n') index++\n index++\n start = index\n }\n this.lines.push({ start, end: text.length })\n }\n\n positionToIndex(position: LspPosition): number {\n if (!isPosition(position)) throw new RangeError('position must use non-negative zero-based UTF-16 coordinates')\n const line = this.lines[position.line]\n if (!line || position.character > line.end - line.start) throw new RangeError('position is outside document')\n const index = line.start + position.character\n if (isBetweenSurrogatePair(this.text, index)) throw new RangeError('position splits a UTF-16 surrogate pair')\n return index\n }\n\n indexToPosition(index: number): LspPosition {\n if (!Number.isSafeInteger(index) || index < 0 || index > this.text.length) throw new RangeError('Tree-sitter index is outside document')\n let low = 0, high = this.lines.length\n while (low < high) {\n const middle = (low + high) >>> 1\n if (this.lines[middle]!.start <= index) low = middle + 1\n else high = middle\n }\n const lineNumber = Math.max(0, low - 1)\n const line = this.lines[lineNumber]!\n return { line: lineNumber, character: Math.min(index, line.end) - line.start }\n }\n\n rangeToIndices(range: LspRange): { startIndex: number; endIndex: number } {\n const startIndex = this.positionToIndex(range.start)\n const endIndex = this.positionToIndex(range.end)\n if (endIndex < startIndex) throw new RangeError('range end precedes range start')\n return { startIndex, endIndex }\n }\n\n indicesToRange(startIndex: number, endIndex: number): LspRange {\n if (endIndex < startIndex) throw new RangeError('range end precedes range start')\n return { start: this.indexToPosition(startIndex), end: this.indexToPosition(endIndex) }\n }\n}\n\nfunction isPosition(value: unknown): value is LspPosition {\n if (typeof value !== 'object' || value === null) return false\n const position = value as { line?: unknown; character?: unknown }\n return Number.isSafeInteger(position.line) && Number.isSafeInteger(position.character) && (position.line as number) >= 0 && (position.character as number) >= 0\n}\n\nfunction isBetweenSurrogatePair(text: string, index: number): boolean {\n if (index <= 0 || index >= text.length) return false\n const previous = text.charCodeAt(index - 1), next = text.charCodeAt(index)\n return previous >= 0xd800 && previous <= 0xdbff && next >= 0xdc00 && next <= 0xdfff\n}\n","import type { StructureLanguage } from './types.js'\n\n// TypeScript and TSX share one grammar family, so TSX accepts the same patterns.\nconst TS_DECLARATIONS = [\n '(function_declaration name: (_) @name) @declaration',\n '(class_declaration name: (_) @name) @declaration',\n '(interface_declaration name: (_) @name) @declaration',\n '(type_alias_declaration name: (_) @name) @declaration',\n '(enum_declaration name: (_) @name) @declaration',\n '(method_definition name: (_) @name) @declaration',\n '(variable_declarator name: (_) @name) @declaration',\n]\n\nconst declarations: Partial<Record<StructureLanguage, string[]>> = {\n php: [\n '(class_declaration name: (_) @name) @declaration',\n '(function_definition name: (_) @name) @declaration',\n '(method_declaration name: (_) @name) @declaration',\n ],\n javascript: [\n '(function_declaration name: (_) @name) @declaration',\n '(class_declaration name: (_) @name) @declaration',\n '(method_definition name: (_) @name) @declaration',\n '(variable_declarator name: (_) @name) @declaration',\n ],\n typescript: TS_DECLARATIONS,\n tsx: TS_DECLARATIONS,\n bash: ['(function_definition name: (word) @name) @declaration'],\n c: [\n '(function_definition declarator: (function_declarator declarator: (identifier) @name)) @declaration',\n '(struct_specifier name: (type_identifier) @name) @declaration',\n '(union_specifier name: (type_identifier) @name) @declaration',\n '(enum_specifier name: (type_identifier) @name) @declaration',\n ],\n cpp: [\n '(class_specifier name: (type_identifier) @name) @declaration',\n '(struct_specifier name: (type_identifier) @name) @declaration',\n '(union_specifier name: (type_identifier) @name) @declaration',\n '(enum_specifier name: (type_identifier) @name) @declaration',\n '(namespace_definition name: (namespace_identifier) @name) @declaration',\n '(function_definition declarator: (function_declarator declarator: [(identifier) (field_identifier) (qualified_identifier)] @name)) @declaration',\n ],\n c_sharp: [\n '(class_declaration name: (identifier) @name) @declaration',\n '(interface_declaration name: (identifier) @name) @declaration',\n '(struct_declaration name: (identifier) @name) @declaration',\n '(enum_declaration name: (identifier) @name) @declaration',\n '(record_declaration name: (identifier) @name) @declaration',\n '(method_declaration name: (identifier) @name) @declaration',\n ],\n css: ['(rule_set (selectors) @name) @declaration'],\n go: [\n '(function_declaration name: (identifier) @name) @declaration',\n '(method_declaration name: (field_identifier) @name) @declaration',\n '(type_spec name: (type_identifier) @name) @declaration',\n ],\n haskell: [\n '(signature name: (variable) @name) @declaration',\n '(function name: (variable) @name) @declaration',\n '(data_type name: (name) @name) @declaration',\n '(newtype name: (name) @name) @declaration',\n '(type_synomym name: (name) @name) @declaration',\n '(class name: (name) @name) @declaration',\n ],\n html: ['(element (start_tag (tag_name) @name)) @declaration'],\n java: [\n '(class_declaration name: (identifier) @name) @declaration',\n '(interface_declaration name: (identifier) @name) @declaration',\n '(enum_declaration name: (identifier) @name) @declaration',\n '(record_declaration name: (identifier) @name) @declaration',\n '(annotation_type_declaration name: (identifier) @name) @declaration',\n '(method_declaration name: (identifier) @name) @declaration',\n ],\n json: ['(pair key: (string) @name) @declaration'],\n julia: [\n '(function_definition (signature (call_expression (identifier) @name))) @declaration',\n '(struct_definition (type_head (identifier) @name)) @declaration',\n '(abstract_definition (type_head (identifier) @name)) @declaration',\n '(macro_definition (signature (call_expression (identifier) @name))) @declaration',\n ],\n ocaml: [\n '(value_definition (let_binding pattern: (value_name) @name)) @declaration',\n '(type_definition (type_binding name: (type_constructor) @name)) @declaration',\n '(module_definition (module_binding (module_name) @name)) @declaration',\n ],\n ocaml_interface: [\n '(value_specification (value_name) @name) @declaration',\n '(type_definition (type_binding name: (type_constructor) @name)) @declaration',\n '(module_definition (module_binding (module_name) @name)) @declaration',\n ],\n python: [\n '(class_definition name: (identifier) @name) @declaration',\n '(function_definition name: (identifier) @name) @declaration',\n ],\n ql_dbscheme: ['(table tableName: (tableName) @name) @declaration'],\n ruby: [\n '(class name: (constant) @name) @declaration',\n '(module name: (constant) @name) @declaration',\n '(method name: (identifier) @name) @declaration',\n '(singleton_method name: (identifier) @name) @declaration',\n ],\n rust: [\n '(function_item name: (identifier) @name) @declaration',\n '(struct_item name: (type_identifier) @name) @declaration',\n '(enum_item name: (type_identifier) @name) @declaration',\n '(trait_item name: (type_identifier) @name) @declaration',\n '(mod_item name: (identifier) @name) @declaration',\n '(type_item name: (type_identifier) @name) @declaration',\n ],\n scala: [\n '(class_definition name: (identifier) @name) @declaration',\n '(object_definition name: (identifier) @name) @declaration',\n '(trait_definition name: (identifier) @name) @declaration',\n '(function_definition name: (identifier) @name) @declaration',\n ],\n}\n\nconst imports: Partial<Record<StructureLanguage, string[]>> = {\n javascript: ['(import_statement) @import', '(export_statement) @export'],\n typescript: ['(import_statement) @import', '(export_statement) @export'],\n tsx: ['(import_statement) @import', '(export_statement) @export'],\n python: ['(import_statement) @import', '(import_from_statement) @import'],\n go: ['(import_declaration) @import'],\n rust: ['(use_declaration) @import'],\n java: ['(import_declaration) @import'],\n c_sharp: ['(using_directive) @import'],\n cpp: ['(preproc_include) @import'],\n c: ['(preproc_include) @import'],\n scala: ['(import_declaration) @import'],\n julia: ['(import_statement) @import', '(using_statement) @import'],\n}\n\nconst calls: Partial<Record<StructureLanguage, string[]>> = {\n javascript: ['(call_expression function: (_) @call) @callsite'],\n typescript: ['(call_expression function: (_) @call) @callsite'],\n tsx: ['(call_expression function: (_) @call) @callsite'],\n python: ['(call function: (_) @call) @callsite'],\n go: ['(call_expression function: (_) @call) @callsite'],\n rust: ['(call_expression function: (_) @call) @callsite'],\n java: ['(method_invocation name: (_) @call) @callsite'],\n c_sharp: ['(invocation_expression function: (_) @call) @callsite'],\n cpp: ['(call_expression function: (_) @call) @callsite'],\n c: ['(call_expression function: (_) @call) @callsite'],\n ruby: ['(call method: (_) @call) @callsite'],\n scala: ['(call_expression function: (_) @call) @callsite'],\n julia: ['(call_expression (identifier) @call) @callsite'],\n}\n\nexport type RegisteredQueryId = 'declarations' | 'calls' | 'imports'\n\nexport function getRegisteredQuery(language: StructureLanguage, queryId: string): string | undefined {\n const patterns = queryId === 'declarations' ? declarations[language] : queryId === 'calls' ? calls[language] : queryId === 'imports' ? imports[language] : undefined\n return patterns?.join('\\n')\n}\n\nexport function isRegisteredQueryId(value: string): value is RegisteredQueryId {\n return value === 'declarations' || value === 'calls' || value === 'imports'\n}\n","import { randomUUID } from 'node:crypto'\nimport { Worker } from 'node:worker_threads'\nimport { WebstackLspError } from '../errors.js'\nimport type { StructureLanguage } from './types.js'\n\nexport interface StructureWorkerRequest {\n operation: 'matches' | 'enclosing' | 'inspect'\n language: StructureLanguage\n text: string\n querySource: string\n scriptQueries?: { javascript: string; typescript: string }\n limit: number\n snapshotHandle?: string\n previousSnapshotHandle?: string\n startIndex?: number\n endIndex?: number\n index?: number\n kinds?: string[]\n}\n\nexport interface WorkerNodeSummary {\n kind: string\n startIndex: number\n endIndex: number\n startPosition: { row: number; column: number }\n endPosition: { row: number; column: number }\n nameStartIndex?: number\n nameEndIndex?: number\n childCount: number\n}\n\nexport interface WorkerErrorSummary { hasError: boolean; errorNodes: number; missingNodes: number; truncated: boolean }\nexport interface WorkerMatch { captures: Array<{ name: string } & WorkerNodeSummary> }\nexport interface StructureWorkerResult {\n status: 'ok' | 'partial'\n abiVersion?: number\n reusedTree?: boolean\n incremental?: boolean\n matches?: WorkerMatch[]\n nodes?: WorkerNodeSummary[]\n truncated?: boolean\n errors: WorkerErrorSummary\n}\n\ninterface WorkerReply { id: string; ok: boolean; value?: StructureWorkerResult; error?: string }\ninterface PendingTask {\n id: string\n request: StructureWorkerRequest\n signal?: AbortSignal\n resolve(value: StructureWorkerResult): void\n reject(error: unknown): void\n timer?: ReturnType<typeof setTimeout>\n removeAbort?: () => void\n}\ninterface WorkerSlot { worker: Worker; current: PendingTask | undefined; completed: number; failed: boolean }\n\nconst MAX_WORKERS = 2\nconst MAX_QUEUE = 16\nconst WORKER_TASK_LIMIT = 100\nconst PARSE_TIMEOUT_MS = 2_000\n\n/** CPU-bound parsing runs off the event loop; cancellation terminates the active worker. */\nexport class StructureWorkerPool {\n private readonly slots = new Set<WorkerSlot>()\n private readonly queue: PendingTask[] = []\n private disposed = false\n\n execute(request: StructureWorkerRequest, signal?: AbortSignal): Promise<StructureWorkerResult> {\n if (this.disposed) return Promise.reject(new WebstackLspError('LSP_DISPOSED', 'structure worker pool is disposed'))\n if (signal?.aborted) return Promise.reject(abortError())\n if (this.queue.length >= MAX_QUEUE) return Promise.reject(new WebstackLspError('LSP_STRUCTURE_BUSY', 'structure worker queue is full'))\n return new Promise((resolve, reject) => {\n const task: PendingTask = { id: randomUUID(), request, ...(signal ? { signal } : {}), resolve, reject }\n if (signal) {\n const abort = () => {\n const index = this.queue.indexOf(task)\n if (index >= 0) { this.queue.splice(index, 1); this.finishTask(task, abortError()) }\n else {\n const slot = [...this.slots].find(candidate => candidate.current === task)\n if (slot) void this.retire(slot, abortError())\n }\n }\n signal.addEventListener('abort', abort, { once: true })\n task.removeAbort = () => signal.removeEventListener('abort', abort)\n }\n this.queue.push(task)\n this.pump()\n })\n }\n\n async dispose(): Promise<void> {\n this.disposed = true\n for (const task of this.queue.splice(0)) this.finishTask(task, new WebstackLspError('LSP_DISPOSED', 'structure worker pool is disposed'))\n await Promise.all([...this.slots].map(slot => this.retire(slot, new WebstackLspError('LSP_DISPOSED', 'structure worker pool is disposed'))))\n }\n\n releaseSnapshot(snapshotHandle: string): void {\n for (const slot of this.slots) {\n if (!slot.failed) {\n try { slot.worker.postMessage({ releaseSnapshotHandle: snapshotHandle }) }\n catch { void this.retire(slot, new WebstackLspError('LSP_STRUCTURE_UNAVAILABLE', 'structure worker could not release a cached snapshot')) }\n }\n }\n }\n\n get queued(): number { return this.queue.length }\n get active(): number { return [...this.slots].filter(slot => slot.current !== undefined).length }\n\n private pump(): void {\n if (this.disposed) return\n while (this.queue.length) {\n let slot = [...this.slots].find(candidate => !candidate.current && !candidate.failed)\n if (!slot && this.slots.size < MAX_WORKERS) slot = this.createWorker()\n if (!slot) return\n const task = this.queue.shift()!\n if (task.signal?.aborted) { this.finishTask(task, abortError()); continue }\n slot.current = task\n task.timer = setTimeout(() => { void this.retire(slot!, new WebstackLspError('LSP_STRUCTURE_TIMEOUT', 'structure parsing exceeded its time limit')) }, PARSE_TIMEOUT_MS)\n try { slot.worker.postMessage({ id: task.id, ...task.request }) }\n catch (error) { void this.retire(slot, error) }\n }\n }\n\n private createWorker(): WorkerSlot {\n const worker = new Worker(new URL('./parser-worker.mjs', import.meta.url))\n const slot: WorkerSlot = { worker, current: undefined, completed: 0, failed: false }\n this.slots.add(slot)\n worker.on('message', (reply: WorkerReply) => {\n if (!slot.current || reply.id !== slot.current.id) { void this.retire(slot, new WebstackLspError('LSP_MALFORMED_RESPONSE', 'structure worker returned an unexpected task identity')); return }\n const task = slot.current\n slot.current = undefined\n slot.completed++\n if (!reply.ok || !reply.value) this.finishTask(task, new WebstackLspError('LSP_STRUCTURE_UNAVAILABLE', reply.error ?? 'structure parsing failed'))\n else this.finishTask(task, undefined, reply.value)\n if (slot.completed >= WORKER_TASK_LIMIT) void this.retire(slot)\n this.pump()\n })\n worker.on('error', error => { void this.retire(slot, error) })\n worker.on('exit', code => {\n if (this.slots.has(slot) && !slot.failed) void this.retire(slot, code === 0 ? undefined : new WebstackLspError('LSP_STRUCTURE_UNAVAILABLE', `structure worker exited (${code})`))\n })\n return slot\n }\n\n private async retire(slot: WorkerSlot, error?: unknown): Promise<void> {\n if (slot.failed) return\n slot.failed = true\n this.slots.delete(slot)\n const task = slot.current\n slot.current = undefined\n if (task) this.finishTask(task, error ?? new WebstackLspError('LSP_STRUCTURE_UNAVAILABLE', 'structure worker was restarted'))\n await slot.worker.terminate().catch(() => 0)\n this.pump()\n }\n\n private finishTask(task: PendingTask, error?: unknown, value?: StructureWorkerResult): void {\n if (task.timer) clearTimeout(task.timer)\n task.removeAbort?.()\n if (error !== undefined) task.reject(error)\n else task.resolve(value!)\n }\n}\n\nfunction abortError(): DOMException { return new DOMException('The operation was aborted', 'AbortError') }\n","import { randomUUID } from 'node:crypto'\nimport { WebstackLspError } from '../errors.js'\nimport { Utf16Coordinates } from './coordinates.js'\nimport { getRegisteredQuery, isRegisteredQueryId } from './queries.js'\nimport { scopeIdentity, type SnapshotRecord } from './snapshots.js'\nimport { StructureWorkerPool } from './worker-pool.js'\nimport type { SnapshotScope, StructureCapture, StructureEnclosingResult, StructureErrorSummary, StructureLanguage, StructureNode, StructureOutlineResult, StructureQueryResult, StructureSpanResult } from './types.js'\n\nexport const MAX_CAPTURES = 200\nexport const MAX_OUTLINE = 100\nexport const MAX_SPAN_CHARS = 8_000\nexport const MAX_STRUCTURE_RESPONSE_BYTES = 32 * 1024\nconst MAX_NODE_HANDLES = 10_000\n\ninterface NodeHandleRecord {\n scopeKey: string\n snapshotHandle: string\n startIndex: number\n endIndex: number\n kind: string\n range: StructureNode['range']\n}\n\nexport class StructureEngine {\n private readonly nodeHandles = new Map<string, NodeHandleRecord>()\n private readonly snapshotOwners = new Map<string, string>()\n private readonly parserFailures = new Map<StructureLanguage, string>()\n constructor(private readonly workers = new StructureWorkerPool()) {}\n\n async inspect(record: SnapshotRecord, signal?: AbortSignal): Promise<{ available: boolean; parseErrors: boolean; reason?: string }> {\n this.snapshotOwners.set(record.descriptor.handle, record.scopeKey)\n const language = record.descriptor.language\n if (!language) return { available: false, parseErrors: false, reason: 'grammar_missing' }\n try {\n const result = await this.runWorker(language, { operation: 'inspect', language, text: record.source.text, querySource: '', limit: 1, snapshotHandle: record.descriptor.handle, ...(record.previousSnapshotHandle ? { previousSnapshotHandle: record.previousSnapshotHandle } : {}) }, signal)\n this.parserFailures.delete(language)\n return { available: true, parseErrors: result.errors.hasError }\n } catch (error) {\n const reason = error instanceof Error ? error.message.slice(0, 128) : 'parser_unavailable'\n return { available: false, parseErrors: false, reason }\n }\n }\n\n async outline(record: SnapshotRecord, scope: SnapshotScope, options: { range?: StructureNode['range']; limit?: number } = {}, signal?: AbortSignal): Promise<StructureOutlineResult> {\n const language = record.descriptor.language\n if (!language) return { status: 'unsupported', handle: record.descriptor.handle, version: record.descriptor.version, declarations: [], truncated: false, processed: 0, errors: { hasError: false, errorNodes: 0, missingNodes: 0, truncated: false } }\n const limit = positiveLimit(options.limit, MAX_OUTLINE, 'outline limit')\n const coordinates = new Utf16Coordinates(record.source.text)\n const range = options.range ? coordinates.rangeToIndices(options.range) : undefined\n const result = await this.runMatches(language, record, 'declarations', limit, range, signal)\n const declarations: StructureNode[] = []\n for (const match of result.matches ?? []) {\n const declaration = match.captures.find(capture => capture.name === 'declaration')\n const nameCapture = match.captures.find(capture => capture.name === 'name')\n if (!declaration) continue\n const node = this.node(record, scope, declaration.kind, declaration.startIndex, declaration.endIndex, nameCapture ? record.source.text.slice(nameCapture.startIndex, nameCapture.endIndex).slice(0, 256) : undefined, declaration.childCount, coordinates)\n declarations.push(node)\n }\n return this.outlineResult(record, declarations, result, limit)\n }\n\n async enclosing(record: SnapshotRecord, scope: SnapshotScope, position: { line: number; character: number }, kinds?: string[], signal?: AbortSignal): Promise<StructureEnclosingResult> {\n const language = record.descriptor.language\n if (!language) return { status: 'unsupported', handle: record.descriptor.handle, version: record.descriptor.version, ancestors: [] }\n const coordinates = new Utf16Coordinates(record.source.text)\n const index = coordinates.positionToIndex(position)\n if (kinds && (!Array.isArray(kinds) || kinds.length > 32 || kinds.some(kind => typeof kind !== 'string' || kind.length > 128 || !/^[a-z][a-z0-9_]*$/u.test(kind))))\n throw new WebstackLspError('LSP_STRUCTURE_LIMIT', 'kinds must be a list of at most 32 node type names')\n const result = await this.runWorker(language, { operation: 'enclosing', language, text: record.source.text, querySource: '', limit: 16, snapshotHandle: record.descriptor.handle, index, ...(kinds ? { kinds: [...kinds] } : {}) }, signal)\n const nodes = result.nodes ?? []\n const summaries = nodes.map(item => this.node(record, scope, item.kind, item.startIndex, item.endIndex, undefined, item.childCount, coordinates))\n const [node, ...ancestors] = summaries\n return { status: result.status, handle: record.descriptor.handle, version: record.descriptor.version, ...(node ? { node } : {}), ancestors, errors: publicErrors(result.errors) }\n }\n\n async query(record: SnapshotRecord, scope: SnapshotScope, queryId: string, options: { range?: StructureNode['range']; limit?: number } = {}, signal?: AbortSignal): Promise<StructureQueryResult> {\n const language = record.descriptor.language\n if (!language) throw new WebstackLspError('LSP_STRUCTURE_UNSUPPORTED', 'no bundled Tree-sitter grammar is available for this document')\n if (!isRegisteredQueryId(queryId)) throw new WebstackLspError('LSP_STRUCTURE_UNSUPPORTED', 'queryId is not in the registered query allowlist')\n const limit = positiveLimit(options.limit, MAX_CAPTURES, 'capture limit')\n const coordinates = new Utf16Coordinates(record.source.text)\n const range = options.range ? coordinates.rangeToIndices(options.range) : undefined\n const result = await this.runMatches(language, record, queryId, limit, range, signal)\n const captures: StructureCapture[] = []\n captureLoop: for (const match of result.matches ?? []) for (const capture of match.captures) {\n const node = this.node(record, scope, capture.kind, capture.startIndex, capture.endIndex, undefined, capture.childCount, coordinates)\n captures.push({ capture: capture.name, kind: capture.kind, range: node.range, nodeHandle: node.handle, ...(capture.name === 'name' ? { name: record.source.text.slice(capture.startIndex, capture.endIndex).slice(0, 256) } : {}) })\n if (captures.length >= limit) break captureLoop\n }\n if (Buffer.byteLength(JSON.stringify(captures), 'utf8') > MAX_STRUCTURE_RESPONSE_BYTES) throw new WebstackLspError('LSP_STRUCTURE_LIMIT', 'query result exceeds the response byte limit')\n return { status: result.status, handle: record.descriptor.handle, version: record.descriptor.version, queryId, captures, truncated: Boolean(result.truncated || (result.matches ?? []).reduce((total, match) => total + match.captures.length, 0) > limit), processed: captures.length, errors: publicErrors(result.errors) }\n }\n\n async span(record: SnapshotRecord, scope: SnapshotScope, nodeHandle: string, maxChars = MAX_SPAN_CHARS): Promise<StructureSpanResult> {\n const handle = this.nodeHandles.get(nodeHandle)\n if (!handle || handle.snapshotHandle !== record.descriptor.handle || handle.scopeKey !== scopeIdentity(scope))\n throw new WebstackLspError('LSP_STALE_SNAPSHOT', 'node handle is stale or belongs to another owner')\n if (!Number.isSafeInteger(maxChars) || maxChars < 1 || maxChars > MAX_SPAN_CHARS)\n throw new WebstackLspError('LSP_STRUCTURE_LIMIT', `maxChars must be between 1 and ${MAX_SPAN_CHARS}`)\n const full = record.source.text.slice(handle.startIndex, handle.endIndex)\n const codePoints = Array.from(full)\n const truncated = codePoints.length > maxChars\n const text = codePoints.slice(0, maxChars).join('')\n if (Buffer.byteLength(text, 'utf8') > MAX_STRUCTURE_RESPONSE_BYTES) throw new WebstackLspError('LSP_STRUCTURE_LIMIT', 'span result exceeds the response byte limit')\n return { status: truncated ? 'partial' : 'ok', text, truncated, range: handle.range }\n }\n\n releaseSnapshot(handle: string): void {\n for (const [nodeHandle, node] of this.nodeHandles) if (node.snapshotHandle === handle) this.nodeHandles.delete(nodeHandle)\n this.snapshotOwners.delete(handle)\n this.workers.releaseSnapshot(handle)\n }\n\n releaseSnapshotForOwner(scope: SnapshotScope, handle: string): void {\n if (this.snapshotOwners.get(handle) === scopeIdentity(scope)) this.releaseSnapshot(handle)\n }\n\n snapshotForNode(scope: SnapshotScope, nodeHandle: string): string {\n const record = this.nodeHandles.get(nodeHandle)\n if (!record || record.scopeKey !== scopeIdentity(scope)) throw new WebstackLspError('LSP_STALE_SNAPSHOT', 'node handle is stale or belongs to another owner')\n return record.snapshotHandle\n }\n\n releaseOwner(scope: SnapshotScope): void {\n const owner = scopeIdentity(scope)\n for (const [nodeHandle, node] of this.nodeHandles) if (node.scopeKey === owner) this.nodeHandles.delete(nodeHandle)\n for (const [snapshotHandle, snapshotOwner] of this.snapshotOwners) {\n if (snapshotOwner === owner) this.releaseSnapshot(snapshotHandle)\n }\n }\n\n capabilities(): Array<{ language: StructureLanguage; extensions: string[]; available: boolean; abiVersion: number | null; lastError?: string }> {\n return [\n this.capability('javascript', ['.js', '.jsx', '.mjs', '.cjs'], 15),\n this.capability('typescript', ['.ts', '.mts', '.cts'], 14),\n this.capability('tsx', ['.tsx'], 14),\n this.capability('php', ['.php'], 15),\n // Svelte uses both script grammars, not a separate grammar ABI.\n this.capability('svelte', ['.svelte'], null),\n this.capability('bash', ['.sh', '.bash', '.zsh', '.ksh'], 15),\n this.capability('c', ['.c', '.h'], 15),\n this.capability('cpp', ['.cc', '.cpp', '.cxx', '.hpp', '.hh', '.hxx', '.c++', '.h++'], 14),\n this.capability('c_sharp', ['.cs', '.csx'], 15),\n this.capability('css', ['.css'], 15),\n this.capability('go', ['.go'], 15),\n this.capability('haskell', ['.hs', '.hsc'], 14),\n this.capability('html', ['.html', '.htm', '.xhtml'], 14),\n this.capability('java', ['.java'], 14),\n this.capability('json', ['.json', '.jsonc'], 14),\n this.capability('julia', ['.jl'], 14),\n this.capability('ocaml', ['.ml'], 14),\n this.capability('ocaml_interface', ['.mli'], 14),\n this.capability('python', ['.py', '.pyi', '.pyw'], 15),\n this.capability('ql_dbscheme', ['.dbscheme'], 14),\n this.capability('ruby', ['.rb', '.rake', '.gemspec'], 14),\n this.capability('rust', ['.rs'], 14),\n this.capability('scala', ['.scala', '.sc', '.sbt'], 14),\n ]\n }\n\n async dispose(): Promise<void> { this.nodeHandles.clear(); this.snapshotOwners.clear(); await this.workers.dispose() }\n\n private async runMatches(language: StructureLanguage, record: SnapshotRecord, queryId: string, limit: number, range?: { startIndex: number; endIndex: number }, signal?: AbortSignal) {\n if (language === 'svelte') {\n const scriptQueries = { javascript: getRegisteredQuery('javascript', queryId)!, typescript: getRegisteredQuery('typescript', queryId)! }\n return this.runWorker(language, { operation: 'matches', language, text: record.source.text, querySource: '', scriptQueries, limit, snapshotHandle: record.descriptor.handle, ...(range ?? {}) }, signal)\n }\n const querySource = getRegisteredQuery(language, queryId)\n if (!querySource) throw new WebstackLspError('LSP_STRUCTURE_UNSUPPORTED', `query ${queryId} is not registered for ${language}`)\n return this.runWorker(language, { operation: 'matches', language, text: record.source.text, querySource, limit, snapshotHandle: record.descriptor.handle, ...(range ?? {}) }, signal)\n }\n\n private capability(language: StructureLanguage, extensions: string[], abiVersion: number | null) {\n const lastError = this.parserFailures.get(language)\n return { language, extensions, available: !lastError, abiVersion, ...(lastError ? { lastError } : {}) }\n }\n\n private async runWorker(language: StructureLanguage, request: Parameters<StructureWorkerPool['execute']>[0], signal?: AbortSignal) {\n try {\n const result = await this.workers.execute(request, signal)\n this.parserFailures.delete(language)\n return result\n } catch (error) {\n if (error instanceof WebstackLspError && ['LSP_STRUCTURE_TIMEOUT', 'LSP_STRUCTURE_UNAVAILABLE'].includes(error.code))\n this.parserFailures.set(language, error.message.slice(0, 128))\n throw error\n }\n }\n\n private outlineResult(record: SnapshotRecord, declarations: StructureNode[], result: Awaited<ReturnType<StructureWorkerPool['execute']>>, limit: number): StructureOutlineResult {\n const truncated = Boolean(result.truncated || declarations.length > limit)\n const selected = declarations.slice(0, limit)\n const jsonBytes = Buffer.byteLength(JSON.stringify(selected), 'utf8')\n if (jsonBytes > MAX_STRUCTURE_RESPONSE_BYTES) throw new WebstackLspError('LSP_STRUCTURE_LIMIT', 'outline result exceeds the response byte limit')\n return { status: result.status, handle: record.descriptor.handle, version: record.descriptor.version, declarations: selected, truncated, processed: selected.length, errors: publicErrors(result.errors) }\n }\n\n private node(record: SnapshotRecord, scope: SnapshotScope, kind: string, startIndex: number, endIndex: number, name?: string, childCount?: number, coordinates = new Utf16Coordinates(record.source.text)): StructureNode {\n if (this.nodeHandles.size >= MAX_NODE_HANDLES) throw new WebstackLspError('LSP_SNAPSHOT_LIMIT', 'node handle capacity is full; release a snapshot and retry')\n const handle = randomUUID()\n const range = coordinates.indicesToRange(startIndex, endIndex)\n this.nodeHandles.set(handle, { scopeKey: scopeIdentity(scope), snapshotHandle: record.descriptor.handle, startIndex, endIndex, kind, range })\n return { handle, kind: publicNodeKind(kind), range, ...(name ? { name } : {}), ...(childCount === undefined ? {} : { childCount }) }\n }\n}\n\nfunction positiveLimit(value: number | undefined, maximum: number, label: string): number {\n const limit = value ?? maximum\n if (!Number.isSafeInteger(limit) || limit < 1 || limit > maximum) throw new WebstackLspError('LSP_STRUCTURE_LIMIT', `${label} must be between 1 and ${maximum}`)\n return limit\n}\n\nfunction publicErrors(errors: StructureErrorSummary): StructureErrorSummary { return { ...errors } }\n\nconst PUBLIC_NODE_KINDS: Record<string, string> = {\n function_declaration: 'function', function_definition: 'function', function_item: 'function',\n class_declaration: 'class', class_definition: 'class', class_specifier: 'class',\n struct_declaration: 'struct', struct_item: 'struct', struct_specifier: 'struct',\n struct_definition: 'struct',\n interface_declaration: 'interface', trait_definition: 'interface',\n type_alias_declaration: 'type', type_definition: 'type', type_item: 'type',\n type_spec: 'type', type_binding: 'type', type_synomym: 'type',\n enum_declaration: 'enum', enum_item: 'enum', enum_specifier: 'enum',\n method_definition: 'method', method_declaration: 'method',\n variable_declarator: 'variable', value_definition: 'variable',\n value_specification: 'value',\n module_definition: 'module', mod_item: 'module', namespace_definition: 'module',\n namespace_declaration: 'module',\n data_type: 'data', newtype: 'data', abstract_definition: 'abstract',\n record_declaration: 'record', annotation_type_declaration: 'annotation',\n}\n\nfunction publicNodeKind(kind: string): string { return PUBLIC_NODE_KINDS[kind] ?? kind }\n","import { WebstackLspError } from '../errors.js'\nimport { DocumentSnapshotStore } from './snapshots.js'\nimport type { SnapshotRecord } from './snapshots.js'\nimport { StructureEngine, MAX_CAPTURES, MAX_OUTLINE, MAX_SPAN_CHARS, MAX_STRUCTURE_RESPONSE_BYTES } from './engine.js'\nimport type { CodeIntelligenceCapabilities, CodeIntelligenceToolServiceV1, SemanticQuery, SemanticResult, SnapshotScope, StructureEnclosingResult, StructureOutlineResult, StructureQueryResult, StructureSpanResult } from './types.js'\nimport type { CompletionResult, DiagnosticsResult, NavigationResult } from '../service.js'\n\nexport interface CodeIntelligenceServiceOptions {\n snapshots: DocumentSnapshotStore\n semanticQuery(scope: SnapshotScope, snapshot: SnapshotRecord, request: SemanticQuery, signal: AbortSignal): Promise<CompletionResult | DiagnosticsResult | NavigationResult>\n}\n\nexport class CodeIntelligenceRuntime implements CodeIntelligenceToolServiceV1 {\n readonly version = 1 as const\n readonly snapshot: CodeIntelligenceToolServiceV1['snapshot']\n readonly structure: CodeIntelligenceToolServiceV1['structure']\n readonly semantic: CodeIntelligenceToolServiceV1['semantic']\n private readonly store: DocumentSnapshotStore\n private readonly engine: StructureEngine\n\n constructor(options: CodeIntelligenceServiceOptions) {\n this.store = options.snapshots\n this.engine = new StructureEngine()\n\n this.snapshot = {\n open: async (scope, filePath, signal) => {\n const record = await this.store.open(scope, filePath, signal)\n try {\n const parser = await this.engine.inspect(record, signal)\n await this.store.current(scope, record.descriptor.handle, signal)\n return { status: 'ok', ...record.descriptor, parserAvailable: parser.available, parseErrors: parser.parseErrors }\n } catch (error) {\n this.store.release(scope, record.descriptor.handle)\n this.engine.releaseSnapshot(record.descriptor.handle)\n throw error\n }\n },\n release: async (scope, handle) => {\n const released = this.store.release(scope, handle)\n if (released) this.engine.releaseSnapshot(handle)\n return { released }\n },\n }\n\n this.structure = {\n outline: (scope, handle, request, signal) => this.withSnapshot(scope, handle, signal, record => this.engine.outline(record, scope, request, signal)) as Promise<StructureOutlineResult>,\n enclosing: (scope, handle, position, request, signal) => this.withSnapshot(scope, handle, signal, record => this.engine.enclosing(record, scope, position, request?.kinds, signal)) as Promise<StructureEnclosingResult>,\n query: (scope, handle, queryId, request, signal) => this.withSnapshot(scope, handle, signal, record => this.engine.query(record, scope, queryId, request, signal)) as Promise<StructureQueryResult>,\n span: (scope, nodeHandle, maxChars, signal) => this.span(scope, nodeHandle, maxChars, signal),\n }\n\n this.semantic = {\n query: async (scope, handle, request, signal) => {\n validateSemanticQuery(request)\n return this.withSnapshot(scope, handle, signal, async record => {\n const raw = await options.semanticQuery(scope, record, request, signal ?? new AbortController().signal)\n await this.store.current(scope, handle, signal)\n const bounded = limitSemanticResult(raw, request.maxResults ?? 200)\n const truncated = 'truncated' in bounded && Boolean(bounded.truncated)\n const status = semanticIsPartial(bounded) || truncated ? 'partial' : 'ok'\n const value: SemanticResult = { status, operation: request.operation, result: bounded, ...(truncated ? { truncated: true, omitted: 'omitted' in bounded && typeof bounded.omitted === 'number' ? bounded.omitted : 0 } : {}) }\n if (Buffer.byteLength(JSON.stringify(value), 'utf8') > MAX_STRUCTURE_RESPONSE_BYTES)\n throw new WebstackLspError('LSP_STRUCTURE_LIMIT', 'semantic result exceeds the response byte limit')\n return value\n }) as Promise<SemanticResult>\n },\n }\n }\n\n capabilities(): CodeIntelligenceCapabilities {\n const parsers = this.engine.capabilities().map(parser => ({\n ...parser,\n runtimeAbi: { minimum: 13, current: 15 },\n }))\n return {\n version: 1,\n parsers,\n sourceKind: 'disk',\n overlay: 'unavailable',\n limits: {\n maxDocumentBytes: Math.min(this.store.documentByteLimit, 2 * 1024 * 1024),\n maxCaptures: MAX_CAPTURES,\n maxOutline: MAX_OUTLINE,\n maxSpanChars: MAX_SPAN_CHARS,\n maxResponseBytes: MAX_STRUCTURE_RESPONSE_BYTES,\n },\n incrementalParsing: true,\n }\n }\n\n async releaseOwner(scope: SnapshotScope): Promise<number> {\n this.engine.releaseOwner(scope)\n return this.store.releaseOwner(scope)\n }\n\n async dispose(): Promise<void> { this.store.clear(); await this.engine.dispose() }\n\n private async span(scope: SnapshotScope, nodeHandle: string, maxChars = MAX_SPAN_CHARS, signal?: AbortSignal): Promise<StructureSpanResult> {\n const snapshotHandle = this.engine.snapshotForNode(scope, nodeHandle)\n return this.withSnapshot(scope, snapshotHandle, signal, record => this.engine.span(record, scope, nodeHandle, maxChars)) as Promise<StructureSpanResult>\n }\n\n private async withSnapshot<T>(scope: SnapshotScope, handle: string, signal: AbortSignal | undefined, execute: (record: Awaited<ReturnType<DocumentSnapshotStore['current']>>) => Promise<T>): Promise<T> {\n let record: Awaited<ReturnType<DocumentSnapshotStore['current']>>\n try { record = await this.store.current(scope, handle, signal) }\n catch (error) {\n if (error instanceof WebstackLspError && error.code === 'LSP_STALE_SNAPSHOT') this.engine.releaseSnapshotForOwner(scope, handle)\n throw error\n }\n try {\n const result = await execute(record)\n await this.store.current(scope, handle, signal)\n return result\n } catch (error) {\n if (error instanceof WebstackLspError && error.code === 'LSP_STALE_SNAPSHOT') this.engine.releaseSnapshotForOwner(scope, handle)\n throw error\n }\n }\n\n}\n\nexport function createCodeIntelligenceToolServiceV1(options: CodeIntelligenceServiceOptions): CodeIntelligenceToolServiceV1 {\n return new CodeIntelligenceRuntime(options)\n}\n\nfunction validateSemanticQuery(request: SemanticQuery): void {\n if (!request || !['definition', 'references', 'implementation', 'hover', 'diagnostics', 'completion'].includes(request.operation))\n throw new WebstackLspError('LSP_UNSUPPORTED_OPERATION', 'semantic operation is not supported')\n if (request.operation !== 'diagnostics' && !request.position)\n throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'semantic position is required for this operation')\n if (request.position && (!Number.isSafeInteger(request.position.line) || !Number.isSafeInteger(request.position.character) || request.position.line < 0 || request.position.character < 0))\n throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'semantic position must be a zero-based UTF-16 position')\n if (request.servers && (!Array.isArray(request.servers) || request.servers.length > 6 || request.servers.some(server => typeof server !== 'string' || server.length > 64)))\n throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'semantic server filter is invalid')\n if (request.maxResults !== undefined && (!Number.isSafeInteger(request.maxResults) || request.maxResults < 1 || request.maxResults > 200))\n throw new WebstackLspError('LSP_STRUCTURE_LIMIT', 'maxResults must be between 1 and 200')\n}\n\nfunction semanticIsPartial(result: CompletionResult | DiagnosticsResult | NavigationResult): boolean {\n if ('diagnostics' in result) return Boolean(result.omittedServers?.length || result.truncated)\n if ('items' in result) return Boolean(result.truncated)\n if (result.kind === 'locations') return Boolean(result.truncated)\n return false\n}\n\nfunction limitSemanticResult(result: CompletionResult | DiagnosticsResult | NavigationResult, limit: number): CompletionResult | DiagnosticsResult | NavigationResult {\n if ('items' in result) {\n if (result.items.length <= limit) return result\n return { ...result, items: result.items.slice(0, limit), truncated: { items: result.items.length - limit, characters: 0 } }\n }\n if ('diagnostics' in result) {\n if (result.diagnostics.length <= limit) return result\n return { ...result, diagnostics: result.diagnostics.slice(0, limit), truncated: { diagnostics: result.diagnostics.length - limit, characters: 0 } }\n }\n if (result.kind === 'locations' && result.locations.length > limit)\n return { ...result, locations: result.locations.slice(0, limit), truncated: true, omitted: result.locations.length - limit }\n return result\n}\n"],"mappings":";;;;;;AAMA,MAAa,kBAAkB,IAAI;AACnC,MAAa,yBAAyB;AACtC,MAAa,qBAAqB,KAAK,OAAO;AAC9C,MAAa,+BAA+B,IAAI,OAAO;AAevD,MAAMA,qBAAwD;CAC5D,OAAO;CAAc,QAAQ;CAAc,QAAQ;CAAc,QAAQ;CACzE,OAAO;CAAc,QAAQ;CAAc,QAAQ;CACnD,QAAQ;CACR,QAAQ;CAAO,WAAW;CAC1B,OAAO;CAAQ,SAAS;CAAQ,QAAQ;CAAQ,QAAQ;CACxD,MAAM;CAAK,MAAM;CACjB,OAAO;CAAO,QAAQ;CAAO,QAAQ;CAAO,QAAQ;CAAO,OAAO;CAAO,QAAQ;CAAO,QAAQ;CAAO,QAAQ;CAC/G,OAAO;CAAW,QAAQ;CAC1B,QAAQ;CACR,OAAO;CACP,OAAO;CAAW,QAAQ;CAC1B,SAAS;CAAQ,QAAQ;CAAQ,UAAU;CAC3C,SAAS;CACT,SAAS;CAAQ,UAAU;CAC3B,OAAO;CACP,OAAO;CAAS,QAAQ;CACxB,OAAO;CAAU,QAAQ;CAAU,QAAQ;CAC3C,aAAa;CACb,OAAO;CAAQ,SAAS;CAAQ,YAAY;CAC5C,OAAO;CACP,UAAU;CAAS,OAAO;CAAS,QAAQ;CAC5C;AAED,IAAa,wBAAb,MAAmC;CACjC,AAAiB,0BAAU,IAAI,KAA6B;CAC5D,AAAiB,2BAAW,IAAI,KAA4B;CAE5D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;AACpK,KAAI,WAAW,QAAQ;AACrB,MAAI,OAAO,MAAM,UAAU,MAAO,QAAO;AACzC,SAAO;GAAE,GAAG;GAAQ,OAAO,OAAO,MAAM,MAAM,GAAG,MAAM;GAAE,WAAW;IAAE,OAAO,OAAO,MAAM,SAAS;IAAO,YAAY;IAAG;GAAE;;AAE7H,KAAI,iBAAiB,QAAQ;AAC3B,MAAI,OAAO,YAAY,UAAU,MAAO,QAAO;AAC/C,SAAO;GAAE,GAAG;GAAQ,aAAa,OAAO,YAAY,MAAM,GAAG,MAAM;GAAE,WAAW;IAAE,aAAa,OAAO,YAAY,SAAS;IAAO,YAAY;IAAG;GAAE;;AAErJ,KAAI,OAAO,SAAS,eAAe,OAAO,UAAU,SAAS,MAC3D,QAAO;EAAE,GAAG;EAAQ,WAAW,OAAO,UAAU,MAAM,GAAG,MAAM;EAAE,WAAW;EAAM,SAAS,OAAO,UAAU,SAAS;EAAO;AAC9H,QAAO"}
@@ -1,5 +1,5 @@
1
1
  import "./errors-DtyWAUi0.js";
2
- import { createCodeIntelligenceToolServiceV1 } from "./code-intelligence-BUs39chK.js";
2
+ import { createCodeIntelligenceToolServiceV1 } from "./code-intelligence-BbjV-vXG.js";
3
3
  import { CODE_INTELLIGENCE_SERVICE, CODE_INTELLIGENCE_VERSION } from "./code-intelligence-contracts-CWXTofdI.js";
4
4
 
5
5
  export { CODE_INTELLIGENCE_SERVICE, CODE_INTELLIGENCE_VERSION, createCodeIntelligenceToolServiceV1 };