@askdkc/dsh-lsp-server 0.1.0

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 (58) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +21 -0
  3. package/README.md +27 -0
  4. package/cordis.patch.yml +29 -0
  5. package/docs/usage.md +94 -0
  6. package/lib/cli/doctor.js +135 -0
  7. package/lib/cli/doctor.js.map +1 -0
  8. package/lib/completion-B7NPVCEN.js +79 -0
  9. package/lib/completion-B7NPVCEN.js.map +1 -0
  10. package/lib/errors-DtyWAUi0.js +16 -0
  11. package/lib/errors-DtyWAUi0.js.map +1 -0
  12. package/lib/extra-tool.js +113 -0
  13. package/lib/extra-tool.js.map +1 -0
  14. package/lib/launch-ByUvgkVv.js +308 -0
  15. package/lib/launch-ByUvgkVv.js.map +1 -0
  16. package/lib/provider.js +1164 -0
  17. package/lib/provider.js.map +1 -0
  18. package/lib/types/cli/availability.d.ts +3 -0
  19. package/lib/types/cli/doctor.d.ts +33 -0
  20. package/lib/types/config.d.ts +87 -0
  21. package/lib/types/errors.d.ts +7 -0
  22. package/lib/types/extra-tool.d.ts +13 -0
  23. package/lib/types/host/dsh.d.ts +10 -0
  24. package/lib/types/host/source.d.ts +8 -0
  25. package/lib/types/host/uri.d.ts +2 -0
  26. package/lib/types/host/workspace.d.ts +16 -0
  27. package/lib/types/merge/completion.d.ts +6 -0
  28. package/lib/types/merge/diagnostics.d.ts +6 -0
  29. package/lib/types/merge/hover.d.ts +5 -0
  30. package/lib/types/protocol/capabilities.d.ts +3 -0
  31. package/lib/types/protocol/initialize.d.ts +3 -0
  32. package/lib/types/protocol/normalize-completion.d.ts +3 -0
  33. package/lib/types/protocol/normalize-diagnostic.d.ts +3 -0
  34. package/lib/types/protocol/normalize-hover.d.ts +6 -0
  35. package/lib/types/protocol/normalize-location.d.ts +7 -0
  36. package/lib/types/protocol/types.d.ts +57 -0
  37. package/lib/types/provider.d.ts +35 -0
  38. package/lib/types/routing/classifier.d.ts +8 -0
  39. package/lib/types/routing/language-id.d.ts +5 -0
  40. package/lib/types/routing/route-table.d.ts +13 -0
  41. package/lib/types/routing/tailwind-candidate.d.ts +1 -0
  42. package/lib/types/runtime/cancellation.d.ts +4 -0
  43. package/lib/types/runtime/connection.d.ts +22 -0
  44. package/lib/types/runtime/framing.d.ts +14 -0
  45. package/lib/types/runtime/process-lifecycle.d.ts +21 -0
  46. package/lib/types/runtime/server-pool.d.ts +24 -0
  47. package/lib/types/runtime/server-session.d.ts +32 -0
  48. package/lib/types/runtime/webstack-runtime.d.ts +28 -0
  49. package/lib/types/servers/html.d.ts +2 -0
  50. package/lib/types/servers/launch.d.ts +5 -0
  51. package/lib/types/servers/package-bin.d.ts +2 -0
  52. package/lib/types/servers/phpantom.d.ts +2 -0
  53. package/lib/types/servers/svelte.d.ts +2 -0
  54. package/lib/types/servers/tailwind.d.ts +2 -0
  55. package/lib/types/servers/types.d.ts +26 -0
  56. package/lib/types/servers/typescript.d.ts +2 -0
  57. package/lib/types/service.d.ts +83 -0
  58. package/package.json +138 -0
