oh-my-opencode-slim 0.8.3 → 0.8.5

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 (38) hide show
  1. package/README.md +35 -7
  2. package/dist/agents/council-master.d.ts +2 -0
  3. package/dist/agents/council.d.ts +28 -0
  4. package/dist/agents/councillor.d.ts +2 -0
  5. package/dist/agents/orchestrator.d.ts +6 -0
  6. package/dist/background/background-manager.d.ts +6 -1
  7. package/dist/background/index.d.ts +1 -0
  8. package/dist/background/subagent-depth.d.ts +35 -0
  9. package/dist/cli/config-io.d.ts +1 -1
  10. package/dist/cli/custom-skills.d.ts +2 -2
  11. package/dist/cli/index.js +173 -56
  12. package/dist/cli/paths.d.ts +22 -0
  13. package/dist/cli/providers.d.ts +4 -4
  14. package/dist/cli/types.d.ts +2 -0
  15. package/dist/config/constants.d.ts +7 -2
  16. package/dist/config/council-schema.d.ts +134 -0
  17. package/dist/config/index.d.ts +1 -0
  18. package/dist/config/loader.d.ts +2 -1
  19. package/dist/config/schema.d.ts +27 -0
  20. package/dist/council/council-manager.d.ts +40 -0
  21. package/dist/council/index.d.ts +1 -0
  22. package/dist/hooks/foreground-fallback/index.d.ts +72 -0
  23. package/dist/hooks/index.d.ts +2 -1
  24. package/dist/hooks/json-error-recovery/hook.d.ts +1 -1
  25. package/dist/hooks/phase-reminder/index.d.ts +1 -1
  26. package/dist/hooks/post-file-tool-nudge/index.d.ts +18 -0
  27. package/dist/index.js +2273 -879
  28. package/dist/tools/council.d.ts +9 -0
  29. package/dist/tools/index.d.ts +2 -2
  30. package/dist/tools/lsp/config-store.d.ts +29 -0
  31. package/dist/tools/lsp/constants.d.ts +18 -2
  32. package/dist/tools/lsp/index.d.ts +1 -0
  33. package/dist/tools/lsp/types.d.ts +7 -0
  34. package/dist/tools/lsp/utils.d.ts +14 -1
  35. package/dist/utils/index.d.ts +1 -0
  36. package/dist/utils/session.d.ts +59 -0
  37. package/oh-my-opencode-slim.schema.json +78 -0
  38. package/package.json +3 -1
@@ -0,0 +1,9 @@
1
+ import { type PluginInput, type ToolDefinition } from '@opencode-ai/plugin';
2
+ import type { CouncilManager } from '../council/council-manager';
3
+ /**
4
+ * Creates the council_session tool for multi-LLM orchestration.
5
+ *
6
+ * This tool triggers a full council session: parallel councillors →
7
+ * master synthesis. Available to the council agent.
8
+ */
9
+ export declare function createCouncilTool(_ctx: PluginInput, councilManager: CouncilManager): Record<string, ToolDefinition>;
@@ -1,4 +1,4 @@
1
1
  export { ast_grep_replace, ast_grep_search } from './ast-grep';
2
2
  export { createBackgroundTools } from './background';
