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
@@ -1,4 +1,5 @@
1
1
  export * from './constants';
2
+ export * from './council-schema';
2
3
  export { loadAgentPrompt, loadPluginConfig } from './loader';
3
4
  export * from './schema';
4
5
  export { getAgentOverride } from './utils';
@@ -3,7 +3,8 @@ import { type PluginConfig } from './schema';
3
3
  * Load plugin configuration from user and project config files, merging them appropriately.
4
4
  *
5
5
  * Configuration is loaded from two locations:
6
- * 1. User config: ~/.config/opencode/oh-my-opencode-slim.jsonc or .json (or $XDG_CONFIG_HOME)
6
+ * 1. User config: $OPENCODE_CONFIG_DIR/oh-my-opencode-slim.jsonc or .json,
7
+ * or ~/.config/opencode/oh-my-opencode-slim.jsonc or .json (or $XDG_CONFIG_HOME)
7
8
  * 2. Project config: <directory>/.opencode/oh-my-opencode-slim.jsonc or .json
8
9
  *
9
10
  * JSONC format is preferred over JSON (allows comments and trailing commas).
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  declare const FALLBACK_AGENT_NAMES: readonly ["orchestrator", "oracle", "designer", "explorer", "librarian", "fixer"];
3
3
  declare const MANUAL_AGENT_NAMES: readonly ["orchestrator", "oracle", "designer", "explorer", "librarian", "fixer"];
