@x-all-in-one/coding-helper 0.4.4 → 0.4.6
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.
|
@@ -27,34 +27,26 @@ export class OhMyOpenCodePlugin {
|
|
|
27
27
|
// 或者检查是否已在 opencode.json 的 plugin 数组中
|
|
28
28
|
return this.isLoaded();
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
31
|
-
* 安装 Oh My OpenCode
|
|
32
|
-
*/
|
|
33
30
|
async install() {
|
|
34
|
-
// 使用 bunInstaller 确保 Bun 已安装
|
|
35
31
|
const hasBun = await bunInstaller.ensureBun();
|
|
36
32
|
if (!hasBun) {
|
|
37
33
|
throw new Error('Bun is required for Oh My OpenCode. Please install bun first.');
|
|
38
34
|
}
|
|
39
35
|
const isWindows = process.platform === 'win32';
|
|
40
|
-
const
|
|
41
|
-
const args = ['oh-my-opencode', 'install', '--no-tui', '--claude=no', '--chatgpt=no', '--gemini=no'];
|
|
36
|
+
const bunxCommand = isWindows ? 'bunx.cmd' : 'bunx';
|
|
42
37
|
return new Promise((resolve, reject) => {
|
|
43
|
-
const
|
|
38
|
+
const args = ['oh-my-opencode@latest', 'install', '--no-tui', '--claude=no', '--openai=no', '--gemini=no', '--copilot=no'];
|
|
39
|
+
const child = spawn(bunxCommand, args, {
|
|
44
40
|
stdio: 'inherit',
|
|
45
41
|
shell: true,
|
|
46
42
|
});
|
|
47
43
|
child.on('close', (code) => {
|
|
48
|
-
if (code === 0)
|
|
44
|
+
if (code === 0)
|
|
49
45
|
resolve();
|
|
50
|
-
|
|
51
|
-
else {
|
|
46
|
+
else
|
|
52
47
|
reject(new Error(`Oh My OpenCode install failed with code ${code}`));
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
child.on('error', (error) => {
|
|
56
|
-
reject(error);
|
|
57
48
|
});
|
|
49
|
+
child.on('error', reject);
|
|
58
50
|
});
|
|
59
51
|
}
|
|
60
52
|
/**
|
|
@@ -7,6 +7,10 @@ export interface OhMyOpenCodeConfig {
|
|
|
7
7
|
model?: string;
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}>;
|
|
10
|
+
categories?: Record<string, {
|
|
11
|
+
model?: string;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}>;
|
|
10
14
|
[key: string]: any;
|
|
11
15
|
}
|
|
12
16
|
export declare const OPENCODE_DEFAULT_CONFIG: {
|
|
@@ -123,9 +127,11 @@ export declare class OpenCodeTool extends BaseTool {
|
|
|
123
127
|
* Save oh-my-opencode config
|
|
124
128
|
*/
|
|
125
129
|
saveOhMyOpenCodeConfig(config: OhMyOpenCodeConfig): void;
|
|
130
|
+
private updateOhMyOpenCodeAgents;
|
|
131
|
+
private updateOhMyOpenCodeCategories;
|
|
126
132
|
/**
|
|
127
|
-
* Update oh-my-opencode agent models
|
|
128
|
-
* Only updates the model field, preserves other
|
|
133
|
+
* Update oh-my-opencode agent and category models
|
|
134
|
+
* Only updates the model field, preserves other configurations
|
|
129
135
|
*/
|
|
130
136
|
updateOhMyOpenCodeModels(model: string): void;
|
|
131
137
|
/**
|
|
@@ -7,15 +7,27 @@ import { modelService } from '../model-service.js';
|
|
|
7
7
|
import { BaseTool } from './base-tool.js';
|
|
8
8
|
// X-AIO Provider ID
|
|
9
9
|
const XAIO_PROVIDER_ID = 'xaio';
|
|
10
|
-
// oh-my-opencode agent names
|
|
10
|
+
// oh-my-opencode agent names (latest version)
|
|
11
11
|
const OH_MY_OPENCODE_AGENTS = [
|
|
12
|
-
'
|
|
12
|
+
'sisyphus',
|
|
13
|
+
'oracle',
|
|
13
14
|
'librarian',
|
|
14
15
|
'explore',
|
|
15
|
-
'oracle',
|
|
16
|
-
'frontend-ui-ux-engineer',
|
|
17
|
-
'document-writer',
|
|
18
16
|
'multimodal-looker',
|
|
17
|
+
'prometheus',
|
|
18
|
+
'metis',
|
|
19
|
+
'momus',
|
|
20
|
+
'atlas',
|
|
21
|
+
];
|
|
22
|
+
// oh-my-opencode category names
|
|
23
|
+
const OH_MY_OPENCODE_CATEGORIES = [
|
|
24
|
+
'visual-engineering',
|
|
25
|
+
'ultrabrain',
|
|
26
|
+
'artistry',
|
|
27
|
+
'quick',
|
|
28
|
+
'unspecified-low',
|
|
29
|
+
'unspecified-high',
|
|
30
|
+
'writing',
|
|
19
31
|
];
|
|
20
32
|
// Unified output token limit for all models
|
|
21
33
|
const OUTPUT_TOKEN_LIMIT = 32000;
|
|
@@ -321,30 +333,41 @@ export class OpenCodeTool extends BaseTool {
|
|
|
321
333
|
throw new Error(`Failed to save oh-my-opencode config: ${error}`);
|
|
322
334
|
}
|
|
323
335
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
*/
|
|
328
|
-
updateOhMyOpenCodeModels(model) {
|
|
329
|
-
const prefixedModel = `${XAIO_PROVIDER_ID}/${model}`;
|
|
330
|
-
// Read existing config or create new one
|
|
331
|
-
const currentConfig = this.getOhMyOpenCodeConfig();
|
|
332
|
-
// Initialize agents if not exists
|
|
333
|
-
if (!currentConfig.agents) {
|
|
334
|
-
currentConfig.agents = {};
|
|
336
|
+
updateOhMyOpenCodeAgents(config, model) {
|
|
337
|
+
if (!config.agents) {
|
|
338
|
+
config.agents = {};
|
|
335
339
|
}
|
|
336
|
-
// Update each agent's model, preserving other settings
|
|
337
340
|
for (const agentName of OH_MY_OPENCODE_AGENTS) {
|
|
338
|
-
if (
|
|
339
|
-
|
|
340
|
-
|
|
341
|
+
if (config.agents[agentName]) {
|
|
342
|
+
config.agents[agentName].model = model;
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
config.agents[agentName] = { model };
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
updateOhMyOpenCodeCategories(config, model) {
|
|
350
|
+
if (!config.categories) {
|
|
351
|
+
config.categories = {};
|
|
352
|
+
}
|
|
353
|
+
for (const categoryName of OH_MY_OPENCODE_CATEGORIES) {
|
|
354
|
+
if (config.categories[categoryName]) {
|
|
355
|
+
config.categories[categoryName].model = model;
|
|
341
356
|
}
|
|
342
357
|
else {
|
|
343
|
-
|
|
344
|
-
currentConfig.agents[agentName] = { model: prefixedModel };
|
|
358
|
+
config.categories[categoryName] = { model };
|
|
345
359
|
}
|
|
346
360
|
}
|
|
347
|
-
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Update oh-my-opencode agent and category models
|
|
364
|
+
* Only updates the model field, preserves other configurations
|
|
365
|
+
*/
|
|
366
|
+
updateOhMyOpenCodeModels(model) {
|
|
367
|
+
const prefixedModel = `${XAIO_PROVIDER_ID}/${model}`;
|
|
368
|
+
const currentConfig = this.getOhMyOpenCodeConfig();
|
|
369
|
+
this.updateOhMyOpenCodeAgents(currentConfig, prefixedModel);
|
|
370
|
+
this.updateOhMyOpenCodeCategories(currentConfig, prefixedModel);
|
|
348
371
|
if (!currentConfig.$schema) {
|
|
349
372
|
currentConfig.$schema = 'https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json';
|
|
350
373
|
}
|
|
@@ -3,6 +3,7 @@ import inquirer from 'inquirer';
|
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
import { i18n } from '../../i18n.js';
|
|
5
5
|
import { modelService } from '../../model-service.js';
|
|
6
|
+
import { openCodeTool } from '../../tools/opencode-tool.js';
|
|
6
7
|
import { promptHelper } from '../ui/prompt-helper.js';
|
|
7
8
|
import { uiRenderer } from '../ui/ui-renderer.js';
|
|
8
9
|
/**
|
|
@@ -115,6 +116,10 @@ export class PluginMenu {
|
|
|
115
116
|
}).start();
|
|
116
117
|
const result = await modelService.refreshAndSyncToOpenCode();
|
|
117
118
|
if (result.success) {
|
|
119
|
+
const modelConfig = openCodeTool.getModelConfig();
|
|
120
|
+
if (modelConfig?.model) {
|
|
121
|
+
openCodeTool.updateOhMyOpenCodeModels(modelConfig.model);
|
|
122
|
+
}
|
|
118
123
|
spinner.succeed(chalk.green(i18n.t('wizard.models_refreshed', { count: String(result.count) })));
|
|
119
124
|
}
|
|
120
125
|
else {
|