oh-my-opencode-serverlocal 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.
Files changed (177) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja-JP.md +775 -0
  3. package/README.ko-KR.md +796 -0
  4. package/README.md +792 -0
  5. package/README.zh-CN.md +765 -0
  6. package/dist/agents/council.d.ts +27 -0
  7. package/dist/agents/councillor.d.ts +2 -0
  8. package/dist/agents/designer.d.ts +2 -0
  9. package/dist/agents/explorer.d.ts +2 -0
  10. package/dist/agents/fixer.d.ts +2 -0
  11. package/dist/agents/index.d.ts +31 -0
  12. package/dist/agents/librarian.d.ts +2 -0
  13. package/dist/agents/observer.d.ts +2 -0
  14. package/dist/agents/oracle.d.ts +2 -0
  15. package/dist/agents/orchestrator.d.ts +28 -0
  16. package/dist/agents/permissions.d.ts +10 -0
  17. package/dist/cli/background-subagents.d.ts +13 -0
  18. package/dist/cli/companion.d.ts +4 -0
  19. package/dist/cli/config-io.d.ts +25 -0
  20. package/dist/cli/config-manager.d.ts +4 -0
  21. package/dist/cli/custom-skills-registry.d.ts +18 -0
  22. package/dist/cli/custom-skills.d.ts +13 -0
  23. package/dist/cli/doctor.d.ts +38 -0
  24. package/dist/cli/index.d.ts +3 -0
  25. package/dist/cli/index.js +3565 -0
  26. package/dist/cli/install.d.ts +7 -0
  27. package/dist/cli/model-key-normalization.d.ts +1 -0
  28. package/dist/cli/paths.d.ts +35 -0
  29. package/dist/cli/providers.d.ts +145 -0
  30. package/dist/cli/skills.d.ts +24 -0
  31. package/dist/cli/system.d.ts +6 -0
  32. package/dist/cli/types.d.ts +47 -0
  33. package/dist/companion/manager.d.ts +50 -0
  34. package/dist/companion/updater.d.ts +36 -0
  35. package/dist/config/agent-mcps.d.ts +11 -0
  36. package/dist/config/constants.d.ts +38 -0
  37. package/dist/config/council-schema.d.ts +137 -0
  38. package/dist/config/index.d.ts +5 -0
  39. package/dist/config/loader.d.ts +88 -0
  40. package/dist/config/runtime-preset.d.ts +11 -0
  41. package/dist/config/schema.d.ts +1107 -0
  42. package/dist/config/strip-orchestrator-model.d.ts +9 -0
  43. package/dist/config/utils.d.ts +18 -0
  44. package/dist/council/council-manager.d.ts +53 -0
  45. package/dist/council/index.d.ts +1 -0
  46. package/dist/hooks/apply-patch/codec.d.ts +7 -0
  47. package/dist/hooks/apply-patch/errors.d.ts +25 -0
  48. package/dist/hooks/apply-patch/execution-context.d.ts +27 -0
  49. package/dist/hooks/apply-patch/index.d.ts +15 -0
  50. package/dist/hooks/apply-patch/matching.d.ts +26 -0
  51. package/dist/hooks/apply-patch/operations.d.ts +3 -0
  52. package/dist/hooks/apply-patch/prepared-changes.d.ts +17 -0
  53. package/dist/hooks/apply-patch/resolution.d.ts +19 -0
  54. package/dist/hooks/apply-patch/rewrite.d.ts +7 -0
  55. package/dist/hooks/apply-patch/test-helpers.d.ts +6 -0
  56. package/dist/hooks/apply-patch/types.d.ts +80 -0
  57. package/dist/hooks/auto-update-checker/cache.d.ts +11 -0
  58. package/dist/hooks/auto-update-checker/checker.d.ts +38 -0
  59. package/dist/hooks/auto-update-checker/constants.d.ts +12 -0
  60. package/dist/hooks/auto-update-checker/index.d.ts +18 -0
  61. package/dist/hooks/auto-update-checker/skill-sync.d.ts +67 -0
  62. package/dist/hooks/auto-update-checker/types.d.ts +34 -0
  63. package/dist/hooks/chat-headers.d.ts +16 -0
  64. package/dist/hooks/command-hook-utils.d.ts +5 -0
  65. package/dist/hooks/deepwork/index.d.ts +13 -0
  66. package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
  67. package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
  68. package/dist/hooks/filter-available-skills/index.d.ts +19 -0
  69. package/dist/hooks/foreground-fallback/index.d.ts +122 -0
  70. package/dist/hooks/image-hook.d.ts +8 -0
  71. package/dist/hooks/index.d.ts +16 -0
  72. package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
  73. package/dist/hooks/loop-command/index.d.ts +13 -0
  74. package/dist/hooks/phase-reminder/index.d.ts +25 -0
  75. package/dist/hooks/post-file-tool-nudge/index.d.ts +23 -0
  76. package/dist/hooks/reflect/index.d.ts +13 -0
  77. package/dist/hooks/session-lifecycle.d.ts +10 -0
  78. package/dist/hooks/task-session-manager/index.d.ts +58 -0
  79. package/dist/hooks/task-session-manager/pending-call-tracker.d.ts +13 -0
  80. package/dist/hooks/task-session-manager/task-context-tracker.d.ts +14 -0
  81. package/dist/hooks/types.d.ts +26 -0
  82. package/dist/index.d.ts +5 -0
  83. package/dist/index.js +39519 -0
  84. package/dist/interview/dashboard-manager.d.ts +21 -0
  85. package/dist/interview/dashboard.d.ts +67 -0
  86. package/dist/interview/document.d.ts +29 -0
  87. package/dist/interview/helpers.d.ts +10 -0
  88. package/dist/interview/index.d.ts +1 -0
  89. package/dist/interview/manager.d.ts +21 -0
  90. package/dist/interview/parser.d.ts +11 -0
  91. package/dist/interview/prompts.d.ts +7 -0
  92. package/dist/interview/server.d.ts +15 -0
  93. package/dist/interview/service.d.ts +45 -0
  94. package/dist/interview/session-server.d.ts +21 -0
  95. package/dist/interview/types.d.ts +111 -0
  96. package/dist/interview/ui.d.ts +11 -0
  97. package/dist/loop/loop-session.d.ts +64 -0
  98. package/dist/mcp/context7.d.ts +6 -0
  99. package/dist/mcp/grep-app.d.ts +6 -0
  100. package/dist/mcp/index.d.ts +8 -0
  101. package/dist/mcp/types.d.ts +12 -0
  102. package/dist/mcp/websearch.d.ts +9 -0
  103. package/dist/multiplexer/cmux/close-policy.d.ts +20 -0
  104. package/dist/multiplexer/cmux/index.d.ts +102 -0
  105. package/dist/multiplexer/cmux/session-lifecycle.d.ts +92 -0
  106. package/dist/multiplexer/cmux/session-state.d.ts +45 -0
  107. package/dist/multiplexer/factory.d.ts +17 -0
  108. package/dist/multiplexer/herdr/index.d.ts +35 -0
  109. package/dist/multiplexer/index.d.ts +12 -0
  110. package/dist/multiplexer/session-manager.d.ts +69 -0
  111. package/dist/multiplexer/shared.d.ts +31 -0
  112. package/dist/multiplexer/tmux/index.d.ts +26 -0
  113. package/dist/multiplexer/types.d.ts +57 -0
  114. package/dist/multiplexer/zellij/index.d.ts +47 -0
  115. package/dist/tools/acp-run.d.ts +3 -0
  116. package/dist/tools/ast-grep/cli.d.ts +15 -0
  117. package/dist/tools/ast-grep/constants.d.ts +25 -0
  118. package/dist/tools/ast-grep/downloader.d.ts +5 -0
  119. package/dist/tools/ast-grep/index.d.ts +10 -0
  120. package/dist/tools/ast-grep/tools.d.ts +3 -0
  121. package/dist/tools/ast-grep/types.d.ts +30 -0
  122. package/dist/tools/ast-grep/utils.d.ts +4 -0
  123. package/dist/tools/cancel-task.d.ts +16 -0
  124. package/dist/tools/council.d.ts +10 -0
  125. package/dist/tools/index.d.ts +7 -0
  126. package/dist/tools/preset-manager.d.ts +26 -0
  127. package/dist/tools/smartfetch/binary.d.ts +3 -0
  128. package/dist/tools/smartfetch/cache.d.ts +6 -0
  129. package/dist/tools/smartfetch/constants.d.ts +12 -0
  130. package/dist/tools/smartfetch/index.d.ts +3 -0
  131. package/dist/tools/smartfetch/network.d.ts +38 -0
  132. package/dist/tools/smartfetch/secondary-model.d.ts +35 -0
  133. package/dist/tools/smartfetch/tool.d.ts +3 -0
  134. package/dist/tools/smartfetch/types.d.ts +122 -0
  135. package/dist/tools/smartfetch/utils.d.ts +20 -0
  136. package/dist/tui-state.d.ts +18 -0
  137. package/dist/tui.d.ts +13 -0
  138. package/dist/tui.js +1112 -0
  139. package/dist/utils/agent-variant.d.ts +23 -0
  140. package/dist/utils/background-job-board.d.ts +113 -0
  141. package/dist/utils/background-job-coordinator.d.ts +72 -0
  142. package/dist/utils/background-job-store.d.ts +46 -0
  143. package/dist/utils/compat.d.ts +29 -0
  144. package/dist/utils/councillor-models.d.ts +20 -0
  145. package/dist/utils/env.d.ts +3 -0
  146. package/dist/utils/escape-html.d.ts +1 -0
  147. package/dist/utils/frontmatter.d.ts +6 -0
  148. package/dist/utils/guards.d.ts +4 -0
  149. package/dist/utils/index.d.ts +10 -0
  150. package/dist/utils/internal-initiator.d.ts +11 -0
  151. package/dist/utils/logger.d.ts +6 -0
  152. package/dist/utils/polling.d.ts +21 -0
  153. package/dist/utils/session.d.ts +75 -0
  154. package/dist/utils/subagent-depth.d.ts +35 -0
  155. package/dist/utils/system-collapse.d.ts +6 -0
  156. package/dist/utils/task.d.ts +20 -0
  157. package/dist/utils/zip-extractor.d.ts +1 -0
  158. package/package.json +108 -0
  159. package/src/companion/companion-manifest.json +12 -0
  160. package/src/skills/clonedeps/README.md +23 -0
  161. package/src/skills/clonedeps/SKILL.md +240 -0
  162. package/src/skills/clonedeps/codemap.md +32 -0
  163. package/src/skills/codemap/README.md +59 -0
  164. package/src/skills/codemap/SKILL.md +163 -0
  165. package/src/skills/codemap/codemap.md +36 -0
  166. package/src/skills/codemap/scripts/codemap.mjs +483 -0
  167. package/src/skills/codemap/scripts/codemap.test.ts +129 -0
  168. package/src/skills/codemap.md +78 -0
  169. package/src/skills/deepwork/SKILL.md +122 -0
  170. package/src/skills/loop-engineering/SKILL.md +30 -0
  171. package/src/skills/oh-my-opencode-slim/SKILL.md +326 -0
  172. package/src/skills/reflect/SKILL.md +326 -0
  173. package/src/skills/simplify/README.md +19 -0
  174. package/src/skills/simplify/SKILL.md +138 -0
  175. package/src/skills/simplify/codemap.md +36 -0
  176. package/src/skills/verification-planning/SKILL.md +102 -0
  177. package/src/skills/worktrees/SKILL.md +171 -0
