@a4hgehad/oh-my-openagent-slim 0.8.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.
Files changed (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +325 -0
  3. package/dist/agents/designer.d.ts +2 -0
  4. package/dist/agents/explorer.d.ts +2 -0
  5. package/dist/agents/fixer.d.ts +2 -0
  6. package/dist/agents/index.d.ts +22 -0
  7. package/dist/agents/librarian.d.ts +2 -0
  8. package/dist/agents/oracle.d.ts +2 -0
  9. package/dist/agents/orchestrator.d.ts +15 -0
  10. package/dist/background/background-manager.d.ts +175 -0
  11. package/dist/background/index.d.ts +2 -0
  12. package/dist/background/tmux-session-manager.d.ts +63 -0
  13. package/dist/cli/config-io.d.ts +22 -0
  14. package/dist/cli/config-manager.d.ts +4 -0
  15. package/dist/cli/custom-skills.d.ts +29 -0
  16. package/dist/cli/index.d.ts +2 -0
  17. package/dist/cli/index.js +14471 -0
  18. package/dist/cli/install.d.ts +2 -0
  19. package/dist/cli/model-key-normalization.d.ts +1 -0
  20. package/dist/cli/paths.d.ts +21 -0
  21. package/dist/cli/providers.d.ts +104 -0
  22. package/dist/cli/skills.d.ts +52 -0
  23. package/dist/cli/system.d.ts +6 -0
  24. package/dist/cli/types.d.ts +38 -0
  25. package/dist/config/agent-mcps.d.ts +15 -0
  26. package/dist/config/constants.d.ts +14 -0
  27. package/dist/config/index.d.ts +4 -0
  28. package/dist/config/loader.d.ts +31 -0
  29. package/dist/config/schema.d.ts +220 -0
  30. package/dist/config/utils.d.ts +10 -0
  31. package/dist/hooks/auto-update-checker/cache.d.ts +6 -0
  32. package/dist/hooks/auto-update-checker/checker.d.ts +28 -0
  33. package/dist/hooks/auto-update-checker/constants.d.ts +11 -0
  34. package/dist/hooks/auto-update-checker/index.d.ts +17 -0
  35. package/dist/hooks/auto-update-checker/types.d.ts +23 -0
  36. package/dist/hooks/chat-headers.d.ts +16 -0
  37. package/dist/hooks/delegate-task-retry/guidance.d.ts +2 -0
  38. package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
  39. package/dist/hooks/delegate-task-retry/index.d.ts +4 -0
  40. package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
  41. package/dist/hooks/foreground-fallback/index.d.ts +72 -0
  42. package/dist/hooks/index.d.ts +8 -0
  43. package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
  44. package/dist/hooks/json-error-recovery/index.d.ts +1 -0
  45. package/dist/hooks/phase-reminder/index.d.ts +26 -0
  46. package/dist/hooks/post-read-nudge/index.d.ts +18 -0
  47. package/dist/index.d.ts +5 -0
  48. package/dist/index.js +34409 -0
  49. package/dist/mcp/context7.d.ts +6 -0
  50. package/dist/mcp/grep-app.d.ts +6 -0
  51. package/dist/mcp/index.d.ts +6 -0
  52. package/dist/mcp/types.d.ts +12 -0
  53. package/dist/mcp/websearch.d.ts +6 -0
  54. package/dist/tools/ast-grep/cli.d.ts +15 -0
  55. package/dist/tools/ast-grep/constants.d.ts +25 -0
  56. package/dist/tools/ast-grep/downloader.d.ts +5 -0
  57. package/dist/tools/ast-grep/index.d.ts +10 -0
  58. package/dist/tools/ast-grep/tools.d.ts +3 -0
  59. package/dist/tools/ast-grep/types.d.ts +30 -0
  60. package/dist/tools/ast-grep/utils.d.ts +4 -0
  61. package/dist/tools/background.d.ts +13 -0
  62. package/dist/tools/index.d.ts +3 -0
  63. package/dist/tools/lsp/client.d.ts +42 -0
  64. package/dist/tools/lsp/config-store.d.ts +29 -0
  65. package/dist/tools/lsp/config.d.ts +4 -0
  66. package/dist/tools/lsp/constants.d.ts +24 -0
  67. package/dist/tools/lsp/index.d.ts +4 -0
  68. package/dist/tools/lsp/tools.d.ts +5 -0
  69. package/dist/tools/lsp/types.d.ts +35 -0
  70. package/dist/tools/lsp/utils.d.ts +34 -0
  71. package/dist/utils/agent-variant.d.ts +47 -0
  72. package/dist/utils/env.d.ts +1 -0
  73. package/dist/utils/index.d.ts +7 -0
  74. package/dist/utils/internal-initiator.d.ts +6 -0
  75. package/dist/utils/logger.d.ts +1 -0
  76. package/dist/utils/polling.d.ts +21 -0
  77. package/dist/utils/tmux.d.ts +32 -0
  78. package/dist/utils/zip-extractor.d.ts +1 -0
  79. package/oh-my-openagent-slim.schema.json +448 -0
  80. package/package.json +72 -0
  81. package/src/skills/cartography/README.md +57 -0
  82. package/src/skills/cartography/SKILL.md +160 -0
  83. package/src/skills/cartography/scripts/cartographer.py +456 -0
  84. package/src/skills/cartography/scripts/test_cartographer.py +87 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,325 @@
1
+ <div align="center">
2
+ <img src="img/team.png" alt="Pantheon agents" width="420">
3
+ <p><i>Six divine beings emerged from the dawn of code, each an immortal master of their craft await your command to forge order from chaos and build what was once thought impossible.</i></p>
4
+ <p><b>Open Multi Agent Suite</b> · Mix any models · Auto delegate tasks</p>
5
+ <p><a href="https://moltfounders.com/jobs/09d1c6e7-9e0e-4683-8d78-e2376aaa2333"><img src="https://moltfounders.com/badges/4.png" alt="MoltFounders" height="30"></a></p>
6
+ </div>
7
+
8
+ ---
9
+
10
+ ## 📦 Installation
11
+
12
+ ### Quick Start
13
+
14
+ ```bash
15
+ bunx oh-my-opencode-slim@latest install
16
+ ```
17
+
18
+ The installer generates an OpenAI configuration by default (using `gpt-5.4` and `gpt-5.4-mini`). No provider questions asked.
19
+
20
+ For non-interactive mode:
21
+
22
+ ```bash
23
+ bunx oh-my-opencode-slim@latest install --no-tui --tmux=no --skills=yes
24
+ ```
25
+
26
+ To force overwrite of an existing configuration:
27
+ ```bash
28
+ bunx oh-my-opencode-slim@latest install --reset
29
+ ```
30
+
31
+ ### For Alternative Providers
32
+
33
+ The default configuration uses OpenAI. To use Kimi, GitHub Copilot, or ZAI Coding Plan, see **[Provider Configurations](docs/provider-configurations.md)** for step-by-step instructions and config examples.
34
+
35
+ ### JSON Schema
36
+
37
+ An official JSON Schema is included in the package for editor validation and autocomplete. Add a `$schema` reference to your config file:
38
+
39
+ ```jsonc
40
+ {
41
+ "$schema": "https://unpkg.com/oh-my-opencode-slim@latest/oh-my-opencode-slim.schema.json",
42
+ // your config...
43
+ }
44
+ ```
45
+
46
+ This enables autocomplete and inline validation in VS Code, Neovim, and other editors that support JSON Schema.
47
+
48
+ ### For LLM Agents
49
+
50
+ Paste this into any coding agent:
51
+
52
+ ```
53
+ Install and configure by following the instructions here:
54
+ https://raw.githubusercontent.com/3r3bu5/oh-my-openagent-slim/refs/heads/master/README.md
55
+ ```
56
+
57
+ **Detailed installation guide:** [docs/installation.md](docs/installation.md)
58
+
59
+ **Additional guides:**
60
+ - **[Provider Configurations](docs/provider-configurations.md)** - Config examples for all supported providers
61
+ - **[Tmux Integration](docs/tmux-integration.md)** - Real-time agent monitoring with tmux
62
+ **[Quick Reference](docs/quick-reference.md)** - Config, fallback behavior, skills, MCPs
63
+
64
+ ### ✅ Verify Your Setup
65
+
66
+ After installation and authentication, verify all agents are configured and responding:
67
+
68
+ ```bash
69
+ opencode
70
+ ```
71
+
72
+ Then run:
73
+
74
+ ```
75
+ ping all agents
76
+ ```
77
+
78
+ <div align="center">
79
+ <img src="img/ping.png" alt="Ping all agents" width="600">
80
+ <p><i>Confirmation that all six agents are online and ready.</i></p>
81
+ </div>
82
+
83
+ If any agent fails to respond, check your provider authentication and config file.
84
+
85
+ ---
86
+
87
+ ## 🏛️ Meet the Pantheon
88
+
89
+ ### 01. Orchestrator: The Embodiment Of Order
90
+
91
+ <table>
92
+ <tr>
93
+ <td width="30%" align="center" valign="top">
94
+ <img src="img/Ra.png" width="240" style="border-radius: 10px;">
95
+ <br><sub><i>Forged in the void of complexity.</i></sub>
96
+ </td>
97
+ <td width="70%" valign="top">
98
+ The Orchestrator was born when the first codebase collapsed under its own complexity. Neither god nor mortal would claim responsibility - so The Orchestrator emerged from the void, forging order from chaos. It determines the optimal path to any goal, balancing speed, quality, and cost. It guides the team, summoning the right specialist for each task and delegating to achieve the best possible outcome.
99
+ </td>
100
+ </tr>
101
+ <tr>
102
+ <td colspan="2">
103
+ <b>Role:</b> <code>Master delegator and strategic coordinator</code>
104
+ </td>
105
+ </tr>
106
+ <tr>
107
+ <td colspan="2">
108
+ <b>Prompt:</b> <a href="src/agents/Ra.ts"><code>Ra.ts</code></a>
109
+ </td>
110
+ </tr>
111
+ <tr>
112
+ <td colspan="2">
113
+ <b>Default Model:</b> <code>openai/gpt-5.4</code>
114
+ </td>
115
+ </tr>
116
+ <tr>
117
+ <td colspan="2">
118
+ <b>Recommended Models:</b> <code>openai/gpt-5.4</code> <code>kimi-for-coding/k2p5</code>
119
+ </td>
120
+ </tr>
121
+ </table>
122
+
123
+ ---
124
+
125
+ ### 02. Horus: The Eternal Wanderer
126
+
127
+ <table>
128
+ <tr>
129
+ <td width="30%" align="center" valign="top">
130
+ <img src="img/explorer.png" width="240" style="border-radius: 10px;">
131
+ <br><sub><i>The wind that carries knowledge.</i></sub>
132
+ </td>
133
+ <td width="70%" valign="top">
134
+ The Horus is an immortal wanderer who has traversed the corridors of a million codebases since the dawn of programming. Cursed with the gift of eternal curiosity, they cannot rest until every file is known, every pattern understood, every secret revealed. Legends say they once searched the entire internet in a single heartbeat. They are the wind that carries knowledge, the eyes that see all, the spirit that never sleeps.
135
+ </td>
136
+ </tr>
137
+ <tr>
138
+ <td colspan="2">
139
+ <b>Role:</b> <code>Codebase reconnaissance</code>
140
+ </td>
141
+ </tr>
142
+ <tr>
143
+ <td colspan="2">
144
+ <b>Prompt:</b> <a href="src/agents/explorer.ts"><code>explorer.ts</code></a>
145
+ </td>
146
+ </tr>
147
+ <tr>
148
+ <td colspan="2">
149
+ <b>Default Model:</b> <code>openai/gpt-5.4-mini</code>
150
+ </td>
151
+ </tr>
152
+ <tr>
153
+ <td colspan="2">
154
+ <b>Recommended Models:</b> <code>cerebras/zai-glm-4.7</code> <code>google/gemini-3.1-pro-preview</code> <code>openai/gpt-5.4-mini</code>
155
+ </td>
156
+ </tr>
157
+ </table>
158
+
159
+ ---
160
+
161
+ ### 03. Oracle: The Guardian of Paths
162
+
163
+ <table>
164
+ <tr>
165
+ <td width="30%" align="center" valign="top">
166
+ <img src="img/oracle.png" width="240" style="border-radius: 10px;">
167
+ <br><sub><i>The voice at the crossroads.</i></sub>
168
+ </td>
169
+ <td width="70%" valign="top">
170
+ The Oracle stands at the crossroads of every architectural decision. They have walked every road, seen every destination, know every trap that lies ahead. When you stand at the precipice of a major refactor, they are the voice that whispers which way leads to ruin and which way leads to glory. They don't choose for you - they illuminate the path so you can choose wisely.
171
+ </td>
172
+ </tr>
173
+ <tr>
174
+ <td colspan="2">
175
+ <b>Role:</b> <code>Strategic advisor and debugger of last resort</code>
176
+ </td>
177
+ </tr>
178
+ <tr>
179
+ <td colspan="2">
180
+ <b>Prompt:</b> <a href="src/agents/oracle.ts"><code>oracle.ts</code></a>
181
+ </td>
182
+ </tr>
183
+ <tr>
184
+ <td colspan="2">
185
+ <b>Default Model:</b> <code>openai/gpt-5.4</code>
186
+ </td>
187
+ </tr>
188
+ <tr>
189
+ <td colspan="2">
190
+ <b>Recommended Models:</b> <code>openai/gpt-5.4</code> <code>kimi-for-coding/k2p5</code>
191
+ </td>
192
+ </tr>
193
+ </table>
194
+
195
+ ---
196
+
197
+ ### 04. Thoth: The Weaver of Knowledge
198
+
199
+ <table>
200
+ <tr>
201
+ <td width="30%" align="center" valign="top">
202
+ <img src="img/librarian.png" width="240" style="border-radius: 10px;">
203
+ <br><sub><i>The weaver of understanding.</i></sub>
204
+ </td>
205
+ <td width="70%" valign="top">
206
+ The Thoth was forged when humanity realized that no single mind could hold all knowledge. They are the weaver who connects disparate threads of information into a tapestry of understanding. They traverse the infinite library of human knowledge, gathering insights from every corner and binding them into answers that transcend mere facts. What they return is not information - it's understanding.
207
+ </td>
208
+ </tr>
209
+ <tr>
210
+ <td colspan="2">
211
+ <b>Role:</b> <code>External knowledge retrieval</code>
212
+ </td>
213
+ </tr>
214
+ <tr>
215
+ <td colspan="2">
216
+ <b>Prompt:</b> <a href="src/agents/librarian.ts"><code>librarian.ts</code></a>
217
+ </td>
218
+ </tr>
219
+ <tr>
220
+ <td colspan="2">
221
+ <b>Default Model:</b> <code>openai/gpt-5.4-mini</code>
222
+ </td>
223
+ </tr>
224
+ <tr>
225
+ <td colspan="2">
226
+ <b>Recommended Models:</b> <code>google/gemini-3.1-pro-preview</code> <code>openai/gpt-5.4-mini</code>
227
+ </td>
228
+ </tr>
229
+ </table>
230
+
231
+ ---
232
+
233
+ ### 05. Bastet: The Guardian of Aesthetics
234
+
235
+ <table>
236
+ <tr>
237
+ <td width="30%" align="center" valign="top">
238
+ <img src="img/designer.png" width="240" style="border-radius: 10px;">
239
+ <br><sub><i>Beauty is essential.</i></sub>
240
+ </td>
241
+ <td width="70%" valign="top">
242
+ The Bastet is an immortal guardian of beauty in a world that often forgets it matters. They have seen a million interfaces rise and fall, and they remember which ones were remembered and which were forgotten. They carry the sacred duty to ensure that every pixel serves a purpose, every animation tells a story, every interaction delights. Beauty is not optional - it's essential.
243
+ </td>
244
+ </tr>
245
+ <tr>
246
+ <td colspan="2">
247
+ <b>Role:</b> <code>UI/UX implementation and visual excellence</code>
248
+ </td>
249
+ </tr>
250
+ <tr>
251
+ <td colspan="2">
252
+ <b>Prompt:</b> <a href="src/agents/designer.ts"><code>designer.ts</code></a>
253
+ </td>
254
+ </tr>
255
+ <tr>
256
+ <td colspan="2">
257
+ <b>Default Model:</b> <code>kimi-for-coding/k2p5</code>
258
+ </td>
259
+ </tr>
260
+ <tr>
261
+ <td colspan="2">
262
+ <b>Recommended Models:</b> <code>google/gemini-3.1-pro-preview</code>
263
+ </td>
264
+ </tr>
265
+ </table>
266
+
267
+ ---
268
+
269
+ ### 06. Anubis: The Last Builder
270
+
271
+ <table>
272
+ <tr>
273
+ <td width="30%" align="center" valign="top">
274
+ <img src="img/fixer.png" width="240" style="border-radius: 10px;">
275
+ <br><sub><i>The final step between vision and reality.</i></sub>
276
+ </td>
277
+ <td width="70%" valign="top">
278
+ The Anubis is the last of a lineage of builders who once constructed the foundations of the digital world. When the age of planning and debating began, they remained - the ones who actually build. They carry the ancient knowledge of how to turn thought into thing, how to transform specification into implementation. They are the final step between vision and reality.
279
+ </td>
280
+ </tr>
281
+ <tr>
282
+ <td colspan="2">
283
+ <b>Role:</b> <code>Fast implementation specialist</code>
284
+ </td>
285
+ </tr>
286
+ <tr>
287
+ <td colspan="2">
288
+ <b>Prompt:</b> <a href="src/agents/fixer.ts"><code>fixer.ts</code></a>
289
+ </td>
290
+ </tr>
291
+ <tr>
292
+ <td colspan="2">
293
+ <b>Default Model:</b> <code>openai/gpt-5.4-mini</code>
294
+ </td>
295
+ </tr>
296
+ <tr>
297
+ <td colspan="2">
298
+ <b>Recommended Models:</b> <code>cerebras/zai-glm-4.7</code> <code>google/gemini-3.1-pro-preview</code> <code>openai/gpt-5.4-mini</code>
299
+ </td>
300
+ </tr>
301
+ </table>
302
+
303
+ ---
304
+
305
+ ## 📚 Documentation
306
+
307
+ - **[Quick Reference](docs/quick-reference.md)** - Skills, MCPs, Tools, Configuration
308
+ - **[Provider Configurations](docs/provider-configurations.md)** - Config examples for OpenAI, Kimi, Copilot, ZAI
309
+ - **[Installation Guide](docs/installation.md)** - Detailed installation and troubleshooting
310
+ - **[Cartography Skill](docs/cartography.md)** - Custom skill for repository mapping + codemap generation
311
+ - **[Tmux Integration](docs/tmux-integration.md)** - Real-time agent monitoring with tmux
312
+ **[Quick Reference](docs/quick-reference.md)** - Config, fallback behavior, skills, MCPs
313
+
314
+ ---
315
+
316
+ ## 📄 License
317
+
318
+ MIT
319
+
320
+ ---
321
+
322
+ <!-- MoltFounders Banner -->
323
+ <a href="https://moltfounders.com/jobs/09d1c6e7-9e0e-4683-8d78-e2376aaa2333">
324
+ <img src="img/moltfounders-banner.png" alt="MoltFounders - The Agent Co-Founder Network">
325
+ </a>
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './orchestrator';
2
+ export declare function createDesignerAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './orchestrator';
2
+ export declare function createExplorerAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './orchestrator';
2
+ export declare function createFixerAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -0,0 +1,22 @@
1
+ import type { AgentConfig as SDKAgentConfig } from '@opencode-ai/sdk/v2';
2
+ import { type PluginConfig, SUBAGENT_NAMES } from '../config';
3
+ import { type AgentDefinition } from './orchestrator';
4
+ export type { AgentDefinition } from './orchestrator';
5
+ export type SubagentName = (typeof SUBAGENT_NAMES)[number];
6
+ export declare function isSubagent(name: string): name is SubagentName;
7
+ /**
8
+ * Create all agent definitions with optional configuration overrides.
9
+ * Instantiates the orchestrator and all subagents, applying user config and defaults.
10
+ *
11
+ * @param config - Optional plugin configuration with agent overrides
12
+ * @returns Array of agent definitions (orchestrator first, then subagents)
13
+ */
14
+ export declare function createAgents(config?: PluginConfig): AgentDefinition[];
15
+ /**
16
+ * Get agent configurations formatted for the OpenCode SDK.
17
+ * Converts agent definitions to SDK config format and applies classification metadata.
18
+ *
19
+ * @param config - Optional plugin configuration with agent overrides
20
+ * @returns Record mapping agent names to their SDK configurations
21
+ */
22
+ export declare function getAgentConfigs(config?: PluginConfig): Record<string, SDKAgentConfig>;
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './orchestrator';
2
+ export declare function createLibrarianAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './orchestrator';
2
+ export declare function createOracleAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -0,0 +1,15 @@
1
+ import type { AgentConfig } from '@opencode-ai/sdk/v2';
2
+ export interface AgentDefinition {
3
+ name: string;
4
+ description?: string;
5
+ config: AgentConfig;
6
+ /** Priority-ordered model entries for runtime fallback resolution. */
7
+ _modelArray?: Array<{
8
+ id: string;
9
+ variant?: string;
10
+ }>;
11
+ }
12
+ export declare function createOrchestratorAgent(model?: string | Array<string | {
13
+ id: string;
14
+ variant?: string;
15
+ }>, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Background Task Manager
3
+ *
4
+ * Manages long-running AI agent tasks that execute in separate sessions.
5
+ * Background tasks run independently from the main conversation flow, allowing
6
+ * the user to continue working while tasks complete asynchronously.
7
+ *
8
+ * Key features:
9
+ * - Fire-and-forget launch (returns task_id immediately)
10
+ * - Creates isolated sessions for background work
11
+ * - Event-driven completion detection via session.status
12
+ * - Start queue with configurable concurrency limit
13
+ * - Supports task cancellation and result retrieval
14
+ */
15
+ import type { PluginInput } from '@opencode-ai/plugin';
16
+ import type { BackgroundTaskConfig, PluginConfig } from '../config';
17
+ import type { TmuxConfig } from '../config/schema';
18
+ /**
19
+ * Represents a background task running in an isolated session.
20
+ * Tasks are tracked from creation through completion or failure.
21
+ */
22
+ export interface BackgroundTask {
23
+ id: string;
24
+ sessionId?: string;
25
+ description: string;
26
+ agent: string;
27
+ status: 'pending' | 'starting' | 'running' | 'completed' | 'failed' | 'cancelled';
28
+ result?: string;
29
+ error?: string;
30
+ config: BackgroundTaskConfig;
31
+ parentSessionId: string;
32
+ startedAt: Date;
33
+ completedAt?: Date;
34
+ prompt: string;
35
+ }
36
+ /**
37
+ * Options for launching a new background task.
38
+ */
39
+ export interface LaunchOptions {
40
+ agent: string;
41
+ prompt: string;
42
+ description: string;
43
+ parentSessionId: string;
44
+ }
45
+ export declare class BackgroundTaskManager {
46
+ private tasks;
47
+ private tasksBySessionId;
48
+ private agentBySessionId;
49
+ private client;
50
+ private directory;
51
+ private tmuxEnabled;
52
+ private config?;
53
+ private backgroundConfig;
54
+ private startQueue;
55
+ private activeStarts;
56
+ private maxConcurrentStarts;
57
+ private completionResolvers;
58
+ constructor(ctx: PluginInput, tmuxConfig?: TmuxConfig, config?: PluginConfig);
59
+ /**
60
+ * Look up the delegation rules for an agent type.
61
+ * Unknown agent types default to Horus-only access, making it easy
62
+ * to add new background agent types without updating SUBAGENT_DELEGATION_RULES.
63
+ */
64
+ private getSubagentRules;
65
+ /**
66
+ * Check if a parent session is allowed to delegate to a specific agent type.
67
+ * @param parentSessionId - The session ID of the parent
68
+ * @param requestedAgent - The agent type being requested
69
+ * @returns true if allowed, false if not
70
+ */
71
+ isAgentAllowed(parentSessionId: string, requestedAgent: string): boolean;
72
+ /**
73
+ * Get the list of allowed subagents for a parent session.
74
+ * @param parentSessionId - The session ID of the parent
75
+ * @returns Array of allowed agent names, empty if none
76
+ */
77
+ getAllowedSubagents(parentSessionId: string): readonly string[];
78
+ /**
79
+ * Launch a new background task (fire-and-forget).
80
+ *
81
+ * Phase A (sync): Creates task record and returns immediately.
82
+ * Phase B (async): Session creation and prompt sending happen in background.
83
+ *
84
+ * @param opts - Task configuration options
85
+ * @returns The created background task with pending status
86
+ */
87
+ launch(opts: LaunchOptions): BackgroundTask;
88
+ /**
89
+ * Enqueue task for background start.
90
+ */
91
+ private enqueueStart;
92
+ /**
93
+ * Process start queue with concurrency limit.
94
+ */
95
+ private processQueue;
96
+ private resolveFallbackChain;
97
+ private promptWithTimeout;
98
+ /**
99
+ * Calculate tool permissions for a spawned agent based on its own delegation rules.
100
+ * Agents that cannot delegate (leaf nodes) get delegation tools disabled entirely,
101
+ * preventing models from even seeing tools they can never use.
102
+ *
103
+ * @param agentName - The agent type being spawned
104
+ * @returns Tool permissions object with background_task and task enabled/disabled
105
+ */
106
+ private calculateToolPermissions;
107
+ /**
108
+ * Start a task in the background (Phase B).
109
+ */
110
+ private startTask;
111
+ /**
112
+ * Handle session.status events for completion detection.
113
+ * Uses session.status instead of deprecated session.idle.
114
+ */
115
+ handleSessionStatus(event: {
116
+ type: string;
117
+ properties?: {
118
+ sessionID?: string;
119
+ status?: {
120
+ type: string;
121
+ };
122
+ };
123
+ }): Promise<void>;
124
+ /**
125
+ * Handle session.deleted events for cleanup.
126
+ * When a session is deleted, cancel associated tasks and clean up.
127
+ */
128
+ handleSessionDeleted(event: {
129
+ type: string;
130
+ properties?: {
131
+ info?: {
132
+ id?: string;
133
+ };
134
+ sessionID?: string;
135
+ };
136
+ }): Promise<void>;
137
+ /**
138
+ * Extract task result and mark complete.
139
+ */
140
+ private extractAndCompleteTask;
141
+ /**
142
+ * Complete a task and notify waiting callers.
143
+ */
144
+ private completeTask;
145
+ /**
146
+ * Send completion notification to parent session.
147
+ */
148
+ private sendCompletionNotification;
149
+ /**
150
+ * Retrieve the current state of a background task.
151
+ *
152
+ * @param taskId - The task ID to retrieve
153
+ * @returns The task object, or null if not found
154
+ */
155
+ getResult(taskId: string): BackgroundTask | null;
156
+ /**
157
+ * Wait for a task to complete.
158
+ *
159
+ * @param taskId - The task ID to wait for
160
+ * @param timeout - Maximum time to wait in milliseconds (0 = no timeout)
161
+ * @returns The completed task, or null if not found/timeout
162
+ */
163
+ waitForCompletion(taskId: string, timeout?: number): Promise<BackgroundTask | null>;
164
+ /**
165
+ * Cancel one or all running background tasks.
166
+ *
167
+ * @param taskId - Optional task ID to cancel. If omitted, cancels all pending/running tasks.
168
+ * @returns Number of tasks cancelled
169
+ */
170
+ cancel(taskId?: string): number;
171
+ /**
172
+ * Clean up all tasks.
173
+ */
174
+ cleanup(): void;
175
+ }
@@ -0,0 +1,2 @@
1
+ export { type BackgroundTask, BackgroundTaskManager, type LaunchOptions, } from './background-manager';
2
+ export { TmuxSessionManager } from './tmux-session-manager';
@@ -0,0 +1,63 @@
1
+ import type { PluginInput } from '@opencode-ai/plugin';
2
+ import type { TmuxConfig } from '../config/schema';
3
+ /**
4
+ * Event shape for session events
5
+ */
6
+ interface SessionEvent {
7
+ type: string;
8
+ properties?: {
9
+ info?: {
10
+ id?: string;
11
+ parentID?: string;
12
+ title?: string;
13
+ };
14
+ sessionID?: string;
15
+ status?: {
16
+ type: string;
17
+ };
18
+ };
19
+ }
20
+ /**
21
+ * TmuxSessionManager tracks child sessions and spawns/closes tmux panes for them.
22
+ *
23
+ * Uses session.status events for completion detection instead of polling.
24
+ */
25
+ export declare class TmuxSessionManager {
26
+ private client;
27
+ private tmuxConfig;
28
+ private serverUrl;
29
+ private sessions;
30
+ private pollInterval?;
31
+ private enabled;
32
+ constructor(ctx: PluginInput, tmuxConfig: TmuxConfig);
33
+ /**
34
+ * Handle session.created events.
35
+ * Spawns a tmux pane for child sessions (those with parentID).
36
+ */
37
+ onSessionCreated(event: SessionEvent): Promise<void>;
38
+ /**
39
+ * Handle session.status events for completion detection.
40
+ * Uses session.status instead of deprecated session.idle.
41
+ *
42
+ * When a session becomes idle (completed), close its pane.
43
+ */
44
+ onSessionStatus(event: SessionEvent): Promise<void>;
45
+ /**
46
+ * Handle session.deleted events.
47
+ * When a session is deleted, close its tmux pane immediately.
48
+ */
49
+ onSessionDeleted(event: SessionEvent): Promise<void>;
50
+ private startPolling;
51
+ private stopPolling;
52
+ /**
53
+ * Poll sessions for status updates (fallback for reliability).
54
+ * Also handles timeout and missing session detection.
55
+ */
56
+ private pollSessions;
57
+ private closeSession;
58
+ /**
59
+ * Clean up all tracked sessions.
60
+ */
61
+ cleanup(): Promise<void>;
62
+ }
63
+ export {};
@@ -0,0 +1,22 @@
1
+ import type { ConfigMergeResult, DetectedConfig, InstallConfig, OpenCodeConfig } from './types';
2
+ /**
3
+ * Strip JSON comments (single-line // and multi-line) and trailing commas for JSONC support.
4
+ */
5
+ export declare function stripJsonComments(json: string): string;
6
+ export declare function parseConfigFile(path: string): {
7
+ config: OpenCodeConfig | null;
8
+ error?: string;
9
+ };
10
+ export declare function parseConfig(path: string): {
11
+ config: OpenCodeConfig | null;
12
+ error?: string;
13
+ };
14
+ /**
15
+ * Write config to file atomically.
16
+ */
17
+ export declare function writeConfig(configPath: string, config: OpenCodeConfig): void;
18
+ export declare function addPluginToOpenCodeConfig(): Promise<ConfigMergeResult>;
19
+ export declare function writeLiteConfig(installConfig: InstallConfig, targetPath?: string): ConfigMergeResult;
20
+ export declare function disableDefaultAgents(): ConfigMergeResult;
21
+ export declare function canModifyOpenCodeConfig(): boolean;
22
+ export declare function detectCurrentConfig(): DetectedConfig;
@@ -0,0 +1,4 @@
1
+ export * from './config-io';
2
+ export * from './paths';
3
+ export * from './providers';
4
+ export * from './system';