ccjk 13.6.4 → 13.6.7
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/dist/chunks/agents.mjs +1 -1
- package/dist/chunks/api-config-selector.mjs +6 -4
- package/dist/chunks/auto-updater.mjs +100 -2
- package/dist/chunks/banner.mjs +0 -16
- package/dist/chunks/ccjk-mcp.mjs +2 -2
- package/dist/chunks/ccr.mjs +6 -4
- package/dist/chunks/check-updates.mjs +28 -17
- package/dist/chunks/claude-code-config-manager.mjs +3 -1
- package/dist/chunks/claude-code-incremental-manager.mjs +46 -20
- package/dist/chunks/claude-config.mjs +52 -2
- package/dist/chunks/claude-wrapper.mjs +1 -1
- package/dist/chunks/cli-hook.mjs +25 -83
- package/dist/chunks/codex-config-switch.mjs +3 -2
- package/dist/chunks/codex-provider-manager.mjs +1 -0
- package/dist/chunks/codex.mjs +3 -359
- package/dist/chunks/config-switch.mjs +23 -10
- package/dist/chunks/config.mjs +1 -1
- package/dist/chunks/config2.mjs +3 -3
- package/dist/chunks/constants.mjs +179 -3
- package/dist/chunks/doctor.mjs +1 -1
- package/dist/chunks/features.mjs +76 -11
- package/dist/chunks/index10.mjs +55 -36
- package/dist/chunks/init.mjs +120 -61
- package/dist/chunks/installer.mjs +80 -19
- package/dist/chunks/mcp-cli.mjs +17 -16
- package/dist/chunks/mcp.mjs +8 -7
- package/dist/chunks/memory-check.mjs +1 -1
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/platform.mjs +5 -1
- package/dist/chunks/quick-setup.mjs +13 -11
- package/dist/chunks/research.mjs +1177 -0
- package/dist/chunks/sessions.mjs +1 -1
- package/dist/chunks/smart-defaults.mjs +42 -14
- package/dist/chunks/uninstall.mjs +2 -2
- package/dist/chunks/update.mjs +14 -13
- package/dist/chunks/version-checker.mjs +11 -1
- package/dist/cli.mjs +32 -0
- package/dist/i18n/locales/en/cli.json +0 -4
- package/dist/i18n/locales/en/menu.json +3 -3
- package/dist/i18n/locales/en/notification.json +2 -2
- package/dist/i18n/locales/zh-CN/cli.json +0 -4
- package/dist/i18n/locales/zh-CN/menu.json +3 -3
- package/dist/i18n/locales/zh-CN/notification.json +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +8 -174
- package/dist/shared/{ccjk.DvAP4XfP.mjs → ccjk.B4aXNclK.mjs} +2 -2
- package/dist/shared/ccjk.BI-hdI7P.mjs +30 -0
- package/dist/shared/{ccjk.DwSebGy0.mjs → ccjk.BOO14f66.mjs} +1 -1
- package/dist/shared/ccjk.BnsY5WxD.mjs +171 -0
- package/dist/shared/{ccjk.C4m4ypdk.mjs → ccjk.DHaUdzX3.mjs} +4 -3
- package/dist/shared/ccjk.DKXs7Fbm.mjs +361 -0
- package/dist/shared/{ccjk.BP5hsTZQ.mjs → ccjk.Dz0ssUQx.mjs} +1 -1
- package/dist/shared/ccjk.yYQMbHH3.mjs +115 -0
- package/package.json +70 -65
- package/templates/common/workflow/essential/en/feat.md +68 -291
- package/templates/common/workflow/sixStep/en/workflow.md +56 -330
- package/dist/shared/ccjk.CiKtBUW_.mjs +0 -54
package/dist/chunks/cli-hook.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
+
import { DEFAULT_CODE_TOOL_TYPE, isCodeToolType, getCodeToolNativeSlashCommands } from './constants.mjs';
|
|
3
|
+
import { readZcfConfig } from './ccjk-config.mjs';
|
|
2
4
|
import { a as getGlobalStateManager, g as getGlobalConvoyManager, c as contextLoader, S as SessionIntelligence } from './session-manager.mjs';
|
|
3
5
|
import { l as logger } from '../shared/ccjk.8oaxX4iR.mjs';
|
|
4
6
|
import { h as hookRegistry } from '../shared/ccjk.KPLeMP-o.mjs';
|
|
@@ -9,6 +11,15 @@ import { d as dirname, j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
|
9
11
|
import { n as nanoid } from '../shared/ccjk.BoApaI4j.mjs';
|
|
10
12
|
import process__default from 'node:process';
|
|
11
13
|
import 'node:os';
|
|
14
|
+
import './index2.mjs';
|
|
15
|
+
import 'node:url';
|
|
16
|
+
import '../shared/ccjk.BBtCGd_g.mjs';
|
|
17
|
+
import './index3.mjs';
|
|
18
|
+
import './fs-operations.mjs';
|
|
19
|
+
import 'node:fs/promises';
|
|
20
|
+
import './json-config.mjs';
|
|
21
|
+
import '../shared/ccjk.RyizuzOI.mjs';
|
|
22
|
+
import '../shared/ccjk.BAGoDD49.mjs';
|
|
12
23
|
import './main.mjs';
|
|
13
24
|
import 'module';
|
|
14
25
|
import 'node:child_process';
|
|
@@ -18,9 +29,7 @@ import 'node:readline';
|
|
|
18
29
|
import 'tinyglobby';
|
|
19
30
|
import '../shared/ccjk.DlTXS9rP.mjs';
|
|
20
31
|
import './index5.mjs';
|
|
21
|
-
import '../shared/ccjk.BAGoDD49.mjs';
|
|
22
32
|
import '../shared/ccjk.wLJHO0Af.mjs';
|
|
23
|
-
import 'node:fs/promises';
|
|
24
33
|
|
|
25
34
|
async function emitCommandHookEvent(event, data, sessionId) {
|
|
26
35
|
try {
|
|
@@ -2793,7 +2802,7 @@ class AutoExecutor extends EventEmitter {
|
|
|
2793
2802
|
};
|
|
2794
2803
|
}
|
|
2795
2804
|
/**
|
|
2796
|
-
* Execute user request
|
|
2805
|
+
* Execute a user request after a router has selected this executor.
|
|
2797
2806
|
*/
|
|
2798
2807
|
async execute(userInput) {
|
|
2799
2808
|
const executionId = `exec-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -3540,80 +3549,13 @@ class CliInterceptor extends EventEmitter {
|
|
|
3540
3549
|
autoSelectMcp: true,
|
|
3541
3550
|
verbose: false
|
|
3542
3551
|
});
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
"/quit",
|
|
3551
|
-
"/resume",
|
|
3552
|
-
// Context Management
|
|
3553
|
-
"/compact",
|
|
3554
|
-
"/context",
|
|
3555
|
-
"/status",
|
|
3556
|
-
// Mode Control
|
|
3557
|
-
"/plan",
|
|
3558
|
-
"/execute",
|
|
3559
|
-
// History
|
|
3560
|
-
"/rewind",
|
|
3561
|
-
// Diagnostic
|
|
3562
|
-
"/mcp",
|
|
3563
|
-
"/doctor",
|
|
3564
|
-
// Configuration
|
|
3565
|
-
"/settings",
|
|
3566
|
-
"/config",
|
|
3567
|
-
"/version",
|
|
3568
|
-
// Extension System
|
|
3569
|
-
"/agents",
|
|
3570
|
-
"/skills",
|
|
3571
|
-
"/commands",
|
|
3572
|
-
// Plugin/Marketplace - CCJK 接管,不在此列表
|
|
3573
|
-
// '/plugin',
|
|
3574
|
-
// '/plugins',
|
|
3575
|
-
// Tasks
|
|
3576
|
-
"/tasks",
|
|
3577
|
-
// Memory
|
|
3578
|
-
"/memory",
|
|
3579
|
-
"/memories",
|
|
3580
|
-
// Model
|
|
3581
|
-
"/model",
|
|
3582
|
-
// Cost
|
|
3583
|
-
"/cost",
|
|
3584
|
-
// Permissions
|
|
3585
|
-
"/permissions",
|
|
3586
|
-
// Hooks
|
|
3587
|
-
"/hooks",
|
|
3588
|
-
// Init
|
|
3589
|
-
"/init",
|
|
3590
|
-
// Login/Logout
|
|
3591
|
-
"/login",
|
|
3592
|
-
"/logout",
|
|
3593
|
-
// Bug report
|
|
3594
|
-
"/bug",
|
|
3595
|
-
// Terminal
|
|
3596
|
-
"/terminal",
|
|
3597
|
-
// IDE
|
|
3598
|
-
"/ide",
|
|
3599
|
-
// Review
|
|
3600
|
-
"/review",
|
|
3601
|
-
// PR
|
|
3602
|
-
"/pr",
|
|
3603
|
-
// Vim mode
|
|
3604
|
-
"/vim",
|
|
3605
|
-
// Listen mode
|
|
3606
|
-
"/listen",
|
|
3607
|
-
// Add files
|
|
3608
|
-
"/add",
|
|
3609
|
-
// Install
|
|
3610
|
-
"/install",
|
|
3611
|
-
// Allowed tools
|
|
3612
|
-
"/allowed-tools",
|
|
3613
|
-
// Thinking
|
|
3614
|
-
"/think",
|
|
3615
|
-
"/thinking"
|
|
3616
|
-
];
|
|
3552
|
+
getActiveCodeTool() {
|
|
3553
|
+
const codeToolType = readZcfConfig()?.codeToolType;
|
|
3554
|
+
return isCodeToolType(codeToolType) ? codeToolType : DEFAULT_CODE_TOOL_TYPE;
|
|
3555
|
+
}
|
|
3556
|
+
getSystemCommands() {
|
|
3557
|
+
return getCodeToolNativeSlashCommands(this.getActiveCodeTool());
|
|
3558
|
+
}
|
|
3617
3559
|
// Simple queries that don't need interception
|
|
3618
3560
|
simpleQueryPatterns = [
|
|
3619
3561
|
/^what is/i,
|
|
@@ -3636,7 +3578,7 @@ class CliInterceptor extends EventEmitter {
|
|
|
3636
3578
|
};
|
|
3637
3579
|
}
|
|
3638
3580
|
/**
|
|
3639
|
-
* Intercept user input
|
|
3581
|
+
* Intercept user input when this component is explicitly integrated.
|
|
3640
3582
|
*/
|
|
3641
3583
|
async intercept(userInput) {
|
|
3642
3584
|
if (!this.config.enabled) {
|
|
@@ -3679,13 +3621,14 @@ class CliInterceptor extends EventEmitter {
|
|
|
3679
3621
|
*/
|
|
3680
3622
|
shouldBypass(input) {
|
|
3681
3623
|
const normalized = input.trim().toLowerCase();
|
|
3624
|
+
const systemCommands = this.getSystemCommands();
|
|
3682
3625
|
if (normalized.startsWith("/")) {
|
|
3683
3626
|
const isCcjkOwned = this.config.ccjkOwnedSlashPrefixes.some((prefix) => normalized.startsWith(prefix));
|
|
3684
|
-
if (!isCcjkOwned) {
|
|
3627
|
+
if (!isCcjkOwned && systemCommands.some((cmd) => normalized.startsWith(cmd))) {
|
|
3685
3628
|
return { bypass: true, reason: "Native slash command passthrough" };
|
|
3686
3629
|
}
|
|
3687
3630
|
}
|
|
3688
|
-
if (
|
|
3631
|
+
if (systemCommands.some((cmd) => normalized.startsWith(cmd))) {
|
|
3689
3632
|
return { bypass: true, reason: "System command" };
|
|
3690
3633
|
}
|
|
3691
3634
|
if (this.config.bypassKeywords.some((kw) => normalized.includes(kw.toLowerCase()))) {
|
|
@@ -3703,9 +3646,8 @@ class CliInterceptor extends EventEmitter {
|
|
|
3703
3646
|
* Show intent message to user
|
|
3704
3647
|
*/
|
|
3705
3648
|
showIntentMessage(_input) {
|
|
3706
|
-
console.log("\n\u{1F9E0}
|
|
3707
|
-
console.log("
|
|
3708
|
-
console.log(" Smart mode: ambiguity checks + capability-ranked tool selection + telemetry\n");
|
|
3649
|
+
console.log("\n\u{1F9E0} Brain router is handling this request...");
|
|
3650
|
+
console.log(" It may use skills, agents, and MCP tools based on the active routing config.\n");
|
|
3709
3651
|
}
|
|
3710
3652
|
async handleBypassedCommand(input, reason) {
|
|
3711
3653
|
const normalized = input.trim().toLowerCase();
|
|
@@ -45,6 +45,7 @@ import './platform.mjs';
|
|
|
45
45
|
import '../shared/ccjk.DScm_NnL.mjs';
|
|
46
46
|
import './prompts.mjs';
|
|
47
47
|
import '../shared/ccjk.gDEDGD_t.mjs';
|
|
48
|
+
import '../shared/ccjk.DKXs7Fbm.mjs';
|
|
48
49
|
|
|
49
50
|
async function configureIncrementalManagement() {
|
|
50
51
|
ensureI18nInitialized();
|
|
@@ -193,7 +194,7 @@ async function handleAddProvider() {
|
|
|
193
194
|
defaultValue: true
|
|
194
195
|
});
|
|
195
196
|
if (setAsDefault) {
|
|
196
|
-
const { switchToProvider } = await import('./codex.mjs').then(function (n) { return n.
|
|
197
|
+
const { switchToProvider } = await import('./codex.mjs').then(function (n) { return n.q; });
|
|
197
198
|
const switched = await switchToProvider(provider.id);
|
|
198
199
|
if (switched) {
|
|
199
200
|
console.log(a.green(i18n.t("multi-config:profileSetAsDefault", { name: provider.name })));
|
|
@@ -388,7 +389,7 @@ ${i18n.t("codex:copyingProvider", { name: provider.name })}`));
|
|
|
388
389
|
defaultValue: false
|
|
389
390
|
});
|
|
390
391
|
if (setAsDefault) {
|
|
391
|
-
const { switchToProvider } = await import('./codex.mjs').then(function (n) { return n.
|
|
392
|
+
const { switchToProvider } = await import('./codex.mjs').then(function (n) { return n.q; });
|
|
392
393
|
const switched = await switchToProvider(copiedProvider.id);
|
|
393
394
|
if (switched) {
|
|
394
395
|
console.log(a.green(i18n.t("multi-config:profileSetAsDefault", { name: copiedProvider.name })));
|
|
@@ -44,6 +44,7 @@ import '../shared/ccjk.BFQ7yr5S.mjs';
|
|
|
44
44
|
import './prompts.mjs';
|
|
45
45
|
import '../shared/ccjk.gDEDGD_t.mjs';
|
|
46
46
|
import '../shared/ccjk.DZ2LLOa-.mjs';
|
|
47
|
+
import '../shared/ccjk.DKXs7Fbm.mjs';
|
|
47
48
|
|
|
48
49
|
async function addProviderToExisting(provider, apiKey, allowOverwrite = false) {
|
|
49
50
|
ensureI18nInitialized();
|
package/dist/chunks/codex.mjs
CHANGED
|
@@ -14,11 +14,11 @@ import { updateZcfConfig, readZcfConfig, readDefaultTomlConfig, updateTomlConfig
|
|
|
14
14
|
import { h as applyAiLanguageDirective } from './config.mjs';
|
|
15
15
|
import { exists, readFile, ensureDir, writeFileAtomic, writeFile, copyDir, copyFile } from './fs-operations.mjs';
|
|
16
16
|
import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
|
|
17
|
-
import {
|
|
17
|
+
import { i as isWindows, l as getMcpCommand, m as getSystemRoot, w as wrapCommandWithSudo, n as normalizeTomlPath } from './platform.mjs';
|
|
18
18
|
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
19
19
|
import { resolveAiOutputLanguage } from './prompts.mjs';
|
|
20
20
|
import { p as promptBoolean } from '../shared/ccjk.DZ2LLOa-.mjs';
|
|
21
|
-
import {
|
|
21
|
+
import { M as MCP_SERVICE_CONFIGS, i as isMcpServiceCompatible, g as getMcpServices, b as getMcpServicesWithCompatibility } from '../shared/ccjk.DKXs7Fbm.mjs';
|
|
22
22
|
import { j as join, d as dirname } from '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
23
23
|
|
|
24
24
|
function detectConfigManagementMode() {
|
|
@@ -49,362 +49,6 @@ function detectConfigManagementMode() {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const MCP_SERVICE_CONFIGS = [
|
|
53
|
-
// Documentation and research services
|
|
54
|
-
{
|
|
55
|
-
id: "context7",
|
|
56
|
-
requiresApiKey: false,
|
|
57
|
-
defaultSelected: true,
|
|
58
|
-
config: {
|
|
59
|
-
type: "stdio",
|
|
60
|
-
command: "npx",
|
|
61
|
-
args: ["-y", "@upstash/context7-mcp@latest"],
|
|
62
|
-
env: {}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: "open-websearch",
|
|
67
|
-
requiresApiKey: false,
|
|
68
|
-
config: {
|
|
69
|
-
type: "stdio",
|
|
70
|
-
command: "npx",
|
|
71
|
-
args: ["-y", "open-websearch@latest"],
|
|
72
|
-
env: {
|
|
73
|
-
MODE: "stdio",
|
|
74
|
-
DEFAULT_SEARCH_ENGINE: "duckduckgo",
|
|
75
|
-
ALLOWED_SEARCH_ENGINES: "duckduckgo,bing,brave"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
id: "mcp-deepwiki",
|
|
81
|
-
requiresApiKey: false,
|
|
82
|
-
config: {
|
|
83
|
-
type: "stdio",
|
|
84
|
-
command: "npx",
|
|
85
|
-
args: ["-y", "mcp-deepwiki@latest"],
|
|
86
|
-
env: {}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: "spec-workflow",
|
|
91
|
-
requiresApiKey: false,
|
|
92
|
-
config: {
|
|
93
|
-
type: "stdio",
|
|
94
|
-
command: "npx",
|
|
95
|
-
args: ["-y", "@pimzino/spec-workflow-mcp@latest"],
|
|
96
|
-
env: {}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
id: "serena",
|
|
101
|
-
requiresApiKey: false,
|
|
102
|
-
config: {
|
|
103
|
-
type: "stdio",
|
|
104
|
-
command: "uvx",
|
|
105
|
-
args: ["--from", "git+https://github.com/oraios/serena", "serena", "start-mcp-server", "--context", "ide-assistant", "--enable-web-dashboard", "false"],
|
|
106
|
-
env: {}
|
|
107
|
-
},
|
|
108
|
-
platformRequirements: {
|
|
109
|
-
requiredCommands: ["uvx"]
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
id: "Playwright",
|
|
114
|
-
requiresApiKey: false,
|
|
115
|
-
config: {
|
|
116
|
-
type: "stdio",
|
|
117
|
-
command: "npx",
|
|
118
|
-
args: ["-y", "@playwright/mcp@latest", "--browser", "chromium"],
|
|
119
|
-
env: {}
|
|
120
|
-
},
|
|
121
|
-
platformRequirements: {
|
|
122
|
-
platforms: ["macos", "windows"],
|
|
123
|
-
requiresGui: true
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
id: "intent-engine",
|
|
128
|
-
requiresApiKey: false,
|
|
129
|
-
config: {
|
|
130
|
-
type: "stdio",
|
|
131
|
-
command: "npx",
|
|
132
|
-
args: ["-y", "@origintask/intent-engine@latest", "mcp"],
|
|
133
|
-
env: {}
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
id: "sqlite",
|
|
138
|
-
requiresApiKey: false,
|
|
139
|
-
config: {
|
|
140
|
-
type: "stdio",
|
|
141
|
-
command: "npx",
|
|
142
|
-
args: ["-y", "@anthropic-ai/mcp-server-sqlite@latest"],
|
|
143
|
-
env: {}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
];
|
|
147
|
-
async function getMcpServices() {
|
|
148
|
-
ensureI18nInitialized();
|
|
149
|
-
const mcpServiceList = [
|
|
150
|
-
{
|
|
151
|
-
id: "context7",
|
|
152
|
-
name: i18n.t("mcp:services.context7.name"),
|
|
153
|
-
description: i18n.t("mcp:services.context7.description")
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
id: "open-websearch",
|
|
157
|
-
name: i18n.t("mcp:services.open-websearch.name"),
|
|
158
|
-
description: i18n.t("mcp:services.open-websearch.description")
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
id: "mcp-deepwiki",
|
|
162
|
-
name: i18n.t("mcp:services.mcp-deepwiki.name"),
|
|
163
|
-
description: i18n.t("mcp:services.mcp-deepwiki.description")
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
id: "spec-workflow",
|
|
167
|
-
name: i18n.t("mcp:services.spec-workflow.name"),
|
|
168
|
-
description: i18n.t("mcp:services.spec-workflow.description")
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
id: "serena",
|
|
172
|
-
name: i18n.t("mcp:services.serena.name"),
|
|
173
|
-
description: i18n.t("mcp:services.serena.description")
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
id: "Playwright",
|
|
177
|
-
name: i18n.t("mcp:services.Playwright.name"),
|
|
178
|
-
description: i18n.t("mcp:services.Playwright.description")
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
id: "intent-engine",
|
|
182
|
-
name: i18n.t("mcp:services.intent-engine.name"),
|
|
183
|
-
description: i18n.t("mcp:services.intent-engine.description")
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
id: "sqlite",
|
|
187
|
-
name: i18n.t("mcp:services.sqlite.name"),
|
|
188
|
-
description: i18n.t("mcp:services.sqlite.description")
|
|
189
|
-
}
|
|
190
|
-
];
|
|
191
|
-
return MCP_SERVICE_CONFIGS.map((config) => {
|
|
192
|
-
const serviceInfo = mcpServiceList.find((s) => s.id === config.id);
|
|
193
|
-
const service = {
|
|
194
|
-
id: config.id,
|
|
195
|
-
name: serviceInfo?.name || config.id,
|
|
196
|
-
description: serviceInfo?.description || "",
|
|
197
|
-
requiresApiKey: config.requiresApiKey,
|
|
198
|
-
config: config.config
|
|
199
|
-
};
|
|
200
|
-
if (config.apiKeyEnvVar) {
|
|
201
|
-
service.apiKeyEnvVar = config.apiKeyEnvVar;
|
|
202
|
-
}
|
|
203
|
-
return service;
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
async function getMcpService(id) {
|
|
207
|
-
const services = await getMcpServices();
|
|
208
|
-
return services.find((service) => service.id === id);
|
|
209
|
-
}
|
|
210
|
-
function detectPlatform() {
|
|
211
|
-
const platform = process__default.platform;
|
|
212
|
-
const env = process__default.env;
|
|
213
|
-
const isWsl = !!(env.WSL_DISTRO_NAME || env.WSLENV || env.PATH && env.PATH.includes("/mnt/c/"));
|
|
214
|
-
const isTermux = !!(env.TERMUX_VERSION || env.PREFIX?.includes("com.termux"));
|
|
215
|
-
const isHeadless = !!(env.SSH_CLIENT || env.SSH_TTY || env.SSH_CONNECTION || !env.DISPLAY && platform === "linux");
|
|
216
|
-
const hasGui = (() => {
|
|
217
|
-
if (platform === "darwin")
|
|
218
|
-
return true;
|
|
219
|
-
if (platform === "win32")
|
|
220
|
-
return !isHeadless;
|
|
221
|
-
if (isWsl || isTermux)
|
|
222
|
-
return false;
|
|
223
|
-
if (platform === "linux")
|
|
224
|
-
return !!env.DISPLAY || !!env.WAYLAND_DISPLAY;
|
|
225
|
-
return false;
|
|
226
|
-
})();
|
|
227
|
-
let detectedPlatform;
|
|
228
|
-
if (platform === "darwin") {
|
|
229
|
-
detectedPlatform = "macos";
|
|
230
|
-
} else if (platform === "win32") {
|
|
231
|
-
detectedPlatform = "windows";
|
|
232
|
-
} else if (isWsl) {
|
|
233
|
-
detectedPlatform = "wsl";
|
|
234
|
-
} else if (isTermux) {
|
|
235
|
-
detectedPlatform = "termux";
|
|
236
|
-
} else if (platform === "linux") {
|
|
237
|
-
detectedPlatform = "linux";
|
|
238
|
-
} else {
|
|
239
|
-
detectedPlatform = "unknown";
|
|
240
|
-
}
|
|
241
|
-
return {
|
|
242
|
-
platform: detectedPlatform,
|
|
243
|
-
hasGui,
|
|
244
|
-
isHeadless
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
function isCommandAvailable(command) {
|
|
248
|
-
try {
|
|
249
|
-
execSync(`which ${command}`, { stdio: "ignore" });
|
|
250
|
-
return true;
|
|
251
|
-
} catch {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function isMcpServiceCompatible(serviceId) {
|
|
256
|
-
const config = MCP_SERVICE_CONFIGS.find((c) => c.id === serviceId);
|
|
257
|
-
if (!config) {
|
|
258
|
-
return { compatible: false, reason: "Service not found" };
|
|
259
|
-
}
|
|
260
|
-
const requirements = config.platformRequirements;
|
|
261
|
-
if (!requirements) {
|
|
262
|
-
return { compatible: true };
|
|
263
|
-
}
|
|
264
|
-
const { platform, hasGui } = detectPlatform();
|
|
265
|
-
if (requirements.platforms && requirements.platforms.length > 0) {
|
|
266
|
-
if (platform !== "unknown" && !requirements.platforms.includes(platform)) {
|
|
267
|
-
return {
|
|
268
|
-
compatible: false,
|
|
269
|
-
reason: `Not supported on ${platform}. Requires: ${requirements.platforms.join(", ")}`
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
if (requirements.requiresGui && !hasGui) {
|
|
274
|
-
return {
|
|
275
|
-
compatible: false,
|
|
276
|
-
reason: "Requires GUI environment (X11/Wayland/Desktop)"
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
if (requirements.requiredCommands) {
|
|
280
|
-
for (const cmd of requirements.requiredCommands) {
|
|
281
|
-
if (!isCommandAvailable(cmd)) {
|
|
282
|
-
return {
|
|
283
|
-
compatible: false,
|
|
284
|
-
reason: `Required command not found: ${cmd}`
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return { compatible: true };
|
|
290
|
-
}
|
|
291
|
-
async function getMcpServicesWithCompatibility() {
|
|
292
|
-
const allServices = await getMcpServices();
|
|
293
|
-
return allServices.map((service) => {
|
|
294
|
-
const { compatible, reason } = isMcpServiceCompatible(service.id);
|
|
295
|
-
return {
|
|
296
|
-
...service,
|
|
297
|
-
compatible,
|
|
298
|
-
incompatibleReason: reason
|
|
299
|
-
};
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
const DEFAULT_MCP_TOOL_SEARCH_CONFIG = {
|
|
303
|
-
mcpAutoEnableThreshold: 10,
|
|
304
|
-
excludedServices: ["mcp-search", "context7"]
|
|
305
|
-
};
|
|
306
|
-
function getMcpToolSearchConfig() {
|
|
307
|
-
const env = process__default.env;
|
|
308
|
-
return {
|
|
309
|
-
mcpAutoEnableThreshold: env.MCP_AUTO_THRESHOLD || DEFAULT_MCP_TOOL_SEARCH_CONFIG.mcpAutoEnableThreshold,
|
|
310
|
-
dynamicServiceDiscovery: env.MCP_DYNAMIC_DISCOVERY !== "false",
|
|
311
|
-
listChangedNotifications: env.MCP_LIST_CHANGED !== "false",
|
|
312
|
-
excludedServices: env.MCP_EXCLUDED_SERVICES?.split(",").map((s) => s.trim()).filter(Boolean) || DEFAULT_MCP_TOOL_SEARCH_CONFIG.excludedServices
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
class DynamicMcpServiceRegistry {
|
|
316
|
-
_services = /* @__PURE__ */ new Map();
|
|
317
|
-
_listeners = /* @__PURE__ */ new Set();
|
|
318
|
-
_enabled = false;
|
|
319
|
-
/**
|
|
320
|
-
* Enable dynamic service discovery
|
|
321
|
-
*/
|
|
322
|
-
enable() {
|
|
323
|
-
this._enabled = true;
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Disable dynamic service discovery
|
|
327
|
-
*/
|
|
328
|
-
disable() {
|
|
329
|
-
this._enabled = false;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Check if dynamic discovery is enabled
|
|
333
|
-
*/
|
|
334
|
-
isEnabled() {
|
|
335
|
-
return this._enabled;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Add a service dynamically
|
|
339
|
-
*/
|
|
340
|
-
addService(serviceId, config) {
|
|
341
|
-
if (!this._enabled) {
|
|
342
|
-
return false;
|
|
343
|
-
}
|
|
344
|
-
const isUpdate = this._services.has(serviceId);
|
|
345
|
-
this._services.set(serviceId, config);
|
|
346
|
-
this._notify({
|
|
347
|
-
type: isUpdate ? "updated" : "added",
|
|
348
|
-
serviceId,
|
|
349
|
-
timestamp: Date.now(),
|
|
350
|
-
config
|
|
351
|
-
});
|
|
352
|
-
return true;
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Remove a service dynamically
|
|
356
|
-
*/
|
|
357
|
-
removeService(serviceId) {
|
|
358
|
-
if (!this._enabled || !this._services.has(serviceId)) {
|
|
359
|
-
return false;
|
|
360
|
-
}
|
|
361
|
-
const config = this._services.get(serviceId);
|
|
362
|
-
this._services.delete(serviceId);
|
|
363
|
-
this._notify({
|
|
364
|
-
type: "removed",
|
|
365
|
-
serviceId,
|
|
366
|
-
timestamp: Date.now(),
|
|
367
|
-
config
|
|
368
|
-
});
|
|
369
|
-
return true;
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* Get a service configuration
|
|
373
|
-
*/
|
|
374
|
-
getService(serviceId) {
|
|
375
|
-
return this._services.get(serviceId);
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* List all dynamically registered services
|
|
379
|
-
*/
|
|
380
|
-
listServices() {
|
|
381
|
-
return new Map(this._services);
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Subscribe to list change notifications
|
|
385
|
-
*/
|
|
386
|
-
subscribe(listener) {
|
|
387
|
-
this._listeners.add(listener);
|
|
388
|
-
return () => this._listeners.delete(listener);
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Notify all listeners of a change
|
|
392
|
-
*/
|
|
393
|
-
_notify(notification) {
|
|
394
|
-
const toolSearchConfig = getMcpToolSearchConfig();
|
|
395
|
-
if (toolSearchConfig.listChangedNotifications) {
|
|
396
|
-
for (const listener of Array.from(this._listeners)) {
|
|
397
|
-
try {
|
|
398
|
-
listener(notification);
|
|
399
|
-
} catch (error) {
|
|
400
|
-
console.error("Error notifying MCP list change listener:", error);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
const dynamicMcpRegistry = new DynamicMcpServiceRegistry();
|
|
407
|
-
|
|
408
52
|
function applyCodexPlatformCommand(config) {
|
|
409
53
|
if (isWindows() && config.command) {
|
|
410
54
|
const mcpCmd = getMcpCommand(config.command);
|
|
@@ -2425,4 +2069,4 @@ const codex = {
|
|
|
2425
2069
|
writeCodexConfig: writeCodexConfig
|
|
2426
2070
|
};
|
|
2427
2071
|
|
|
2428
|
-
export {
|
|
2072
|
+
export { switchToOfficialLogin as a, switchToProvider as b, runCodexUpdate as c, detectConfigManagementMode as d, backupCodexComplete as e, writeAuthFile as f, applyCodexPlatformCommand as g, runCodexFullInit as h, runCodexUninstall as i, configureCodexAiMemoryFeature as j, configureCodexDefaultModelFeature as k, listCodexProviders as l, configureCodexMcp as m, configureCodexApi as n, configureCodexPresetFeature as o, runCodexWorkflowImportWithLanguageSelection as p, codex as q, readCodexConfig as r, switchCodexProvider as s, writeCodexConfig as w };
|
|
@@ -5,6 +5,7 @@ import { resolveCodeToolType, isCodeToolType, DEFAULT_CODE_TOOL_TYPE } from './c
|
|
|
5
5
|
import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
6
6
|
import { readZcfConfig } from './ccjk-config.mjs';
|
|
7
7
|
import { ClaudeCodeConfigManager } from './claude-code-config-manager.mjs';
|
|
8
|
+
import { s as setMyclaudeActiveProviderProfile, c as syncMyclaudeProviderProfilesFromClaudeConfig } from './claude-config.mjs';
|
|
8
9
|
import { s as switchCodexProvider, l as listCodexProviders, r as readCodexConfig, a as switchToOfficialLogin, b as switchToProvider } from './codex.mjs';
|
|
9
10
|
import { h as handleGeneralError } from '../shared/ccjk.DGllfVCZ.mjs';
|
|
10
11
|
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
@@ -33,19 +34,19 @@ import 'node:fs/promises';
|
|
|
33
34
|
import './json-config.mjs';
|
|
34
35
|
import '../shared/ccjk.RyizuzOI.mjs';
|
|
35
36
|
import './config.mjs';
|
|
36
|
-
import '
|
|
37
|
+
import '../shared/ccjk.DScm_NnL.mjs';
|
|
37
38
|
import './platform.mjs';
|
|
38
39
|
import './main.mjs';
|
|
39
40
|
import 'module';
|
|
40
41
|
import 'node:child_process';
|
|
41
42
|
import 'node:stream';
|
|
42
|
-
import '../shared/ccjk.DScm_NnL.mjs';
|
|
43
43
|
import './index8.mjs';
|
|
44
44
|
import '../shared/ccjk.DeWpAShp.mjs';
|
|
45
45
|
import '../shared/ccjk.CxpGa6MC.mjs';
|
|
46
46
|
import './prompts.mjs';
|
|
47
47
|
import '../shared/ccjk.gDEDGD_t.mjs';
|
|
48
48
|
import '../shared/ccjk.DZ2LLOa-.mjs';
|
|
49
|
+
import '../shared/ccjk.DKXs7Fbm.mjs';
|
|
49
50
|
|
|
50
51
|
async function configSwitchCommand(options) {
|
|
51
52
|
try {
|
|
@@ -78,9 +79,18 @@ function resolveCodeType(codeType) {
|
|
|
78
79
|
}
|
|
79
80
|
return DEFAULT_CODE_TOOL_TYPE;
|
|
80
81
|
}
|
|
82
|
+
function syncMyclaudeStateIfNeeded(codeType, currentProfileId) {
|
|
83
|
+
if (codeType !== "myclaude") {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (currentProfileId !== void 0) {
|
|
87
|
+
setMyclaudeActiveProviderProfile(currentProfileId);
|
|
88
|
+
}
|
|
89
|
+
syncMyclaudeProviderProfilesFromClaudeConfig(ClaudeCodeConfigManager.readConfig());
|
|
90
|
+
}
|
|
81
91
|
async function handleList(codeType) {
|
|
82
92
|
const targetCodeType = resolveCodeType(codeType);
|
|
83
|
-
if (targetCodeType === "claude-code") {
|
|
93
|
+
if (targetCodeType === "claude-code" || targetCodeType === "myclaude") {
|
|
84
94
|
await listClaudeCodeProfiles();
|
|
85
95
|
} else if (targetCodeType === "codex") {
|
|
86
96
|
await listCodexProvidersWithDisplay();
|
|
@@ -133,18 +143,19 @@ async function listClaudeCodeProfiles() {
|
|
|
133
143
|
}
|
|
134
144
|
async function handleDirectSwitch(codeType, target) {
|
|
135
145
|
const resolvedCodeType = resolveCodeType(codeType);
|
|
136
|
-
if (resolvedCodeType === "claude-code") {
|
|
137
|
-
await handleClaudeCodeDirectSwitch(target);
|
|
146
|
+
if (resolvedCodeType === "claude-code" || resolvedCodeType === "myclaude") {
|
|
147
|
+
await handleClaudeCodeDirectSwitch(target, resolvedCodeType);
|
|
138
148
|
} else if (resolvedCodeType === "codex") {
|
|
139
149
|
await switchCodexProvider(target);
|
|
140
150
|
}
|
|
141
151
|
}
|
|
142
|
-
async function handleClaudeCodeDirectSwitch(target) {
|
|
152
|
+
async function handleClaudeCodeDirectSwitch(target, codeType = "claude-code") {
|
|
143
153
|
if (target === "official") {
|
|
144
154
|
const result = await ClaudeCodeConfigManager.switchToOfficial();
|
|
145
155
|
if (result.success) {
|
|
146
156
|
try {
|
|
147
157
|
await ClaudeCodeConfigManager.applyProfileSettings(null);
|
|
158
|
+
syncMyclaudeStateIfNeeded(codeType, "");
|
|
148
159
|
console.log(a.green(i18n.t("multi-config:successfullySwitchedToOfficial")));
|
|
149
160
|
} catch (error) {
|
|
150
161
|
const reason = error instanceof Error ? error.message : String(error);
|
|
@@ -159,6 +170,7 @@ async function handleClaudeCodeDirectSwitch(target) {
|
|
|
159
170
|
try {
|
|
160
171
|
const profile = ClaudeCodeConfigManager.getProfileById("ccr-proxy");
|
|
161
172
|
await ClaudeCodeConfigManager.applyProfileSettings(profile);
|
|
173
|
+
syncMyclaudeStateIfNeeded(codeType, "ccr-proxy");
|
|
162
174
|
console.log(a.green(i18n.t("multi-config:successfullySwitchedToCcr")));
|
|
163
175
|
} catch (error) {
|
|
164
176
|
const reason = error instanceof Error ? error.message : String(error);
|
|
@@ -191,6 +203,7 @@ async function handleClaudeCodeDirectSwitch(target) {
|
|
|
191
203
|
if (result.success) {
|
|
192
204
|
try {
|
|
193
205
|
await ClaudeCodeConfigManager.applyProfileSettings({ ...resolvedProfile, id: resolvedId });
|
|
206
|
+
syncMyclaudeStateIfNeeded(codeType, resolvedId);
|
|
194
207
|
console.log(a.green(i18n.t("multi-config:successfullySwitchedToProfile", { name: resolvedProfile.name })));
|
|
195
208
|
} catch (error) {
|
|
196
209
|
const reason = error instanceof Error ? error.message : String(error);
|
|
@@ -203,13 +216,13 @@ async function handleClaudeCodeDirectSwitch(target) {
|
|
|
203
216
|
}
|
|
204
217
|
async function handleInteractiveSwitch(codeType) {
|
|
205
218
|
const resolvedCodeType = resolveCodeType(codeType);
|
|
206
|
-
if (resolvedCodeType === "claude-code") {
|
|
207
|
-
await handleClaudeCodeInteractiveSwitch();
|
|
219
|
+
if (resolvedCodeType === "claude-code" || resolvedCodeType === "myclaude") {
|
|
220
|
+
await handleClaudeCodeInteractiveSwitch(resolvedCodeType);
|
|
208
221
|
} else if (resolvedCodeType === "codex") {
|
|
209
222
|
await handleCodexInteractiveSwitch();
|
|
210
223
|
}
|
|
211
224
|
}
|
|
212
|
-
async function handleClaudeCodeInteractiveSwitch() {
|
|
225
|
+
async function handleClaudeCodeInteractiveSwitch(codeType = "claude-code") {
|
|
213
226
|
const config = ClaudeCodeConfigManager.readConfig();
|
|
214
227
|
if (!config || !config.profiles || Object.keys(config.profiles).length === 0) {
|
|
215
228
|
console.log(a.yellow(i18n.t("multi-config:noClaudeCodeProfilesAvailable")));
|
|
@@ -249,7 +262,7 @@ async function handleClaudeCodeInteractiveSwitch() {
|
|
|
249
262
|
console.log(a.yellow(i18n.t("multi-config:cancelled")));
|
|
250
263
|
return;
|
|
251
264
|
}
|
|
252
|
-
await handleClaudeCodeDirectSwitch(selectedConfig);
|
|
265
|
+
await handleClaudeCodeDirectSwitch(selectedConfig, codeType);
|
|
253
266
|
} catch (error) {
|
|
254
267
|
if (error.name === "ExitPromptError") {
|
|
255
268
|
console.log(a.green(`
|