oh-my-opencode-lite 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 (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +365 -0
  3. package/dist/agents/deep.d.ts +2 -0
  4. package/dist/agents/designer.d.ts +2 -0
  5. package/dist/agents/explorer.d.ts +2 -0
  6. package/dist/agents/index.d.ts +8 -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/agents/prompt-utils.d.ts +10 -0
  11. package/dist/agents/quick.d.ts +2 -0
  12. package/dist/background/background-manager.d.ts +196 -0
  13. package/dist/background/index.d.ts +2 -0
  14. package/dist/background/tmux-session-manager.d.ts +63 -0
  15. package/dist/cli/config-io.d.ts +22 -0
  16. package/dist/cli/config-manager.d.ts +4 -0
  17. package/dist/cli/custom-skills.d.ts +48 -0
  18. package/dist/cli/index.d.ts +2 -0
  19. package/dist/cli/index.js +1178 -0
  20. package/dist/cli/install.d.ts +3 -0
  21. package/dist/cli/model-key-normalization.d.ts +1 -0
  22. package/dist/cli/paths.d.ts +21 -0
  23. package/dist/cli/providers.d.ts +120 -0
  24. package/dist/cli/skill-manifest.d.ts +32 -0
  25. package/dist/cli/skills.d.ts +26 -0
  26. package/dist/cli/system.d.ts +6 -0
  27. package/dist/cli/types.d.ts +38 -0
  28. package/dist/config/constants.d.ts +19 -0
  29. package/dist/config/index.d.ts +5 -0
  30. package/dist/config/loader.d.ts +33 -0
  31. package/dist/config/schema.d.ts +313 -0
  32. package/dist/config/utils.d.ts +10 -0
  33. package/dist/delegation/delegation-manager.d.ts +25 -0
  34. package/dist/delegation/index.d.ts +4 -0
  35. package/dist/delegation/paths.d.ts +15 -0
  36. package/dist/delegation/project-id.d.ts +1 -0
  37. package/dist/delegation/types.d.ts +39 -0
  38. package/dist/hooks/auto-update-checker/cache.d.ts +6 -0
  39. package/dist/hooks/auto-update-checker/checker.d.ts +28 -0
  40. package/dist/hooks/auto-update-checker/constants.d.ts +11 -0
  41. package/dist/hooks/auto-update-checker/index.d.ts +17 -0
  42. package/dist/hooks/auto-update-checker/types.d.ts +23 -0
  43. package/dist/hooks/chat-headers.d.ts +16 -0
  44. package/dist/hooks/clarification-gate/index.d.ts +30 -0
  45. package/dist/hooks/delegate-task-retry/guidance.d.ts +2 -0
  46. package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
  47. package/dist/hooks/delegate-task-retry/index.d.ts +4 -0
  48. package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
  49. package/dist/hooks/foreground-fallback/index.d.ts +72 -0
  50. package/dist/hooks/index.d.ts +11 -0
  51. package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
  52. package/dist/hooks/json-error-recovery/index.d.ts +1 -0
  53. package/dist/hooks/phase-reminder/index.d.ts +26 -0
  54. package/dist/hooks/post-read-nudge/index.d.ts +18 -0
  55. package/dist/hooks/skill-sync.d.ts +10 -0
  56. package/dist/hooks/thoth-mem/index.d.ts +46 -0
  57. package/dist/hooks/thoth-mem/protocol.d.ts +6 -0
  58. package/dist/index.d.ts +5 -0
  59. package/dist/index.js +36210 -0
  60. package/dist/mcp/context7.d.ts +6 -0
  61. package/dist/mcp/grep-app.d.ts +6 -0
  62. package/dist/mcp/index.d.ts +7 -0
  63. package/dist/mcp/thoth.d.ts +3 -0
  64. package/dist/mcp/types.d.ts +12 -0
  65. package/dist/mcp/websearch.d.ts +6 -0
  66. package/dist/thoth/client.d.ts +14 -0
  67. package/dist/thoth/index.d.ts +2 -0
  68. package/dist/tools/ast-grep/cli.d.ts +15 -0
  69. package/dist/tools/ast-grep/constants.d.ts +25 -0
  70. package/dist/tools/ast-grep/downloader.d.ts +5 -0
  71. package/dist/tools/ast-grep/index.d.ts +10 -0
  72. package/dist/tools/ast-grep/tools.d.ts +3 -0
  73. package/dist/tools/ast-grep/types.d.ts +30 -0
  74. package/dist/tools/ast-grep/utils.d.ts +4 -0
  75. package/dist/tools/background.d.ts +13 -0
  76. package/dist/tools/index.d.ts +3 -0
  77. package/dist/tools/lsp/client.d.ts +42 -0
  78. package/dist/tools/lsp/config-store.d.ts +29 -0
  79. package/dist/tools/lsp/config.d.ts +4 -0
  80. package/dist/tools/lsp/constants.d.ts +24 -0
  81. package/dist/tools/lsp/index.d.ts +4 -0
  82. package/dist/tools/lsp/tools.d.ts +5 -0
  83. package/dist/tools/lsp/types.d.ts +35 -0
  84. package/dist/tools/lsp/utils.d.ts +34 -0
  85. package/dist/utils/agent-variant.d.ts +47 -0
  86. package/dist/utils/env.d.ts +1 -0
  87. package/dist/utils/index.d.ts +7 -0
  88. package/dist/utils/internal-initiator.d.ts +6 -0
  89. package/dist/utils/logger.d.ts +1 -0
  90. package/dist/utils/polling.d.ts +21 -0
  91. package/dist/utils/tmux.d.ts +32 -0
  92. package/dist/utils/zip-extractor.d.ts +1 -0
  93. package/oh-my-opencode-lite.schema.json +556 -0
  94. package/package.json +74 -0
  95. package/src/skills/_shared/openspec-convention.md +92 -0
  96. package/src/skills/_shared/persistence-contract.md +78 -0
  97. package/src/skills/_shared/thoth-mem-convention.md +80 -0
  98. package/src/skills/brainstorming/SKILL.md +120 -0
  99. package/src/skills/cartography/README.md +57 -0
  100. package/src/skills/cartography/SKILL.md +160 -0
  101. package/src/skills/cartography/scripts/cartographer.py +460 -0
  102. package/src/skills/cartography/scripts/test_cartographer.py +87 -0
  103. package/src/skills/executing-plans/SKILL.md +211 -0
  104. package/src/skills/plan-reviewer/SKILL.md +100 -0
  105. package/src/skills/sdd-apply/SKILL.md +101 -0
  106. package/src/skills/sdd-archive/SKILL.md +94 -0
  107. package/src/skills/sdd-design/SKILL.md +104 -0
  108. package/src/skills/sdd-propose/SKILL.md +99 -0
  109. package/src/skills/sdd-spec/SKILL.md +105 -0
  110. package/src/skills/sdd-tasks/SKILL.md +116 -0
  111. package/src/skills/sdd-verify/SKILL.md +102 -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,365 @@
1
+ <div align="center">
2
+ <img src="img/team.png" alt="oh-my-opencode-lite agents" width="420">
3
+ <p><i>Seven specialized agents, one orchestrator — delegate any task to the right specialist and ship faster.</i></p>
4
+ <p><b>oh-my-opencode-lite</b> · Delegate-first orchestration · Thoth-mem persistence · Bundled SDD pipeline</p>
5
+ </div>
6
+
7
+ ---
8
+
9
+ Delegate-first OpenCode plugin with a seven-agent roster, root-session
10
+ `thoth_mem` persistence, disk-backed delegation records, bundled brainstorming,
11
+ and a full SDD workflow.
12
+
13
+ oh-my-opencode-lite keeps the `orchestrator` lean, pushes discovery into
14
+ specialists, persists important context, and ships the planning skills needed
15
+ to move from ambiguous requests to verified implementation.
16
+
17
+ ## 📦 Installation
18
+
19
+ ### Quick start
20
+
21
+ ```bash
22
+ bunx oh-my-opencode-lite@latest install
23
+ opencode auth login
24
+ opencode
25
+ ```
26
+
27
+ Then ask OpenCode to verify the roster:
28
+
29
+ ```text
30
+ ping all agents
31
+ ```
32
+
33
+ ### Non-interactive install
34
+
35
+ ```bash
36
+ bunx oh-my-opencode-lite@latest install --no-tui --tmux=no --skills=yes
37
+ ```
38
+
39
+ ### Reset an existing generated config
40
+
41
+ ```bash
42
+ bunx oh-my-opencode-lite@latest install --reset
43
+ ```
44
+
45
+ When skills are enabled, the installer adds the recommended external skills and
46
+ copies the bundled brainstorming, cartography, plan-reviewer,
47
+ executing-plans, and SDD skills into your OpenCode skills directory.
48
+
49
+ ### For LLM agents
50
+
51
+ Use the installer directly:
52
+
53
+ ```bash
54
+ bunx oh-my-opencode-lite@latest install --no-tui --tmux=no --skills=yes
55
+ ```
56
+
57
+ Or hand another coding agent this README:
58
+
59
+ ```text
60
+ Install and configure oh-my-opencode-lite by following:
61
+ https://raw.githubusercontent.com/EremesNG/oh-my-opencode-lite/refs/heads/master/README.md
62
+ ```
63
+
64
+ ### JSON Schema
65
+
66
+ The package ships `oh-my-opencode-lite.schema.json` for editor autocomplete and
67
+ validation:
68
+
69
+ ```jsonc
70
+ {
71
+ "$schema": "https://unpkg.com/oh-my-opencode-lite@latest/oh-my-opencode-lite.schema.json"
72
+ }
73
+ ```
74
+
75
+ See [docs/installation.md](docs/installation.md) and
76
+ [docs/provider-configurations.md](docs/provider-configurations.md) for the full
77
+ setup flow.
78
+
79
+ ## 🏛️ Seven-Agent Roster
80
+
81
+ The delegate-first philosophy is simple: the `orchestrator` coordinates while
82
+ specialists execute. Read-only discovery work goes to async specialists for
83
+ context isolation. Advisory and write-capable work stays sync so review, undo
84
+ safety, and verification remain straightforward.
85
+
86
+ ### 🔑 Primary Agent
87
+
88
+ <table width="100%">
89
+ <tr>
90
+ <td width="100%" valign="top">
91
+ <img src="img/orchestrator.png" width="100%" alt="Orchestrator">
92
+ <br>
93
+ <b>Orchestrator</b>
94
+ <br>
95
+ <i>Root coordinator and sole primary agent.</i>
96
+ <br><br>
97
+ <b>Role:</b> The root coordinator. Handles delegation, sequencing, memory ownership, and SDD progress tracking. Does not read or modify source files directly.
98
+ <br>
99
+ <b>Mode:</b> primary, non-mutating
100
+ <br>
101
+ <b>Dispatch:</b> sync coordinator
102
+ <br>
103
+ <b>Recommended:</b>
104
+ <br>
105
+ <code>anthropic/claude-opus-4-6</code> · <code>openai/gpt-5.4</code> · <code>kimi-for-coding/k2p5</code>
106
+ <br>
107
+ <b>Personality:</b> Autonomous deep coordinator — multi-agent reasoning, works through delegation
108
+ </td>
109
+ </tr>
110
+ </table>
111
+
112
+ ### 🛠️ Specialist Subagents
113
+
114
+ <table width="100%">
115
+ <tr>
116
+ <td width="33%" valign="top">
117
+ <img src="img/explorer.png" width="100%" alt="Explorer">
118
+ <br>
119
+ <b>Explorer</b>
120
+ <br>
121
+ <i>Speed runner — fast parallel grep, codebase search.</i>
122
+ <br><br>
123
+ <b>Role:</b> Local codebase discovery and navigation. Fast parallel search, file reading, symbol lookup.
124
+ <br>
125
+ <b>Mode:</b> read-only
126
+ <br>
127
+ <b>Dispatch:</b> async via <code>background_task</code>
128
+ <br>
129
+ <b>Recommended:</b>
130
+ <br>
131
+ <code>Grok Code Fast</code> · <code>openai/gpt-5.4-nano</code> · <code>anthropic/claude-haiku-4-5</code>
132
+ </td>
133
+ <td width="33%" valign="top">
134
+ <img src="img/librarian.png" width="100%" alt="Librarian">
135
+ <br>
136
+ <b>Librarian</b>
137
+ <br>
138
+ <i>All-rounder — large context + decent speed for research.</i>
139
+ <br><br>
140
+ <b>Role:</b> External docs and API research. Fetches documentation, finds public examples, validates version-specific behavior.
141
+ <br>
142
+ <b>Mode:</b> read-only
143
+ <br>
144
+ <b>Dispatch:</b> async via <code>background_task</code>
145
+ <br>
146
+ <b>Recommended:</b>
147
+ <br>
148
+ <code>openai/gpt-5.4</code> · <code>anthropic/claude-sonnet-4-6</code> · <code>google/gemini-3.1-pro-preview</code>
149
+ </td>
150
+ <td width="33%" valign="top">
151
+ <img src="img/oracle.png" width="100%" alt="Oracle">
152
+ <br>
153
+ <b>Oracle</b>
154
+ <br>
155
+ <i>Deep reasoner — maximum strategic thinking capability.</i>
156
+ <br><br>
157
+ <b>Role:</b> Strategic advisor for debugging, architecture review, code review, and SDD plan review.
158
+ <br>
159
+ <b>Mode:</b> read-only
160
+ <br>
161
+ <b>Dispatch:</b> sync via <code>task</code>
162
+ <br>
163
+ <b>Recommended:</b>
164
+ <br>
165
+ <code>openai/gpt-5.4</code> · <code>anthropic/claude-opus-4-6</code> · <code>opencode-go/glm-5</code>
166
+ </td>
167
+ </tr>
168
+ <tr>
169
+ <td width="33%" valign="top">
170
+ <img src="img/designer.png" width="100%" alt="Designer">
171
+ <br>
172
+ <b>Designer</b>
173
+ <br>
174
+ <i>Visual/multimodal — UI/UX reasoning, frontend engineering.</i>
175
+ <br><br>
176
+ <b>Role:</b> UI/UX implementation with visual verification. Owns approach, execution, and browser-based quality checks.
177
+ <br>
178
+ <b>Mode:</b> write-capable
179
+ <br>
180
+ <b>Dispatch:</b> sync via <code>task</code>
181
+ <br>
182
+ <b>Recommended:</b>
183
+ <br>
184
+ <code>google/gemini-3.1-pro-preview</code> · <code>opencode-go/glm-5</code> · <code>kimi-for-coding/k2p5</code>
185
+ </td>
186
+ <td width="33%" valign="top">
187
+ <img src="img/quick.png" width="100%" alt="Quick">
188
+ <br>
189
+ <b>Quick</b>
190
+ <br>
191
+ <i>Speed runner — well-defined tasks, fast turnaround.</i>
192
+ <br><br>
193
+ <b>Role:</b> Fast implementation for well-defined, bounded tasks. Optimized for speed over thoroughness.
194
+ <br>
195
+ <b>Mode:</b> write-capable
196
+ <br>
197
+ <b>Dispatch:</b> sync via <code>task</code>
198
+ <br>
199
+ <b>Recommended:</b>
200
+ <br>
201
+ <code>openai/gpt-5.4-mini</code> · <code>anthropic/claude-haiku-4-5</code> · <code>google/gemini-3-flash-preview</code>
202
+ </td>
203
+ <td width="33%" valign="top">
204
+ <img src="img/deep.png" width="100%" alt="Deep">
205
+ <br>
206
+ <b>Deep</b>
207
+ <br>
208
+ <i>Deep specialist — maximum coding capability for complex tasks.</i>
209
+ <br><br>
210
+ <b>Role:</b> Thorough implementation and verification. Handles correctness-critical, multi-file, edge-case-heavy work.
211
+ <br>
212
+ <b>Mode:</b> write-capable
213
+ <br>
214
+ <b>Dispatch:</b> sync via <code>task</code>
215
+ <br>
216
+ <b>Recommended:</b>
217
+ <br>
218
+ <code>openai/gpt-5.4</code> · <code>anthropic/claude-opus-4-6</code> · <code>google/gemini-3.1-pro-preview</code>
219
+ </td>
220
+ </tr>
221
+ </table>
222
+
223
+ ## 🧩 What oh-my-opencode-lite Adds
224
+
225
+ - Delegate-first orchestration with context isolation across specialists
226
+ - `thoth_mem` persistence for root-session memory workflows
227
+ - Disk-persisted delegation results that survive compaction and in-memory loss
228
+ - Bundled SDD pipeline: `sdd-propose`, `sdd-spec`, `sdd-design`, `sdd-tasks`,
229
+ `sdd-apply`, `sdd-verify`, `sdd-archive`
230
+ - Brainstorming skill with clarification-gate hook for ambiguous work
231
+ - `plan-reviewer` for oracle review loops on task plans
232
+ - `executing-plans` for task-state ownership and progress tracking
233
+ - `cartography` for repository mapping and codemap generation
234
+ - Tmux integration for real-time agent monitoring
235
+ - Configurable presets, fallback chains, prompt overriding, and artifact-store
236
+ modes
237
+
238
+ Delegation records persist under:
239
+
240
+ ```text
241
+ ~/.local/share/opencode/delegations/<project-id>/<root-session-id>/<task-id>.md
242
+ ```
243
+
244
+ ## SDD Pipeline
245
+
246
+ The bundled SDD workflow follows this path:
247
+
248
+ ```text
249
+ propose -> [spec || design] -> tasks -> apply -> verify -> archive
250
+ ```
251
+
252
+ For medium work, brainstorming can route into an accelerated path that starts at
253
+ `propose -> tasks`. For complex work, the full path is used.
254
+
255
+ Artifacts can be persisted in three modes:
256
+
257
+ | Mode | Writes to | Use when |
258
+ | --- | --- | --- |
259
+ | `thoth-mem` | Memory only | Fast iteration without repo planning files |
260
+ | `openspec` | `openspec/` files only | Reviewable planning artifacts in the repo |
261
+ | `hybrid` | Both | Maximum durability; default |
262
+
263
+ After `sdd-tasks`, the orchestrator can run an oracle review loop with
264
+ `plan-reviewer`:
265
+
266
+ 1. Generate `tasks.md`
267
+ 2. Dispatch oracle with `plan-reviewer`
268
+ 3. If result is `[REJECT]`, fix only the blocking issues
269
+ 4. Repeat until `[OKAY]`
270
+ 5. Continue into execution
271
+
272
+ During execution, `executing-plans` owns task-state tracking:
273
+
274
+ - `- [ ]` pending
275
+ - `- [~]` in progress
276
+ - `- [x]` completed
277
+ - `- [-]` skipped with reason
278
+
279
+ ## Brainstorming & Clarification Gate
280
+
281
+ The bundled `brainstorming` skill is the front door for ambiguous or substantial
282
+ work. Its workflow is six phases:
283
+
284
+ 1. Context gathering
285
+ 2. Interview
286
+ 3. Scope assessment
287
+ 4. Approach proposal
288
+ 5. User approval
289
+ 6. Handoff
290
+
291
+ The clarification-gate hook can auto-detect requests that should go through this
292
+ flow before implementation. It checks for explicit planning keywords plus scope
293
+ signals such as multi-view work, API/data changes, restructuring, multi-layer
294
+ impact, business-language requests, open-ended phrasing, and cross-directory
295
+ scope. When triggered, it injects a reminder for the `orchestrator` to load the
296
+ brainstorming skill, ask one clarifying question at a time, and wait for
297
+ explicit approval before coding.
298
+
299
+ ## 🧩 Skills & MCP Servers
300
+
301
+ ### Bundled skills
302
+
303
+ | Skill | Category | Purpose |
304
+ | --- | --- | --- |
305
+ | `brainstorming` | Clarification | Clarify intent, assess scope, and choose direct work vs accelerated or full SDD |
306
+ | `cartography` | Discovery | Generate and update hierarchical repository codemaps |
307
+ | `plan-reviewer` | Review | Validate `tasks.md` for real execution blockers and return `[OKAY]` or `[REJECT]` |
308
+ | `sdd-propose` | SDD | Create or update `proposal.md` |
309
+ | `sdd-spec` | SDD | Write OpenSpec delta specs with RFC 2119 requirements and scenarios |
310
+ | `sdd-design` | SDD | Produce `design.md` with technical decisions and file changes |
311
+ | `sdd-tasks` | SDD | Generate phased `tasks.md` checklists |
312
+ | `sdd-apply` | SDD | Execute assigned SDD tasks and report structured results |
313
+ | `executing-plans` | Execution | Run task lists with durable progress tracking and verification checkpoints |
314
+ | `sdd-verify` | Verification | Create compliance-oriented verification reports |
315
+ | `sdd-archive` | Archive | Merge verified deltas into main specs and archive the change |
316
+
317
+ ### Recommended external skills
318
+
319
+ | Skill | Status | Typical use |
320
+ | --- | --- | --- |
321
+ | `simplify` | Installed by `--skills=yes` | Keep solutions lean and reduce unnecessary complexity |
322
+ | `agent-browser` | Installed by `--skills=yes` | Browser automation for `designer` visual checks |
323
+ | `test-driven-development` | Optional companion | Useful before implementing bug fixes or features with `deep` |
324
+ | `systematic-debugging` | Optional companion | Useful for `oracle` and `deep` when failures need disciplined diagnosis |
325
+
326
+ ### Built-in MCP servers
327
+
328
+ | MCP | Purpose | Auth / runtime |
329
+ | --- | --- | --- |
330
+ | `websearch` | Exa-backed web search | Optional `EXA_API_KEY` via env |
331
+ | `context7` | Official library and framework docs | Optional `CONTEXT7_API_KEY` via env |
332
+ | `grep_app` | Public GitHub code search | No auth required |
333
+ | `thoth_mem` | Local persistent memory and artifact storage | Local command, default `npx -y thoth-mem@latest` |
334
+
335
+ Skill and MCP access in this project is prompt-driven. The generated plugin
336
+ config focuses on model presets and runtime options rather than per-agent
337
+ permission matrices.
338
+
339
+ ## 📚 Documentation
340
+
341
+ - [docs/installation.md](docs/installation.md)
342
+ - [docs/provider-configurations.md](docs/provider-configurations.md)
343
+ - [docs/tmux-integration.md](docs/tmux-integration.md)
344
+ - [docs/quick-reference.md](docs/quick-reference.md)
345
+ - [docs/cartography.md](docs/cartography.md)
346
+ - [docs/sdd-pipeline.md](docs/sdd-pipeline.md)
347
+ - [docs/skills-and-mcps.md](docs/skills-and-mcps.md)
348
+ - [AGENTS.md](AGENTS.md)
349
+
350
+ ## Development
351
+
352
+ | Command | Purpose |
353
+ | --- | --- |
354
+ | `bun run build` | Build TypeScript into `dist/` |
355
+ | `bun run typecheck` | Run TypeScript type checking without emit |
356
+ | `bun test` | Run the Bun test suite |
357
+ | `bun run lint` | Run Biome linter |
358
+ | `bun run format` | Run Biome formatter |
359
+ | `bun run check` | Run Biome check with auto-fix |
360
+ | `bun run check:ci` | Run Biome check without writes |
361
+ | `bun run dev` | Build and launch the plugin in local dev mode |
362
+
363
+ ## 📄 License
364
+
365
+ MIT
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './orchestrator';
2
+ export declare function createDeepAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -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,8 @@
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
+ export declare function createAgents(config?: PluginConfig): AgentDefinition[];
8
+ 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,10 @@
1
+ interface ComposeAgentPromptOptions {
2
+ basePrompt: string;
3
+ customPrompt?: string;
4
+ customAppendPrompt?: string;
5
+ placeholders?: Record<string, string | number | undefined>;
6
+ }
7
+ export declare function appendPromptSections(...sections: Array<string | undefined>): string;
8
+ export declare function replacePromptPlaceholders(template: string, placeholders?: Record<string, string | number | undefined>): string;
9
+ export declare function composeAgentPrompt({ basePrompt, customPrompt, customAppendPrompt, placeholders, }: ComposeAgentPromptOptions): string;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { AgentDefinition } from './orchestrator';
2
+ export declare function createQuickAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -0,0 +1,196 @@
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
+ import type { DelegationManager, PersistedDelegationRecord } from '../delegation';
19
+ export declare const BACKGROUND_CAPABLE_AGENTS: readonly ["explorer", "librarian"];
20
+ export type BackgroundCapableAgent = (typeof BACKGROUND_CAPABLE_AGENTS)[number];
21
+ export type BackgroundTaskStatus = 'pending' | 'starting' | 'running' | 'completed' | 'failed' | 'cancelled';
22
+ /**
23
+ * Represents a background task running in an isolated session.
24
+ * Tasks are tracked from creation through completion or failure.
25
+ */
26
+ export interface BackgroundTask {
27
+ id: string;
28
+ sessionId?: string;
29
+ rootSessionId: string;
30
+ description: string;
31
+ agent: string;
32
+ status: BackgroundTaskStatus;
33
+ result?: string;
34
+ error?: string;
35
+ persistencePath?: string;
36
+ persistenceError?: string;
37
+ config: BackgroundTaskConfig;
38
+ parentSessionId: string;
39
+ startedAt: Date;
40
+ completedAt?: Date;
41
+ prompt: string;
42
+ _abortingForTimeout?: boolean;
43
+ }
44
+ /**
45
+ * Options for launching a new background task.
46
+ */
47
+ export interface LaunchOptions {
48
+ agent: string;
49
+ prompt: string;
50
+ description: string;
51
+ parentSessionId: string;
52
+ }
53
+ export declare class BackgroundTaskManager {
54
+ private tasks;
55
+ private tasksBySessionId;
56
+ private agentBySessionId;
57
+ private client;
58
+ private directory;
59
+ private tmuxEnabled;
60
+ private config?;
61
+ private backgroundConfig;
62
+ private delegationManager?;
63
+ private startQueue;
64
+ private activeStarts;
65
+ private maxConcurrentStarts;
66
+ private completionResolvers;
67
+ constructor(ctx: PluginInput, tmuxConfig?: TmuxConfig, config?: PluginConfig, delegationManager?: DelegationManager);
68
+ private resolveRootSessionId;
69
+ private createTaskId;
70
+ private buildDelegationSummary;
71
+ private persistCompletedTask;
72
+ /**
73
+ * Look up the delegation rules for an agent type.
74
+ * Unknown agent types default to explorer-only access, making it easy
75
+ * to add new background agent types without updating SUBAGENT_DELEGATION_RULES.
76
+ */
77
+ private getSubagentRules;
78
+ /**
79
+ * Check if a parent session is allowed to delegate to a specific agent type.
80
+ * @param parentSessionId - The session ID of the parent
81
+ * @param requestedAgent - The agent type being requested
82
+ * @returns true if allowed, false if not
83
+ */
84
+ isAgentAllowed(parentSessionId: string, requestedAgent: string): boolean;
85
+ /**
86
+ * Get the list of allowed subagents for a parent session.
87
+ * @param parentSessionId - The session ID of the parent
88
+ * @returns Array of allowed agent names, empty if none
89
+ */
90
+ getAllowedSubagents(parentSessionId: string): readonly string[];
91
+ isBackgroundCapableAgent(agentName: string): agentName is BackgroundCapableAgent;
92
+ getBackgroundCapableAgents(): readonly BackgroundCapableAgent[];
93
+ getActiveTaskIds(rootSessionId: string): string[];
94
+ private createTaskRecord;
95
+ private registerLaunchedTask;
96
+ /**
97
+ * Launch a new background task (fire-and-forget).
98
+ *
99
+ * Phase A (sync): Creates task record and returns immediately.
100
+ * Phase B (async): Session creation and prompt sending happen in background.
101
+ *
102
+ * @param opts - Task configuration options
103
+ * @returns The created background task with pending status
104
+ */
105
+ launch(opts: LaunchOptions): BackgroundTask;
106
+ launchBackgroundTask(opts: LaunchOptions): Promise<BackgroundTask>;
107
+ /**
108
+ * Enqueue task for background start.
109
+ */
110
+ private enqueueStart;
111
+ /**
112
+ * Process start queue with concurrency limit.
113
+ */
114
+ private processQueue;
115
+ private resolveFallbackChain;
116
+ private promptWithTimeout;
117
+ /**
118
+ * Calculate tool permissions for a spawned agent based on its own delegation rules.
119
+ * Agents that cannot delegate (leaf nodes) get delegation tools disabled entirely,
120
+ * preventing models from even seeing tools they can never use.
121
+ *
122
+ * @param agentName - The agent type being spawned
123
+ * @returns Tool permissions object with background_task and task enabled/disabled
124
+ */
125
+ private calculateToolPermissions;
126
+ /**
127
+ * Start a task in the background (Phase B).
128
+ */
129
+ private startTask;
130
+ /**
131
+ * Handle session.status events for completion detection.
132
+ * Uses session.status instead of deprecated session.idle.
133
+ */
134
+ handleSessionStatus(event: {
135
+ type: string;
136
+ properties?: {
137
+ sessionID?: string;
138
+ status?: {
139
+ type: string;
140
+ };
141
+ };
142
+ }): Promise<void>;
143
+ /**
144
+ * Handle session.deleted events for cleanup.
145
+ * When a session is deleted, cancel associated tasks and clean up.
146
+ */
147
+ handleSessionDeleted(event: {
148
+ type: string;
149
+ properties?: {
150
+ info?: {
151
+ id?: string;
152
+ };
153
+ sessionID?: string;
154
+ };
155
+ }): Promise<void>;
156
+ /**
157
+ * Extract task result and mark complete.
158
+ */
159
+ private extractAndCompleteTask;
160
+ /**
161
+ * Complete a task and notify waiting callers.
162
+ */
163
+ private completeTask;
164
+ /**
165
+ * Send completion notification to parent session.
166
+ */
167
+ private sendCompletionNotification;
168
+ /**
169
+ * Retrieve the current state of a background task.
170
+ *
171
+ * @param taskId - The task ID to retrieve
172
+ * @returns The task object, or null if not found
173
+ */
174
+ getResult(taskId: string): BackgroundTask | null;
175
+ readDelegation(taskId: string, sessionId: string): Promise<PersistedDelegationRecord | null>;
176
+ getDelegationSummary(sessionId: string, limit?: number): Promise<string | null>;
177
+ /**
178
+ * Wait for a task to complete.
179
+ *
180
+ * @param taskId - The task ID to wait for
181
+ * @param timeout - Maximum time to wait in milliseconds (0 = no timeout)
182
+ * @returns The completed task, or null if not found/timeout
183
+ */
184
+ waitForCompletion(taskId: string, timeout?: number): Promise<BackgroundTask | null>;
185
+ /**
186
+ * Cancel one or all running background tasks.
187
+ *
188
+ * @param taskId - Optional task ID to cancel. If omitted, cancels all pending/running tasks.
189
+ * @returns Number of tasks cancelled
190
+ */
191
+ cancel(taskId?: string): number;
192
+ /**
193
+ * Clean up all tasks.
194
+ */
195
+ cleanup(): void;
196
+ }
@@ -0,0 +1,2 @@
1
+ export { BACKGROUND_CAPABLE_AGENTS, type BackgroundCapableAgent, type BackgroundTask, BackgroundTaskManager, type BackgroundTaskStatus, type LaunchOptions, } from './background-manager';
2
+ export { TmuxSessionManager } from './tmux-session-manager';