Skip to content

Commit be6bc00

Browse files
Maksym Diabincodemie-ai
andcommitted
refactor(agents): replace codemie-code LangGraph agent with OpenCode binary wrapper
- Replace built-in LangGraph agent with OpenCode binary execution - Add codemie-opencode plugin with binary management and lifecycle - Add SkillSync for synchronizing skills to agent plugins - Bump @codemieai/codemie-opencode to 0.0.41 - Add unit tests for OpenCode plugin system Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
1 parent 1349968 commit be6bc00

35 files changed

Lines changed: 4523 additions & 225 deletions

bin/codemie-opencode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import { AgentCLI } from '../dist/agents/core/AgentCLI.js';
33
import { AgentRegistry } from '../dist/agents/registry.js';
44

5-
const agent = AgentRegistry.getAgent('opencode');
5+
const agent = AgentRegistry.getAgent('codemie-opencode');
66
if (!agent) {
7-
console.error('OpenCode agent not found. Run: codemie doctor');
7+
console.error('CodeMie OpenCode agent not found. Run: codemie doctor');
88
process.exit(1);
99
}
1010
const cli = new AgentCLI(agent);

package-lock.json

Lines changed: 167 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
"ora": "^7.0.1",
129129
"strip-ansi": "^7.1.2",
130130
"yaml": "^2.3.4",
131+
"@codemieai/codemie-opencode": "0.0.41",
131132
"zod": "^4.1.12"
132133
},
133134
"devDependencies": {

src/agents/__tests__/registry.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ describe('AgentRegistry', () => {
1212
it('should register all default agents', () => {
1313
const agentNames = AgentRegistry.getAgentNames();
1414

15-
// Should have all 5 default agents (codemie-code, claude, claude-acp, gemini, opencode)
16-
expect(agentNames).toHaveLength(5);
15+
// Should have all 6 default agents (codemie-code, claude, claude-acp, gemini, opencode, codemie-opencode)
16+
expect(agentNames).toHaveLength(6);
1717
});
1818

1919
it('should register built-in agent', () => {
@@ -62,7 +62,7 @@ describe('AgentRegistry', () => {
6262
it('should return all registered agents', () => {
6363
const agents = AgentRegistry.getAllAgents();
6464

65-
expect(agents).toHaveLength(5);
65+
expect(agents).toHaveLength(6);
6666
expect(agents.every((agent) => agent.name)).toBe(true);
6767
});
6868

@@ -74,6 +74,7 @@ describe('AgentRegistry', () => {
7474
expect(names).toContain('claude-acp');
7575
expect(names).toContain('gemini');
7676
expect(names).toContain('opencode');
77+
expect(names).toContain('codemie-opencode');
7778
});
7879
});
7980

@@ -114,11 +115,11 @@ describe('AgentRegistry', () => {
114115
}
115116
});
116117

117-
it('should include built-in agent in installed agents', async () => {
118-
const installedAgents = await AgentRegistry.getInstalledAgents();
118+
it('should include built-in agent in all agents', () => {
119+
const allAgents = AgentRegistry.getAllAgents();
119120

120-
// Built-in agent should always be "installed"
121-
const builtInAgent = installedAgents.find(
121+
// Built-in agent should always be registered
122+
const builtInAgent = allAgents.find(
122123
(agent) => agent.name === BUILTIN_AGENT_NAME
123124
);
124125

src/agents/codemie-code/agent.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ import { logger } from '@/utils/logger.js';
2121
import { sanitizeCookies, sanitizeAuthToken } from '@/utils/security.js';
2222
import { HookExecutor } from '../../hooks/executor.js';
2323
import type { HookExecutionContext } from '../../hooks/types.js';
24-
import type { Skill } from '../../skills/index.js';
25-
import { extractSkillPatterns } from '../../skills/utils/pattern-matcher.js';
26-
import type { SkillPattern, SkillWithInventory } from '../../skills/core/types.js';
27-
import { SkillManager } from '../../skills/core/SkillManager.js';
24+
import type { Skill } from './skills/index.js';
25+
import { extractSkillPatterns } from './skills/utils/pattern-matcher.js';
26+
import type { SkillPattern, SkillWithInventory } from './skills/core/types.js';
27+
import { SkillManager } from './skills/core/SkillManager.js';
2828
import { parseAtMentionCommand } from './ui/mentions.js';
2929
import { loadRegisteredAssistants } from '@/utils/config.js';
3030

src/agents/codemie-code/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import { CodeMieAgentError } from './types.js';
1313
import { hasClipboardImage, getClipboardImage } from '../../utils/clipboard.js';
1414
import { logger } from '../../utils/logger.js';
1515
import { sanitizeCookies } from '../../utils/security.js';
16-
import { SkillManager } from '../../skills/index.js';
17-
import type { Skill } from '../../skills/index.js';
16+
import { SkillManager } from './skills/index.js';
17+
import type { Skill } from './skills/index.js';
1818

1919
export class CodeMieCode {
2020
private agent: CodeMieAgent | null = null;

src/agents/codemie-code/prompts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Contains the system prompt and instructions for the LangGraph ReAct agent
55
*/
66

7-
import type { Skill } from '../../skills/index.js';
7+
import type { Skill } from './skills/index.js';
88
import type { CodemieAssistant } from '@/env/types.js';
99

1010
export const SYSTEM_PROMPT = `You are CodeMie, an advanced AI coding assistant designed to help developers with various programming tasks.

0 commit comments

Comments
 (0)