@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.
- package/CHANGELOG.md +10 -0
- package/README.md +10 -4
- package/docs/usage.md +8 -4
- package/lib/{code-intelligence-BUs39chK.js → code-intelligence-BbjV-vXG.js} +244 -32
- package/lib/code-intelligence-BbjV-vXG.js.map +1 -0
- package/lib/code-intelligence.js +1 -1
- package/lib/extra-tool.js +15 -11
- package/lib/extra-tool.js.map +1 -1
- package/lib/grammars/manifest.json +180 -0
- package/lib/grammars/tree-sitter-bash.wasm +0 -0
- package/lib/grammars/tree-sitter-c.wasm +0 -0
- package/lib/grammars/tree-sitter-c_sharp.wasm +0 -0
- package/lib/grammars/tree-sitter-cpp.wasm +0 -0
- package/lib/grammars/tree-sitter-css.wasm +0 -0
- package/lib/grammars/tree-sitter-go.wasm +0 -0
- package/lib/grammars/tree-sitter-haskell.wasm +0 -0
- package/lib/grammars/tree-sitter-html.wasm +0 -0
- package/lib/grammars/tree-sitter-java.wasm +0 -0
- package/lib/grammars/tree-sitter-json.wasm +0 -0
- package/lib/grammars/tree-sitter-julia.wasm +0 -0
- package/lib/grammars/tree-sitter-ocaml.wasm +0 -0
- package/lib/grammars/tree-sitter-ocaml_interface.wasm +0 -0
- package/lib/grammars/tree-sitter-python.wasm +0 -0
- package/lib/grammars/tree-sitter-ql_dbscheme.wasm +0 -0
- package/lib/grammars/tree-sitter-ruby.wasm +0 -0
- package/lib/grammars/tree-sitter-rust.wasm +0 -0
- package/lib/grammars/tree-sitter-scala.wasm +0 -0
- package/lib/parser-worker.mjs +18 -0
- package/lib/provider.js +70 -2
- package/lib/provider.js.map +1 -1
- package/lib/types/extra-tool.d.ts +2 -1
- package/lib/types/servers/typescript-diagnostics.d.ts +3 -0
- package/lib/types/structure/types.d.ts +1 -1
- package/package.json +58 -30
- package/lib/code-intelligence-BUs39chK.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
3
|
+
import type { WorkingDirectoryService } from '@deepseek-ai/dsh-working-directory';
|
|
3
4
|
import type { WebstackLspService } from './service.js';
|
|
4
5
|
import type { CodeIntelligenceToolServiceV1 } from './structure/types.js';
|
|
5
6
|
export declare const name = "lsp_extra";
|
|
@@ -10,5 +11,5 @@ export interface Config {
|
|
|
10
11
|
maxResultChars?: number;
|
|
11
12
|
timeoutMs?: number;
|
|
12
13
|
}
|
|
13
|
-
export declare function createExtraTool(service: WebstackLspService, codeIntelligence?: CodeIntelligenceToolServiceV1, config?: Config): ToolDefinition;
|
|
14
|
+
export declare function createExtraTool(service: WebstackLspService, codeIntelligence?: CodeIntelligenceToolServiceV1, config?: Config, workingDirectory?: Pick<WorkingDirectoryService, 'ensure'>): ToolDefinition;
|
|
14
15
|
export declare function apply(ctx: Context, config?: Config): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { JsonRpcConnection } from '../runtime/connection.js';
|
|
2
|
+
export declare function supportsTypeScriptDiagnostics(capabilities: Record<string, unknown>): boolean;
|
|
3
|
+
export declare function requestTypeScriptDiagnostics(connection: JsonRpcConnection, uri: string, signal: AbortSignal): Promise<unknown[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompletionResult, DiagnosticsResult, LspPosition, LspRange, NavigationResult } from '../service.js';
|
|
2
|
-
export type StructureLanguage = 'javascript' | 'typescript' | 'tsx' | 'php' | 'svelte';
|
|
2
|
+
export type StructureLanguage = 'javascript' | 'typescript' | 'tsx' | 'php' | 'svelte' | 'bash' | 'c' | 'cpp' | 'c_sharp' | 'css' | 'go' | 'haskell' | 'html' | 'java' | 'json' | 'julia' | 'ocaml' | 'ocaml_interface' | 'python' | 'ql_dbscheme' | 'ruby' | 'rust' | 'scala';
|
|
3
3
|
export type CodeIntelligenceStatus = 'ok' | 'partial' | 'unsupported' | 'unavailable' | 'stale' | 'cancelled' | 'timeout' | 'limit_exceeded';
|
|
4
4
|
export type SourceKind = 'disk' | 'overlay';
|
|
5
5
|
/** Values are created by the trusted host adapter, never from model arguments. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askdkc/dsh-lsp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "Composite read-only LSP provider for DeepSeek Harness web stacks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/provider.js",
|
|
@@ -63,58 +63,79 @@
|
|
|
63
63
|
"prepublishOnly": "pnpm install --frozen-lockfile --ignore-scripts --prod=false --optional=true && npm run check"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@deepseek-ai/dsh-lsp": "0.2.
|
|
67
|
-
"@deepseek-ai/dsh-tool-lsp": "0.2.
|
|
66
|
+
"@deepseek-ai/dsh-lsp": "0.2.2-rc.1",
|
|
67
|
+
"@deepseek-ai/dsh-tool-lsp": "0.2.2-rc.1",
|
|
68
68
|
"@tailwindcss/language-server": "0.16.0",
|
|
69
69
|
"svelte": "5.55.7",
|
|
70
70
|
"svelte-language-server": "0.17.15",
|
|
71
71
|
"typescript": "5.7.3",
|
|
72
|
-
"typescript-language-server": "4.
|
|
72
|
+
"typescript-language-server": "4.4.1",
|
|
73
73
|
"vscode-langservers-extracted": "4.10.0",
|
|
74
74
|
"web-tree-sitter": "0.27.1"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@deepseek-ai/cordis": "~4.0
|
|
77
|
+
"@deepseek-ai/cordis": "~4.1.0",
|
|
78
78
|
"@deepseek-ai/dsh-fs": "*",
|
|
79
79
|
"@deepseek-ai/dsh-subprocess": "*",
|
|
80
80
|
"@deepseek-ai/dsh-system-prompt": "*",
|
|
81
81
|
"@deepseek-ai/dsh-tools": "*",
|
|
82
|
-
"@deepseek-ai/
|
|
82
|
+
"@deepseek-ai/dsh-working-directory": "*",
|
|
83
|
+
"@deepseek-ai/schemastery": "~3.19.0"
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
85
|
-
"@deepseek-ai/cordis": "~4.0
|
|
86
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
87
|
-
"@deepseek-ai/dsh-brand": "0.2.
|
|
88
|
-
"@deepseek-ai/dsh-fs": "0.2.
|
|
89
|
-
"@deepseek-ai/dsh-fs-local": "0.2.
|
|
90
|
-
"@deepseek-ai/dsh-http-proxy": "0.2.
|
|
91
|
-
"@deepseek-ai/dsh-
|
|
92
|
-
"@deepseek-ai/dsh-
|
|
93
|
-
"@deepseek-ai/dsh-
|
|
94
|
-
"@deepseek-ai/dsh-sandbox": "0.2.
|
|
95
|
-
"@deepseek-ai/dsh-
|
|
96
|
-
"@deepseek-ai/dsh-
|
|
97
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
98
|
-
"@deepseek-ai/dsh-
|
|
99
|
-
"@deepseek-ai/dsh-subprocess": "0.2.
|
|
100
|
-
"@deepseek-ai/dsh-
|
|
101
|
-
"@deepseek-ai/dsh-
|
|
102
|
-
"@deepseek-ai/dsh-
|
|
103
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
104
|
-
"@deepseek-ai/dsh-
|
|
105
|
-
"@deepseek-ai/
|
|
86
|
+
"@deepseek-ai/cordis": "~4.1.0",
|
|
87
|
+
"@deepseek-ai/dsh-agent": "0.2.2-rc.1",
|
|
88
|
+
"@deepseek-ai/dsh-brand": "0.2.2-rc.1",
|
|
89
|
+
"@deepseek-ai/dsh-fs": "0.2.2-rc.1",
|
|
90
|
+
"@deepseek-ai/dsh-fs-local": "0.2.2-rc.1",
|
|
91
|
+
"@deepseek-ai/dsh-http-proxy": "0.2.2-rc.1",
|
|
92
|
+
"@deepseek-ai/dsh-llm": "0.2.2-rc.1",
|
|
93
|
+
"@deepseek-ai/dsh-ptc-runtime": "0.2.2-rc.1",
|
|
94
|
+
"@deepseek-ai/dsh-sandbox": "0.2.2-rc.1",
|
|
95
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.1",
|
|
96
|
+
"@deepseek-ai/dsh-scope": "0.2.2-rc.1",
|
|
97
|
+
"@deepseek-ai/dsh-session": "0.2.2-rc.1",
|
|
98
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.1",
|
|
99
|
+
"@deepseek-ai/dsh-subprocess": "0.2.2-rc.1",
|
|
100
|
+
"@deepseek-ai/dsh-subprocess-local": "0.2.2-rc.1",
|
|
101
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
|
|
102
|
+
"@deepseek-ai/dsh-timeout": "0.2.2-rc.1",
|
|
103
|
+
"@deepseek-ai/dsh-tool-executor-native": "0.2.2-rc.1",
|
|
104
|
+
"@deepseek-ai/dsh-tools": "0.2.2-rc.1",
|
|
105
|
+
"@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.1",
|
|
106
|
+
"@deepseek-ai/dsh-user-approval": "0.2.2-rc.1",
|
|
107
|
+
"@deepseek-ai/dsh-working-directory": "0.2.2-rc.1",
|
|
108
|
+
"@deepseek-ai/dsh-workspace": "0.2.2-rc.1",
|
|
109
|
+
"@deepseek-ai/schemastery": "~3.19.0",
|
|
106
110
|
"@types/node": "22.10.5",
|
|
107
111
|
"tailwindcss-v3": "npm:tailwindcss@3.4.17",
|
|
108
112
|
"tailwindcss-v4": "npm:tailwindcss@4.1.13",
|
|
113
|
+
"tree-sitter-bash": "0.25.1",
|
|
114
|
+
"tree-sitter-c": "0.24.1",
|
|
115
|
+
"tree-sitter-c-sharp": "0.23.5",
|
|
116
|
+
"tree-sitter-cpp": "0.23.4",
|
|
117
|
+
"tree-sitter-css": "0.25.0",
|
|
118
|
+
"tree-sitter-go": "0.25.0",
|
|
119
|
+
"tree-sitter-haskell": "0.23.1",
|
|
120
|
+
"tree-sitter-html": "0.23.2",
|
|
121
|
+
"tree-sitter-java": "0.23.5",
|
|
109
122
|
"tree-sitter-javascript": "0.25.0",
|
|
123
|
+
"tree-sitter-json": "0.24.8",
|
|
124
|
+
"tree-sitter-julia": "0.23.1",
|
|
125
|
+
"tree-sitter-ocaml": "0.24.2",
|
|
110
126
|
"tree-sitter-php": "0.24.2",
|
|
127
|
+
"tree-sitter-python": "0.25.0",
|
|
128
|
+
"tree-sitter-ql-dbscheme": "0.23.1",
|
|
129
|
+
"tree-sitter-ruby": "0.23.1",
|
|
130
|
+
"tree-sitter-rust": "0.24.0",
|
|
131
|
+
"tree-sitter-scala": "0.24.0",
|
|
111
132
|
"tree-sitter-typescript": "0.23.2",
|
|
112
133
|
"tsdown": "0.15.0",
|
|
113
134
|
"typescript": "5.7.3",
|
|
114
135
|
"vitest": "4.1.12"
|
|
115
136
|
},
|
|
116
137
|
"engines": {
|
|
117
|
-
"node": "
|
|
138
|
+
"node": ">=24.9.0"
|
|
118
139
|
},
|
|
119
140
|
"publishConfig": {
|
|
120
141
|
"access": "public"
|
|
@@ -126,7 +147,9 @@
|
|
|
126
147
|
"svelte-language-server>svelte": "5.55.7",
|
|
127
148
|
"vite": "6.4.5",
|
|
128
149
|
"source-map-js": "1.2.2",
|
|
129
|
-
"postcss-selector-parser": "7.1.6"
|
|
150
|
+
"postcss-selector-parser": "7.1.6",
|
|
151
|
+
"undici@8.11.2": "8.12.3",
|
|
152
|
+
"zod@>=4.0.0 <4.6.6": "4.6.7"
|
|
130
153
|
}
|
|
131
154
|
},
|
|
132
155
|
"license": "MIT",
|
|
@@ -141,7 +164,9 @@
|
|
|
141
164
|
"svelte-language-server": {
|
|
142
165
|
"svelte": "5.55.7"
|
|
143
166
|
},
|
|
144
|
-
"vite": "6.4.5"
|
|
167
|
+
"vite": "6.4.5",
|
|
168
|
+
"undici@8.11.2": "8.12.3",
|
|
169
|
+
"zod@>=4.0.0 <4.6.6": "4.6.7"
|
|
145
170
|
},
|
|
146
171
|
"peerDependenciesMeta": {
|
|
147
172
|
"@deepseek-ai/cordis": {
|
|
@@ -161,6 +186,9 @@
|
|
|
161
186
|
},
|
|
162
187
|
"@deepseek-ai/dsh-system-prompt": {
|
|
163
188
|
"optional": true
|
|
189
|
+
},
|
|
190
|
+
"@deepseek-ai/dsh-working-directory": {
|
|
191
|
+
"optional": true
|
|
164
192
|
}
|
|
165
193
|
}
|
|
166
194
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-intelligence-BUs39chK.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[]","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}\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\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: [\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 tsx: [\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}\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}\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}\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 ]\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\nfunction publicNodeKind(kind: string): string {\n return ({ function_declaration: 'function', function_definition: 'function', class_declaration: 'class', interface_declaration: 'interface', type_alias_declaration: 'type', enum_declaration: 'enum', method_definition: 'method', method_declaration: 'method', variable_declarator: 'variable' } as Record<string, string>)[kind] ?? kind\n}\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;CAC3B;AAED,IAAa,wBAAb,MAAmC;CACjC,AAAiB,0BAAU,IAAI,KAA6B;CAC5D,AAAiB,2BAAW,IAAI,KAA4B;CAE5D,YAAY,AAAiBC,YAA4B,AAAiBC,kBAA0B;EAAvE;EAA6C;;CAE1E,MAAM,KAAK,OAAsB,UAAkB,QAA+C;AAChG,gBAAc,MAAM;EACpB,MAAM,iBAAiB,sBAAsB,SAAS;AACtD,UAAQ,gBAAgB;EACxB,MAAM,QAAQ,MAAM,KAAK,WAAW,MAAM,eAAe,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