3
- export { grep } from './grep';
4
- export { lsp_diagnostics, lsp_find_references, lsp_goto_definition, lsp_rename, lspManager, } from './lsp';
3
+ export { createCouncilTool } from './council';
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, {
@@ -3,5 +3,6 @@ export * from './env';
3
3
  export * from './internal-initiator';
4
4
  export { log } from './logger';
5
5
  export * from './polling';
6
+ export * from './session';
6
7
  export * from './tmux';
7
8
  export { extractZip } from './zip-extractor';
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Shared session utilities for council and background managers.
3
+ */
4
+ import type { PluginInput } from '@opencode-ai/plugin';
5
+ type OpencodeClient = PluginInput['client'];
6
+ /**
7
+ * Extract the short model label from a "provider/model" string.
8
+ * E.g. "openai/gpt-5.4-mini" → "gpt-5.4-mini"
9
+ */
10
+ export declare function shortModelLabel(model: string): string;
11
+ export type PromptBody = {
12
+ messageID?: string;
13
+ model?: {
14
+ providerID: string;
15
+ modelID: string;
16
+ };
17
+ agent?: string;
18
+ noReply?: boolean;
19
+ system?: string;
20
+ tools?: {
21
+ [key: string]: boolean;
22
+ };
23
+ parts: Array<{
24
+ type: 'text';
25
+ text: string;
26
+ }>;
27
+ variant?: string;
28
+ };
29
+ /**
30
+ * Parse a model reference string into provider and model IDs.
31
+ * @param model - Model string in format "provider/model"
32
+ * @returns Object with providerID and modelID, or null if invalid
33
+ */
34
+ export declare function parseModelReference(model: string): {
35
+ providerID: string;
36
+ modelID: string;
37
+ } | null;
38
+ /**
39
+ * Send a prompt to a session with optional timeout.
40
+ * If timeout is exceeded, the session is aborted and an error is thrown.
41
+ * @param client - OpenCode client instance
42
+ * @param args - Arguments for session.prompt()
43
+ * @param timeoutMs - Timeout in milliseconds (0 = no timeout)
44
+ * @throws Error if timeout is exceeded
45
+ */
46
+ export declare function promptWithTimeout(client: OpencodeClient, args: Parameters<OpencodeClient['session']['prompt']>[0], timeoutMs: number): Promise<void>;
47
+ /**
48
+ * Extract the result text from a session.
49
+ * Collects all assistant messages and concatenates their text parts.
50
+ * @param client - OpenCode client instance
51
+ * @param sessionId - Session ID to extract from
52
+ * @param options - Optional: `includeReasoning` (default true) controls whether
53
+ * reasoning/chain-of-thought parts are included.
54
+ * @returns Concatenated text from all assistant messages
55
+ */
56
+ export declare function extractSessionResult(client: OpencodeClient, sessionId: string, options?: {
57
+ includeReasoning?: boolean;
58
+ }): Promise<string>;
59
+ export {};
@@ -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",
@@ -433,6 +441,76 @@
433
441
  }
434
442
  }
435
443
  }
444
+ },
445
+ "council": {
446
+ "type": "object",
447
+ "properties": {
448
+ "master": {
449
+ "type": "object",
450
+ "properties": {
451
+ "model": {
452
+ "type": "string",
453
+ "pattern": "^[^/\\s]+\\/[^\\s]+$",
454
+ "description": "Model ID for the council master (e.g. \"anthropic/claude-opus-4-6\")"
455
+ },
456
+ "variant": {
457
+ "type": "string"
458
+ },
459
+ "prompt": {
460
+ "description": "Optional role/guidance injected into the master synthesis prompt",
461
+ "type": "string"
462
+ }
463
+ },
464
+ "required": [
465
+ "model"
466
+ ]
467
+ },
468
+ "presets": {
469
+ "type": "object",
470
+ "propertyNames": {
471
+ "type": "string"
472
+ },
473
+ "additionalProperties": {
474
+ "type": "object",
475
+ "propertyNames": {
476
+ "type": "string"
477
+ },
478
+ "additionalProperties": {
479
+ "type": "object",
480
+ "propertyNames": {
481
+ "type": "string"
482
+ },
483
+ "additionalProperties": {}
484
+ }
485
+ }
486
+ },
487
+ "master_timeout": {
488
+ "default": 300000,
489
+ "type": "number",
490
+ "minimum": 0
491
+ },
492
+ "councillors_timeout": {
493
+ "default": 180000,
494
+ "type": "number",
495
+ "minimum": 0
496
+ },
497
+ "default_preset": {
498
+ "default": "default",
499
+ "type": "string"
500
+ },
501
+ "master_fallback": {
502
+ "description": "Fallback models for the council master. Tried in order if the primary model fails. Example: [\"anthropic/claude-sonnet-4-6\", \"openai/gpt-5.4\"]",
503
+ "type": "array",
504
+ "items": {
505
+ "type": "string",
506
+ "pattern": "^[^/\\s]+\\/[^\\s]+$"
507
+ }
508
+ }
509
+ },
510
+ "required": [
511
+ "master",
512
+ "presets"
513
+ ]
436
514
  }
437
515
  },
438
516
  "title": "oh-my-opencode-slim",
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.5",
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
  },