4
+ export declare const ProviderModelIdSchema: z.ZodString;
4
5
  export declare const ManualAgentPlanSchema: z.ZodObject<{
5
6
  primary: z.ZodString;
6
7
  fallback1: z.ZodString;
@@ -109,6 +110,7 @@ export type BackgroundTaskConfig = z.infer<typeof BackgroundTaskConfigSchema>;
109
110
  export declare const FailoverConfigSchema: z.ZodObject<{
110
111
  enabled: z.ZodDefault<z.ZodBoolean>;
111
112
  timeoutMs: z.ZodDefault<z.ZodNumber>;
113
+ retryDelayMs: z.ZodDefault<z.ZodNumber>;
112
114
  chains: z.ZodDefault<z.ZodObject<{
113
115
  orchestrator: z.ZodOptional<z.ZodArray<z.ZodString>>;
114
116
  oracle: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -121,6 +123,7 @@ export declare const FailoverConfigSchema: z.ZodObject<{
121
123
  export type FailoverConfig = z.infer<typeof FailoverConfigSchema>;
122
124
  export declare const PluginConfigSchema: z.ZodObject<{
123
125
  preset: z.ZodOptional<z.ZodString>;
126
+ setDefaultAgent: z.ZodOptional<z.ZodBoolean>;
124
127
  scoringEngineVersion: z.ZodOptional<z.ZodEnum<{
125
128
  v1: "v1";
126
129
  "v2-shadow": "v2-shadow";
@@ -203,6 +206,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
203
206
  fallback: z.ZodOptional<z.ZodObject<{
204
207
  enabled: z.ZodDefault<z.ZodBoolean>;
205
208
  timeoutMs: z.ZodDefault<z.ZodNumber>;
209
+ retryDelayMs: z.ZodDefault<z.ZodNumber>;
206
210
  chains: z.ZodDefault<z.ZodObject<{
207
211
  orchestrator: z.ZodOptional<z.ZodArray<z.ZodString>>;
208
212
  oracle: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -212,6 +216,29 @@ export declare const PluginConfigSchema: z.ZodObject<{
212
216
  fixer: z.ZodOptional<z.ZodArray<z.ZodString>>;
213
217
  }, z.core.$catchall<z.ZodArray<z.ZodString>>>>;
214
218
  }, z.core.$strip>>;
219
+ council: z.ZodOptional<z.ZodObject<{
220
+ master: z.ZodObject<{
221
+ model: z.ZodString;
222
+ variant: z.ZodOptional<z.ZodString>;
223
+ prompt: z.ZodOptional<z.ZodString>;
224
+ }, z.core.$strip>;
225
+ presets: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>, z.ZodTransform<{
226
+ councillors: Record<string, {
227
+ model: string;
228
+ variant?: string | undefined;
229
+ prompt?: string | undefined;
230
+ }>;
231
+ master: {
232
+ model?: string | undefined;
233
+ variant?: string | undefined;
234
+ prompt?: string | undefined;
235
+ } | undefined;
236
+ }, Record<string, Record<string, unknown>>>>>;
237
+ master_timeout: z.ZodDefault<z.ZodNumber>;
238
+ councillors_timeout: z.ZodDefault<z.ZodNumber>;
239
+ default_preset: z.ZodDefault<z.ZodString>;
240
+ master_fallback: z.ZodPipe<z.ZodOptional<z.ZodArray<z.ZodString>>, z.ZodTransform<string[] | undefined, string[] | undefined>>;
241
+ }, z.core.$strip>>;
215
242
  }, z.core.$strip>;
216
243
  export type PluginConfig = z.infer<typeof PluginConfigSchema>;
217
244
  export type { AgentName } from './constants';
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Council Manager
3
+ *
4
+ * Orchestrates multi-LLM council sessions: launches councillors in
5
+ * parallel, collects results, then runs the council master for synthesis.
6
+ */
7
+ import type { PluginInput } from '@opencode-ai/plugin';
8
+ import type { SubagentDepthTracker } from '../background/subagent-depth';
9
+ import type { PluginConfig } from '../config';
10
+ import type { CouncilResult } from '../config/council-schema';
11
+ export declare class CouncilManager {
12
+ private client;
13
+ private directory;
14
+ private config?;
15
+ private depthTracker?;
16
+ private tmuxEnabled;
17
+ constructor(ctx: PluginInput, config?: PluginConfig, depthTracker?: SubagentDepthTracker, tmuxEnabled?: boolean);
18
+ /**
19
+ * Run a full council session.
20
+ *
21
+ * 1. Look up the preset
22
+ * 2. Launch all councillors in parallel
23
+ * 3. Collect results (respecting timeout)
24
+ * 4. Run master synthesis
25
+ * 5. Return combined result
26
+ */
27
+ runCouncil(prompt: string, presetName: string | undefined, parentSessionId: string): Promise<CouncilResult>;
28
+ /**
29
+ * Inject a start notification into the parent session so the user
30
+ * sees immediate feedback while councillors are spinning up.
31
+ */
32
+ private sendStartNotification;
33
+ /**
34
+ * Run a single agent session: create → register → prompt → extract → cleanup.
35
+ * Both councillors and the master follow this identical lifecycle.
36
+ */
37
+ private runAgentSession;
38
+ private runCouncillors;
39
+ private runMaster;
40
+ }
@@ -0,0 +1 @@
1
+ export { CouncilManager } from './council-manager';
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Runtime model fallback for foreground (interactive) agent sessions.
3
+ *
4
+ * When OpenCode fires a session.error, message.updated, or session.status
5
+ * event containing a rate-limit signal, this manager:
6
+ * 1. Looks up the next untried model in the agent's configured chain
7
+ * 2. Aborts the rate-limited prompt via client.session.abort()
8
+ * 3. Re-queues the last user message via client.session.promptAsync()
9
+ * with the new model — promptAsync returns immediately so we never
10
+ * block the event handler waiting for a full LLM response.
11
+ *
12
+ * This mirrors the BackgroundTaskManager's fallback loop but operates
13
+ * reactively through the event system instead of wrapping prompt() in a
14
+ * try/catch, which is not possible for interactive (foreground) sessions.
15
+ */
16
+ import type { PluginInput } from '@opencode-ai/plugin';
17
+ type OpencodeClient = PluginInput['client'];
18
+ export declare function isRateLimitError(error: unknown): boolean;
19
+ /**
20
+ * Manages runtime model fallback for foreground agent sessions.
21
+ *
22
+ * Constructed at plugin init with the ordered fallback chains for each agent
23
+ * (built from _modelArray entries merged with fallback.chains config).
24
+ */
25
+ export declare class ForegroundFallbackManager {
26
+ private readonly client;
27
+ /**
28
+ * Ordered fallback chains per agent.
29
+ * e.g. { orchestrator: ['anthropic/claude-opus-4-5', 'openai/gpt-4o'] }
30
+ * The first model that hasn't been tried yet is selected on each fallback.
31
+ */
32
+ private readonly chains;
33
+ private readonly enabled;
34
+ /** sessionID → last observed model string ("providerID/modelID") */
35
+ private readonly sessionModel;
36
+ /** sessionID → agent name (populated from message.updated info.agent field) */
37
+ private readonly sessionAgent;
38
+ /** sessionID → set of models already attempted this session */
39
+ private readonly sessionTried;
40
+ /** Sessions with an active fallback switch in flight */
41
+ private readonly inProgress;
42
+ /** sessionID → timestamp of last trigger (for deduplication) */
43
+ private readonly lastTrigger;
44
+ constructor(client: OpencodeClient,
45
+ /**
46
+ * Ordered fallback chains per agent.
47
+ * e.g. { orchestrator: ['anthropic/claude-opus-4-5', 'openai/gpt-4o'] }
48
+ * The first model that hasn't been tried yet is selected on each fallback.
49
+ */
50
+ chains: Record<string, string[]>, enabled: boolean);
51
+ /**
52
+ * Process an OpenCode plugin event.
53
+ * Call this from the plugin's `event` hook for every event received.
54
+ */
55
+ handleEvent(rawEvent: unknown): Promise<void>;
56
+ private tryFallback;
57
+ /**
58
+ * Determine the fallback chain to use for a session.
59
+ *
60
+ * Priority:
61
+ * 1. Agent name known AND has a configured chain → return it directly
62
+ * 2. Agent name known but NO chain configured → return [] (no fallback;
63
+ * do NOT bleed into other agents' chains which would re-prompt the
64
+ * session with a model belonging to a completely different agent)
65
+ * 3. Agent name unknown, current model known → search all chains for
66
+ * the model to infer which chain to use
67
+ * 4. Nothing matches → flatten all chains as a last resort (only
68
+ * reached when both agent name and current model are unavailable)
69
+ */
70
+ private resolveChain;
71
+ }
72
+ export {};
@@ -2,6 +2,7 @@ export type { AutoUpdateCheckerOptions } from './auto-update-checker';
2
2
  export { createAutoUpdateCheckerHook } from './auto-update-checker';
3
3
  export { createChatHeadersHook } from './chat-headers';
4
4
  export { createDelegateTaskRetryHook } from './delegate-task-retry';
5
+ export { ForegroundFallbackManager, isRateLimitError, } from './foreground-fallback';
5
6
  export { createJsonErrorRecoveryHook } from './json-error-recovery';
6
7
  export { createPhaseReminderHook } from './phase-reminder';
7
- export { createPostReadNudgeHook } from './post-read-nudge';
8
+ export { createPostFileToolNudgeHook } from './post-file-tool-nudge';
@@ -1,5 +1,5 @@
1
1
  import type { PluginInput } from '@opencode-ai/plugin';
2
- export declare const JSON_ERROR_TOOL_EXCLUDE_LIST: readonly ["bash", "read", "glob", "grep", "webfetch", "grep_app_searchgithub", "websearch_web_search_exa"];
2
+ export declare const JSON_ERROR_TOOL_EXCLUDE_LIST: readonly ["bash", "read", "glob", "webfetch", "grep_app_searchgithub", "websearch_web_search_exa"];
3
3
  export declare const JSON_ERROR_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
4
4
  export declare const JSON_ERROR_REMINDER = "\n[JSON PARSE ERROR - IMMEDIATE ACTION REQUIRED]\n\nYou sent invalid JSON arguments. The system could not parse your tool call.\nSTOP and do this NOW:\n\n1. LOOK at the error message above to see what was expected vs what you sent.\n2. CORRECT your JSON syntax (missing braces, unescaped quotes, trailing commas, etc).\n3. RETRY the tool call with valid JSON.\n\nDO NOT repeat the exact same invalid call.\n";
5
5
  interface ToolExecuteAfterInput {
@@ -1,4 +1,4 @@
1
- export declare const PHASE_REMINDER = "<reminder>Recall Workflow Rules:\nUnderstand \u2192 find the best path (delegate based on rules and parallelize independent work) \u2192 execute \u2192 verify.\nIf delegating, launch the specialist in the same turn you mention it.</reminder>";
1
+ export declare const PHASE_REMINDER = "<reminder>Recall Workflow Rules:\nUnderstand \u2192 build the best path (delegated based on Agent rules, split and parallelized as much as possible) \u2192 execute \u2192 verify.\nIf delegating, launch the specialist in the same turn you mention it.</reminder>";
2
2
  interface MessageInfo {
3
3
  role: string;
4
4
  agent?: string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Post-tool nudge - appends a delegation reminder after file reads/writes.
3
+ * Catches the "inspect/edit files → implement myself" anti-pattern.
4
+ */
5
+ interface ToolExecuteAfterInput {
6
+ tool: string;
7
+ sessionID?: string;
8
+ callID?: string;
9
+ }
10
+ interface ToolExecuteAfterOutput {
11
+ title: string;
12
+ output: string;
13
+ metadata: Record<string, unknown>;
14
+ }
15
+ export declare function createPostFileToolNudgeHook(): {
16
+ 'tool.execute.after': (input: ToolExecuteAfterInput, output: ToolExecuteAfterOutput) => Promise<void>;
17
+ };
18
+ export {};