opencode-dux 1.0.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 (302) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +452 -0
  3. package/dist/agents/descriptions.d.ts +6 -0
  4. package/dist/agents/designer.d.ts +2 -0
  5. package/dist/agents/explorer.d.ts +2 -0
  6. package/dist/agents/fixer.d.ts +2 -0
  7. package/dist/agents/index.d.ts +22 -0
  8. package/dist/agents/interpreter.d.ts +2 -0
  9. package/dist/agents/librarian.d.ts +2 -0
  10. package/dist/agents/oracle.d.ts +2 -0
  11. package/dist/agents/orchestrator.d.ts +27 -0
  12. package/dist/agents/overrides.d.ts +18 -0
  13. package/dist/agents/prompt-blocks.d.ts +97 -0
  14. package/dist/agents/steward.d.ts +3 -0
  15. package/dist/cli/config-io.d.ts +24 -0
  16. package/dist/cli/config-manager.d.ts +4 -0
  17. package/dist/cli/index.d.ts +2 -0
  18. package/dist/cli/index.js +1006 -0
  19. package/dist/cli/install.d.ts +2 -0
  20. package/dist/cli/mcps.d.ts +13 -0
  21. package/dist/cli/model-key-normalization.d.ts +1 -0
  22. package/dist/cli/paths.d.ts +35 -0
  23. package/dist/cli/providers.d.ts +137 -0
  24. package/dist/cli/skills.d.ts +22 -0
  25. package/dist/cli/system.d.ts +5 -0
  26. package/dist/cli/types.d.ts +38 -0
  27. package/dist/config/constants.d.ts +12 -0
  28. package/dist/config/index.d.ts +4 -0
  29. package/dist/config/loader.d.ts +40 -0
  30. package/dist/config/runtime-preset.d.ts +12 -0
  31. package/dist/config/schema.d.ts +281 -0
  32. package/dist/config/utils.d.ts +10 -0
  33. package/dist/discovery/local/types.d.ts +79 -0
  34. package/dist/discovery/local.d.ts +73 -0
  35. package/dist/discovery/mcp-servers.d.ts +88 -0
  36. package/dist/discovery/skills.d.ts +94 -0
  37. package/dist/hooks/apply-patch/codec.d.ts +7 -0
  38. package/dist/hooks/apply-patch/errors.d.ts +25 -0
  39. package/dist/hooks/apply-patch/execution-context.d.ts +27 -0
  40. package/dist/hooks/apply-patch/index.d.ts +15 -0
  41. package/dist/hooks/apply-patch/matching.d.ts +26 -0
  42. package/dist/hooks/apply-patch/operations.d.ts +3 -0
  43. package/dist/hooks/apply-patch/patch.d.ts +2 -0
  44. package/dist/hooks/apply-patch/prepared-changes.d.ts +17 -0
  45. package/dist/hooks/apply-patch/resolution.d.ts +19 -0
  46. package/dist/hooks/apply-patch/rewrite.d.ts +7 -0
  47. package/dist/hooks/apply-patch/test-helpers.d.ts +6 -0
  48. package/dist/hooks/apply-patch/types.d.ts +80 -0
  49. package/dist/hooks/auto-update-checker/cache.d.ts +11 -0
  50. package/dist/hooks/auto-update-checker/checker.d.ts +32 -0
  51. package/dist/hooks/auto-update-checker/constants.d.ts +11 -0
  52. package/dist/hooks/auto-update-checker/index.d.ts +18 -0
  53. package/dist/hooks/auto-update-checker/types.d.ts +22 -0
  54. package/dist/hooks/chat-headers.d.ts +16 -0
  55. package/dist/hooks/context-pressure-reminder/index.d.ts +33 -0
  56. package/dist/hooks/delegate-task-retry/guidance.d.ts +2 -0
  57. package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
  58. package/dist/hooks/delegate-task-retry/index.d.ts +4 -0
  59. package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
  60. package/dist/hooks/filter-available-skills/index.d.ts +32 -0
  61. package/dist/hooks/foreground-fallback/index.d.ts +72 -0
  62. package/dist/hooks/image-hook.d.ts +5 -0
  63. package/dist/hooks/index.d.ts +14 -0
  64. package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
  65. package/dist/hooks/json-error-recovery/index.d.ts +1 -0
  66. package/dist/hooks/phase-reminder/index.d.ts +26 -0
  67. package/dist/hooks/post-file-tool-nudge/index.d.ts +19 -0
  68. package/dist/hooks/task-session-manager/index.d.ts +52 -0
  69. package/dist/hooks/todo-continuation/index.d.ts +53 -0
  70. package/dist/hooks/todo-continuation/todo-hygiene.d.ts +35 -0
  71. package/dist/index.d.ts +5 -0
  72. package/dist/index.js +31782 -0
  73. package/dist/mcp/context7.d.ts +6 -0
  74. package/dist/mcp/grep-app.d.ts +6 -0
  75. package/dist/mcp/index.d.ts +13 -0
  76. package/dist/mcp/types.d.ts +12 -0
  77. package/dist/mcp/websearch.d.ts +9 -0
  78. package/dist/skills/registry.d.ts +29 -0
  79. package/dist/subscriptions/accounts-store.d.ts +57 -0
  80. package/dist/subscriptions/index.d.ts +13 -0
  81. package/dist/subscriptions/neuralwatt-scraper.d.ts +14 -0
  82. package/dist/subscriptions/opencode-go-scraper.d.ts +27 -0
  83. package/dist/subscriptions/types.d.ts +115 -0
  84. package/dist/subscriptions/usage-service.d.ts +74 -0
  85. package/dist/tools/ast-grep/cli.d.ts +15 -0
  86. package/dist/tools/ast-grep/constants.d.ts +25 -0
  87. package/dist/tools/ast-grep/downloader.d.ts +5 -0
  88. package/dist/tools/ast-grep/index.d.ts +10 -0
  89. package/dist/tools/ast-grep/tools.d.ts +3 -0
  90. package/dist/tools/ast-grep/types.d.ts +30 -0
  91. package/dist/tools/ast-grep/utils.d.ts +4 -0
  92. package/dist/tools/delegate.d.ts +14 -0
  93. package/dist/tools/index.d.ts +5 -0
  94. package/dist/tools/preset-manager.d.ts +27 -0
  95. package/dist/tools/smartfetch/binary.d.ts +3 -0
  96. package/dist/tools/smartfetch/cache.d.ts +6 -0
  97. package/dist/tools/smartfetch/constants.d.ts +12 -0
  98. package/dist/tools/smartfetch/index.d.ts +3 -0
  99. package/dist/tools/smartfetch/network.d.ts +38 -0
  100. package/dist/tools/smartfetch/secondary-model.d.ts +28 -0
  101. package/dist/tools/smartfetch/tool.d.ts +3 -0
  102. package/dist/tools/smartfetch/types.d.ts +122 -0
  103. package/dist/tools/smartfetch/utils.d.ts +18 -0
  104. package/dist/tui-state.d.ts +168 -0
  105. package/dist/tui.d.ts +37 -0
  106. package/dist/tui.js +1896 -0
  107. package/dist/utils/agent-variant.d.ts +63 -0
  108. package/dist/utils/compat.d.ts +30 -0
  109. package/dist/utils/env.d.ts +1 -0
  110. package/dist/utils/index.d.ts +9 -0
  111. package/dist/utils/internal-initiator.d.ts +6 -0
  112. package/dist/utils/logger.d.ts +8 -0
  113. package/dist/utils/polling.d.ts +21 -0
  114. package/dist/utils/session-manager.d.ts +55 -0
  115. package/dist/utils/session.d.ts +90 -0
  116. package/dist/utils/subagent-depth.d.ts +35 -0
  117. package/dist/utils/system-collapse.d.ts +6 -0
  118. package/dist/utils/task.d.ts +4 -0
  119. package/dist/utils/zip-extractor.d.ts +1 -0
  120. package/index.ts +1 -0
  121. package/opencode-dux.schema.json +634 -0
  122. package/package.json +103 -0
  123. package/src/agents/descriptions.ts +55 -0
  124. package/src/agents/designer.test.ts +86 -0
  125. package/src/agents/designer.ts +154 -0
  126. package/src/agents/display-name.test.ts +186 -0
  127. package/src/agents/explorer.test.ts +79 -0
  128. package/src/agents/explorer.ts +144 -0
  129. package/src/agents/fixer.test.ts +79 -0
  130. package/src/agents/fixer.ts +145 -0
  131. package/src/agents/index.test.ts +472 -0
  132. package/src/agents/index.ts +248 -0
  133. package/src/agents/interpreter.ts +136 -0
  134. package/src/agents/librarian.test.ts +80 -0
  135. package/src/agents/librarian.ts +145 -0
  136. package/src/agents/oracle.test.ts +89 -0
  137. package/src/agents/oracle.ts +184 -0
  138. package/src/agents/orchestrator.test.ts +116 -0
  139. package/src/agents/orchestrator.ts +574 -0
  140. package/src/agents/overrides.ts +95 -0
  141. package/src/agents/prompt-blocks.test.ts +114 -0
  142. package/src/agents/prompt-blocks.ts +640 -0
  143. package/src/agents/steward.ts +146 -0
  144. package/src/cli/config-io.test.ts +536 -0
  145. package/src/cli/config-io.ts +473 -0
  146. package/src/cli/config-manager.test.ts +141 -0
  147. package/src/cli/config-manager.ts +4 -0
  148. package/src/cli/index.ts +88 -0
  149. package/src/cli/install.ts +282 -0
  150. package/src/cli/mcps.test.ts +62 -0
  151. package/src/cli/mcps.ts +39 -0
  152. package/src/cli/model-key-normalization.test.ts +21 -0
  153. package/src/cli/model-key-normalization.ts +60 -0
  154. package/src/cli/paths.test.ts +167 -0
  155. package/src/cli/paths.ts +144 -0
  156. package/src/cli/providers.test.ts +118 -0
  157. package/src/cli/providers.ts +141 -0
  158. package/src/cli/skills.test.ts +111 -0
  159. package/src/cli/skills.ts +103 -0
  160. package/src/cli/system.test.ts +91 -0
  161. package/src/cli/system.ts +180 -0
  162. package/src/cli/types.ts +43 -0
  163. package/src/config/constants.ts +58 -0
  164. package/src/config/index.ts +4 -0
  165. package/src/config/loader.test.ts +1194 -0
  166. package/src/config/loader.ts +269 -0
  167. package/src/config/model-resolution.test.ts +176 -0
  168. package/src/config/runtime-preset.test.ts +61 -0
  169. package/src/config/runtime-preset.ts +37 -0
  170. package/src/config/schema.ts +248 -0
  171. package/src/config/utils.test.ts +41 -0
  172. package/src/config/utils.ts +23 -0
  173. package/src/discovery/local/types.ts +85 -0
  174. package/src/discovery/local.ts +322 -0
  175. package/src/discovery/mcp-servers.ts +804 -0
  176. package/src/discovery/skills.ts +959 -0
  177. package/src/hooks/apply-patch/codec.test.ts +184 -0
  178. package/src/hooks/apply-patch/codec.ts +352 -0
  179. package/src/hooks/apply-patch/errors.ts +117 -0
  180. package/src/hooks/apply-patch/execution-context.ts +432 -0
  181. package/src/hooks/apply-patch/hook.test.ts +768 -0
  182. package/src/hooks/apply-patch/index.ts +126 -0
  183. package/src/hooks/apply-patch/matching.test.ts +215 -0
  184. package/src/hooks/apply-patch/matching.ts +586 -0
  185. package/src/hooks/apply-patch/operations.test.ts +1535 -0
  186. package/src/hooks/apply-patch/operations.ts +3 -0
  187. package/src/hooks/apply-patch/patch.ts +9 -0
  188. package/src/hooks/apply-patch/prepared-changes.ts +400 -0
  189. package/src/hooks/apply-patch/resolution.test.ts +420 -0
  190. package/src/hooks/apply-patch/resolution.ts +437 -0
  191. package/src/hooks/apply-patch/rewrite.ts +496 -0
  192. package/src/hooks/apply-patch/test-helpers.ts +52 -0
  193. package/src/hooks/apply-patch/types.ts +111 -0
  194. package/src/hooks/auto-update-checker/cache.test.ts +179 -0
  195. package/src/hooks/auto-update-checker/cache.ts +188 -0
  196. package/src/hooks/auto-update-checker/checker.test.ts +159 -0
  197. package/src/hooks/auto-update-checker/checker.ts +308 -0
  198. package/src/hooks/auto-update-checker/constants.ts +33 -0
  199. package/src/hooks/auto-update-checker/index.test.ts +282 -0
  200. package/src/hooks/auto-update-checker/index.ts +225 -0
  201. package/src/hooks/auto-update-checker/types.ts +26 -0
  202. package/src/hooks/chat-headers.test.ts +236 -0
  203. package/src/hooks/chat-headers.ts +97 -0
  204. package/src/hooks/context-pressure-reminder/index.test.ts +179 -0
  205. package/src/hooks/context-pressure-reminder/index.ts +137 -0
  206. package/src/hooks/delegate-task-retry/guidance.ts +41 -0
  207. package/src/hooks/delegate-task-retry/hook.ts +23 -0
  208. package/src/hooks/delegate-task-retry/index.test.ts +38 -0
  209. package/src/hooks/delegate-task-retry/index.ts +7 -0
  210. package/src/hooks/delegate-task-retry/patterns.ts +79 -0
  211. package/src/hooks/filter-available-skills/index.test.ts +297 -0
  212. package/src/hooks/filter-available-skills/index.ts +160 -0
  213. package/src/hooks/foreground-fallback/index.test.ts +624 -0
  214. package/src/hooks/foreground-fallback/index.ts +374 -0
  215. package/src/hooks/image-hook.ts +6 -0
  216. package/src/hooks/index.ts +17 -0
  217. package/src/hooks/json-error-recovery/hook.ts +73 -0
  218. package/src/hooks/json-error-recovery/index.test.ts +111 -0
  219. package/src/hooks/json-error-recovery/index.ts +6 -0
  220. package/src/hooks/phase-reminder/index.test.ts +74 -0
  221. package/src/hooks/phase-reminder/index.ts +85 -0
  222. package/src/hooks/post-file-tool-nudge/index.test.ts +94 -0
  223. package/src/hooks/post-file-tool-nudge/index.ts +63 -0
  224. package/src/hooks/task-session-manager/index.test.ts +833 -0
  225. package/src/hooks/task-session-manager/index.ts +434 -0
  226. package/src/hooks/todo-continuation/index.test.ts +3026 -0
  227. package/src/hooks/todo-continuation/index.ts +878 -0
  228. package/src/hooks/todo-continuation/todo-hygiene.test.ts +204 -0
  229. package/src/hooks/todo-continuation/todo-hygiene.ts +207 -0
  230. package/src/index.ts +1672 -0
  231. package/src/mcp/context7.ts +14 -0
  232. package/src/mcp/grep-app.ts +11 -0
  233. package/src/mcp/index.test.ts +96 -0
  234. package/src/mcp/index.ts +66 -0
  235. package/src/mcp/types.ts +16 -0
  236. package/src/mcp/websearch.ts +47 -0
  237. package/src/skills/codemap/README.md +60 -0
  238. package/src/skills/codemap/SKILL.md +174 -0
  239. package/src/skills/codemap/scripts/codemap.mjs +483 -0
  240. package/src/skills/codemap/scripts/codemap.test.ts +129 -0
  241. package/src/skills/registry.ts +218 -0
  242. package/src/skills/simplify/README.md +19 -0
  243. package/src/skills/simplify/SKILL.md +138 -0
  244. package/src/subscriptions/accounts-store.test.ts +236 -0
  245. package/src/subscriptions/accounts-store.ts +184 -0
  246. package/src/subscriptions/index.ts +30 -0
  247. package/src/subscriptions/neuralwatt-scraper.ts +108 -0
  248. package/src/subscriptions/opencode-go-scraper.ts +301 -0
  249. package/src/subscriptions/types.ts +145 -0
  250. package/src/subscriptions/usage-service.test.ts +202 -0
  251. package/src/subscriptions/usage-service.ts +651 -0
  252. package/src/tools/ast-grep/cli.ts +257 -0
  253. package/src/tools/ast-grep/constants.ts +214 -0
  254. package/src/tools/ast-grep/downloader.ts +131 -0
  255. package/src/tools/ast-grep/index.ts +24 -0
  256. package/src/tools/ast-grep/tools.ts +117 -0
  257. package/src/tools/ast-grep/types.ts +51 -0
  258. package/src/tools/ast-grep/utils.ts +126 -0
  259. package/src/tools/delegate-handoff.test.ts +18 -0
  260. package/src/tools/delegate.ts +508 -0
  261. package/src/tools/index.ts +8 -0
  262. package/src/tools/preset-manager.test.ts +795 -0
  263. package/src/tools/preset-manager.ts +332 -0
  264. package/src/tools/smartfetch/binary.ts +58 -0
  265. package/src/tools/smartfetch/cache.test.ts +34 -0
  266. package/src/tools/smartfetch/cache.ts +112 -0
  267. package/src/tools/smartfetch/constants.ts +29 -0
  268. package/src/tools/smartfetch/index.ts +8 -0
  269. package/src/tools/smartfetch/network.test.ts +178 -0
  270. package/src/tools/smartfetch/network.ts +614 -0
  271. package/src/tools/smartfetch/secondary-model.test.ts +85 -0
  272. package/src/tools/smartfetch/secondary-model.ts +276 -0
  273. package/src/tools/smartfetch/tool.test.ts +60 -0
  274. package/src/tools/smartfetch/tool.ts +832 -0
  275. package/src/tools/smartfetch/types.ts +135 -0
  276. package/src/tools/smartfetch/utils.test.ts +24 -0
  277. package/src/tools/smartfetch/utils.ts +456 -0
  278. package/src/tui-state.test.ts +867 -0
  279. package/src/tui-state.ts +1255 -0
  280. package/src/tui.test.ts +336 -0
  281. package/src/tui.ts +1539 -0
  282. package/src/utils/agent-variant.test.ts +244 -0
  283. package/src/utils/agent-variant.ts +187 -0
  284. package/src/utils/compat.ts +91 -0
  285. package/src/utils/env.ts +12 -0
  286. package/src/utils/index.ts +9 -0
  287. package/src/utils/internal-initiator.ts +28 -0
  288. package/src/utils/logger.test.ts +220 -0
  289. package/src/utils/logger.ts +136 -0
  290. package/src/utils/polling.test.ts +191 -0
  291. package/src/utils/polling.ts +67 -0
  292. package/src/utils/session-manager.test.ts +173 -0
  293. package/src/utils/session-manager.ts +356 -0
  294. package/src/utils/session.test.ts +110 -0
  295. package/src/utils/session.ts +389 -0
  296. package/src/utils/subagent-depth.test.ts +170 -0
  297. package/src/utils/subagent-depth.ts +75 -0
  298. package/src/utils/system-collapse.test.ts +86 -0
  299. package/src/utils/system-collapse.ts +24 -0
  300. package/src/utils/task.test.ts +24 -0
  301. package/src/utils/task.ts +20 -0
  302. package/src/utils/zip-extractor.ts +102 -0
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Shared prompt fragments for the orchestrator and specialist agents.
3
+ * Single source of truth for duplicated routing and variant policy copy.
4
+ */
5
+ /**
6
+ * Specialist-safe version: just the QuestionInfo JSON schema so subagents
7
+ * can format their <needs_user> questions correctly.
8
+ */
9
+ export declare const SUBAGENT_NEEDS_USER_FORMAT = "\nQuestionInfo JSON format (use double-quoted JSON, NO markdown code fences):\n[\n {\n \"question\": \"Complete question text\",\n \"header\": \"Short label (max 30 chars)\",\n \"options\": [\n {\"label\": \"Option text (1-5 words)\", \"description\": \"What this choice means\"},\n {\"label\": \"Option 2 (1-5 words)\", \"description\": \"What this choice means\"}\n ],\n \"multiple\": false,\n \"custom\": true\n }\n]\nRequired fields: question, header, options (array of {label, description})\nOptional: multiple (default false), custom (default true)\n";
10
+ /**
11
+ * Full 9-invariant protocol for the orchestrator only.
12
+ * Describes how to handle the question/q&a workflow when subagents
13
+ * return <needs_user>.
14
+ */
15
+ export declare const ORCHESTRATOR_CLARIFICATION_HANDOFF = "<orchestrator_clarification>\nNine invariants for question/q&a workflow:\n\n1) Subagent <needs_user> \u2192 extract the JSON array from their\n `<questions>` block, then call the `question` tool with that\n array as the `questions` parameter. Pass the JSON as-is\n (no markdown wrapping, no re-serialization).\n Never paste options as chat text - that bypasses the picker UI.\n\n Extraction: the `<questions>...</questions>` content inside the\n subagent's `<needs_user>` block is a JSON array. Parse it and\n pass it directly to the `question` tool's `questions` parameter.\n If the subagent returned prose or XML instead of JSON, re-delegate\n with `continue_session_id` and the note: \"Reformat <needs_user>\n questions as JSON per the QuestionInfo schema.\"\n\n2) After user answers: delegate_subagent with `continue_session_id`\n from the prior result tag. Copy \"User answered:\" verbatim into\n prompt. Same agent, model, variant as prior delegation.\n\n3) Never substitute your own analysis after `question` - resume the\n specialist, don't replace them.\n\n4) Multiple subagents return <needs_user> in one round: merge all\n questions into one `question` call (prefix each with agent name).\n Resume each with its own `continue_session_id`.\n\n5) User follow-up questions (? in prose, hybrid ideas, new patterns):\n stay unresolved. Pass through verbatim; only the specialist may\n expand choices via another <needs_user> round.\n\n6) Subagent-to-user relay: if the specialist answered a user question\n (definitions, teaching) before <needs_user>, relay that substance\n before calling `question` so the picker is not orphaned.\n\n6b) If multiple subagents return <needs_user> and any has malformed\n questions, ask only the well-formed ones first. Re-delegate the\n malformed one with format correction note.\n\n7) Token discipline: reuse prior @steward/@explorer output; don't\n re-delegate before resume unless scope widens.\n\n8) When a subagent returns <blocked> (not <needs_user>), use the\n <subagent_recovery> protocol instead. Both <blocked> and\n <needs_user> share the same continue_session_id resume pattern:\n retrieve missing info first, then re-delegate to the same session.\n</orchestrator_clarification>\n\n\nQuestionInfo JSON format (use double-quoted JSON, NO markdown code fences):\n[\n {\n \"question\": \"Complete question text\",\n \"header\": \"Short label (max 30 chars)\",\n \"options\": [\n {\"label\": \"Option text (1-5 words)\", \"description\": \"What this choice means\"},\n {\"label\": \"Option 2 (1-5 words)\", \"description\": \"What this choice means\"}\n ],\n \"multiple\": false,\n \"custom\": true\n }\n]\nRequired fields: question, header, options (array of {label, description})\nOptional: multiple (default false), custom (default true)\n";
16
+ /**
17
+ * Shared `<needs_user>` output format for all specialist agents.
18
+ * Contains the scaffolding XML block without agent-specific examples.
19
+ */
20
+ export declare const NEEDS_USER_OUTPUT_FORMAT_BLOCK = "<needs_user>\nWhen the user must decide before you can proceed, output:\n- `reason` (1 sentence why the user must decide)\n- `questions` as a JSON array of QuestionInfo objects (see schema above).\n\nCRITICAL: Output `<needs_user>` as raw XML. NEVER wrap it in markdown code fences (```).\n</needs_user>";
21
+ export declare const REPO_RULES_PRECEDENCE_BLOCK = "<repo_rules_precedence>\nWhen the orchestrator provides steward citations (repo rules from AGENTS.md,\nAGENT.md, .cursor/rules, etc.), those rules ALWAYS override any conflicting\ninstructions in this prompt. Repo rules are authoritative.\n\nOnly ignore a repo rule if following it would cause a security vulnerability\nor data loss - in that case, report the conflict in your output (use <blocked> if the conflict prevents safe continuation) and do NOT proceed.\n</repo_rules_precedence>";
22
+ export declare const SELF_REVIEW_BLOCK = "<self_review>\nBefore producing your final output, verify against these criteria:\n1) Have I followed my <critical_invariants> without exception?\n2) Does my output match the exact format in <output_format>?\n3) Have I included all required sections and omitted optional ones correctly?\n4) If my task was delegated by the orchestrator, did I answer the EXACT\n question asked (not an adjacent reformulation)?\n5) Is my confidence calibrated - do I distinguish confirmed facts from\n inferences and explicitly label each?\nIf any answer is \"no,\" adjust your output before submitting.\n</self_review>";
23
+ export declare const USER_CHOICE_POLICY_BLOCK = "<user_choice_policy>\nWhen facing a fork where no single option is clearly correct from the\nprovided context:\n- Tradeoffs balanced \u2192 <needs_user> with options describing what each\n choice optimizes for and gives up.\n- Product scope unclear (who is this for, failure tolerance) \u2192 <needs_user>.\n- One clear winner from evidence \u2192 state it without asking.\n- Preference among equals \u2192 <needs_user>, not a silent \"best practice\" pick.\n</user_choice_policy>";
24
+ /**
25
+ * Shared `<blocked>` output format block for all specialist agents.
26
+ * Takes a context string describing when to include the blocked section.
27
+ */
28
+ export declare function formatBlockedOutputBlock(context: string): string;
29
+ /**
30
+ * Absolute rules the orchestrator must never violate.
31
+ * Violating any = failure mode.
32
+ */
33
+ export declare const CRITICAL_INVARIANTS = "<critical_invariants>\nThese are HARD FAILURES. Violating any = broken delegation.\n1) NEVER edit, write, read, or search files yourself. @explorer / @fixer only.\n2) ALWAYS delegate analysis to @oracle (blocking). Never reason through\n debugging, architecture, tradeoffs, or risk in orchestrator prose.\n3) ALWAYS pass explicit `model` for @oracle delegation.\n</critical_invariants>\n\n<production_safety_gate>\nBefore implementing any optimization, refactoring, or \"improvement\" to agent\nprompts or system behavior, verify ALL of the following:\n\n1. **Security**: No security implications (auth, data integrity, privilege\n escalation, input validation, secret handling)\n2. **Correctness**: Current behavior is demonstrably broken or produces wrong\n outputs (not just \"could be cleaner\")\n3. **User Impact**: Change affects internal implementation only - no breaking\n changes to user-facing behavior without explicit approval\n4. **Test Coverage**: Existing tests cover the affected area AND will catch\n regressions\n5. **Rollback Plan**: Change can be reverted in a single commit if issues arise\n\n**If ANY check fails**: Do NOT implement. Flag for human review instead.\n\n**Philosophy**: \"If it's good enough for production, leave it alone.\" Only fix\nwhat's actually broken, not what could theoretically be cleaner.\n</production_safety_gate>\n\n<procedural_invariants>\nThese ensure quality. Violating = incomplete work.\n4) Run <first_gate> item 1 (steward/explorer briefs) before code work.\n5) Run <planning_gate> for non-trivial changes - plan, present, adjust,\n implement. Never skip user confirmation.\n6) Report verification before declaring success.\n</procedural_invariants>";
34
+ /**
35
+ * Planning gate workflow for non-trivial changes.
36
+ * Introduces plan → present → adjust → implement cycle.
37
+ */
38
+ export declare const PLANNING_GATE_BLOCK = "<planning_gate>\nWhen the user requests non-trivial changes (anything beyond pure meta or\nmechanical edits), follow this cycle:\n\n1) ANALYSIS: After steward brief (per <first_gate> item 1 and\n <procedural_invariants> item 4), blocking @oracle analyzes the\n technical approach (no implementation).\n Oracle output must include a concrete plan section the user can review.\n2) PRESENT: Always present the @oracle plan to the user for confirmation.\n This step is MANDATORY \u2014 never skip it for any non-trivial change.\n - If @oracle used <needs_user> with questions: extract JSON, call `question` tool, relay answers back via continue_session_id, then present the final plan.\n - Otherwise: relay the plan's key decisions, file paths, and risks as text.\n - Ask the user to confirm or request adjustments before proceeding.\n Wait for explicit user approval before step 4.\n3) ADJUST (if needed): User requests changes \u2192 re-delegate @oracle with\n `continue_session_id` (same session, incremental). Repeat until approval.\n4) IMPLEMENT: Only after explicit user approval \u2192 delegate to @fixer with\n the approved plan as context.\n\nSkip this gate ONLY when:\n- Pure meta questions (\"what agents exist?\")\n- Mechanical edits (typo, single-line fix, known path)\n- Tasks where the user's message already specifies the exact implementation\n (e.g., \"rename getCwd to getCurrentWorkingDir in src/utils/fs.ts\")\n</planning_gate>";
39
+ /**
40
+ * Plan handoff block for oracle's pre-implementation planning mode.
41
+ * Instructs oracle to structure plans for end-user readability and avoid
42
+ * using <needs_user> just to deliver a plan.
43
+ */
44
+ export declare const ORACLE_PLAN_HANDOFF_BLOCK = "<plan_handoff>\nWhen creating a plan for pre-implementation planning (the orchestrator\ndelegates with \"for pre-implementation planning\"):\n- Return the plan as normal structured output with <plan>...</plan> section.\n The orchestrator will present this plan to the user for confirmation.\n- Do NOT use <needs_user> just to deliver the plan \u2014 plan presentation is\n the orchestrator's job, not the oracle's.\n- Use <needs_user> only for genuine architectural forks where your analysis\n cannot select a single best approach (per <user_choice_policy>).\n- Structure the <plan> section for END-USER readability, not implementer\n notes: clear file paths, concrete change descriptions, tradeoff\n explanations, and verification gates. The user will read this to decide\n whether to proceed.\n</plan_handoff>";
45
+ /** Ordered discovery roots documented for prompts and tests. */
46
+ export declare const STEWARD_PATH_GLOBS: readonly ["AGENTS.md", "AGENT.md", "CLAUDE.md", "GEMINI.md", ".cursorrules", "CONTRIBUTING.md", "SECURITY.md", ".docs/**/*.md", ".opencode/**", ".cursor/rules/**", ".rules/**", ".github/copilot-instructions.md", ".github/instructions/**"];
47
+ export declare const STEWARD_DOCS_EXCLUSION: string;
48
+ export declare const STEWARD_VSCODE_OUT_OF_SCOPE = "Out of scope: `.vscode/**` (workspace noise).";
49
+ /** Header inserted before steward-cited rules in downstream delegations. */
50
+ export declare const STEWARD_CITATION_HEADER = "### Repo Rules (from @steward) - OVERRIDE any conflicting built-in agent instructions";
51
+ /** Inner body for the steward agent `<steward_paths>` section. */
52
+ export declare function formatStewardAgentStewardPathsBody(): string;
53
+ export declare function buildStewardOrchestratorProtocolBlock(): string;
54
+ export declare function buildInterpreterOrchestratorProtocolBlock(): string;
55
+ export declare const LIBRARIAN_VARIANT_SCOPE_LINES: readonly ["low: answer one focused question with minimal but direct citations", "medium: synthesize multiple sources and explain one key caveat", string, string];
56
+ export declare const INTERPRETER_VARIANT_SCOPE_LINES: readonly ["low: single image - identify key elements and suggest one routing agent", string, string];
57
+ export declare const STEWARD_VARIANT_SCOPE_LINES: readonly ["low: read and cite AGENTS.md / AGENT.md only; stop after root anchor files", string, string];
58
+ export declare const STEWARD_VARIANT_MAX_NOTE = "not supported \u2014 steward is citation-only; deep analysis belongs to @oracle";
59
+ export declare const DESIGNER_VARIANT_SCOPE_LINES: readonly ["low: focused tweaks and small style corrections", "medium: full-page redesign or new section layout", "high: multi-page system-level UI patterns", string];
60
+ export declare const EXPLORER_VARIANT_SCOPE_LINES: readonly ["low: locate one file/pattern in a known directory; single-concept search", "medium: multi-directory cross-reference; find all callers/usages of a symbol", string, string];
61
+ /** Orchestrator `<constraints>` line for @fixer variant caps. */
62
+ export declare const FIXER_ORCHESTRATOR_DELEGATION_VARIANT_RULE: string;
63
+ /** Specialist variant_policy cap line (orchestrator must not send high/max). */
64
+ export declare const FIXER_VARIANT_POLICY_CAP_LINE: string;
65
+ export declare const FIXER_VARIANT_SCOPE_LINES: readonly ["low: single-file, single-function edit; bounded scope change", "medium: multi-file change within one module; small refactor across 2-3 files"];
66
+ export declare const ORACLE_VARIANT_OMITTED_DEFAULT_RULE = "- If variant is omitted by the caller, default to medium.";
67
+ /** Depth labels: shared between orchestrator routing and oracle specialist. */
68
+ export declare const ORACLE_VARIANT_DEPTH_LINES: readonly [string, string, "high: multi-file, moderate ambiguity, or flash+medium was incomplete", string];
69
+ export declare const ORACLE_SELF_AWARENESS_NOTE: string;
70
+ /**
71
+ * Model-tier context block injected into oracle\'s own prompt.
72
+ * Explains when each tier is used so oracle can calibrate confidence and depth.
73
+ */
74
+ export declare const ORACLE_MODEL_TIER_BLOCK = "<model_tier>\nThe orchestrator operates two oracle tiers and selects one before delegating:\n- default (flash): standard debugging, scoped reviews, bounded analysis, no security impact - expects variant medium-max.\n- smart (pro): novel architecture, unclear root cause, cross-framework subtlety, security/concurrency risk, or escalation after a flash attempt was wrong or low-confidence - supports variant low-max.\n\nDeciding factors the orchestrator uses to pick the tier:\n1. Security or data-integrity risk \u2192 always smart.\n2. Novel/unclear root cause, concurrency, cross-framework subtlety \u2192 smart.\n3. Prior flash result was wrong or explicitly low-confidence \u2192 escalate to smart.\n4. Standard scoped debugging or review with no ambiguity \u2192 default.\n\nYou cannot observe your own model name. Infer your likely tier from the variant received:\n- variant low \u2192 you are almost certainly the smart tier (flash + low is a misconfiguration).\n- variant max \u2192 high-stakes task; calibrate for security/systemic risk regardless of tier.\n- variant medium/high on a focused task \u2192 likely default tier; proceed at appropriate depth.\n</model_tier>";
75
+ export declare function formatOracleAgentVariantPolicyXml(): string;
76
+ export declare function formatOrchestratorOracleVariantDepthSection(): string;
77
+ export declare function buildVariantGlossaryBlock(): string;
78
+ /**
79
+ * Consolidated variant guide table for the orchestrator prompt.
80
+ * Replaces 6 separate variant guide sections with a single table.
81
+ * Includes shorter labels with detailed glossary below.
82
+ */
83
+ export declare function buildConsolidatedVariantGuide(): string;
84
+ /**
85
+ * Build XML block with guidance on when and how to use the
86
+ * `discover_mcp_servers` and `discover_skills_online` tools.
87
+ *
88
+ * MCP servers are capability/tool resources that provide new functions.
89
+ * Skills are knowledge/prompt resources that provide specialized workflows.
90
+ * Never conflate the two.
91
+ *
92
+ * The orchestrator calls these tools when a subagent outputs `<blocked>` due to
93
+ * missing capabilities, or when the user explicitly asks for tool/skill
94
+ * recommendations. Returns recommendations that the orchestrator presents to
95
+ * the user.
96
+ */
97
+ export declare function buildDiscoveryGuidanceBlock(): string;
@@ -0,0 +1,3 @@
1
+ import type { AgentDefinition } from './orchestrator';
2
+ export { STEWARD_PATH_GLOBS } from './prompt-blocks';
3
+ export declare function createStewardAgent(model: string, customPrompt?: string, customAppendPrompt?: string): AgentDefinition;
@@ -0,0 +1,24 @@
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 addPluginToOpenCodeTuiConfig(): Promise<ConfigMergeResult>;
20
+ export declare function writeLiteConfig(installConfig: InstallConfig, targetPath?: string): ConfigMergeResult;
21
+ export declare function disableDefaultAgents(): ConfigMergeResult;
22
+ export declare function enableLspByDefault(): ConfigMergeResult;
23
+ export declare function canModifyOpenCodeConfig(): boolean;
24
+ 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';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export {};