@@ -0,0 +1,122 @@
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 transient error (rate-limit, 403/Forbidden, etc.), this
6
+ * manager:
7
+ * 1. Looks up the next untried model in the agent's configured chain
8
+ * 2. Aborts the rate-limited prompt via client.session.abort() on the
9
+ * session.status retry path; session.error and message.updated paths
10
+ * re-prompt directly without abort.
11
+ * 3. Re-queues the last user message via client.session.promptAsync()
12
+ * with the new model - promptAsync returns immediately so we never
13
+ * block the event handler waiting for a full LLM response.
14
+ *
15
+ * This mirrors the same fallback loop used for delegated sessions, but operates
16
+ * reactively through the event system instead of wrapping prompt() in a
17
+ * try/catch, which is not possible for interactive (foreground) sessions.
18
+ */
19
+ import type { PluginInput } from '@opencode-ai/plugin';
20
+ import type { SessionLifecycle } from '../session-lifecycle';
21
+ type OpencodeClient = PluginInput['client'];
22
+ export declare function isFailoverError(error: unknown): boolean;
23
+ /**
24
+ * Checks whether an error is a transient/retryable error (rate-limit,
25
+ * 403/Forbidden, etc.) that should trigger model fallback.
26
+ */
27
+ export declare function isRetryableError(error: unknown): boolean;
28
+ /** @deprecated Use isRetryableError instead. */
29
+ export declare function isRateLimitError(error: unknown): boolean;
30
+ /**
31
+ * Manages runtime model fallback for foreground agent sessions.
32
+ *
33
+ * Constructed at plugin init with the ordered fallback chains for each agent
34
+ * (built from _modelArray entries in agents.<name>.model).
35
+ */
36
+ export declare class ForegroundFallbackManager {
37
+ private readonly client;
38
+ /**
39
+ * Ordered fallback chains per agent.
40
+ * e.g. { orchestrator: ['anthropic/claude-opus-4-5', 'openai/gpt-4o'] }
41
+ * The first model that hasn't been tried yet is selected on each fallback.
42
+ */
43
+ private chains;
44
+ private readonly enabled;
45
+ /** Consecutive 429s tolerated on the same model before swap/abort. */
46
+ private readonly maxRetries;
47
+ /** sessionID → last observed model string ("providerID/modelID") */
48
+ private readonly sessionModel;
49
+ /** sessionID → agent name (populated from message.updated info.agent field) */
50
+ private readonly sessionAgent;
51
+ /** sessionID → set of models already attempted this session */
52
+ private readonly sessionTried;
53
+ /** Sessions with an active fallback switch in flight */
54
+ private readonly inProgress;
55
+ /** sessionID → timestamp of last trigger (for deduplication) */
56
+ private readonly lastTrigger;
57
+ /** sessionID → model in use when lastTrigger was set; dedup is bypassed
58
+ * when the model has changed, allowing the cascade to continue when a
59
+ * new fallback model also fails within the dedup window. */
60
+ private readonly lastTriggerModel;
61
+ /** sessionID → consecutive 429 count for the current model.
62
+ * Reset on model swap or session deletion. */
63
+ private readonly sessionRetries;
64
+ /** Exposed for task-session-manager: prevents idle reconciliation
65
+ * while a fallback abort/re-prompt is in flight for this session. */
66
+ isFallbackInProgress(sessionID: string): boolean;
67
+ /**
68
+ * Disable the fallback chain for a specific agent.
69
+ * After calling this, rate-limit errors for that agent surface instead of
70
+ * silently falling back through the chain.
71
+ */
72
+ disableChain(agentName: string): void;
73
+ registerSessionAgent(sessionID: string, agentName: string): void;
74
+ constructor(client: OpencodeClient,
75
+ /**
76
+ * Ordered fallback chains per agent.
77
+ * e.g. { orchestrator: ['anthropic/claude-opus-4-5', 'openai/gpt-4o'] }
78
+ * The first model that hasn't been tried yet is selected on each fallback.
79
+ */
80
+ chains: Record<string, string[]>, enabled: boolean,
81
+ /** Consecutive 429s tolerated on the same model before swap/abort. */
82
+ maxRetries?: number, coordinator?: SessionLifecycle);
83
+ /**
84
+ * Process an OpenCode plugin event.
85
+ * Call this from the plugin's `event` hook for every event received.
86
+ */
87
+ handleEvent(rawEvent: unknown): Promise<void>;
88
+ /** Increment retry counter and return true when the budget is exhausted.
89
+ * Used by shouldIntervene when tried > 0 — each retry counts toward the
90
+ * budget and only triggers fallback after maxRetries - 1 absorptions.
91
+ * First failover retry (tried === 0) bypasses the counter via shouldIntervene. */
92
+ private consumeRetryBudget;
93
+ /** Intervene immediately on first occurrence (tried === 0), otherwise
94
+ * delegate to retry budget. Used by all three event paths. */
95
+ private shouldTriggerFallback;
96
+ private isRecoveredStatus;
97
+ private tryFallback;
98
+ /**
99
+ * Fallback path for session.status retry events. Aborts the retry loop
100
+ * before falling back because promptAsync alone is ignored while the
101
+ * session is in retry mode. inProgress is set first so the
102
+ * task-session-manager sees isFallbackInProgress()=true during the
103
+ * abort idle window and does not cancel the pending task call.
104
+ */
105
+ private tryFallbackWithAbort;
106
+ private isDeduped;
107
+ private execFallback;
108
+ /**
109
+ * Determine the fallback chain to use for a session.
110
+ *
111
+ * Priority:
112
+ * 1. Agent name known AND has a configured chain → return it directly
113
+ * 2. Agent name known but NO chain → return [] (no fallback; never
114
+ * bleed into other agents' chains)
115
+ * 3. Agent name unknown, current model known → search all chains for
116
+ * the model to infer which chain to use
117
+ * 4. Nothing matches → flatten all chains as a last resort (only
118
+ * reached when both agent name and current model are unavailable)
119
+ */
120
+ private resolveChain;
121
+ }
122
+ export {};
@@ -0,0 +1,8 @@
1
+ import { type MessageWithParts } from './types';
2
+ export declare function processImageAttachments(args: {
3
+ messages: MessageWithParts[];
4
+ workDir: string;
5
+ imageRouting: 'auto' | 'direct';
6
+ disabledAgents: Set<string>;
7
+ log: (msg: string) => void;
8
+ }): void;
@@ -0,0 +1,16 @@
1
+ export { createApplyPatchHook } from './apply-patch';
2
+ export type { AutoUpdateCheckerOptions } from './auto-update-checker';
3
+ export { createAutoUpdateCheckerHook } from './auto-update-checker';
4
+ export { createChatHeadersHook } from './chat-headers';
5
+ export { createDeepworkCommandHook } from './deepwork';
6
+ export { createDelegateTaskRetryHook } from './delegate-task-retry/hook';
7
+ export { createFilterAvailableSkillsHook } from './filter-available-skills';
8
+ export { ForegroundFallbackManager, isFailoverError, isRetryableError, } from './foreground-fallback';
9
+ export { processImageAttachments } from './image-hook';
10
+ export { createJsonErrorRecoveryHook } from './json-error-recovery/hook';
11
+ export { createLoopCommandHook } from './loop-command';
12
+ export { createPhaseReminderHook } from './phase-reminder';
13
+ export { createPostFileToolNudgeHook } from './post-file-tool-nudge';
14
+ export { createReflectCommandHook } from './reflect';
15
+ export { SessionLifecycle } from './session-lifecycle';
16
+ export { createTaskSessionManagerHook } from './task-session-manager';
@@ -0,0 +1,18 @@
1
+ import type { PluginInput } from '@opencode-ai/plugin';
2
+ export declare const JSON_ERROR_TOOL_EXCLUDE_LIST: readonly ["bash", "read", "glob", "webfetch", "gh_grep_searchgithub", "websearch_web_search_exa"];
3
+ export declare const JSON_ERROR_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
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
+ interface ToolExecuteAfterInput {
6
+ tool: string;
7
+ sessionID: string;
8
+ callID: string;
9
+ }
10
+ interface ToolExecuteAfterOutput {
11
+ title: string;
12
+ output: unknown;
13
+ metadata: unknown;
14
+ }
15
+ export declare function createJsonErrorRecoveryHook(_ctx: PluginInput): {
16
+ 'tool.execute.after': (input: ToolExecuteAfterInput, output: ToolExecuteAfterOutput) => Promise<void>;
17
+ };
18
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare function createLoopCommandHook(): {
2
+ registerCommand: (config: Record<string, unknown>) => void;
3
+ handleCommandExecuteBefore: (input: {
4
+ command: string;
5
+ sessionID: string;
6
+ arguments: string;
7
+ }, output: {
8
+ parts: Array<{
9
+ type: string;
10
+ text?: string;
11
+ }>;
12
+ }) => Promise<void>;
13
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Phase reminder to append after each latest user message.
3
+ *
4
+ * Keeping this at the tail preserves immediate workflow guidance without
5
+ * mutating the cached system prompt or prepending request-local content ahead
6
+ * of the user's actual turn.
7
+ */
8
+ import { PHASE_REMINDER } from '../../config/constants';
9
+ import { type MessagePart } from '../types';
10
+ export { PHASE_REMINDER };
11
+ export declare const PHASE_REMINDER_METADATA_KEY = "oh-my-opencode-slim.phaseReminder";
12
+ export declare function hasPhaseReminder(part: MessagePart): boolean;
13
+ interface PhaseReminderOptions {
14
+ shouldInject?: (sessionID: string) => boolean;
15
+ }
16
+ /**
17
+ * Creates the experimental.chat.messages.transform hook for phase reminder injection.
18
+ * This hook runs right before sending to API, so it doesn't affect UI display.
19
+ * Only injects for the orchestrator agent.
20
+ */
21
+ export declare function createPhaseReminderHook(options?: PhaseReminderOptions): {
22
+ 'experimental.chat.messages.transform': (_input: Record<string, never>, output: {
23
+ messages?: unknown;
24
+ }) => Promise<void>;
25
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Post-tool nudge - queues a delegation reminder after file reads/writes.
3
+ * Catches the "inspect/edit files → implement myself" anti-pattern.
4
+ *
5
+ * The reminder is ephemeral: recorded on tool execution, injected via
6
+ * messages.transform, and consumed once. File tool output stays clean.
7
+ */
8
+ import type { SessionLifecycle } from '../session-lifecycle';
9
+ interface PostFileToolNudgeOptions {
10
+ shouldInject?: (sessionID: string) => boolean;
11
+ coordinator?: SessionLifecycle;
12
+ }
13
+ export declare function createPostFileToolNudgeHook(options?: PostFileToolNudgeOptions): {
14
+ 'tool.execute.after': (input: {
15
+ tool: string;
16
+ sessionID?: string;
17
+ callID?: string;
18
+ }, _output: unknown) => Promise<void>;
19
+ 'experimental.chat.messages.transform': (_input: Record<string, never>, output: {
20
+ messages?: unknown;
21
+ }) => Promise<void>;
22
+ };
23
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare function createReflectCommandHook(): {
2
+ registerCommand: (config: Record<string, unknown>) => void;
3
+ handleCommandExecuteBefore: (input: {
4
+ command: string;
5
+ sessionID: string;
6
+ arguments: string;
7
+ }, output: {
8
+ parts: Array<{
9
+ type: string;
10
+ text?: string;
11
+ }>;
12
+ }) => Promise<void>;
13
+ };
@@ -0,0 +1,10 @@
1
+ export declare class SessionLifecycle {
2
+ #private;
3
+ constructor(log: (msg: string, meta?: Record<string, unknown>) => void);
4
+ onSessionDeleted(callback: (sessionId: string) => void): void;
5
+ dispatchSessionDeleted(sessionId: string): void;
6
+ markPending(sessionId: string): void;
7
+ /** Atomic — only one caller gets true per markPending call. */
8
+ consumePending(sessionId: string): boolean;
9
+ clearSession(sessionId: string): void;
10
+ }
@@ -0,0 +1,58 @@
1
+ import type { PluginInput } from '@opencode-ai/plugin';
2
+ import { type BackgroundJobStore } from '../../utils';
3
+ import type { SessionLifecycle } from '../session-lifecycle';
4
+ export declare const BACKGROUND_JOB_BOARD_METADATA_KEY = "oh-my-opencode-slim.backgroundJobBoard";
5
+ export declare function createTaskSessionManagerHook(_ctx: PluginInput, options: {
6
+ maxSessionsPerAgent: number;
7
+ readContextMinLines?: number;
8
+ readContextMaxFiles?: number;
9
+ backgroundJobBoard?: BackgroundJobStore;
10
+ shouldManageSession: (sessionID: string) => boolean;
11
+ /** Register a session as orchestrator when the transform hook detects
12
+ * an orchestrator message but the session isn't in the agent map yet. */
13
+ registerSessionAsOrchestrator?: (sessionID: string) => void;
14
+ /** Optional guard: when provided, idle events for a session that is
15
+ * currently undergoing a foreground-fallback abort/re-prompt cycle
16
+ * will NOT trigger idle reconciliation. prevents marking a still-
17
+ * active child job as completed when the session was aborted for
18
+ * model fallback rather than natural completion. */
19
+ isFallbackInProgress?: (sessionID: string) => boolean;
20
+ coordinator?: SessionLifecycle;
21
+ }): {
22
+ 'tool.execute.before': (input: {
23
+ tool: string;
24
+ sessionID?: string;
25
+ callID?: string;
26
+ }, output: {
27
+ args?: unknown;
28
+ }) => Promise<void>;
29
+ 'tool.execute.after': (input: {
30
+ tool: string;
31
+ sessionID?: string;
32
+ callID?: string;
33
+ }, output: {
34
+ output: unknown;
35
+ metadata?: unknown;
36
+ }) => Promise<void>;
37
+ 'experimental.chat.messages.transform': (_input: Record<string, never>, output: {
38
+ messages?: unknown;
39
+ }) => Promise<void>;
40
+ event: (input: {
41
+ event: {
42
+ type: string;
43
+ properties?: {
44
+ info?: {
45
+ id?: string;
46
+ parentID?: string;
47
+ };
48
+ sessionID?: string;
49
+ status?: {
50
+ type?: string;
51
+ };
52
+ error?: {
53
+ name?: string;
54
+ };
55
+ };
56
+ };
57
+ }) => Promise<void>;
58
+ };
@@ -0,0 +1,13 @@
1
+ export interface PendingTaskCall {
2
+ callId: string;
3
+ parentSessionId: string;
4
+ agentType: string;
5
+ label: string;
6
+ resumedTaskId?: string;
7
+ }
8
+ export declare function createPendingCallTracker(): {
9
+ add(call: PendingTaskCall): void;
10
+ take(callId?: string, parentSessionId?: string): PendingTaskCall | undefined;
11
+ clearSession(sessionId: string): void;
12
+ pendingCallId(sessionID?: string, callID?: string): string;
13
+ };
@@ -0,0 +1,14 @@
1
+ import type { ContextFile } from '../../utils';
2
+ export declare function createTaskContextTracker(): {
3
+ pendingManagedTaskIds: Set<string>;
4
+ addContext(taskId: string, files: ContextFile[]): void;
5
+ prune(backgroundJobBoard: {
6
+ taskIDs(): Set<string>;
7
+ }): void;
8
+ clearSession(sessionId: string): void;
9
+ contextFilesForPrompt(taskId: string): ContextFile[];
10
+ };
11
+ export declare function extractReadFiles(root: string, output: {
12
+ output: unknown;
13
+ metadata?: unknown;
14
+ }): ContextFile[];
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Shared message type shapes for the OpenCode plugin API's `messages` array.
3
+ *
4
+ * These types describe the structure of chat messages passed through
5
+ * `experimental.chat.messages.transform` and related hooks. All fields
6
+ * are unioned across the files that previously defined them privately -
7
+ * optional extras are harmless under structural typing.
8
+ */
9
+ export type MessageInfo = {
10
+ role: string;
11
+ agent?: string;
12
+ sessionID?: string;
13
+ id?: string;
14
+ };
15
+ export type MessagePart = {
16
+ type: string;
17
+ text?: string;
18
+ [key: string]: unknown;
19
+ };
20
+ export type MessageWithParts = {
21
+ info: MessageInfo;
22
+ parts: MessagePart[];
23
+ };
24
+ export declare function isMessageWithParts(message: unknown): message is MessageWithParts;
25
+ export declare function isUserMessageWithParts(message: unknown): message is MessageWithParts;
26
+ export declare function findLatestUserMessage(messages: unknown[]): MessageWithParts | undefined;
@@ -0,0 +1,5 @@
1
+ import type { Plugin } from '@opencode-ai/plugin';
2
+ declare const OhMyOpenCodeLite: Plugin;
3
+ export default OhMyOpenCodeLite;
4
+ export type { AgentName, AgentOverrideConfig, McpName, MultiplexerConfig, MultiplexerLayout, MultiplexerType, PluginConfig, TmuxConfig, TmuxLayout, } from './config';
5
+ export type { RemoteMcpConfig } from './mcp';