coding-tool-x 3.7.0 → 3.7.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.
- package/README.md +5 -6
- package/dist/web/assets/{Analytics-Dma_j2Rq.js → Analytics-Dpje9L84.js} +1 -1
- package/dist/web/assets/{ConfigTemplates-C49Y1PLH.js → ConfigTemplates-Cz6kasek.js} +1 -1
- package/dist/web/assets/Home-BwTaYu3q.js +1 -0
- package/dist/web/assets/Home-Jom_ZcdY.css +1 -0
- package/dist/web/assets/{PluginManager-B1ECTHyY.js → PluginManager-DsN-xNXx.js} +1 -1
- package/dist/web/assets/ProjectList-4BCObimU.js +1 -0
- package/dist/web/assets/{ProjectList-B_L55-l9.css → ProjectList-D3a0oRum.css} +1 -1
- package/dist/web/assets/{SessionList-CH5GwwiJ.js → SessionList-D4c8FRzq.js} +1 -1
- package/dist/web/assets/{SkillManager-CRyVhjYQ.js → SkillManager-C-KYbXB5.js} +1 -1
- package/dist/web/assets/{WorkspaceManager-CO9tclVt.js → WorkspaceManager-B-BlPJHX.js} +1 -1
- package/dist/web/assets/index-Btfvh0GG.js +2 -0
- package/dist/web/assets/{index-CM26UrnJ.css → index-CLNa6DhH.css} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +2 -1
- package/src/commands/channels.js +8 -8
- package/src/commands/daemon.js +4 -4
- package/src/commands/doctor.js +1 -1
- package/src/commands/logs.js +1 -3
- package/src/commands/port-config.js +4 -4
- package/src/commands/proxy-control.js +13 -13
- package/src/commands/stats.js +6 -6
- package/src/commands/toggle-proxy.js +8 -8
- package/src/config/default.js +3 -3
- package/src/config/paths.js +46 -49
- package/src/index.js +4 -5
- package/src/server/api/commands.js +1 -1
- package/src/server/api/config-export.js +2 -2
- package/src/server/api/config-registry.js +1 -1
- package/src/server/api/config.js +1 -1
- package/src/server/api/dashboard.js +16 -16
- package/src/server/api/mcp.js +2 -2
- package/src/server/api/{pi-channels.js → omp-channels.js} +15 -15
- package/src/server/api/{pi-config.js → omp-config.js} +13 -13
- package/src/server/api/{pi-projects.js → omp-projects.js} +5 -5
- package/src/server/api/{pi-proxy.js → omp-proxy.js} +18 -18
- package/src/server/api/{pi-sessions.js → omp-sessions.js} +21 -21
- package/src/server/api/{pi-statistics.js → omp-statistics.js} +1 -1
- package/src/server/api/plugins.js +1 -1
- package/src/server/api/skills.js +1 -1
- package/src/server/api/workspaces.js +1 -1
- package/src/server/index.js +10 -10
- package/src/server/{pi-proxy-server.js → omp-proxy-server.js} +13 -13
- package/src/server/services/channel-balance.js +3 -3
- package/src/server/services/channel-scheduler.js +4 -4
- package/src/server/services/commands-service.js +5 -5
- package/src/server/services/config-export-service.js +53 -53
- package/src/server/services/config-registry-service.js +8 -8
- package/src/server/services/config-sync-manager.js +26 -26
- package/src/server/services/config-templates-service.js +28 -28
- package/src/server/services/mcp-service.js +20 -20
- package/src/server/services/notification-hooks.js +138 -6
- package/src/server/services/{pi-auth-providers.js → omp-auth-providers.js} +2 -2
- package/src/server/services/{pi-channels.js → omp-channels.js} +5 -5
- package/src/server/services/{pi-config.js → omp-config.js} +47 -65
- package/src/server/services/{pi-sessions.js → omp-sessions.js} +20 -20
- package/src/server/services/{pi-settings-manager.js → omp-settings-manager.js} +422 -18
- package/src/server/services/{pi-statistics-service.js → omp-statistics-service.js} +2 -2
- package/src/server/services/plugins-service.js +122 -122
- package/src/server/services/prompts-service.js +20 -20
- package/src/server/services/proxy-log-helper.js +1 -1
- package/src/server/services/proxy-runtime.js +1 -1
- package/src/server/services/skill-service.js +7 -7
- package/src/server/services/speed-test.js +29 -29
- package/src/server/services/ui-config.js +3 -3
- package/src/server/services/workspace-service.js +8 -8
- package/src/server/websocket-server.js +4 -4
- package/src/shared/platforms.js +201 -0
- package/dist/web/assets/Home-DGGC8H4g.js +0 -1
- package/dist/web/assets/Home-ewgeIhF7.css +0 -1
- package/dist/web/assets/ProjectList-DyiGyT-H.js +0 -1
- package/dist/web/assets/index-EQq56pRa.js +0 -2
package/src/index.js
CHANGED
|
@@ -67,9 +67,8 @@ function showHelp() {
|
|
|
67
67
|
console.log(' ctx codex start 启动 Codex 代理');
|
|
68
68
|
console.log(' ctx gemini start 启动 Gemini 代理');
|
|
69
69
|
console.log(' ctx opencode start 启动 OpenCode 代理');
|
|
70
|
-
console.log(' ctx
|
|
71
|
-
console.log('
|
|
72
|
-
console.log(chalk.gray(' (codex/gemini/opencode/pi/omp 命令与 claude 类似)\n'));
|
|
70
|
+
console.log(' ctx omp start 启用 OMP 受管模型配置');
|
|
71
|
+
console.log(chalk.gray(' (codex/gemini/opencode/omp 命令与 claude 类似)\n'));
|
|
73
72
|
|
|
74
73
|
console.log(chalk.yellow('[LOG] 日志管理:'));
|
|
75
74
|
console.log(' ctx logs 查看所有日志');
|
|
@@ -265,8 +264,8 @@ async function main() {
|
|
|
265
264
|
return;
|
|
266
265
|
}
|
|
267
266
|
|
|
268
|
-
// claude/codex/gemini/opencode/
|
|
269
|
-
const channels = ['claude', 'codex', 'gemini', 'opencode', '
|
|
267
|
+
// claude/codex/gemini/opencode/omp 代理管理命令
|
|
268
|
+
const channels = ['claude', 'codex', 'gemini', 'opencode', 'omp'];
|
|
270
269
|
const normalizedChannel = normalizePlatformKey(args[0]);
|
|
271
270
|
if (channels.includes(normalizedChannel)) {
|
|
272
271
|
const channel = String(args[0] || '').trim().toLowerCase();
|
|
@@ -9,7 +9,7 @@ const { CommandsService } = require('../services/commands-service');
|
|
|
9
9
|
const { sendApiError } = require('./validation-errors');
|
|
10
10
|
|
|
11
11
|
const router = express.Router();
|
|
12
|
-
const SUPPORTED_PLATFORMS = ['claude', 'codex', 'gemini', 'opencode', '
|
|
12
|
+
const SUPPORTED_PLATFORMS = ['claude', 'codex', 'gemini', 'opencode', 'omp'];
|
|
13
13
|
const commandServices = new Map();
|
|
14
14
|
|
|
15
15
|
function resolvePlatform(rawPlatform) {
|
|
@@ -26,7 +26,7 @@ function resolveChannelsByType(exportData) {
|
|
|
26
26
|
codex: Array.isArray(typed.codex) ? typed.codex : [],
|
|
27
27
|
gemini: Array.isArray(typed.gemini) ? typed.gemini : [],
|
|
28
28
|
opencode: Array.isArray(typed.opencode) ? typed.opencode : [],
|
|
29
|
-
|
|
29
|
+
omp: Array.isArray(typed.omp) ? typed.omp: []
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -46,7 +46,7 @@ function buildPreviewSummary(data) {
|
|
|
46
46
|
...channelsByType.codex.map(c => ({ ...c, type: c.type || 'codex' })),
|
|
47
47
|
...channelsByType.gemini.map(c => ({ ...c, type: c.type || 'gemini' })),
|
|
48
48
|
...channelsByType.opencode.map(c => ({ ...c, type: c.type || 'opencode' })),
|
|
49
|
-
...channelsByType.
|
|
49
|
+
...channelsByType.omp.map(c => ({ ...c, type: c.type || 'omp' }))
|
|
50
50
|
];
|
|
51
51
|
|
|
52
52
|
return {
|
|
@@ -48,7 +48,7 @@ const PLATFORM_SYNC_METHODS = {
|
|
|
48
48
|
codex: { sync: 'syncToCodex', remove: 'removeFromCodex' },
|
|
49
49
|
gemini: { sync: 'syncToGemini', remove: 'removeFromGemini' },
|
|
50
50
|
opencode: { sync: 'syncToOpenCode', remove: 'removeFromOpenCode' },
|
|
51
|
-
|
|
51
|
+
omp: { sync: 'syncToOmp', remove: 'removeFromOmp' }
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
function syncPlatform(type, name, platform) {
|
package/src/server/api/config.js
CHANGED
|
@@ -409,7 +409,7 @@ router.get('/advanced', (req, res) => {
|
|
|
409
409
|
codexProxy: config.ports?.codexProxy || 20089,
|
|
410
410
|
geminiProxy: config.ports?.geminiProxy || 20090,
|
|
411
411
|
opencodeProxy: config.ports?.opencodeProxy || 20091,
|
|
412
|
-
|
|
412
|
+
ompProxy: config.ports?.ompProxy || 20092
|
|
413
413
|
},
|
|
414
414
|
maxLogs: config.maxLogs || 100,
|
|
415
415
|
statsInterval: config.statsInterval || 30,
|
|
@@ -10,25 +10,25 @@ const { getProxyStatus } = require('../proxy-server');
|
|
|
10
10
|
const { getCodexProxyStatus } = require('../codex-proxy-server');
|
|
11
11
|
const { getGeminiProxyStatus } = require('../gemini-proxy-server');
|
|
12
12
|
const { getOpenCodeProxyStatus } = require('../opencode-proxy-server');
|
|
13
|
-
const {
|
|
13
|
+
const { getOmpProxyStatus } = require('../omp-proxy-server');
|
|
14
14
|
const { getProjectAndSessionCounts: getClaudeCounts } = require('../services/sessions');
|
|
15
15
|
const { getProjectAndSessionCounts: getCodexCounts } = require('../services/codex-sessions');
|
|
16
16
|
const { getProjectAndSessionCounts: getGeminiCounts } = require('../services/gemini-sessions');
|
|
17
17
|
const { getProjectAndSessionCounts: getOpenCodeCounts } = require('../services/opencode-sessions');
|
|
18
|
-
const { getProjectAndSessionCounts:
|
|
18
|
+
const { getProjectAndSessionCounts: getOmpCounts } = require('../services/omp-sessions');
|
|
19
19
|
|
|
20
20
|
// Channel-specific services
|
|
21
21
|
const { getChannels: getCodexChannels } = require('../services/codex-channels');
|
|
22
22
|
const { getChannels: getGeminiChannels } = require('../services/gemini-channels');
|
|
23
23
|
const { getChannels: getOpenCodeChannels } = require('../services/opencode-channels');
|
|
24
|
-
const { getChannels:
|
|
24
|
+
const { getChannels: getOmpChannels } = require('../services/omp-channels');
|
|
25
25
|
|
|
26
26
|
// Statistics
|
|
27
27
|
const { getTodayStatistics: getClaudeTodayStatistics } = require('../services/claude-statistics-service');
|
|
28
28
|
const { getTodayStatistics: getCodexTodayStatistics } = require('../services/codex-statistics-service');
|
|
29
29
|
const { getTodayStatistics: getGeminiTodayStatistics } = require('../services/gemini-statistics-service');
|
|
30
30
|
const { getTodayStatistics: getOpenCodeTodayStatistics } = require('../services/opencode-statistics-service');
|
|
31
|
-
const { getTodayStatistics:
|
|
31
|
+
const { getTodayStatistics: getOmpTodayStatistics } = require('../services/omp-statistics-service');
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* GET /api/dashboard/init
|
|
@@ -46,22 +46,22 @@ router.get('/init', async (req, res) => {
|
|
|
46
46
|
codexChannels,
|
|
47
47
|
geminiChannels,
|
|
48
48
|
opencodeChannels,
|
|
49
|
-
|
|
49
|
+
ompChannels,
|
|
50
50
|
claudeProxyStatus,
|
|
51
51
|
codexProxyStatus,
|
|
52
52
|
geminiProxyStatus,
|
|
53
53
|
opencodeProxyStatus,
|
|
54
|
-
|
|
54
|
+
ompProxyStatus,
|
|
55
55
|
claudeTodayStats,
|
|
56
56
|
codexTodayStats,
|
|
57
57
|
geminiTodayStats,
|
|
58
58
|
opencodeTodayStats,
|
|
59
|
-
|
|
59
|
+
ompTodayStats,
|
|
60
60
|
claudeCounts,
|
|
61
61
|
codexCounts,
|
|
62
62
|
geminiCounts,
|
|
63
63
|
opencodeCounts,
|
|
64
|
-
|
|
64
|
+
ompCounts
|
|
65
65
|
] = await Promise.all([
|
|
66
66
|
// UI Config
|
|
67
67
|
Promise.resolve(loadUIConfig()),
|
|
@@ -74,28 +74,28 @@ router.get('/init', async (req, res) => {
|
|
|
74
74
|
Promise.resolve(getCodexChannels()),
|
|
75
75
|
Promise.resolve(getGeminiChannels()),
|
|
76
76
|
Promise.resolve(getOpenCodeChannels()),
|
|
77
|
-
Promise.resolve(
|
|
77
|
+
Promise.resolve(getOmpChannels()),
|
|
78
78
|
|
|
79
79
|
// Proxy Status
|
|
80
80
|
Promise.resolve(getProxyStatus()),
|
|
81
81
|
Promise.resolve(getCodexProxyStatus()),
|
|
82
82
|
Promise.resolve(getGeminiProxyStatus()),
|
|
83
83
|
Promise.resolve(getOpenCodeProxyStatus()),
|
|
84
|
-
Promise.resolve(
|
|
84
|
+
Promise.resolve(getOmpProxyStatus()),
|
|
85
85
|
|
|
86
86
|
// Today Stats (所有平台)
|
|
87
87
|
Promise.resolve(getClaudeTodayStatistics()),
|
|
88
88
|
Promise.resolve(getCodexTodayStatistics()),
|
|
89
89
|
Promise.resolve(getGeminiTodayStatistics()),
|
|
90
90
|
Promise.resolve(getOpenCodeTodayStatistics()),
|
|
91
|
-
Promise.resolve(
|
|
91
|
+
Promise.resolve(getOmpTodayStatistics()),
|
|
92
92
|
|
|
93
93
|
// 轻量级统计
|
|
94
94
|
Promise.resolve(getClaudeCounts(config)),
|
|
95
95
|
Promise.resolve(getCodexCounts()),
|
|
96
96
|
Promise.resolve(getGeminiCounts()),
|
|
97
97
|
Promise.resolve(getOpenCodeCounts()),
|
|
98
|
-
Promise.resolve(
|
|
98
|
+
Promise.resolve(getOmpCounts())
|
|
99
99
|
]);
|
|
100
100
|
|
|
101
101
|
// 格式化统计数据:取 summary 和 byModel 中的数据
|
|
@@ -121,28 +121,28 @@ router.get('/init', async (req, res) => {
|
|
|
121
121
|
codex: codexChannels,
|
|
122
122
|
gemini: geminiChannels,
|
|
123
123
|
opencode: opencodeChannels.channels || [],
|
|
124
|
-
|
|
124
|
+
omp: ompChannels.channels || []
|
|
125
125
|
},
|
|
126
126
|
proxyStatus: {
|
|
127
127
|
claude: claudeProxyStatus,
|
|
128
128
|
codex: codexProxyStatus,
|
|
129
129
|
gemini: geminiProxyStatus,
|
|
130
130
|
opencode: opencodeProxyStatus,
|
|
131
|
-
|
|
131
|
+
omp: ompProxyStatus
|
|
132
132
|
},
|
|
133
133
|
counts: {
|
|
134
134
|
claude: claudeCounts || { projectCount: 0, sessionCount: 0 },
|
|
135
135
|
codex: codexCounts || { projectCount: 0, sessionCount: 0 },
|
|
136
136
|
gemini: geminiCounts || { projectCount: 0, sessionCount: 0 },
|
|
137
137
|
opencode: opencodeCounts || { projectCount: 0, sessionCount: 0 },
|
|
138
|
-
|
|
138
|
+
omp: ompCounts || { projectCount: 0, sessionCount: 0 }
|
|
139
139
|
},
|
|
140
140
|
todayStats: {
|
|
141
141
|
claude: formatStats(claudeTodayStats),
|
|
142
142
|
codex: formatStats(codexTodayStats),
|
|
143
143
|
gemini: formatStats(geminiTodayStats),
|
|
144
144
|
opencode: formatStats(opencodeTodayStats),
|
|
145
|
-
|
|
145
|
+
omp: formatStats(ompTodayStats)
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
});
|
package/src/server/api/mcp.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
const express = require('express');
|
|
6
6
|
const router = express.Router();
|
|
7
7
|
const mcpService = require('../services/mcp-service');
|
|
8
|
-
const MCP_PLATFORMS = ['claude', 'codex', 'gemini', 'opencode', '
|
|
9
|
-
const MCP_EXPORT_FORMATS = ['json', 'claude', 'codex', 'gemini', 'opencode', '
|
|
8
|
+
const MCP_PLATFORMS = ['claude', 'codex', 'gemini', 'opencode', 'omp'];
|
|
9
|
+
const MCP_EXPORT_FORMATS = ['json', 'claude', 'codex', 'gemini', 'opencode', 'omp'];
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* GET /api/mcp/servers
|
|
@@ -6,8 +6,8 @@ const {
|
|
|
6
6
|
updateChannel,
|
|
7
7
|
deleteChannel,
|
|
8
8
|
saveChannelOrder
|
|
9
|
-
} = require('../services/
|
|
10
|
-
const {
|
|
9
|
+
} = require('../services/omp-channels');
|
|
10
|
+
const { isOmpInstalled } = require('../services/omp-sessions');
|
|
11
11
|
const { getSchedulerState } = require('../services/channel-scheduler');
|
|
12
12
|
const { getChannelHealthStatus, resetChannelHealth } = require('../services/channel-health');
|
|
13
13
|
const { broadcastSchedulerState } = require('../websocket-server');
|
|
@@ -23,7 +23,7 @@ const {
|
|
|
23
23
|
const {
|
|
24
24
|
findAuthProviderForKey,
|
|
25
25
|
getOmpAuthProviderSnapshot
|
|
26
|
-
} = require('../services/
|
|
26
|
+
} = require('../services/omp-auth-providers');
|
|
27
27
|
|
|
28
28
|
function uniqueModels(models = []) {
|
|
29
29
|
const seen = new Set();
|
|
@@ -81,14 +81,14 @@ function attachAuthProvider(channel, snapshot) {
|
|
|
81
81
|
module.exports = () => {
|
|
82
82
|
router.get('/', (req, res) => {
|
|
83
83
|
try {
|
|
84
|
-
if (!
|
|
84
|
+
if (!isOmpInstalled()) {
|
|
85
85
|
return res.json({ channels: [], installed: false, error: 'OMP CLI not installed' });
|
|
86
86
|
}
|
|
87
87
|
const data = getChannels();
|
|
88
88
|
const authSnapshot = getOmpAuthProviderSnapshot({ accountCheck: false, includeStatus: false });
|
|
89
89
|
const channels = (data.channels || []).map(ch => ({
|
|
90
90
|
...attachAuthProvider(ch, authSnapshot),
|
|
91
|
-
health: getChannelHealthStatus(ch.id, '
|
|
91
|
+
health: getChannelHealthStatus(ch.id, 'omp')
|
|
92
92
|
}));
|
|
93
93
|
res.json({ channels, installed: true });
|
|
94
94
|
} catch (err) {
|
|
@@ -99,14 +99,14 @@ module.exports = () => {
|
|
|
99
99
|
|
|
100
100
|
router.get('/enabled', (req, res) => {
|
|
101
101
|
try {
|
|
102
|
-
if (!
|
|
102
|
+
if (!isOmpInstalled()) {
|
|
103
103
|
return res.json({ channels: [], installed: false, error: 'OMP CLI not installed' });
|
|
104
104
|
}
|
|
105
105
|
const data = getChannels();
|
|
106
106
|
const authSnapshot = getOmpAuthProviderSnapshot({ accountCheck: false, includeStatus: false });
|
|
107
107
|
const channels = (data.channels || [])
|
|
108
108
|
.filter(ch => ch.enabled !== false)
|
|
109
|
-
.map(ch => ({ ...attachAuthProvider(ch, authSnapshot), health: getChannelHealthStatus(ch.id, '
|
|
109
|
+
.map(ch => ({ ...attachAuthProvider(ch, authSnapshot), health: getChannelHealthStatus(ch.id, 'omp') }));
|
|
110
110
|
res.json({ channels, installed: true });
|
|
111
111
|
} catch (err) {
|
|
112
112
|
console.error('[OMP Channels API] Failed to get enabled channels:', err);
|
|
@@ -234,7 +234,7 @@ module.exports = () => {
|
|
|
234
234
|
balanceUserId: balanceUserId || null
|
|
235
235
|
});
|
|
236
236
|
res.json(channel);
|
|
237
|
-
broadcastSchedulerState('
|
|
237
|
+
broadcastSchedulerState('omp', getSchedulerState('omp'));
|
|
238
238
|
} catch (err) {
|
|
239
239
|
console.error('[OMP Channels API] Failed to create channel:', err);
|
|
240
240
|
res.status(500).json({ error: err.message });
|
|
@@ -245,7 +245,7 @@ module.exports = () => {
|
|
|
245
245
|
try {
|
|
246
246
|
const channel = updateChannel(req.params.channelId, req.body || {});
|
|
247
247
|
res.json(channel);
|
|
248
|
-
broadcastSchedulerState('
|
|
248
|
+
broadcastSchedulerState('omp', getSchedulerState('omp'));
|
|
249
249
|
} catch (err) {
|
|
250
250
|
console.error('[OMP Channels API] Failed to update channel:', err);
|
|
251
251
|
res.status(500).json({ error: err.message });
|
|
@@ -256,7 +256,7 @@ module.exports = () => {
|
|
|
256
256
|
try {
|
|
257
257
|
const result = await deleteChannel(req.params.channelId);
|
|
258
258
|
res.json(result);
|
|
259
|
-
broadcastSchedulerState('
|
|
259
|
+
broadcastSchedulerState('omp', getSchedulerState('omp'));
|
|
260
260
|
} catch (err) {
|
|
261
261
|
console.error('[OMP Channels API] Failed to delete channel:', err);
|
|
262
262
|
res.status(500).json({ error: err.message });
|
|
@@ -271,7 +271,7 @@ module.exports = () => {
|
|
|
271
271
|
}
|
|
272
272
|
saveChannelOrder(order);
|
|
273
273
|
res.json({ success: true });
|
|
274
|
-
broadcastSchedulerState('
|
|
274
|
+
broadcastSchedulerState('omp', getSchedulerState('omp'));
|
|
275
275
|
} catch (err) {
|
|
276
276
|
console.error('[OMP Channels API] Failed to save order:', err);
|
|
277
277
|
res.status(500).json({ error: err.message });
|
|
@@ -280,9 +280,9 @@ module.exports = () => {
|
|
|
280
280
|
|
|
281
281
|
router.post('/:channelId/reset-health', (req, res) => {
|
|
282
282
|
try {
|
|
283
|
-
resetChannelHealth(req.params.channelId, '
|
|
283
|
+
resetChannelHealth(req.params.channelId, 'omp');
|
|
284
284
|
res.json({ success: true });
|
|
285
|
-
broadcastSchedulerState('
|
|
285
|
+
broadcastSchedulerState('omp', getSchedulerState('omp'));
|
|
286
286
|
} catch (err) {
|
|
287
287
|
console.error('[OMP Channels API] Failed to reset health:', err);
|
|
288
288
|
res.status(500).json({ error: err.message });
|
|
@@ -296,7 +296,7 @@ module.exports = () => {
|
|
|
296
296
|
return res.status(404).json({ error: 'Channel not found' });
|
|
297
297
|
}
|
|
298
298
|
const result = await testChannelSpeed(channel, req.body?.timeout || 20000, resolveGatewaySourceType(channel), {
|
|
299
|
-
authSourceType: '
|
|
299
|
+
authSourceType: 'omp'
|
|
300
300
|
});
|
|
301
301
|
res.json(result);
|
|
302
302
|
} catch (error) {
|
|
@@ -314,7 +314,7 @@ module.exports = () => {
|
|
|
314
314
|
channels,
|
|
315
315
|
safeConcurrency,
|
|
316
316
|
channel => testChannelSpeed(channel, timeout, resolveGatewaySourceType(channel), {
|
|
317
|
-
authSourceType: '
|
|
317
|
+
authSourceType: 'omp'
|
|
318
318
|
})
|
|
319
319
|
);
|
|
320
320
|
results.sort((a, b) => {
|
|
@@ -3,15 +3,15 @@ const fs = require('fs');
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const router = express.Router();
|
|
5
5
|
const {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
getOmpPaths,
|
|
7
|
+
getOmpStatus,
|
|
8
8
|
readJsonFile,
|
|
9
9
|
readYamlFile,
|
|
10
|
-
|
|
11
|
-
} = require('../services/
|
|
10
|
+
readOmpSettings
|
|
11
|
+
} = require('../services/omp-config');
|
|
12
12
|
const {
|
|
13
13
|
getOmpAuthProviderSnapshot
|
|
14
|
-
} = require('../services/
|
|
14
|
+
} = require('../services/omp-auth-providers');
|
|
15
15
|
|
|
16
16
|
function listDirEntries(dirPath, options = {}) {
|
|
17
17
|
const { extensions = null, includeDirectories = true } = options;
|
|
@@ -46,7 +46,7 @@ function normalizeArray(value) {
|
|
|
46
46
|
|
|
47
47
|
function buildCapabilities() {
|
|
48
48
|
return {
|
|
49
|
-
platform: '
|
|
49
|
+
platform: 'omp',
|
|
50
50
|
runtime: 'omp',
|
|
51
51
|
native: {
|
|
52
52
|
config: true,
|
|
@@ -81,7 +81,7 @@ function buildCapabilities() {
|
|
|
81
81
|
agent: false
|
|
82
82
|
},
|
|
83
83
|
notes: [
|
|
84
|
-
'The
|
|
84
|
+
'The omp channel is backed by OMP and uses omp as its platform key.',
|
|
85
85
|
'Provider channels are enabled by merging managed ctx-* providers into OMP models.yml.'
|
|
86
86
|
]
|
|
87
87
|
};
|
|
@@ -89,8 +89,8 @@ function buildCapabilities() {
|
|
|
89
89
|
|
|
90
90
|
router.get('/', (req, res) => {
|
|
91
91
|
try {
|
|
92
|
-
const paths =
|
|
93
|
-
const settings =
|
|
92
|
+
const paths = getOmpPaths();
|
|
93
|
+
const settings = readOmpSettings();
|
|
94
94
|
const resources = {
|
|
95
95
|
config: readYamlFile(paths.config, {}),
|
|
96
96
|
settings: readYamlFile(paths.settings, {}),
|
|
@@ -110,7 +110,7 @@ router.get('/', (req, res) => {
|
|
|
110
110
|
|
|
111
111
|
res.json({
|
|
112
112
|
success: true,
|
|
113
|
-
status:
|
|
113
|
+
status: getOmpStatus(),
|
|
114
114
|
capabilities: buildCapabilities(),
|
|
115
115
|
resources
|
|
116
116
|
});
|
|
@@ -123,7 +123,7 @@ router.get('/', (req, res) => {
|
|
|
123
123
|
router.get('/capabilities', (req, res) => {
|
|
124
124
|
res.json({
|
|
125
125
|
success: true,
|
|
126
|
-
platform: '
|
|
126
|
+
platform: 'omp',
|
|
127
127
|
capabilities: buildCapabilities()
|
|
128
128
|
});
|
|
129
129
|
});
|
|
@@ -143,8 +143,8 @@ router.get('/auth-providers', (req, res) => {
|
|
|
143
143
|
|
|
144
144
|
router.get('/resources', (req, res) => {
|
|
145
145
|
try {
|
|
146
|
-
const paths =
|
|
147
|
-
const settings =
|
|
146
|
+
const paths = getOmpPaths();
|
|
147
|
+
const settings = readOmpSettings();
|
|
148
148
|
res.json({
|
|
149
149
|
success: true,
|
|
150
150
|
paths,
|
|
@@ -4,8 +4,8 @@ const {
|
|
|
4
4
|
getProjects,
|
|
5
5
|
saveProjectOrder,
|
|
6
6
|
deleteProject,
|
|
7
|
-
|
|
8
|
-
} = require('../services/
|
|
7
|
+
isOmpInstalled
|
|
8
|
+
} = require('../services/omp-sessions');
|
|
9
9
|
|
|
10
10
|
function isNotFoundError(error) {
|
|
11
11
|
return !!(error && error.message === 'Project not found');
|
|
@@ -14,7 +14,7 @@ function isNotFoundError(error) {
|
|
|
14
14
|
module.exports = () => {
|
|
15
15
|
router.get('/', (req, res) => {
|
|
16
16
|
try {
|
|
17
|
-
if (!
|
|
17
|
+
if (!isOmpInstalled()) {
|
|
18
18
|
return res.json({
|
|
19
19
|
projects: [],
|
|
20
20
|
currentProject: null,
|
|
@@ -41,7 +41,7 @@ module.exports = () => {
|
|
|
41
41
|
|
|
42
42
|
router.post('/order', (req, res) => {
|
|
43
43
|
try {
|
|
44
|
-
if (!
|
|
44
|
+
if (!isOmpInstalled()) {
|
|
45
45
|
return res.status(404).json({ error: 'OMP CLI not installed' });
|
|
46
46
|
}
|
|
47
47
|
const { order } = req.body || {};
|
|
@@ -58,7 +58,7 @@ module.exports = () => {
|
|
|
58
58
|
|
|
59
59
|
router.delete('/:projectName', (req, res) => {
|
|
60
60
|
try {
|
|
61
|
-
if (!
|
|
61
|
+
if (!isOmpInstalled()) {
|
|
62
62
|
return res.status(404).json({ error: 'OMP CLI not installed' });
|
|
63
63
|
}
|
|
64
64
|
const result = deleteProject(req.params.projectName);
|
|
@@ -3,15 +3,15 @@ const fs = require('fs');
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const router = express.Router();
|
|
5
5
|
const {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} = require('../
|
|
6
|
+
startOmpProxyServer,
|
|
7
|
+
stopOmpProxyServer,
|
|
8
|
+
getOmpProxyStatus
|
|
9
|
+
} = require('../omp-proxy-server');
|
|
10
10
|
const {
|
|
11
11
|
getChannels,
|
|
12
12
|
getEnabledChannels,
|
|
13
13
|
markChannelAsRecentlyUsed
|
|
14
|
-
} = require('../services/
|
|
14
|
+
} = require('../services/omp-channels');
|
|
15
15
|
const { getSchedulerState } = require('../services/channel-scheduler');
|
|
16
16
|
const { PATHS, ensureStorageDirMigrated } = require('../../config/paths');
|
|
17
17
|
|
|
@@ -37,7 +37,7 @@ function selectLatestEnabledChannel(channels) {
|
|
|
37
37
|
|
|
38
38
|
function saveActiveChannelId(channelId) {
|
|
39
39
|
ensureStorageDirMigrated();
|
|
40
|
-
const filePath = PATHS.activeChannel.
|
|
40
|
+
const filePath = PATHS.activeChannel.omp;
|
|
41
41
|
const dir = path.dirname(filePath);
|
|
42
42
|
if (!fs.existsSync(dir)) {
|
|
43
43
|
fs.mkdirSync(dir, { recursive: true });
|
|
@@ -48,8 +48,8 @@ function saveActiveChannelId(channelId) {
|
|
|
48
48
|
function loadActiveChannelId() {
|
|
49
49
|
ensureStorageDirMigrated();
|
|
50
50
|
try {
|
|
51
|
-
if (!fs.existsSync(PATHS.activeChannel.
|
|
52
|
-
const data = JSON.parse(fs.readFileSync(PATHS.activeChannel.
|
|
51
|
+
if (!fs.existsSync(PATHS.activeChannel.omp)) return null;
|
|
52
|
+
const data = JSON.parse(fs.readFileSync(PATHS.activeChannel.omp, 'utf8'));
|
|
53
53
|
return data.activeChannelId || null;
|
|
54
54
|
} catch {
|
|
55
55
|
return null;
|
|
@@ -58,8 +58,8 @@ function loadActiveChannelId() {
|
|
|
58
58
|
|
|
59
59
|
function removeActiveChannelFile() {
|
|
60
60
|
ensureStorageDirMigrated();
|
|
61
|
-
if (fs.existsSync(PATHS.activeChannel.
|
|
62
|
-
fs.unlinkSync(PATHS.activeChannel.
|
|
61
|
+
if (fs.existsSync(PATHS.activeChannel.omp)) {
|
|
62
|
+
fs.unlinkSync(PATHS.activeChannel.omp);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -77,7 +77,7 @@ function resolveActiveChannel(channels, activeChannelId = null) {
|
|
|
77
77
|
|
|
78
78
|
router.get('/status', (req, res) => {
|
|
79
79
|
try {
|
|
80
|
-
const proxy =
|
|
80
|
+
const proxy = getOmpProxyStatus();
|
|
81
81
|
const { channels } = getChannels();
|
|
82
82
|
const enabledChannels = channels.filter(ch => ch.enabled !== false);
|
|
83
83
|
const activeChannel = resolveActiveChannel(channels, loadActiveChannelId());
|
|
@@ -109,17 +109,17 @@ router.post('/start', async (req, res) => {
|
|
|
109
109
|
currentChannel = markChannelAsRecentlyUsed(currentChannel.id);
|
|
110
110
|
saveActiveChannelId(currentChannel.id);
|
|
111
111
|
|
|
112
|
-
const proxyResult = await
|
|
112
|
+
const proxyResult = await startOmpProxyServer();
|
|
113
113
|
if (!proxyResult.success) {
|
|
114
114
|
return res.status(500).json({ error: 'Failed to enable OMP models.yml provider config' });
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
const { broadcastProxyState, broadcastSchedulerState } = require('../websocket-server');
|
|
118
|
-
const updatedStatus =
|
|
118
|
+
const updatedStatus = getOmpProxyStatus();
|
|
119
119
|
const { channels: latestChannels } = getChannels();
|
|
120
120
|
const activeChannel = latestChannels.find(channel => channel.id === currentChannel.id) || currentChannel;
|
|
121
|
-
broadcastProxyState('
|
|
122
|
-
broadcastSchedulerState('
|
|
121
|
+
broadcastProxyState('omp', updatedStatus, activeChannel, latestChannels);
|
|
122
|
+
broadcastSchedulerState('omp', getSchedulerState('omp'));
|
|
123
123
|
|
|
124
124
|
res.json({
|
|
125
125
|
success: true,
|
|
@@ -138,12 +138,12 @@ router.post('/start', async (req, res) => {
|
|
|
138
138
|
|
|
139
139
|
router.post('/stop', async (req, res) => {
|
|
140
140
|
try {
|
|
141
|
-
const result = await
|
|
141
|
+
const result = await stopOmpProxyServer();
|
|
142
142
|
removeActiveChannelFile();
|
|
143
143
|
const { broadcastProxyState, broadcastSchedulerState } = require('../websocket-server');
|
|
144
144
|
const { channels } = getChannels();
|
|
145
|
-
broadcastProxyState('
|
|
146
|
-
broadcastSchedulerState('
|
|
145
|
+
broadcastProxyState('omp', getOmpProxyStatus(), null, channels);
|
|
146
|
+
broadcastSchedulerState('omp', getSchedulerState('omp'));
|
|
147
147
|
res.json({ success: true, ...result });
|
|
148
148
|
} catch (error) {
|
|
149
149
|
console.error('[OMP Proxy] Stop failed:', error);
|