oh-my-opencode-slim 0.8.3 → 0.8.4

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.
@@ -1,4 +1,4 @@
1
1
  export { ast_grep_replace, ast_grep_search } from './ast-grep';
2
2
  export { createBackgroundTools } from './background';
3
3
  export { grep } from './grep';
4
- export { lsp_diagnostics, lsp_find_references, lsp_goto_definition, lsp_rename, lspManager, } from './lsp';
4
+ export { lsp_diagnostics, lsp_find_references, lsp_goto_definition, lsp_rename, lspManager, setUserLspConfig, } from './lsp';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * User-provided LSP server config (from opencode.json lsp section).
3
+ * Fields are optional because user config may not include all properties.
4
+ */
5
+ export interface UserLspConfig {
6
+ id: string;
7
+ command?: string[];
8
+ extensions?: string[];
9
+ disabled?: boolean;
10
+ env?: Record<string, string>;
11
+ initialization?: Record<string, unknown>;
12
+ }
13
+ /**
14
+ * Set the user's lsp config from opencode.json.
15
+ * Called during plugin initialization.
16
+ */
17
+ export declare function setUserLspConfig(config: Record<string, unknown> | undefined): void;
18
+ /**
19
+ * Get the user's lsp config for a specific server ID.
20
+ */
21
+ export declare function getUserLspConfig(serverId: string): UserLspConfig | undefined;
22
+ /**
23
+ * Get all user-configured lsp servers.
24
+ */
25
+ export declare function getAllUserLspConfigs(): Map<string, UserLspConfig>;
26
+ /**
27
+ * Check if user has configured any lsp servers.
28
+ */
29
+ export declare function hasUserLspConfig(): boolean;
@@ -1,8 +1,24 @@
1
- import type { LSPServerConfig } from './types';
1
+ import type { LSPServerConfig, RootFunction } from './types';
2
2
  export declare const SYMBOL_KIND_MAP: Record<number, string>;
3
3
  export declare const SEVERITY_MAP: Record<number, string>;
4
4
  export declare const DEFAULT_MAX_REFERENCES = 200;
5
5
  export declare const DEFAULT_MAX_DIAGNOSTICS = 200;
6
+ /**
7
+ * NearestRoot helper - mirrors OpenCode core's NearestRoot function.
8
+ * Creates a RootFunction that walks up directories looking for root markers.
9
+ */
10
+ export declare function NearestRoot(includePatterns: string[], excludePatterns?: string[]): RootFunction;
11
+ /**
12
+ * Built-in LSP servers - mirrors OpenCode core LSPServer namespace.
13
+ * User configuration from opencode.json lsp section takes precedence and is
14
+ * merged on top of these: user settings override command/extensions/env, while
15
+ * root patterns are always preserved from built-in. Servers can be removed by
16
+ * setting `"disabled": true` in the user config.
17
+ */
6
18
  export declare const BUILTIN_SERVERS: Record<string, Omit<LSPServerConfig, 'id'>>;
7
19
  export declare const LSP_INSTALL_HINTS: Record<string, string>;
8
- export declare const EXT_TO_LANG: Record<string, string>;
20
+ /**
21
+ * Maps file extensions to LSP language IDs.
22
+ * Mirrors OpenCode core's LANGUAGE_EXTENSIONS constant.
23
+ */
24
+ export declare const LANGUAGE_EXTENSIONS: Record<string, string>;
@@ -1,3 +1,4 @@
1
1
  export { lspManager } from './client';
2
+ export { getUserLspConfig, setUserLspConfig } from './config-store';
2
3
  export { lsp_diagnostics, lsp_find_references, lsp_goto_definition, lsp_rename, } from './tools';
3
4
  export type { Diagnostic, Location, LSPServerConfig, ResolvedServer, WorkspaceEdit, } from './types';
@@ -1,8 +1,14 @@
1
1
  import type { CreateFile, DeleteFile, Diagnostic, DocumentSymbol, Location, LocationLink, Position, Range, RenameFile, SymbolInformation as SymbolInfo, TextDocumentEdit, TextDocumentIdentifier, TextEdit, VersionedTextDocumentIdentifier, WorkspaceEdit } from 'vscode-languageserver-protocol';
2
+ /**
3
+ * Root function type - mirrors OpenCode core's RootFunction.
4
+ * Returns the project root directory for a given file, or undefined if not applicable.
5
+ */
6
+ export type RootFunction = (file: string) => string | undefined;
2
7
  export interface LSPServerConfig {
3
8
  id: string;
4
9
  command: string[];
5
10
  extensions: string[];
11
+ root?: RootFunction;
6
12
  disabled?: boolean;
7
13
  env?: Record<string, string>;
8
14
  initialization?: Record<string, unknown>;
@@ -11,6 +17,7 @@ export interface ResolvedServer {
11
17
  id: string;
12
18
  command: string[];
13
19
  extensions: string[];
20
+ root?: RootFunction;
14
21
  env?: Record<string, string>;
15
22
  initialization?: Record<string, unknown>;
16
23
  }
@@ -1,5 +1,18 @@
1
1
  import type { LSPClient } from './client';
2
- import type { Diagnostic, Location, LocationLink, ServerLookupResult, WorkspaceEdit } from './types';
2
+ import type { Diagnostic, Location, LocationLink, ResolvedServer, ServerLookupResult, WorkspaceEdit } from './types';
3
+ /**
4
+ * Find the project root for a specific LSP server using its root function.
5
+ * Mirrors OpenCode core's RootFunction approach.
6
+ *
7
+ * @param filePath - The file to find the root for
8
+ * @param server - The LSP server config with root function
9
+ * @returns The project root directory, or file's directory if no root function
10
+ */
11
+ export declare function findServerProjectRoot(filePath: string, server: ResolvedServer): string;
12
+ /**
13
+ * Legacy function for backward compatibility.
14
+ * @deprecated Use findServerProjectRoot with server-specific patterns instead.
15
+ */
3
16
  export declare function findWorkspaceRoot(filePath: string): string;
4
17
  export declare function uriToPath(uri: string): string;
5
18
  export declare function formatServerLookupError(result: Exclude<ServerLookupResult, {
@@ -5,6 +5,9 @@
5
5
  "preset": {
6
6
  "type": "string"
7
7
  },
8
+ "setDefaultAgent": {
9
+ "type": "boolean"
10
+ },
8
11
  "scoringEngineVersion": {
9
12
  "type": "string",
10
13
  "enum": [
@@ -377,6 +380,11 @@
377
380
  "type": "number",
378
381
  "minimum": 0
379
382
  },
383
+ "retryDelayMs": {
384
+ "default": 500,
385
+ "type": "number",
386
+ "minimum": 0
387
+ },
380
388
  "chains": {
381
389
  "default": {},
382
390
  "type": "object",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-opencode-slim",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "description": "Lightweight agent orchestration plugin for OpenCode - a slimmed-down fork of oh-my-opencode",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -57,10 +57,12 @@
57
57
  "@opencode-ai/sdk": "^1.2.6",
58
58
  "vscode-jsonrpc": "^8.2.0",
59
59
  "vscode-languageserver-protocol": "^3.17.5",
60
+ "which": "^6.0.0",
60
61
  "zod": "^4.3.6"
61
62
  },
62
63
  "devDependencies": {
63
64
  "@biomejs/biome": "2.4.2",
65
+ "@types/which": "^3.0.4",
64
66
  "bun-types": "1.3.9",
65
67
  "typescript": "^5.9.3"
66
68
  },