@@ -0,0 +1,21 @@
1
+ import { type ChildProcess } from 'node:child_process';
2
+ export interface SpawnSpec {
3
+ command: string;
4
+ args: string[];
5
+ cwd: string;
6
+ env?: Record<string, string>;
7
+ }
8
+ export interface ShutdownOptions {
9
+ shutdownMs: number;
10
+ killGraceMs: number;
11
+ }
12
+ export declare function spawnServer(spec: SpawnSpec): ChildProcess;
13
+ export declare function terminateProcess(child: ChildProcess, options: ShutdownOptions): Promise<void>;
14
+ export declare function abortableShutdown(child: ChildProcess, options: ShutdownOptions, signal?: AbortSignal): Promise<void>;
15
+ export declare class StderrTail {
16
+ private readonly maxBytes;
17
+ private value;
18
+ constructor(maxBytes: number);
19
+ append(chunk: Uint8Array): void;
20
+ text(): string;
21
+ }
@@ -0,0 +1,24 @@
1
+ export interface PoolSession {
2
+ readonly state: string;
3
+ start(signal?: AbortSignal): Promise<unknown>;
4
+ stop(): Promise<void>;
5
+ isUsable(): boolean;
6
+ }
7
+ export type SessionFactory<S extends PoolSession> = (serverId: string, workspace: string, signal?: AbortSignal) => Promise<S>;
8
+ export declare class ServerPool<S extends PoolSession> {
9
+ private readonly factory;
10
+ private readonly sessions;
11
+ private readonly creation;
12
+ private readonly queues;
13
+ private disposing;
14
+ constructor(factory: SessionFactory<S>);
15
+ getOrCreate(serverId: string, workspace: string, signal?: AbortSignal): Promise<S>;
16
+ run<T>(serverId: string, workspace: string, task: (session: S) => Promise<T>, signal?: AbortSignal): Promise<T>;
17
+ runWithRetry<T>(serverId: string, workspace: string, task: (session: S) => Promise<T>, signal?: AbortSignal): Promise<T>;
18
+ evict(serverId: string, workspace: string): Promise<void>;
19
+ disposeAll(): Promise<void>;
20
+ get size(): number;
21
+ private serialize;
22
+ private create;
23
+ }
24
+ export declare function keyOf(serverId: string, workspace: string): string;
@@ -0,0 +1,32 @@
1
+ import type { SubprocessHandle } from '@deepseek-ai/dsh-subprocess';
2
+ import type { InitializeParams, InitializeResult } from '../protocol/types.js';
3
+ import { JsonRpcConnection } from './connection.js';
4
+ export type SessionState = 'NEW' | 'STARTING' | 'READY' | 'STOPPING' | 'STOPPED' | 'FAILED';
5
+ export interface ServerSessionOptions {
6
+ spawn(): SubprocessHandle;
7
+ initialize: InitializeParams;
8
+ configuration: unknown;
9
+ maxMessageBytes: number;
10
+ shutdown: {
11
+ shutdownMs: number;
12
+ killGraceMs: number;
13
+ };
14
+ }
15
+ export declare class ServerSession {
16
+ private readonly options;
17
+ state: SessionState;
18
+ capabilities: Record<string, unknown>;
19
+ private child?;
20
+ private connection?;
21
+ private stopping?;
22
+ private readonly lifetime;
23
+ constructor(options: ServerSessionOptions);
24
+ start(signal?: AbortSignal): Promise<InitializeResult>;
25
+ get usable(): boolean;
26
+ isUsable(): boolean;
27
+ run<T>(task: (connection: JsonRpcConnection) => Promise<T>, signal?: AbortSignal): Promise<T>;
28
+ stop(): Promise<void>;
29
+ private teardown;
30
+ private signal;
31
+ private answer;
32
+ }
@@ -0,0 +1,28 @@
1
+ import type { LspProviderQuery, LspQueryResult } from '@deepseek-ai/dsh-lsp';
2
+ import type { SubprocessService } from '@deepseek-ai/dsh-subprocess';
3
+ import type { ResolvedConfig } from '../config.js';
4
+ import { type HostFileSystem } from '../host/dsh.js';
5
+ import type { CompletionRequest, CompletionResult, DiagnosticsRequest, DiagnosticsResult, WebstackLspStatus } from '../service.js';
6
+ export type HostSubprocess = Pick<SubprocessService, 'spawn' | 'resolveExecutable'>;
7
+ export declare class WebstackLspRuntime {
8
+ private readonly config;
9
+ private readonly fs;
10
+ private readonly subprocess;
11
+ private readonly pool;
12
+ private readonly workspaces;
13
+ private readonly lifetime;
14
+ private readonly live;
15
+ private readonly starts;
16
+ private readonly restarts;
17
+ constructor(config: ResolvedConfig, fs: HostFileSystem, subprocess: HostSubprocess);
18
+ navigation(request: LspProviderQuery, signal?: AbortSignal): Promise<LspQueryResult>;
19
+ completion(request: CompletionRequest, signal?: AbortSignal): Promise<CompletionResult>;
20
+ diagnostics(request: DiagnosticsRequest, signal?: AbortSignal): Promise<DiagnosticsResult>;
21
+ status(): Promise<WebstackLspStatus>;
22
+ dispose(): Promise<void>;
23
+ private signal;
24
+ private prepare;
25
+ private validatePosition;
26
+ private useTailwind;
27
+ private document;
28
+ }
@@ -0,0 +1,2 @@
1
+ import type { ServerAdapter } from './types.js';
2
+ export declare const htmlAdapter: ServerAdapter;
@@ -0,0 +1,5 @@
1
+ import type { ResolvedConfig, ServerId } from '../config.js';
2
+ import type { LaunchSpec } from './types.js';
3
+ export declare function resolveLaunch(id: ServerId, config: ResolvedConfig, workspace: string): Promise<LaunchSpec>;
4
+ export declare function initializationOptions(id: ServerId, config: ResolvedConfig): unknown;
5
+ export declare function serverConfiguration(id: ServerId, config: ResolvedConfig): unknown;
@@ -0,0 +1,2 @@
1
+ import type { LaunchSpec } from './types.js';
2
+ export declare function resolvePackageBinary(packageName: string, binName: string, cwd: string, args?: string[]): Promise<LaunchSpec>;
@@ -0,0 +1,2 @@
1
+ import type { ServerAdapter } from './types.js';
2
+ export declare const phpantomAdapter: ServerAdapter;
@@ -0,0 +1,2 @@
1
+ import type { ServerAdapter } from './types.js';
2
+ export declare const svelteAdapter: ServerAdapter;
@@ -0,0 +1,2 @@
1
+ import type { ServerAdapter } from './types.js';
2
+ export declare const tailwindAdapter: ServerAdapter;
@@ -0,0 +1,26 @@
1
+ import type { ClassifiedFile } from '../routing/classifier.js';
2
+ import type { ResolvedConfig } from '../config.js';
3
+ export interface LaunchSpec {
4
+ command: string;
5
+ args: string[];
6
+ cwd: string;
7
+ env?: Record<string, string>;
8
+ }
9
+ export interface ConfigurationItem {
10
+ section?: string;
11
+ scopeUri?: string | null;
12
+ }
13
+ export interface ServerInfo {
14
+ id: string;
15
+ version?: string;
16
+ }
17
+ export interface ServerAdapter {
18
+ readonly id: string;
19
+ readonly role: 'primary' | 'auxiliary' | 'both';
20
+ resolveLaunch(config: ResolvedConfig, workspace: string): Promise<LaunchSpec>;
21
+ languageId(file: ClassifiedFile): string | null;
22
+ supportsFile(file: ClassifiedFile): boolean;
23
+ configuration(items: ConfigurationItem[]): unknown[];
24
+ initializationOptions(workspace: string): unknown;
25
+ normalizeServerInfo(value: unknown): ServerInfo | undefined;
26
+ }
@@ -0,0 +1,2 @@
1
+ import type { ServerAdapter } from './types.js';
2
+ export declare const typescriptAdapter: ServerAdapter;
@@ -0,0 +1,83 @@
1
+ import type { ResolvedConfig } from './config.js';
2
+ export interface LspPosition {
3
+ line: number;
4
+ character: number;
5
+ }
6
+ export interface LspRange {
7
+ start: LspPosition;
8
+ end: LspPosition;
9
+ }
10
+ export interface DiagnosticsRequest {
11
+ workspaceRoot: string;
12
+ filePath: string;
13
+ severity?: 'all' | 'error' | 'warning';
14
+ servers?: string[];
15
+ }
16
+ export interface CompletionRequest {
17
+ workspaceRoot: string;
18
+ filePath: string;
19
+ position: LspPosition;
20
+ triggerKind?: 1 | 2 | 3;
21
+ triggerCharacter?: string;
22
+ }
23
+ export interface NormalizedDiagnostic {
24
+ server: string;
25
+ uri: string;
26
+ range: LspRange;
27
+ severity?: 1 | 2 | 3 | 4;
28
+ code?: string | number;
29
+ source?: string;
30
+ message: string;
31
+ tags?: number[];
32
+ servers?: string[];
33
+ }
34
+ export interface NormalizedCompletionItem {
35
+ server: string;
36
+ label: string;
37
+ kind?: number;
38
+ detail?: string;
39
+ documentation?: string;
40
+ sortText?: string;
41
+ filterText?: string;
42
+ insertText?: string;
43
+ insertTextFormat?: number;
44
+ deprecated?: boolean;
45
+ }
46
+ export interface DiagnosticsResult {
47
+ diagnostics: NormalizedDiagnostic[];
48
+ omittedServers?: string[];
49
+ truncated?: {
50
+ diagnostics: number;
51
+ characters: number;
52
+ };
53
+ }
54
+ export interface CompletionResult {
55
+ items: NormalizedCompletionItem[];
56
+ truncated?: {
57
+ items: number;
58
+ characters: number;
59
+ };
60
+ }
61
+ export interface WebstackLspStatus {
62
+ providerId: string;
63
+ servers: Array<{
64
+ id: import('./config.js').ServerId;
65
+ enabled: boolean;
66
+ available: boolean;
67
+ source: 'bundled' | 'path';
68
+ command?: string;
69
+ version?: string;
70
+ lastError?: string;
71
+ liveWorkspaces: number;
72
+ restarts: number;
73
+ }>;
74
+ }
75
+ export interface WebstackLspService {
76
+ status(): Promise<WebstackLspStatus>;
77
+ diagnostics(request: DiagnosticsRequest, signal?: AbortSignal): Promise<DiagnosticsResult>;
78
+ completion(request: CompletionRequest, signal?: AbortSignal): Promise<CompletionResult>;
79
+ }
80
+ export interface ExtendedRuntime extends WebstackLspService {
81
+ }
82
+ export declare function createWebstackLspService(runtime: ExtendedRuntime, config?: Pick<ResolvedConfig, 'limits'>): WebstackLspService;
83
+ export declare function createUnavailableService(providerId?: string): WebstackLspService;
package/package.json ADDED
@@ -0,0 +1,138 @@
1
+ {
2
+ "name": "@askdkc/dsh-lsp-server",
3
+ "version": "0.1.0",
4
+ "description": "Composite read-only LSP provider for DeepSeek Harness web stacks",
5
+ "type": "module",
6
+ "main": "./lib/provider.js",
7
+ "types": "./lib/types/provider.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/types/provider.d.ts",
11
+ "default": "./lib/provider.js"
12
+ },
13
+ "./provider": {
14
+ "types": "./lib/types/provider.d.ts",
15
+ "default": "./lib/provider.js"
16
+ },
17
+ "./extra-tool": {
18
+ "types": "./lib/types/extra-tool.d.ts",
19
+ "default": "./lib/extra-tool.js"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "bin": {
24
+ "dsh-lsp-webstack": "./lib/cli/doctor.js"
25
+ },
26
+ "files": [
27
+ "lib/**",
28
+ "cordis.patch.yml",
29
+ "README.md",
30
+ "docs/**",
31
+ "LICENSE",
32
+ "CHANGELOG.md"
33
+ ],
34
+ "dsh": {
35
+ "bundle": {
36
+ "patch": "./cordis.patch.yml"
37
+ }
38
+ },
39
+ "scripts": {
40
+ "build": "tsdown && tsc -p tsconfig.build.json",
41
+ "typecheck": "tsc --noEmit",
42
+ "test": "vitest run",
43
+ "test:e2e": "vitest run --config vitest.e2e.config.ts",
44
+ "check": "npm run typecheck && npm test && npm run build && npm run test:package",
45
+ "test:package": "vitest run --config vitest.package.config.ts",
46
+ "prepare": "npm run build",
47
+ "prepublishOnly": "npm run check"
48
+ },
49
+ "dependencies": {
50
+ "@tailwindcss/language-server": "0.16.0",
51
+ "svelte-language-server": "0.17.15",
52
+ "typescript": "5.7.3",
53
+ "typescript-language-server": "4.3.3",
54
+ "vscode-langservers-extracted": "4.10.0"
55
+ },
56
+ "peerDependencies": {
57
+ "@deepseek-ai/cordis": "^4.0.2",
58
+ "@deepseek-ai/dsh-lsp": "0.0.1-rc.1 || ^0.1.3-alpha.1",
59
+ "@deepseek-ai/schemastery": "^3.18.2",
60
+ "@deepseek-ai/dsh-fs": "0.0.1-rc.1 || ^0.1.3-alpha.1",
61
+ "@deepseek-ai/dsh-subprocess": "0.0.1-rc.1 || ^0.1.3-alpha.1",
62
+ "@deepseek-ai/dsh-tools": "0.0.1-rc.1 || ^0.1.3-alpha.1",
63
+ "@deepseek-ai/dsh-system-prompt": "0.0.1-rc.1 || ^0.1.3-alpha.1",
64
+ "@deepseek-ai/dsh-tool-lsp": "0.0.1-rc.1 || ^0.1.3-alpha.1"
65
+ },
66
+ "devDependencies": {
67
+ "@types/node": "22.10.5",
68
+ "tsdown": "0.15.0",
69
+ "typescript": "5.7.3",
70
+ "vitest": "3.2.6",
71
+ "@deepseek-ai/cordis": "^4.0.2",
72
+ "@deepseek-ai/dsh-lsp": "0.0.1-rc.1",
73
+ "@deepseek-ai/schemastery": "^3.18.2",
74
+ "@deepseek-ai/dsh-fs": "0.0.1-rc.1",
75
+ "@deepseek-ai/dsh-subprocess": "0.0.1-rc.1",
76
+ "@deepseek-ai/dsh-tools": "0.0.1-rc.1",
77
+ "@deepseek-ai/dsh-system-prompt": "0.0.1-rc.1",
78
+ "@deepseek-ai/dsh-tool-lsp": "0.0.1-rc.1",
79
+ "@deepseek-ai/dsh-brand": "0.0.1-rc.1",
80
+ "@deepseek-ai/dsh-invariants": "0.0.1-rc.1",
81
+ "@deepseek-ai/dsh-llm": "0.0.1-rc.1",
82
+ "@deepseek-ai/dsh-timeout": "0.0.1-rc.1",
83
+ "@deepseek-ai/dsh-scope": "0.0.1-rc.1",
84
+ "@deepseek-ai/dsh-session": "0.0.1-rc.1",
85
+ "@deepseek-ai/dsh-fs-local": "0.0.1-rc.1",
86
+ "@deepseek-ai/dsh-subprocess-local": "0.0.1-rc.1",
87
+ "tailwindcss-v3": "npm:tailwindcss@3.4.17",
88
+ "tailwindcss-v4": "npm:tailwindcss@4.1.13"
89
+ },
90
+ "engines": {
91
+ "node": ">=22.18.0"
92
+ },
93
+ "publishConfig": {
94
+ "access": "public"
95
+ },
96
+ "packageManager": "pnpm@9.15.9",
97
+ "pnpm": {
98
+ "overrides": {
99
+ "tsdown>rolldown": "1.0.0-beta.38"
100
+ }
101
+ },
102
+ "license": "MIT",
103
+ "repository": {
104
+ "type": "git",
105
+ "url": "git+https://github.com/askdkc/dsh-lsp-server.git"
106
+ },
107
+ "overrides": {
108
+ "tsdown": {
109
+ "rolldown": "1.0.0-beta.38"
110
+ }
111
+ },
112
+ "peerDependenciesMeta": {
113
+ "@deepseek-ai/cordis": {
114
+ "optional": true
115
+ },
116
+ "@deepseek-ai/dsh-lsp": {
117
+ "optional": true
118
+ },
119
+ "@deepseek-ai/schemastery": {
120
+ "optional": true
121
+ },
122
+ "@deepseek-ai/dsh-fs": {
123
+ "optional": true
124
+ },
125
+ "@deepseek-ai/dsh-subprocess": {
126
+ "optional": true
127
+ },
128
+ "@deepseek-ai/dsh-tools": {
129
+ "optional": true
130
+ },
131
+ "@deepseek-ai/dsh-system-prompt": {
132
+ "optional": true
133
+ },
134
+ "@deepseek-ai/dsh-tool-lsp": {
135
+ "optional": true
136
+ }
137
+ }
138
+ }