myai-opencode 0.6.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.
- package/LICENSE +21 -0
- package/README.md +244 -0
- package/dist/agents/designer.d.ts +2 -0
- package/dist/agents/explorer.d.ts +2 -0
- package/dist/agents/fixer.d.ts +2 -0
- package/dist/agents/index.d.ts +22 -0
- package/dist/agents/librarian.d.ts +2 -0
- package/dist/agents/oracle.d.ts +2 -0
- package/dist/agents/orchestrator.d.ts +7 -0
- package/dist/background/background-manager.d.ts +131 -0
- package/dist/background/index.d.ts +2 -0
- package/dist/background/tmux-session-manager.d.ts +58 -0
- package/dist/cli/config-io.d.ts +21 -0
- package/dist/cli/config-manager.d.ts +4 -0
- package/dist/cli/custom-skills.d.ts +29 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +14342 -0
- package/dist/cli/install.d.ts +2 -0
- package/dist/cli/paths.d.ts +7 -0
- package/dist/cli/providers.d.ts +79 -0
- package/dist/cli/skills.d.ts +35 -0
- package/dist/cli/system.d.ts +4 -0
- package/dist/cli/types.d.ts +34 -0
- package/dist/config/agent-mcps.d.ts +15 -0
- package/dist/config/constants.d.ts +12 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/loader.d.ts +26 -0
- package/dist/config/schema.d.ts +81 -0
- package/dist/config/utils.d.ts +10 -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/index.d.ts +4 -0
- package/dist/hooks/phase-reminder/index.d.ts +25 -0
- package/dist/hooks/post-read-nudge/index.d.ts +18 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +33076 -0
- package/dist/mcp/context7.d.ts +6 -0
- package/dist/mcp/grep-app.d.ts +6 -0
- package/dist/mcp/index.d.ts +6 -0
- package/dist/mcp/types.d.ts +12 -0
- package/dist/mcp/websearch.d.ts +6 -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/grep/cli.d.ts +3 -0
- package/dist/tools/grep/constants.d.ts +18 -0
- package/dist/tools/grep/downloader.d.ts +3 -0
- package/dist/tools/grep/index.d.ts +5 -0
- package/dist/tools/grep/tools.d.ts +2 -0
- package/dist/tools/grep/types.d.ts +35 -0
- package/dist/tools/grep/utils.d.ts +2 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/lsp/client.d.ts +42 -0
- package/dist/tools/lsp/config.d.ts +4 -0
- package/dist/tools/lsp/constants.d.ts +8 -0
- package/dist/tools/lsp/index.d.ts +3 -0
- package/dist/tools/lsp/tools.d.ts +5 -0
- package/dist/tools/lsp/types.d.ts +28 -0
- package/dist/tools/lsp/utils.d.ts +21 -0
- package/dist/utils/agent-variant.d.ts +47 -0
- package/dist/utils/index.d.ts +5 -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/package.json +68 -0
- package/src/skills/cartography/README.md +57 -0
- package/src/skills/cartography/SKILL.md +137 -0
- package/src/skills/cartography/scripts/cartographer.py +456 -0
- package/src/skills/cartography/scripts/test_cartographer.py +87 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { McpConfig } from './types';
|
|
2
|
+
export type { LocalMcpConfig, McpConfig, RemoteMcpConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates MCP configurations, excluding disabled ones
|
|
5
|
+
*/
|
|
6
|
+
export declare function createBuiltinMcps(disabledMcps?: readonly string[]): 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,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,18 @@
|
|
|
1
|
+
export type GrepBackend = 'rg' | 'grep';
|
|
2
|
+
interface ResolvedCli {
|
|
3
|
+
path: string;
|
|
4
|
+
backend: GrepBackend;
|
|
5
|
+
}
|
|
6
|
+
export declare function getDataDir(): string;
|
|
7
|
+
export declare function resolveGrepCli(): ResolvedCli;
|
|
8
|
+
export declare function resolveGrepCliWithAutoInstall(): Promise<ResolvedCli>;
|
|
9
|
+
export declare const DEFAULT_MAX_DEPTH = 20;
|
|
10
|
+
export declare const DEFAULT_MAX_FILESIZE = "10M";
|
|
11
|
+
export declare const DEFAULT_MAX_COUNT = 500;
|
|
12
|
+
export declare const DEFAULT_MAX_COLUMNS = 1000;
|
|
13
|
+
export declare const DEFAULT_CONTEXT = 2;
|
|
14
|
+
export declare const DEFAULT_TIMEOUT_MS = 300000;
|
|
15
|
+
export declare const DEFAULT_MAX_OUTPUT_BYTES: number;
|
|
16
|
+
export declare const RG_SAFETY_FLAGS: readonly ["--no-follow", "--color=never", "--no-heading", "--line-number", "--with-filename"];
|
|
17
|
+
export declare const GREP_SAFETY_FLAGS: readonly ["-n", "-H", "--color=never"];
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { runRg, runRgCount } from './cli';
|
|
2
|
+
export { resolveGrepCli, resolveGrepCliWithAutoInstall } from './constants';
|
|
3
|
+
export { downloadAndInstallRipgrep, getInstalledRipgrepPath, } from './downloader';
|
|
4
|
+
export { grep } from './tools';
|
|
5
|
+
export type { CountResult, GrepMatch, GrepOptions, GrepResult } from './types';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface GrepMatch {
|
|
2
|
+
file: string;
|
|
3
|
+
line: number;
|
|
4
|
+
text: string;
|
|
5
|
+
}
|
|
6
|
+
export interface GrepResult {
|
|
7
|
+
matches: GrepMatch[];
|
|
8
|
+
totalMatches: number;
|
|
9
|
+
filesSearched: number;
|
|
10
|
+
truncated: boolean;
|
|
11
|
+
error?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CountResult {
|
|
14
|
+
file: string;
|
|
15
|
+
count: number;
|
|
16
|
+
}
|
|
17
|
+
export interface GrepOptions {
|
|
18
|
+
pattern: string;
|
|
19
|
+
paths?: string[];
|
|
20
|
+
globs?: string[];
|
|
21
|
+
excludeGlobs?: string[];
|
|
22
|
+
context?: number;
|
|
23
|
+
caseSensitive?: boolean;
|
|
24
|
+
wholeWord?: boolean;
|
|
25
|
+
fixedStrings?: boolean;
|
|
26
|
+
multiline?: boolean;
|
|
27
|
+
hidden?: boolean;
|
|
28
|
+
noIgnore?: boolean;
|
|
29
|
+
fileType?: string[];
|
|
30
|
+
maxDepth?: number;
|
|
31
|
+
maxFilesize?: string;
|
|
32
|
+
maxCount?: number;
|
|
33
|
+
maxColumns?: number;
|
|
34
|
+
timeout?: number;
|
|
35
|
+
}
|
|
@@ -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,8 @@
|
|
|
1
|
+
import type { LSPServerConfig } 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
|
+
export declare const BUILTIN_SERVERS: Record<string, Omit<LSPServerConfig, 'id'>>;
|
|
7
|
+
export declare const LSP_INSTALL_HINTS: Record<string, string>;
|
|
8
|
+
export declare const EXT_TO_LANG: Record<string, string>;
|
|
@@ -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,28 @@
|
|
|
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
|
+
export interface LSPServerConfig {
|
|
3
|
+
id: string;
|
|
4
|
+
command: string[];
|
|
5
|
+
extensions: string[];
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
env?: Record<string, string>;
|
|
8
|
+
initialization?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface ResolvedServer {
|
|
11
|
+
id: string;
|
|
12
|
+
command: string[];
|
|
13
|
+
extensions: string[];
|
|
14
|
+
env?: Record<string, string>;
|
|
15
|
+
initialization?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export type ServerLookupResult = {
|
|
18
|
+
status: 'found';
|
|
19
|
+
server: ResolvedServer;
|
|
20
|
+
} | {
|
|
21
|
+
status: 'not_configured';
|
|
22
|
+
extension: string;
|
|
23
|
+
} | {
|
|
24
|
+
status: 'not_installed';
|
|
25
|
+
server: ResolvedServer;
|
|
26
|
+
installHint: string;
|
|
27
|
+
};
|
|
28
|
+
export type { Position, Range, Location, LocationLink, Diagnostic, TextDocumentIdentifier, VersionedTextDocumentIdentifier, TextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, SymbolInfo, DocumentSymbol, };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LSPClient } from './client';
|
|
2
|
+
import type { Diagnostic, Location, LocationLink, ServerLookupResult, WorkspaceEdit } from './types';
|
|
3
|
+
export declare function findWorkspaceRoot(filePath: string): string;
|
|
4
|
+
export declare function uriToPath(uri: string): string;
|
|
5
|
+
export declare function formatServerLookupError(result: Exclude<ServerLookupResult, {
|
|
6
|
+
status: 'found';
|
|
7
|
+
}>): string;
|
|
8
|
+
export declare function withLspClient<T>(filePath: string, fn: (client: LSPClient) => Promise<T>): Promise<T>;
|
|
9
|
+
export declare function formatLocation(loc: Location | LocationLink): string;
|
|
10
|
+
export declare function formatSymbolKind(kind: number): string;
|
|
11
|
+
export declare function formatSeverity(severity: number | undefined): string;
|
|
12
|
+
export declare function formatDiagnostic(diag: Diagnostic): string;
|
|
13
|
+
export declare function filterDiagnosticsBySeverity(diagnostics: Diagnostic[], severityFilter?: 'error' | 'warning' | 'information' | 'hint' | 'all'): Diagnostic[];
|
|
14
|
+
export interface ApplyResult {
|
|
15
|
+
success: boolean;
|
|
16
|
+
filesModified: string[];
|
|
17
|
+
totalEdits: number;
|
|
18
|
+
errors: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function applyWorkspaceEdit(edit: WorkspaceEdit | null): ApplyResult;
|
|
21
|
+
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 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>;
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "myai-opencode",
|
|
3
|
+
"version": "0.6.4",
|
|
4
|
+
"description": "Lightweight agent orchestration plugin for OpenCode",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"myai-opencode": "./dist/cli/index.js"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"opencode",
|
|
14
|
+
"opencode-plugin",
|
|
15
|
+
"ai",
|
|
16
|
+
"agents",
|
|
17
|
+
"orchestration",
|
|
18
|
+
"llm",
|
|
19
|
+
"claude",
|
|
20
|
+
"gpt",
|
|
21
|
+
"gemini"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/alvinunreal/oh-my-opencode-slim"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/alvinunreal/oh-my-opencode-slim/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/alvinunreal/oh-my-opencode-slim#readme",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"src/skills",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "bun build src/index.ts --outdir dist --target bun --format esm && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm && tsc --emitDeclarationOnly",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"test": "bun test",
|
|
41
|
+
"lint": "biome lint .",
|
|
42
|
+
"format": "biome format . --write",
|
|
43
|
+
"check": "biome check --write .",
|
|
44
|
+
"check:ci": "biome check .",
|
|
45
|
+
"dev": "bun run build && opencode",
|
|
46
|
+
"prepublishOnly": "bun run build",
|
|
47
|
+
"release:patch": "npm version patch && git push --follow-tags && npm publish",
|
|
48
|
+
"release:minor": "npm version minor && git push --follow-tags && npm publish",
|
|
49
|
+
"release:major": "npm version major && git push --follow-tags && npm publish"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@ast-grep/cli": "^0.40.0",
|
|
53
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
54
|
+
"@opencode-ai/plugin": "^1.1.19",
|
|
55
|
+
"@opencode-ai/sdk": "^1.1.19",
|
|
56
|
+
"vscode-jsonrpc": "^8.2.0",
|
|
57
|
+
"vscode-languageserver-protocol": "^3.17.5",
|
|
58
|
+
"zod": "^4.1.8"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@biomejs/biome": "2.3.11",
|
|
62
|
+
"bun-types": "latest",
|
|
63
|
+
"typescript": "^5.7.3"
|
|
64
|
+
},
|
|
65
|
+
"trustedDependencies": [
|
|
66
|
+
"@ast-grep/cli"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Cartography Skill
|
|
2
|
+
|
|
3
|
+
Repository understanding and hierarchical codemap generation.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Cartography helps orchestrators map and understand codebases by:
|
|
8
|
+
|
|
9
|
+
1. Selecting relevant code/config files using LLM judgment
|
|
10
|
+
2. Creating `.slim/cartography.json` for change tracking
|
|
11
|
+
3. Generating empty `codemap.md` templates for explorers to fill in
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Initialize mapping
|
|
17
|
+
python3 cartographer.py init --root /repo --include "src/**/*.ts" --exclude "node_modules/**"
|
|
18
|
+
|
|
19
|
+
# Check what changed
|
|
20
|
+
python3 cartographer.py changes --root /repo
|
|
21
|
+
|
|
22
|
+
# Update hashes
|
|
23
|
+
python3 cartographer.py update --root /repo
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Outputs
|
|
27
|
+
|
|
28
|
+
### .slim/cartography.json
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"metadata": {
|
|
33
|
+
"version": "1.0.0",
|
|
34
|
+
"last_run": "2026-01-25T19:00:00Z",
|
|
35
|
+
"include_patterns": ["src/**/*.ts"],
|
|
36
|
+
"exclude_patterns": ["node_modules/**"]
|
|
37
|
+
},
|
|
38
|
+
"file_hashes": {
|
|
39
|
+
"src/index.ts": "abc123..."
|
|
40
|
+
},
|
|
41
|
+
"folder_hashes": {
|
|
42
|
+
"src": "def456..."
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### codemap.md (per folder)
|
|
48
|
+
|
|
49
|
+
Empty templates created in each folder for explorers to fill with:
|
|
50
|
+
- Responsibility
|
|
51
|
+
- Design patterns
|
|
52
|
+
- Data/control flow
|
|
53
|
+
- Integration points
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
Installed automatically via oh-my-opencode-slim installer when custom skills are enabled.
|