oh-my-opencode-lite 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.
- package/LICENSE +21 -0
- package/README.md +365 -0
- package/dist/agents/deep.d.ts +2 -0
- package/dist/agents/designer.d.ts +2 -0
- package/dist/agents/explorer.d.ts +2 -0
- package/dist/agents/index.d.ts +8 -0
- package/dist/agents/librarian.d.ts +2 -0
- package/dist/agents/oracle.d.ts +2 -0
- package/dist/agents/orchestrator.d.ts +15 -0
- package/dist/agents/prompt-utils.d.ts +10 -0
- package/dist/agents/quick.d.ts +2 -0
- package/dist/background/background-manager.d.ts +196 -0
- package/dist/background/index.d.ts +2 -0
- package/dist/background/tmux-session-manager.d.ts +63 -0
- package/dist/cli/config-io.d.ts +22 -0
- package/dist/cli/config-manager.d.ts +4 -0
- package/dist/cli/custom-skills.d.ts +48 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +1178 -0
- package/dist/cli/install.d.ts +3 -0
- package/dist/cli/model-key-normalization.d.ts +1 -0
- package/dist/cli/paths.d.ts +21 -0
- package/dist/cli/providers.d.ts +120 -0
- package/dist/cli/skill-manifest.d.ts +32 -0
- package/dist/cli/skills.d.ts +26 -0
- package/dist/cli/system.d.ts +6 -0
- package/dist/cli/types.d.ts +38 -0
- package/dist/config/constants.d.ts +19 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/loader.d.ts +33 -0
- package/dist/config/schema.d.ts +313 -0
- package/dist/config/utils.d.ts +10 -0
- package/dist/delegation/delegation-manager.d.ts +25 -0
- package/dist/delegation/index.d.ts +4 -0
- package/dist/delegation/paths.d.ts +15 -0
- package/dist/delegation/project-id.d.ts +1 -0
- package/dist/delegation/types.d.ts +39 -0
- package/dist/hooks/auto-update-checker/cache.d.ts +6 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +28 -0
- package/dist/hooks/auto-update-checker/constants.d.ts +11 -0
- package/dist/hooks/auto-update-checker/index.d.ts +17 -0
- package/dist/hooks/auto-update-checker/types.d.ts +23 -0
- package/dist/hooks/chat-headers.d.ts +16 -0
- package/dist/hooks/clarification-gate/index.d.ts +30 -0
- package/dist/hooks/delegate-task-retry/guidance.d.ts +2 -0
- package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
- package/dist/hooks/delegate-task-retry/index.d.ts +4 -0
- package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
- package/dist/hooks/foreground-fallback/index.d.ts +72 -0
- package/dist/hooks/index.d.ts +11 -0
- package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
- package/dist/hooks/json-error-recovery/index.d.ts +1 -0
- package/dist/hooks/phase-reminder/index.d.ts +26 -0
- package/dist/hooks/post-read-nudge/index.d.ts +18 -0
- package/dist/hooks/skill-sync.d.ts +10 -0
- package/dist/hooks/thoth-mem/index.d.ts +46 -0
- package/dist/hooks/thoth-mem/protocol.d.ts +6 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +36210 -0
- package/dist/mcp/context7.d.ts +6 -0
- package/dist/mcp/grep-app.d.ts +6 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/thoth.d.ts +3 -0
- package/dist/mcp/types.d.ts +12 -0
- package/dist/mcp/websearch.d.ts +6 -0
- package/dist/thoth/client.d.ts +14 -0
- package/dist/thoth/index.d.ts +2 -0
- package/dist/tools/ast-grep/cli.d.ts +15 -0
- package/dist/tools/ast-grep/constants.d.ts +25 -0
- package/dist/tools/ast-grep/downloader.d.ts +5 -0
- package/dist/tools/ast-grep/index.d.ts +10 -0
- package/dist/tools/ast-grep/tools.d.ts +3 -0
- package/dist/tools/ast-grep/types.d.ts +30 -0
- package/dist/tools/ast-grep/utils.d.ts +4 -0
- package/dist/tools/background.d.ts +13 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/lsp/client.d.ts +42 -0
- package/dist/tools/lsp/config-store.d.ts +29 -0
- package/dist/tools/lsp/config.d.ts +4 -0
- package/dist/tools/lsp/constants.d.ts +24 -0
- package/dist/tools/lsp/index.d.ts +4 -0
- package/dist/tools/lsp/tools.d.ts +5 -0
- package/dist/tools/lsp/types.d.ts +35 -0
- package/dist/tools/lsp/utils.d.ts +34 -0
- package/dist/utils/agent-variant.d.ts +47 -0
- package/dist/utils/env.d.ts +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/internal-initiator.d.ts +6 -0
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/polling.d.ts +21 -0
- package/dist/utils/tmux.d.ts +32 -0
- package/dist/utils/zip-extractor.d.ts +1 -0
- package/oh-my-opencode-lite.schema.json +556 -0
- package/package.json +74 -0
- package/src/skills/_shared/openspec-convention.md +92 -0
- package/src/skills/_shared/persistence-contract.md +78 -0
- package/src/skills/_shared/thoth-mem-convention.md +80 -0
- package/src/skills/brainstorming/SKILL.md +120 -0
- package/src/skills/cartography/README.md +57 -0
- package/src/skills/cartography/SKILL.md +160 -0
- package/src/skills/cartography/scripts/cartographer.py +460 -0
- package/src/skills/cartography/scripts/test_cartographer.py +87 -0
- package/src/skills/executing-plans/SKILL.md +211 -0
- package/src/skills/plan-reviewer/SKILL.md +100 -0
- package/src/skills/sdd-apply/SKILL.md +101 -0
- package/src/skills/sdd-archive/SKILL.md +94 -0
- package/src/skills/sdd-design/SKILL.md +104 -0
- package/src/skills/sdd-propose/SKILL.md +99 -0
- package/src/skills/sdd-spec/SKILL.md +105 -0
- package/src/skills/sdd-tasks/SKILL.md +116 -0
- package/src/skills/sdd-verify/SKILL.md +102 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ThothConfig } from '../config';
|
|
2
|
+
import type { McpConfig } from './types';
|
|
3
|
+
export type { LocalMcpConfig, McpConfig, RemoteMcpConfig } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Creates MCP configurations, excluding disabled ones
|
|
6
|
+
*/
|
|
7
|
+
export declare function createBuiltinMcps(disabledMcps?: readonly string[], thothConfig?: ThothConfig): Record<string, McpConfig>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type RemoteMcpConfig = {
|
|
2
|
+
type: 'remote';
|
|
3
|
+
url: string;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
oauth?: false;
|
|
6
|
+
};
|
|
7
|
+
export type LocalMcpConfig = {
|
|
8
|
+
type: 'local';
|
|
9
|
+
command: string[];
|
|
10
|
+
environment?: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
export type McpConfig = RemoteMcpConfig | LocalMcpConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface CreateThothClientOptions {
|
|
2
|
+
project: string;
|
|
3
|
+
directory?: string;
|
|
4
|
+
httpPort?: number;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface ThothClient {
|
|
9
|
+
readonly enabled: boolean;
|
|
10
|
+
memContext(sessionId?: string, limit?: number): Promise<string | null>;
|
|
11
|
+
memSessionStart(sessionId: string): Promise<boolean>;
|
|
12
|
+
memSavePrompt(sessionId: string, content: string): Promise<boolean>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createThothClient(options: CreateThothClientOptions): ThothClient;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CliLanguage, SgResult } from './types';
|
|
2
|
+
export interface RunOptions {
|
|
3
|
+
pattern: string;
|
|
4
|
+
lang: CliLanguage;
|
|
5
|
+
paths?: string[];
|
|
6
|
+
globs?: string[];
|
|
7
|
+
rewrite?: string;
|
|
8
|
+
context?: number;
|
|
9
|
+
updateAll?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function getAstGrepPath(): Promise<string | null>;
|
|
12
|
+
export declare function startBackgroundInit(): void;
|
|
13
|
+
export declare function runSg(options: RunOptions): Promise<SgResult>;
|
|
14
|
+
export declare function isCliAvailable(): boolean;
|
|
15
|
+
export declare function ensureCliAvailable(): Promise<boolean>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CLI_LANGUAGES } from './types';
|
|
2
|
+
export declare function findSgCliPathSync(): string | null;
|
|
3
|
+
export declare function getSgCliPath(): string;
|
|
4
|
+
export declare function setSgCliPath(path: string): void;
|
|
5
|
+
export { CLI_LANGUAGES };
|
|
6
|
+
export declare const DEFAULT_TIMEOUT_MS = 300000;
|
|
7
|
+
export declare const DEFAULT_MAX_OUTPUT_BYTES: number;
|
|
8
|
+
export declare const DEFAULT_MAX_MATCHES = 500;
|
|
9
|
+
export declare const LANG_EXTENSIONS: Record<string, string[]>;
|
|
10
|
+
export interface EnvironmentCheckResult {
|
|
11
|
+
cli: {
|
|
12
|
+
available: boolean;
|
|
13
|
+
path: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check if ast-grep CLI is available.
|
|
19
|
+
* Call this at startup to provide early feedback about missing dependencies.
|
|
20
|
+
*/
|
|
21
|
+
export declare function checkEnvironment(): EnvironmentCheckResult;
|
|
22
|
+
/**
|
|
23
|
+
* Format environment check result as user-friendly message.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatEnvironmentCheck(result: EnvironmentCheckResult): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function getCacheDir(): string;
|
|
2
|
+
export declare function getBinaryName(): string;
|
|
3
|
+
export declare function getCachedBinaryPath(): string | null;
|
|
4
|
+
export declare function downloadAstGrep(version?: string): Promise<string | null>;
|
|
5
|
+
export declare function ensureAstGrepBinary(): Promise<string | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ToolDefinition } from '@opencode-ai/plugin';
|
|
2
|
+
import { ast_grep_replace, ast_grep_search } from './tools';
|
|
3
|
+
export declare const builtinTools: Record<string, ToolDefinition>;
|
|
4
|
+
export { ast_grep_search, ast_grep_replace };
|
|
5
|
+
export { ensureCliAvailable, getAstGrepPath, isCliAvailable, startBackgroundInit, } from './cli';
|
|
6
|
+
export type { EnvironmentCheckResult } from './constants';
|
|
7
|
+
export { checkEnvironment, formatEnvironmentCheck } from './constants';
|
|
8
|
+
export { ensureAstGrepBinary, getCacheDir, getCachedBinaryPath, } from './downloader';
|
|
9
|
+
export type { CliLanguage, CliMatch, SgResult } from './types';
|
|
10
|
+
export { CLI_LANGUAGES } from './types';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const CLI_LANGUAGES: readonly ["bash", "c", "cpp", "csharp", "css", "elixir", "go", "haskell", "html", "java", "javascript", "json", "kotlin", "lua", "nix", "php", "python", "ruby", "rust", "scala", "solidity", "swift", "typescript", "tsx", "yaml"];
|
|
2
|
+
export type CliLanguage = (typeof CLI_LANGUAGES)[number];
|
|
3
|
+
export interface CliMatch {
|
|
4
|
+
file: string;
|
|
5
|
+
range: {
|
|
6
|
+
byteOffset: {
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
};
|
|
10
|
+
start: {
|
|
11
|
+
line: number;
|
|
12
|
+
column: number;
|
|
13
|
+
};
|
|
14
|
+
end: {
|
|
15
|
+
line: number;
|
|
16
|
+
column: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
lines: string;
|
|
20
|
+
text: string;
|
|
21
|
+
replacement?: string;
|
|
22
|
+
language: string;
|
|
23
|
+
}
|
|
24
|
+
export interface SgResult {
|
|
25
|
+
matches: CliMatch[];
|
|
26
|
+
totalMatches: number;
|
|
27
|
+
truncated: boolean;
|
|
28
|
+
truncatedReason?: 'timeout' | 'max_output_bytes' | 'max_matches';
|
|
29
|
+
error?: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CliLanguage, SgResult } from './types';
|
|
2
|
+
export declare function formatSearchResult(result: SgResult): string;
|
|
3
|
+
export declare function formatReplaceResult(result: SgResult, isDryRun: boolean): string;
|
|
4
|
+
export declare function getEmptyResultHint(pattern: string, lang: CliLanguage): string | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type PluginInput, type ToolDefinition } from '@opencode-ai/plugin';
|
|
2
|
+
import { type BackgroundTaskManager } from '../background';
|
|
3
|
+
import type { PluginConfig } from '../config';
|
|
4
|
+
import type { TmuxConfig } from '../config/schema';
|
|
5
|
+
/**
|
|
6
|
+
* Creates background task management tools for the plugin.
|
|
7
|
+
* @param _ctx - Plugin input context
|
|
8
|
+
* @param manager - Background task manager for launching and tracking tasks
|
|
9
|
+
* @param _tmuxConfig - Optional tmux configuration for session management
|
|
10
|
+
* @param _pluginConfig - Optional plugin configuration for agent variants
|
|
11
|
+
* @returns Object containing background_task, background_output, and background_cancel tools
|
|
12
|
+
*/
|
|
13
|
+
export declare function createBackgroundTools(_ctx: PluginInput, manager: BackgroundTaskManager, _tmuxConfig?: TmuxConfig, _pluginConfig?: PluginConfig): Record<string, ToolDefinition>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Diagnostic, ResolvedServer } from './types';
|
|
2
|
+
declare class LSPServerManager {
|
|
3
|
+
private static instance;
|
|
4
|
+
private clients;
|
|
5
|
+
private cleanupInterval;
|
|
6
|
+
private readonly IDLE_TIMEOUT;
|
|
7
|
+
private constructor();
|
|
8
|
+
private registerProcessCleanup;
|
|
9
|
+
static getInstance(): LSPServerManager;
|
|
10
|
+
private getKey;
|
|
11
|
+
private startCleanupTimer;
|
|
12
|
+
private cleanupIdleClients;
|
|
13
|
+
getClient(root: string, server: ResolvedServer): Promise<LSPClient>;
|
|
14
|
+
releaseClient(root: string, serverId: string): void;
|
|
15
|
+
isServerInitializing(root: string, serverId: string): boolean;
|
|
16
|
+
stopAll(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare const lspManager: LSPServerManager;
|
|
19
|
+
export declare class LSPClient {
|
|
20
|
+
private root;
|
|
21
|
+
private server;
|
|
22
|
+
private proc;
|
|
23
|
+
private connection;
|
|
24
|
+
private openedFiles;
|
|
25
|
+
private stderrBuffer;
|
|
26
|
+
private processExited;
|
|
27
|
+
private diagnosticsStore;
|
|
28
|
+
constructor(root: string, server: ResolvedServer);
|
|
29
|
+
start(): Promise<void>;
|
|
30
|
+
private startStderrReading;
|
|
31
|
+
initialize(): Promise<void>;
|
|
32
|
+
openFile(filePath: string): Promise<void>;
|
|
33
|
+
definition(filePath: string, line: number, character: number): Promise<unknown>;
|
|
34
|
+
references(filePath: string, line: number, character: number, includeDeclaration?: boolean): Promise<unknown>;
|
|
35
|
+
diagnostics(filePath: string): Promise<{
|
|
36
|
+
items: Diagnostic[];
|
|
37
|
+
}>;
|
|
38
|
+
rename(filePath: string, line: number, character: number, newName: string): Promise<unknown>;
|
|
39
|
+
isAlive(): boolean;
|
|
40
|
+
stop(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
@@ -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;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LSPServerConfig, RootFunction } from './types';
|
|
2
|
+
export declare const SYMBOL_KIND_MAP: Record<number, string>;
|
|
3
|
+
export declare const SEVERITY_MAP: Record<number, string>;
|
|
4
|
+
export declare const DEFAULT_MAX_REFERENCES = 200;
|
|
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
|
+
*/
|
|
18
|
+
export declare const BUILTIN_SERVERS: Record<string, Omit<LSPServerConfig, 'id'>>;
|
|
19
|
+
export declare const LSP_INSTALL_HINTS: 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>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { lspManager } from './client';
|
|
2
|
+
export { getUserLspConfig, setUserLspConfig } from './config-store';
|
|
3
|
+
export { lsp_diagnostics, lsp_find_references, lsp_goto_definition, lsp_rename, } from './tools';
|
|
4
|
+
export type { Diagnostic, Location, LSPServerConfig, ResolvedServer, WorkspaceEdit, } from './types';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ToolDefinition } from '@opencode-ai/plugin/tool';
|
|
2
|
+
export declare const lsp_goto_definition: ToolDefinition;
|
|
3
|
+
export declare const lsp_find_references: ToolDefinition;
|
|
4
|
+
export declare const lsp_diagnostics: ToolDefinition;
|
|
5
|
+
export declare const lsp_rename: ToolDefinition;
|
|
@@ -0,0 +1,35 @@
|
|
|
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;
|
|
7
|
+
export interface LSPServerConfig {
|
|
8
|
+
id: string;
|
|
9
|
+
command: string[];
|
|
10
|
+
extensions: string[];
|
|
11
|
+
root?: RootFunction;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
env?: Record<string, string>;
|
|
14
|
+
initialization?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface ResolvedServer {
|
|
17
|
+
id: string;
|
|
18
|
+
command: string[];
|
|
19
|
+
extensions: string[];
|
|
20
|
+
root?: RootFunction;
|
|
21
|
+
env?: Record<string, string>;
|
|
22
|
+
initialization?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export type ServerLookupResult = {
|
|
25
|
+
status: 'found';
|
|
26
|
+
server: ResolvedServer;
|
|
27
|
+
} | {
|
|
28
|
+
status: 'not_configured';
|
|
29
|
+
extension: string;
|
|
30
|
+
} | {
|
|
31
|
+
status: 'not_installed';
|
|
32
|
+
server: ResolvedServer;
|
|
33
|
+
installHint: string;
|
|
34
|
+
};
|
|
35
|
+
export type { Position, Range, Location, LocationLink, Diagnostic, TextDocumentIdentifier, VersionedTextDocumentIdentifier, TextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, SymbolInfo, DocumentSymbol, };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { LSPClient } from './client';
|
|
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
|
+
*/
|
|
16
|
+
export declare function findWorkspaceRoot(filePath: string): string;
|
|
17
|
+
export declare function uriToPath(uri: string): string;
|
|
18
|
+
export declare function formatServerLookupError(result: Exclude<ServerLookupResult, {
|
|
19
|
+
status: 'found';
|
|
20
|
+
}>): string;
|
|
21
|
+
export declare function withLspClient<T>(filePath: string, fn: (client: LSPClient) => Promise<T>): Promise<T>;
|
|
22
|
+
export declare function formatLocation(loc: Location | LocationLink): string;
|
|
23
|
+
export declare function formatSymbolKind(kind: number): string;
|
|
24
|
+
export declare function formatSeverity(severity: number | undefined): string;
|
|
25
|
+
export declare function formatDiagnostic(diag: Diagnostic): string;
|
|
26
|
+
export declare function filterDiagnosticsBySeverity(diagnostics: Diagnostic[], severityFilter?: 'error' | 'warning' | 'information' | 'hint' | 'all'): Diagnostic[];
|
|
27
|
+
export interface ApplyResult {
|
|
28
|
+
success: boolean;
|
|
29
|
+
filesModified: string[];
|
|
30
|
+
totalEdits: number;
|
|
31
|
+
errors: string[];
|
|
32
|
+
}
|
|
33
|
+
export declare function applyWorkspaceEdit(edit: WorkspaceEdit | null): ApplyResult;
|
|
34
|
+
export declare function formatApplyResult(result: ApplyResult): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { PluginConfig } from '../config';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes an agent name by trimming whitespace and removing the optional @ prefix.
|
|
4
|
+
*
|
|
5
|
+
* @param agentName - The agent name to normalize (e.g., "@oracle" or "oracle")
|
|
6
|
+
* @returns The normalized agent name without @ prefix and trimmed of whitespace
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* normalizeAgentName("@oracle") // returns "oracle"
|
|
10
|
+
* normalizeAgentName(" explore ") // returns "explore"
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalizeAgentName(agentName: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the variant configuration for a specific agent.
|
|
15
|
+
*
|
|
16
|
+
* Looks up the agent's variant in the plugin configuration. Returns undefined if:
|
|
17
|
+
* - No config is provided
|
|
18
|
+
* - The agent has no variant configured
|
|
19
|
+
* - The variant is not a string
|
|
20
|
+
* - The variant is empty or whitespace-only
|
|
21
|
+
*
|
|
22
|
+
* @param config - The plugin configuration object
|
|
23
|
+
* @param agentName - The name of the agent (with or without @ prefix)
|
|
24
|
+
* @returns The trimmed variant string, or undefined if no valid variant is found
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* resolveAgentVariant(config, "@oracle") // returns "high" if configured
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveAgentVariant(config: PluginConfig | undefined, agentName: string): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Applies a variant to a request body if the body doesn't already have one.
|
|
32
|
+
*
|
|
33
|
+
* This function will NOT override an existing variant in the body. If no variant
|
|
34
|
+
* is provided or the body already has a variant, the original body is returned.
|
|
35
|
+
*
|
|
36
|
+
* @template T - The type of the body object, must have an optional variant property
|
|
37
|
+
* @param variant - The variant string to apply (or undefined)
|
|
38
|
+
* @param body - The request body object
|
|
39
|
+
* @returns The body with the variant applied (new object) or the original body unchanged
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* applyAgentVariant("high", { agent: "oracle" }) // returns { agent: "oracle", variant: "high" }
|
|
43
|
+
* applyAgentVariant("high", { agent: "oracle", variant: "low" }) // returns original body with variant: "low"
|
|
44
|
+
*/
|
|
45
|
+
export declare function applyAgentVariant<T extends {
|
|
46
|
+
variant?: string;
|
|
47
|
+
}>(variant: string | undefined, body: T): T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getEnv(name: string): string | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const LITE_INTERNAL_INITIATOR_MARKER = "<!-- LITE_INTERNAL_INITIATOR -->";
|
|
2
|
+
export declare function createInternalAgentTextPart(text: string): {
|
|
3
|
+
type: 'text';
|
|
4
|
+
text: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function hasInternalInitiatorMarker(part: unknown): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function log(message: string, data?: unknown): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface PollOptions {
|
|
2
|
+
pollInterval?: number;
|
|
3
|
+
maxPollTime?: number;
|
|
4
|
+
stableThreshold?: number;
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
}
|
|
7
|
+
export interface PollResult<T> {
|
|
8
|
+
success: boolean;
|
|
9
|
+
data?: T;
|
|
10
|
+
timedOut?: boolean;
|
|
11
|
+
aborted?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generic polling utility that waits for a condition to be met.
|
|
15
|
+
* Returns when the condition is satisfied or timeout/abort occurs.
|
|
16
|
+
*/
|
|
17
|
+
export declare function pollUntilStable<T>(fetchFn: () => Promise<T>, isStable: (current: T, previous: T | null, stableCount: number) => boolean, opts?: PollOptions): Promise<PollResult<T>>;
|
|
18
|
+
/**
|
|
19
|
+
* Simple delay utility
|
|
20
|
+
*/
|
|
21
|
+
export declare function delay(ms: number): Promise<void>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TmuxConfig } from '../config/schema';
|
|
2
|
+
/**
|
|
3
|
+
* Reset the server availability cache (useful when server might have started)
|
|
4
|
+
*/
|
|
5
|
+
export declare function resetServerCheck(): void;
|
|
6
|
+
/**
|
|
7
|
+
* Get cached tmux path, initializing if needed
|
|
8
|
+
*/
|
|
9
|
+
export declare function getTmuxPath(): Promise<string | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Check if we're running inside tmux
|
|
12
|
+
*/
|
|
13
|
+
export declare function isInsideTmux(): boolean;
|
|
14
|
+
export interface SpawnPaneResult {
|
|
15
|
+
success: boolean;
|
|
16
|
+
paneId?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Spawn a new tmux pane running `opencode attach <serverUrl> --session <sessionId>`
|
|
20
|
+
* This connects the new TUI to the existing server so it receives streaming updates.
|
|
21
|
+
* After spawning, applies the configured layout to auto-rebalance all panes.
|
|
22
|
+
* Returns the pane ID so it can be closed later.
|
|
23
|
+
*/
|
|
24
|
+
export declare function spawnTmuxPane(sessionId: string, description: string, config: TmuxConfig, serverUrl: string): Promise<SpawnPaneResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Close a tmux pane by its ID and reapply layout to rebalance remaining panes
|
|
27
|
+
*/
|
|
28
|
+
export declare function closeTmuxPane(paneId: string): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Start background check for tmux availability
|
|
31
|
+
*/
|
|
32
|
+
export declare function startTmuxCheck(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function extractZip(archivePath: string, destDir: string): Promise<void>;
|