@zcy2nn/agent-forge 1.0.1

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 (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +266 -0
  3. package/agent-forge.schema.json +675 -0
  4. package/dist/agents/council.d.ts +27 -0
  5. package/dist/agents/councillor.d.ts +2 -0
  6. package/dist/agents/implementer.d.ts +2 -0
  7. package/dist/agents/index.d.ts +30 -0
  8. package/dist/agents/orchestrator.d.ts +30 -0
  9. package/dist/agents/researcher.d.ts +2 -0
  10. package/dist/agents/reviewer.d.ts +2 -0
  11. package/dist/cli/config-io.d.ts +24 -0
  12. package/dist/cli/config-manager.d.ts +4 -0
  13. package/dist/cli/custom-skills.d.ts +29 -0
  14. package/dist/cli/doctor.d.ts +38 -0
  15. package/dist/cli/index.d.ts +2 -0
  16. package/dist/cli/index.js +1932 -0
  17. package/dist/cli/install.d.ts +2 -0
  18. package/dist/cli/migration.d.ts +46 -0
  19. package/dist/cli/model-key-normalization.d.ts +1 -0
  20. package/dist/cli/paths.d.ts +35 -0
  21. package/dist/cli/providers.d.ts +99 -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 +40 -0
  25. package/dist/config/agent-mcps.d.ts +15 -0
  26. package/dist/config/constants.d.ts +28 -0
  27. package/dist/config/council-schema.d.ts +127 -0
  28. package/dist/config/index.d.ts +5 -0
  29. package/dist/config/loader.d.ts +57 -0
  30. package/dist/config/runtime-preset.d.ts +12 -0
  31. package/dist/config/schema.d.ts +371 -0
  32. package/dist/config/utils.d.ts +15 -0
  33. package/dist/council/council-manager.d.ts +49 -0
  34. package/dist/council/index.d.ts +1 -0
  35. package/dist/divoom/council.gif +0 -0
  36. package/dist/divoom/designer.gif +0 -0
  37. package/dist/divoom/explorer.gif +0 -0
  38. package/dist/divoom/fixer.gif +0 -0
  39. package/dist/divoom/input.gif +0 -0
  40. package/dist/divoom/intro.gif +0 -0
  41. package/dist/divoom/librarian.gif +0 -0
  42. package/dist/divoom/manager.d.ts +57 -0
  43. package/dist/divoom/oracle.gif +0 -0
  44. package/dist/divoom/orchestrator.gif +0 -0
  45. package/dist/hooks/apply-patch/codec.d.ts +7 -0
  46. package/dist/hooks/apply-patch/errors.d.ts +25 -0
  47. package/dist/hooks/apply-patch/execution-context.d.ts +27 -0
  48. package/dist/hooks/apply-patch/index.d.ts +15 -0
  49. package/dist/hooks/apply-patch/matching.d.ts +26 -0
  50. package/dist/hooks/apply-patch/operations.d.ts +3 -0
  51. package/dist/hooks/apply-patch/patch.d.ts +2 -0
  52. package/dist/hooks/apply-patch/prepared-changes.d.ts +17 -0
  53. package/dist/hooks/apply-patch/resolution.d.ts +19 -0
  54. package/dist/hooks/apply-patch/rewrite.d.ts +7 -0
  55. package/dist/hooks/apply-patch/test-helpers.d.ts +6 -0
  56. package/dist/hooks/apply-patch/types.d.ts +80 -0
  57. package/dist/hooks/auto-update-checker/cache.d.ts +11 -0
  58. package/dist/hooks/auto-update-checker/checker.d.ts +32 -0
  59. package/dist/hooks/auto-update-checker/constants.d.ts +11 -0
  60. package/dist/hooks/auto-update-checker/index.d.ts +18 -0
  61. package/dist/hooks/auto-update-checker/types.d.ts +22 -0
  62. package/dist/hooks/chat-headers.d.ts +16 -0
  63. package/dist/hooks/delegate-task-retry/guidance.d.ts +2 -0
  64. package/dist/hooks/delegate-task-retry/hook.d.ts +8 -0
  65. package/dist/hooks/delegate-task-retry/index.d.ts +4 -0
  66. package/dist/hooks/delegate-task-retry/patterns.d.ts +11 -0
  67. package/dist/hooks/filter-available-skills/index.d.ts +32 -0
  68. package/dist/hooks/foreground-fallback/index.d.ts +72 -0
  69. package/dist/hooks/image-hook.d.ts +19 -0
  70. package/dist/hooks/index.d.ts +13 -0
  71. package/dist/hooks/json-error-recovery/hook.d.ts +18 -0
  72. package/dist/hooks/json-error-recovery/index.d.ts +1 -0
  73. package/dist/hooks/phase-reminder/index.d.ts +26 -0
  74. package/dist/hooks/post-file-tool-nudge/index.d.ts +19 -0
  75. package/dist/hooks/task-session-manager/index.d.ts +52 -0
  76. package/dist/hooks/todo-continuation/index.d.ts +53 -0
  77. package/dist/hooks/todo-continuation/todo-hygiene.d.ts +35 -0
  78. package/dist/index.d.ts +5 -0
  79. package/dist/index.js +32981 -0
  80. package/dist/interview/dashboard.d.ts +62 -0
  81. package/dist/interview/document.d.ts +25 -0
  82. package/dist/interview/helpers.d.ts +10 -0
  83. package/dist/interview/index.d.ts +1 -0
  84. package/dist/interview/manager.d.ts +35 -0
  85. package/dist/interview/parser.d.ts +11 -0
  86. package/dist/interview/prompts.d.ts +7 -0
  87. package/dist/interview/server.d.ts +13 -0
  88. package/dist/interview/service.d.ts +34 -0
  89. package/dist/interview/types.d.ts +96 -0
  90. package/dist/interview/ui.d.ts +12 -0
  91. package/dist/mcp/context7.d.ts +6 -0
  92. package/dist/mcp/grep-app.d.ts +6 -0
  93. package/dist/mcp/index.d.ts +8 -0
  94. package/dist/mcp/types.d.ts +12 -0
  95. package/dist/mcp/websearch.d.ts +9 -0
  96. package/dist/multiplexer/factory.d.ts +26 -0
  97. package/dist/multiplexer/index.d.ts +9 -0
  98. package/dist/multiplexer/session-manager.d.ts +53 -0
  99. package/dist/multiplexer/tmux/index.d.ts +22 -0
  100. package/dist/multiplexer/types.d.ts +54 -0
  101. package/dist/multiplexer/zellij/index.d.ts +34 -0
  102. package/dist/tools/ast-grep/cli.d.ts +15 -0
  103. package/dist/tools/ast-grep/constants.d.ts +25 -0
  104. package/dist/tools/ast-grep/downloader.d.ts +5 -0
  105. package/dist/tools/ast-grep/index.d.ts +10 -0
  106. package/dist/tools/ast-grep/tools.d.ts +3 -0
  107. package/dist/tools/ast-grep/types.d.ts +30 -0
  108. package/dist/tools/ast-grep/utils.d.ts +4 -0
  109. package/dist/tools/council.d.ts +10 -0
  110. package/dist/tools/index.d.ts +6 -0
  111. package/dist/tools/preset-manager.d.ts +27 -0
  112. package/dist/tools/skill.d.ts +9 -0
  113. package/dist/tools/smartfetch/binary.d.ts +3 -0
  114. package/dist/tools/smartfetch/cache.d.ts +6 -0
  115. package/dist/tools/smartfetch/constants.d.ts +12 -0
  116. package/dist/tools/smartfetch/index.d.ts +3 -0
  117. package/dist/tools/smartfetch/network.d.ts +38 -0
  118. package/dist/tools/smartfetch/secondary-model.d.ts +28 -0
  119. package/dist/tools/smartfetch/tool.d.ts +3 -0
  120. package/dist/tools/smartfetch/types.d.ts +122 -0
  121. package/dist/tools/smartfetch/utils.d.ts +18 -0
  122. package/dist/tui-state.d.ts +15 -0
  123. package/dist/tui.d.ts +8 -0
  124. package/dist/tui.js +248 -0
  125. package/dist/utils/agent-variant.d.ts +63 -0
  126. package/dist/utils/compat.d.ts +30 -0
  127. package/dist/utils/env.d.ts +1 -0
  128. package/dist/utils/index.d.ts +9 -0
  129. package/dist/utils/internal-initiator.d.ts +6 -0
  130. package/dist/utils/logger.d.ts +8 -0
  131. package/dist/utils/polling.d.ts +21 -0
  132. package/dist/utils/session-manager.d.ts +55 -0
  133. package/dist/utils/session.d.ts +74 -0
  134. package/dist/utils/subagent-depth.d.ts +35 -0
  135. package/dist/utils/system-collapse.d.ts +6 -0
  136. package/dist/utils/task.d.ts +4 -0
  137. package/dist/utils/zip-extractor.d.ts +1 -0
  138. package/package.json +104 -0
  139. package/src/skills/brainstorming/SKILL.md +177 -0
  140. package/src/skills/brainstorming/scripts/frame-template.html +214 -0
  141. package/src/skills/brainstorming/scripts/helper.js +88 -0
  142. package/src/skills/brainstorming/scripts/server.cjs +354 -0
  143. package/src/skills/brainstorming/scripts/start-server.sh +148 -0
  144. package/src/skills/brainstorming/scripts/stop-server.sh +56 -0
  145. package/src/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  146. package/src/skills/brainstorming/visual-companion.md +279 -0
  147. package/src/skills/codemap/README.md +59 -0
  148. package/src/skills/codemap/SKILL.md +163 -0
  149. package/src/skills/codemap/codemap.md +36 -0
  150. package/src/skills/codemap/scripts/codemap.mjs +483 -0
  151. package/src/skills/codemap/scripts/codemap.test.ts +129 -0
  152. package/src/skills/codemap.md +40 -0
  153. package/src/skills/dispatching-parallel-agents/SKILL.md +193 -0
  154. package/src/skills/executing-plans/SKILL.md +78 -0
  155. package/src/skills/finishing-a-development-branch/SKILL.md +211 -0
  156. package/src/skills/receiving-code-review/SKILL.md +224 -0
  157. package/src/skills/requesting-code-review/SKILL.md +113 -0
  158. package/src/skills/requesting-code-review/code-reviewer.md +146 -0
  159. package/src/skills/simplify/README.md +19 -0
  160. package/src/skills/simplify/SKILL.md +138 -0
  161. package/src/skills/simplify/codemap.md +36 -0
  162. package/src/skills/subagent-driven-development/SKILL.md +288 -0
  163. package/src/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
  164. package/src/skills/subagent-driven-development/implementer-prompt.md +113 -0
  165. package/src/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  166. package/src/skills/systematic-debugging/CREATION-LOG.md +119 -0
  167. package/src/skills/systematic-debugging/SKILL.md +308 -0
  168. package/src/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  169. package/src/skills/systematic-debugging/condition-based-waiting.md +115 -0
  170. package/src/skills/systematic-debugging/defense-in-depth.md +122 -0
  171. package/src/skills/systematic-debugging/find-polluter.sh +63 -0
  172. package/src/skills/systematic-debugging/root-cause-tracing.md +169 -0
  173. package/src/skills/systematic-debugging/test-academic.md +14 -0
  174. package/src/skills/systematic-debugging/test-pressure-1.md +58 -0
  175. package/src/skills/systematic-debugging/test-pressure-2.md +68 -0
  176. package/src/skills/systematic-debugging/test-pressure-3.md +69 -0
  177. package/src/skills/test-driven-development/SKILL.md +383 -0
  178. package/src/skills/test-driven-development/testing-anti-patterns.md +299 -0
  179. package/src/skills/using-git-worktrees/SKILL.md +226 -0
  180. package/src/skills/verification-before-completion/SKILL.md +147 -0
  181. package/src/skills/writing-plans/SKILL.md +165 -0
  182. package/src/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  183. package/src/skills/writing-skills/SKILL.md +666 -0
  184. package/src/skills/writing-skills/anthropic-best-practices.md +1150 -0
  185. package/src/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  186. package/src/skills/writing-skills/graphviz-conventions.dot +172 -0
  187. package/src/skills/writing-skills/persuasion-principles.md +187 -0
  188. package/src/skills/writing-skills/render-graphs.js +168 -0
  189. package/src/skills/writing-skills/testing-skills-with-subagents.md +384 -0
@@ -0,0 +1,2 @@
1
+ import type { InstallArgs } from './types';
2
+ export declare function install(args: InstallArgs): Promise<number>;
@@ -0,0 +1,46 @@
1
+ /** Result of a migration attempt. */
2
+ export interface MigrationResult {
3
+ /** Whether a legacy config was detected. */
4
+ detected: boolean;
5
+ /** Whether the migration was performed. */
6
+ migrated: boolean;
7
+ /** Path to the new config file, if migrated. */
8
+ newPath?: string;
9
+ /** Path to the legacy config file that was found. */
10
+ legacyPath?: string;
11
+ /** Error message if migration failed. */
12
+ error?: string;
13
+ }
14
+ /**
15
+ * Get all possible legacy config file paths (json and jsonc).
16
+ */
17
+ export declare function getLegacyConfigPaths(): string[];
18
+ /**
19
+ * Detect whether a legacy `oh-my-opencode-slim.json` config exists.
20
+ * Returns the path if found, or undefined.
21
+ */
22
+ export declare function detectLegacyConfig(): string | undefined;
23
+ /**
24
+ * Check if a config object contains any legacy agent names
25
+ * in its presets or agents sections.
26
+ */
27
+ export declare function hasLegacyAgentNames(config: Record<string, unknown>): boolean;
28
+ /**
29
+ * Migrate agent names in a config object.
30
+ *
31
+ * - Renames primary mapping keys (explorer→researcher, oracle→reviewer,
32
+ * designer→implementer).
33
+ * - For secondary mappings (librarian→researcher, fixer→implementer),
34
+ * only applies if the primary mapping target doesn't already exist.
35
+ * - Removes observer entries entirely.
36
+ * - Preserves all non-agent config keys unchanged.
37
+ */
38
+ export declare function migrateAgentNames(config: Record<string, unknown>): Record<string, unknown>;
39
+ /**
40
+ * Perform the full migration:
41
+ * 1. Read legacy config
42
+ * 2. Migrate agent names
43
+ * 3. Write to `agent-forge.json`
44
+ * 4. Rename legacy file to `.bak`
45
+ */
46
+ export declare function performMigration(legacyPath: string): MigrationResult;
@@ -0,0 +1 @@
1
+ export declare function buildModelKeyAliases(input: string): string[];
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Get the OpenCode plugin config directory.
3
+ *
4
+ * Resolution order:
5
+ * 1. OPENCODE_CONFIG_DIR (custom OpenCode directory)
6
+ * 2. XDG_CONFIG_HOME/opencode
7
+ * 3. ~/.config/opencode
8
+ */
9
+ export declare function getConfigDir(): string;
10
+ /**
11
+ * Get OpenCode config directories in read/search order.
12
+ *
13
+ * Resolution order:
14
+ * 1. OPENCODE_CONFIG_DIR (if set)
15
+ * 2. XDG_CONFIG_HOME/opencode or ~/.config/opencode
16
+ *
17
+ * Duplicate entries are removed.
18
+ */
19
+ export declare function getConfigSearchDirs(): string[];
20
+ export declare function getOpenCodeConfigPaths(): string[];
21
+ export declare function getConfigJson(): string;
22
+ export declare function getConfigJsonc(): string;
23
+ export declare function getLiteConfig(): string;
24
+ export declare function getLiteConfigJsonc(): string;
25
+ export declare function getTuiConfig(): string;
26
+ export declare function getTuiConfigJsonc(): string;
27
+ export declare function getExistingLiteConfigPath(): string;
28
+ export declare function getExistingTuiConfigPath(): string;
29
+ export declare function getExistingConfigPath(): string;
30
+ export declare function ensureConfigDir(): void;
31
+ export declare function ensureTuiConfigDir(): void;
32
+ /**
33
+ * Ensure the directory for OpenCode's main config file exists.
34
+ */
35
+ export declare function ensureOpenCodeConfigDir(): void;
@@ -0,0 +1,99 @@
1
+ import type { InstallConfig } from './types';
2
+ export declare const GENERATED_PRESETS: readonly ["openai", "opencode-go"];
3
+ export declare const MODEL_MAPPINGS: {
4
+ readonly openai: {
5
+ readonly orchestrator: {
6
+ readonly model: "openai/gpt-5.5";
7
+ };
8
+ readonly reviewer: {
9
+ readonly model: "openai/gpt-5.5";
10
+ readonly variant: "high";
11
+ };
12
+ readonly researcher: {
13
+ readonly model: "openai/gpt-5.4-mini";
14
+ readonly variant: "low";
15
+ };
16
+ readonly implementer: {
17
+ readonly model: "openai/gpt-5.4-mini";
18
+ readonly variant: "low";
19
+ };
20
+ };
21
+ readonly kimi: {
22
+ readonly orchestrator: {
23
+ readonly model: "kimi-for-coding/k2p5";
24
+ };
25
+ readonly reviewer: {
26
+ readonly model: "kimi-for-coding/k2p5";
27
+ readonly variant: "high";
28
+ };
29
+ readonly researcher: {
30
+ readonly model: "kimi-for-coding/k2p5";
31
+ readonly variant: "low";
32
+ };
33
+ readonly implementer: {
34
+ readonly model: "kimi-for-coding/k2p5";
35
+ readonly variant: "low";
36
+ };
37
+ };
38
+ readonly copilot: {
39
+ readonly orchestrator: {
40
+ readonly model: "github-copilot/claude-opus-4.6";
41
+ };
42
+ readonly reviewer: {
43
+ readonly model: "github-copilot/claude-opus-4.6";
44
+ readonly variant: "high";
45
+ };
46
+ readonly researcher: {
47
+ readonly model: "github-copilot/grok-code-fast-1";
48
+ readonly variant: "low";
49
+ };
50
+ readonly implementer: {
51
+ readonly model: "github-copilot/claude-sonnet-4.6";
52
+ readonly variant: "low";
53
+ };
54
+ };
55
+ readonly 'zai-plan': {
56
+ readonly orchestrator: {
57
+ readonly model: "zai-coding-plan/glm-5";
58
+ };
59
+ readonly reviewer: {
60
+ readonly model: "zai-coding-plan/glm-5";
61
+ readonly variant: "high";
62
+ };
63
+ readonly researcher: {
64
+ readonly model: "zai-coding-plan/glm-5";
65
+ readonly variant: "low";
66
+ };
67
+ readonly implementer: {
68
+ readonly model: "zai-coding-plan/glm-5";
69
+ readonly variant: "low";
70
+ };
71
+ };
72
+ readonly 'opencode-go': {
73
+ readonly orchestrator: {
74
+ readonly model: "opencode-go/glm-5.1";
75
+ };
76
+ readonly reviewer: {
77
+ readonly model: "opencode-go/deepseek-v4-pro";
78
+ readonly variant: "max";
79
+ };
80
+ readonly council: {
81
+ readonly model: "opencode-go/deepseek-v4-pro";
82
+ readonly variant: "high";
83
+ };
84
+ readonly researcher: {
85
+ readonly model: "opencode-go/minimax-m2.7";
86
+ };
87
+ readonly implementer: {
88
+ readonly model: "opencode-go/deepseek-v4-flash";
89
+ readonly variant: "high";
90
+ };
91
+ };
92
+ };
93
+ export type PresetName = keyof typeof MODEL_MAPPINGS;
94
+ export type GeneratedPresetName = (typeof GENERATED_PRESETS)[number];
95
+ export declare function isPresetName(value: string): value is PresetName;
96
+ export declare function getPresetNames(): PresetName[];
97
+ export declare function isGeneratedPresetName(value: string): value is GeneratedPresetName;
98
+ export declare function getGeneratedPresetNames(): GeneratedPresetName[];
99
+ export declare function generateLiteConfig(installConfig: InstallConfig): Record<string, unknown>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * A recommended skill to install via `npx skills add`.
3
+ */
4
+ export interface RecommendedSkill {
5
+ /** Human-readable name for prompts */
6
+ name: string;
7
+ /** GitHub repo URL for `npx skills add` */
8
+ repo: string;
9
+ /** Skill name within the repo (--skill flag) */
10
+ skillName: string;
11
+ /** List of agents that should auto-allow this skill */
12
+ allowedAgents: string[];
13
+ /** Description shown to user during install */
14
+ description: string;
15
+ /** Optional commands to run after the skill is added */
16
+ postInstallCommands?: string[];
17
+ }
18
+ /**
19
+ * A skill that is managed externally (e.g. user-installed) and needs
20
+ * permission grants but is NOT installed by this plugin's CLI.
21
+ */
22
+ export interface PermissionOnlySkill {
23
+ /** Skill name — must match the name OpenCode uses for permission checks */
24
+ name: string;
25
+ /** List of agents that should auto-allow this skill */
26
+ allowedAgents: string[];
27
+ /** Human-readable description (for documentation only) */
28
+ description: string;
29
+ }
30
+ /**
31
+ * List of recommended skills.
32
+ * Add new skills here to include them in the installation flow.
33
+ */
34
+ export declare const RECOMMENDED_SKILLS: RecommendedSkill[];
35
+ /**
36
+ * Skills managed externally (not installed by this plugin's CLI).
37
+ * Entries here only affect agent permission grants — nothing is installed.
38
+ */
39
+ export declare const PERMISSION_ONLY_SKILLS: PermissionOnlySkill[];
40
+ /**
41
+ * Install a skill using `npx skills add`.
42
+ * @param skill - The skill to install
43
+ * @returns True if installation succeeded, false otherwise
44
+ */
45
+ export declare function installSkill(skill: RecommendedSkill): boolean;
46
+ /**
47
+ * Get permission presets for a specific agent based on recommended skills.
48
+ * @param agentName - The name of the agent
49
+ * @param skillList - Optional explicit list of skills to allow (overrides recommendations)
50
+ * @returns Permission rules for the skill permission type
51
+ */
52
+ export declare function getSkillPermissionsForAgent(agentName: string, skillList?: string[]): Record<string, 'allow' | 'ask' | 'deny'>;
@@ -0,0 +1,6 @@
1
+ export declare function resolveOpenCodePath(): string;
2
+ export declare function isOpenCodeInstalled(): Promise<boolean>;
3
+ export declare function isTmuxInstalled(): Promise<boolean>;
4
+ export declare function getOpenCodeVersion(): Promise<string | null>;
5
+ export declare function getOpenCodePath(): string | null;
6
+ export declare function fetchLatestVersion(packageName: string): Promise<string | null>;
@@ -0,0 +1,40 @@
1
+ export type BooleanArg = 'yes' | 'no';
2
+ export interface InstallArgs {
3
+ tui: boolean;
4
+ skills?: BooleanArg;
5
+ preset?: string;
6
+ dryRun?: boolean;
7
+ reset?: boolean;
8
+ }
9
+ export interface OpenCodeConfig {
10
+ plugin?: unknown[];
11
+ provider?: Record<string, unknown>;
12
+ agent?: Record<string, unknown>;
13
+ [key: string]: unknown;
14
+ }
15
+ export interface InstallConfig {
16
+ hasTmux: boolean;
17
+ installSkills: boolean;
18
+ installCustomSkills: boolean;
19
+ preset?: string;
20
+ promptForStar?: boolean;
21
+ dryRun?: boolean;
22
+ reset: boolean;
23
+ }
24
+ export interface ConfigMergeResult {
25
+ success: boolean;
26
+ configPath: string;
27
+ error?: string;
28
+ }
29
+ export interface DetectedConfig {
30
+ isInstalled: boolean;
31
+ hasKimi: boolean;
32
+ hasOpenAI: boolean;
33
+ hasAnthropic?: boolean;
34
+ hasCopilot?: boolean;
35
+ hasZaiPlan?: boolean;
36
+ hasAntigravity: boolean;
37
+ hasChutes?: boolean;
38
+ hasOpencodeZen: boolean;
39
+ hasTmux: boolean;
40
+ }
@@ -0,0 +1,15 @@
1
+ import { type AgentName, type PluginConfig } from '.';
2
+ /** Default MCPs per agent - "*" means all MCPs, "!item" excludes specific MCPs */
3
+ export declare const DEFAULT_AGENT_MCPS: Record<AgentName, string[]>;
4
+ /**
5
+ * Parse a list with wildcard and exclusion syntax.
6
+ */
7
+ export declare function parseList(items: string[], allAvailable: string[]): string[];
8
+ /**
9
+ * Get available MCP names from schema and config.
10
+ */
11
+ export declare function getAvailableMcpNames(config?: PluginConfig): string[];
12
+ /**
13
+ * Get the MCP list for an agent (from config or defaults).
14
+ */
15
+ export declare function getAgentMcpList(agentName: string, config?: PluginConfig): string[];
@@ -0,0 +1,28 @@
1
+ export declare const SUBAGENT_NAMES: readonly ["researcher", "reviewer", "implementer", "council", "councillor"];
2
+ export declare const ORCHESTRATOR_NAME: "orchestrator";
3
+ export declare const ALL_AGENT_NAMES: readonly ["orchestrator", "researcher", "reviewer", "implementer", "council", "councillor"];
4
+ export type AgentName = (typeof ALL_AGENT_NAMES)[number];
5
+ export declare const ORCHESTRATABLE_AGENTS: readonly ["researcher", "reviewer", "implementer", "council"];
6
+ /** Agents that cannot be disabled even if listed in disabled_agents config. */
7
+ export declare const PROTECTED_AGENTS: Set<string>;
8
+ /**
9
+ * Get the list of orchestratable agents, excluding any disabled agents.
10
+ * This is used for delegation validation at runtime.
11
+ */
12
+ export declare function getOrchestratableAgents(disabledAgents?: Set<string>): string[];
13
+ export declare const SUBAGENT_DELEGATION_RULES: Record<AgentName, readonly string[]>;
14
+ export declare const DEFAULT_MODELS: Record<AgentName, string | undefined>;
15
+ export declare const POLL_INTERVAL_MS = 500;
16
+ export declare const POLL_INTERVAL_SLOW_MS = 1000;
17
+ export declare const POLL_INTERVAL_BACKGROUND_MS = 2000;
18
+ export declare const DEFAULT_TIMEOUT_MS: number;
19
+ export declare const MAX_POLL_TIME_MS: number;
20
+ export declare const FALLBACK_FAILOVER_TIMEOUT_MS = 15000;
21
+ export declare const DEFAULT_MAX_SUBAGENT_DEPTH = 3;
22
+ export declare const PHASE_REMINDER_TEXT = "!IMPORTANT! Recall the workflow rules:\nUnderstand \u2192 choose the best parallelized path based on your capabilities and agents delegation rules \u2192 recall session reuse rules \u2192 execute \u2192 verify.\nIf delegating, launch the specialist in the same turn you mention it !END!";
23
+ export declare const TMUX_SPAWN_DELAY_MS = 500;
24
+ export declare const COUNCILLOR_STAGGER_MS = 250;
25
+ export declare const STABLE_POLLS_THRESHOLD = 3;
26
+ /** Agents that are disabled by default. Users must explicitly enable them
27
+ * by removing from disabled_agents and configuring an appropriate model. */
28
+ export declare const DEFAULT_DISABLED_AGENTS: string[];
@@ -0,0 +1,127 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Configuration for a single councillor within a preset.
4
+ * Each councillor is an independent LLM that processes the same prompt.
5
+ *
6
+ * Councillors run as agent sessions with read-only codebase access
7
+ * (read, glob, grep, lsp, list). They can examine the codebase but
8
+ * cannot modify files or spawn subagents.
9
+ */
10
+ export declare const CouncillorConfigSchema: z.ZodObject<{
11
+ model: z.ZodString;
12
+ variant: z.ZodOptional<z.ZodString>;
13
+ prompt: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ export type CouncillorConfig = z.infer<typeof CouncillorConfigSchema>;
16
+ /**
17
+ * A named preset grouping several councillors.
18
+ *
19
+ * All keys are treated as councillor names mapping to councillor configs.
20
+ * The reserved key `"master"` is silently ignored (legacy from when
21
+ * council-master was a separate agent).
22
+ */
23
+ export declare const CouncilPresetSchema: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>, z.ZodTransform<Record<string, {
24
+ model: string;
25
+ variant?: string | undefined;
26
+ prompt?: string | undefined;
27
+ }>, Record<string, Record<string, unknown>>>>;
28
+ export type CouncilPreset = z.infer<typeof CouncilPresetSchema>;
29
+ /**
30
+ * Execution mode for councillors.
31
+ * - parallel: Run all councillors concurrently (default, fastest for multi-model systems)
32
+ * - serial: Run councillors one at a time (required for single-model systems to avoid conflicts)
33
+ */
34
+ export declare const CouncillorExecutionModeSchema: z.ZodDefault<z.ZodEnum<{
35
+ parallel: "parallel";
36
+ serial: "serial";
37
+ }>>;
38
+ /**
39
+ * Top-level council configuration.
40
+ *
41
+ * Example JSONC:
42
+ * ```jsonc
43
+ * {
44
+ * "council": {
45
+ * "presets": {
46
+ * "default": {
47
+ * "alpha": { "model": "openai/gpt-5.4-mini" },
48
+ * "beta": { "model": "openai/gpt-5.3-codex" },
49
+ * "gamma": { "model": "google/gemini-3-pro" }
50
+ * }
51
+ * },
52
+ * "timeout": 180000,
53
+ * "councillor_execution_mode": "serial"
54
+ * }
55
+ * }
56
+ * ```
57
+ */
58
+ export declare const CouncilConfigSchema: z.ZodPipe<z.ZodObject<{
59
+ presets: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>, z.ZodTransform<Record<string, {
60
+ model: string;
61
+ variant?: string | undefined;
62
+ prompt?: string | undefined;
63
+ }>, Record<string, Record<string, unknown>>>>>;
64
+ timeout: z.ZodDefault<z.ZodNumber>;
65
+ default_preset: z.ZodDefault<z.ZodString>;
66
+ councillor_execution_mode: z.ZodDefault<z.ZodEnum<{
67
+ parallel: "parallel";
68
+ serial: "serial";
69
+ }>>;
70
+ councillor_retries: z.ZodDefault<z.ZodNumber>;
71
+ master: z.ZodOptional<z.ZodUnknown>;
72
+ master_timeout: z.ZodOptional<z.ZodUnknown>;
73
+ master_fallback: z.ZodOptional<z.ZodUnknown>;
74
+ }, z.core.$strip>, z.ZodTransform<{
75
+ presets: Record<string, Record<string, {
76
+ model: string;
77
+ variant?: string | undefined;
78
+ prompt?: string | undefined;
79
+ }>>;
80
+ timeout: number;
81
+ default_preset: string;
82
+ councillor_execution_mode: "parallel" | "serial";
83
+ councillor_retries: number;
84
+ _deprecated: string[] | undefined;
85
+ _legacyMasterModel: string | undefined;
86
+ }, {
87
+ presets: Record<string, Record<string, {
88
+ model: string;
89
+ variant?: string | undefined;
90
+ prompt?: string | undefined;
91
+ }>>;
92
+ timeout: number;
93
+ default_preset: string;
94
+ councillor_execution_mode: "parallel" | "serial";
95
+ councillor_retries: number;
96
+ master?: unknown;
97
+ master_timeout?: unknown;
98
+ master_fallback?: unknown;
99
+ }>>;
100
+ export type CouncilConfig = z.infer<typeof CouncilConfigSchema>;
101
+ export type CouncillorExecutionMode = z.infer<typeof CouncillorExecutionModeSchema>;
102
+ /**
103
+ * A sensible default council configuration that users can copy into their
104
+ * opencode.jsonc. Provides a 3-councillor preset using common models.
105
+ *
106
+ * Users should replace models with ones they have access to.
107
+ *
108
+ * ```jsonc
109
+ * "council": DEFAULT_COUNCIL_CONFIG
110
+ * ```
111
+ */
112
+ export declare const DEFAULT_COUNCIL_CONFIG: z.input<typeof CouncilConfigSchema>;
113
+ /**
114
+ * Result of a council session.
115
+ */
116
+ export interface CouncilResult {
117
+ success: boolean;
118
+ result?: string;
119
+ error?: string;
120
+ councillorResults: Array<{
121
+ name: string;
122
+ model: string;
123
+ status: 'completed' | 'failed' | 'timed_out';
124
+ result?: string;
125
+ error?: string;
126
+ }>;
127
+ }
@@ -0,0 +1,5 @@
1
+ export * from './constants';
2
+ export * from './council-schema';
3
+ export { deepMerge, loadAgentPrompt, loadPluginConfig } from './loader';
4
+ export * from './schema';
5
+ export { getAgentOverride, getCustomAgentNames } from './utils';
@@ -0,0 +1,57 @@
1
+ import { type PluginConfig } from './schema';
2
+ /**
3
+ * Find plugin config paths (user and project) for a given directory.
4
+ * User config uses getConfigSearchDirs() for lookup.
5
+ * Project config uses <directory>/.opencode/agent-forge.
6
+ *
7
+ * @param directory - Project directory to search for .opencode config
8
+ * @returns Object with userConfigPath and projectConfigPath (null if not found)
9
+ */
10
+ export declare function findPluginConfigPaths(directory: string): {
11
+ userConfigPath: string | null;
12
+ projectConfigPath: string | null;
13
+ };
14
+ /**
15
+ * Merge two plugin configs using the loader's merge rules.
16
+ * Project/override takes precedence over base.
17
+ */
18
+ export declare function mergePluginConfigs(base: PluginConfig, override: PluginConfig): PluginConfig;
19
+ /**
20
+ * Recursively merge two objects, with override values taking precedence.
21
+ * For nested objects, merges recursively. For arrays and primitives, override replaces base.
22
+ *
23
+ * @param base - Base object to merge into
24
+ * @param override - Override object whose values take precedence
25
+ * @returns Merged object, or undefined if both inputs are undefined
26
+ */
27
+ export declare function deepMerge<T extends Record<string, unknown>>(base?: T, override?: T): T | undefined;
28
+ /**
29
+ * Load plugin configuration from user and project config files, merging them appropriately.
30
+ *
31
+ * Configuration is loaded from two locations:
32
+ * 1. User config: $OPENCODE_CONFIG_DIR/agent-forge.jsonc or .json,
33
+ * or ~/.config/opencode/agent-forge.jsonc or .json (or $XDG_CONFIG_HOME)
34
+ * 2. Project config: <directory>/.opencode/agent-forge.jsonc or .json
35
+ *
36
+ * JSONC format is preferred over JSON (allows comments and trailing commas).
37
+ * Project config takes precedence over user config. Nested objects (agents, tmux) are
38
+ * deep-merged, while top-level arrays are replaced entirely by project config.
39
+ *
40
+ * @param directory - Project directory to search for .opencode config
41
+ * @returns Merged plugin configuration (empty object if no configs found)
42
+ */
43
+ export declare function loadPluginConfig(directory: string): PluginConfig;
44
+ /**
45
+ * Load custom prompt for an agent from the prompts directory.
46
+ * Checks for {agent}.md (replaces default) and {agent}_append.md (appends to default).
47
+ * If preset is provided and safe for paths, it first checks {preset}/ subdirectory,
48
+ * then falls back to the root prompts directory.
49
+ *
50
+ * @param agentName - Name of the agent (e.g., "orchestrator", "researcher")
51
+ * @param preset - Optional preset name for preset-scoped prompt lookup
52
+ * @returns Object with prompt and/or appendPrompt if files exist
53
+ */
54
+ export declare function loadAgentPrompt(agentName: string, preset?: string): {
55
+ prompt?: string;
56
+ appendPrompt?: string;
57
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Module-level runtime preset state.
3
+ *
4
+ * Survives plugin re-inits triggered by client.config.update() →
5
+ * Instance.dispose(). The plugin function re-runs but this module-level
6
+ * variable persists within the same Node.js process.
7
+ */
8
+ export declare function setActiveRuntimePreset(name: string | null): void;
9
+ export declare function getActiveRuntimePreset(): string | null;
10
+ export declare function getPreviousRuntimePreset(): string | null;
11
+ export declare function setActiveRuntimePresetWithPrevious(name: string | null): void;
12
+ export declare function rollbackRuntimePreset(previous: string | null): void;