ccjk 12.0.7 → 12.0.8
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/package.json +1 -1
- package/dist/chunks/agent-teams.mjs +0 -136
- package/dist/chunks/agent.mjs +0 -1439
- package/dist/chunks/agents.mjs +0 -3778
- package/dist/chunks/api-cli.mjs +0 -132
- package/dist/chunks/api-providers.mjs +0 -129
- package/dist/chunks/api.mjs +0 -112
- package/dist/chunks/auto-bootstrap.mjs +0 -358
- package/dist/chunks/auto-init.mjs +0 -7584
- package/dist/chunks/auto-updater.mjs +0 -410
- package/dist/chunks/banner.mjs +0 -188
- package/dist/chunks/bash.mjs +0 -187
- package/dist/chunks/boost.mjs +0 -397
- package/dist/chunks/ccjk-agents.mjs +0 -414
- package/dist/chunks/ccjk-all.mjs +0 -1028
- package/dist/chunks/ccjk-config.mjs +0 -261
- package/dist/chunks/ccjk-hooks.mjs +0 -1074
- package/dist/chunks/ccjk-mcp.mjs +0 -761
- package/dist/chunks/ccjk-setup.mjs +0 -763
- package/dist/chunks/ccjk-skills.mjs +0 -514
- package/dist/chunks/ccr.mjs +0 -98
- package/dist/chunks/ccu.mjs +0 -40
- package/dist/chunks/check-updates.mjs +0 -108
- package/dist/chunks/claude-code-config-manager.mjs +0 -750
- package/dist/chunks/claude-code-incremental-manager.mjs +0 -623
- package/dist/chunks/claude-config.mjs +0 -236
- package/dist/chunks/claude-wrapper.mjs +0 -85
- package/dist/chunks/cleanup-migration.mjs +0 -20
- package/dist/chunks/cli-hook.mjs +0 -2285
- package/dist/chunks/cloud-sync.mjs +0 -29
- package/dist/chunks/codex-config-switch.mjs +0 -451
- package/dist/chunks/codex-provider-manager.mjs +0 -236
- package/dist/chunks/codex-uninstaller.mjs +0 -404
- package/dist/chunks/codex.mjs +0 -2077
- package/dist/chunks/commands.mjs +0 -108
- package/dist/chunks/commands2.mjs +0 -413
- package/dist/chunks/commit.mjs +0 -138
- package/dist/chunks/completion.mjs +0 -515
- package/dist/chunks/config-consolidator.mjs +0 -172
- package/dist/chunks/config-switch.mjs +0 -317
- package/dist/chunks/config.mjs +0 -379
- package/dist/chunks/config2.mjs +0 -477
- package/dist/chunks/config3.mjs +0 -470
- package/dist/chunks/constants.mjs +0 -133
- package/dist/chunks/context-loader.mjs +0 -343
- package/dist/chunks/context.mjs +0 -372
- package/dist/chunks/convoy-manager.mjs +0 -880
- package/dist/chunks/dashboard.mjs +0 -476
- package/dist/chunks/doctor.mjs +0 -964
- package/dist/chunks/evolution.mjs +0 -382
- package/dist/chunks/features.mjs +0 -698
- package/dist/chunks/fish.mjs +0 -181
- package/dist/chunks/fs-operations.mjs +0 -192
- package/dist/chunks/health-alerts.mjs +0 -304
- package/dist/chunks/health-check.mjs +0 -532
- package/dist/chunks/help.mjs +0 -340
- package/dist/chunks/hook-installer.mjs +0 -45
- package/dist/chunks/index.mjs +0 -24
- package/dist/chunks/index10.mjs +0 -1171
- package/dist/chunks/index11.mjs +0 -1008
- package/dist/chunks/index12.mjs +0 -193
- package/dist/chunks/index13.mjs +0 -218
- package/dist/chunks/index14.mjs +0 -663
- package/dist/chunks/index2.mjs +0 -19
- package/dist/chunks/index3.mjs +0 -19092
- package/dist/chunks/index4.mjs +0 -8
- package/dist/chunks/index5.mjs +0 -7600
- package/dist/chunks/index6.mjs +0 -171
- package/dist/chunks/index7.mjs +0 -3583
- package/dist/chunks/index8.mjs +0 -19
- package/dist/chunks/index9.mjs +0 -616
- package/dist/chunks/init.mjs +0 -1606
- package/dist/chunks/installer.mjs +0 -690
- package/dist/chunks/installer2.mjs +0 -179
- package/dist/chunks/interview.mjs +0 -2927
- package/dist/chunks/json-config.mjs +0 -60
- package/dist/chunks/linux.mjs +0 -3863
- package/dist/chunks/macos.mjs +0 -69
- package/dist/chunks/main.mjs +0 -635
- package/dist/chunks/manager.mjs +0 -1048
- package/dist/chunks/marketplace.mjs +0 -949
- package/dist/chunks/mcp-cli.mjs +0 -204
- package/dist/chunks/mcp-performance.mjs +0 -187
- package/dist/chunks/mcp.mjs +0 -1231
- package/dist/chunks/menu.mjs +0 -652
- package/dist/chunks/metrics-display.mjs +0 -153
- package/dist/chunks/migrator.mjs +0 -178
- package/dist/chunks/monitor.mjs +0 -1856
- package/dist/chunks/notification.mjs +0 -1864
- package/dist/chunks/onboarding.mjs +0 -385
- package/dist/chunks/package.mjs +0 -3
- package/dist/chunks/paradigm.mjs +0 -74
- package/dist/chunks/permission-manager.mjs +0 -132
- package/dist/chunks/permissions.mjs +0 -265
- package/dist/chunks/persistence-manager.mjs +0 -794
- package/dist/chunks/persistence.mjs +0 -667
- package/dist/chunks/platform.mjs +0 -391
- package/dist/chunks/plugin.mjs +0 -1936
- package/dist/chunks/powershell.mjs +0 -213
- package/dist/chunks/prompts.mjs +0 -241
- package/dist/chunks/providers.mjs +0 -260
- package/dist/chunks/quick-actions.mjs +0 -320
- package/dist/chunks/quick-provider.mjs +0 -682
- package/dist/chunks/quick-setup.mjs +0 -412
- package/dist/chunks/remote.mjs +0 -497
- package/dist/chunks/session.mjs +0 -878
- package/dist/chunks/sessions.mjs +0 -106
- package/dist/chunks/silent-updater.mjs +0 -396
- package/dist/chunks/simple-config.mjs +0 -98
- package/dist/chunks/skill.mjs +0 -117
- package/dist/chunks/skill2.mjs +0 -9003
- package/dist/chunks/skills-sync.mjs +0 -6460
- package/dist/chunks/skills.mjs +0 -567
- package/dist/chunks/slash-commands.mjs +0 -207
- package/dist/chunks/smart-defaults.mjs +0 -412
- package/dist/chunks/smart-guide.mjs +0 -194
- package/dist/chunks/startup.mjs +0 -487
- package/dist/chunks/stats.mjs +0 -410
- package/dist/chunks/status.mjs +0 -289
- package/dist/chunks/team.mjs +0 -63
- package/dist/chunks/thinking.mjs +0 -626
- package/dist/chunks/trace.mjs +0 -57
- package/dist/chunks/uninstall.mjs +0 -849
- package/dist/chunks/update.mjs +0 -167
- package/dist/chunks/upgrade-manager.mjs +0 -204
- package/dist/chunks/version-checker.mjs +0 -881
- package/dist/chunks/vim.mjs +0 -903
- package/dist/chunks/windows.mjs +0 -14
- package/dist/chunks/workflows.mjs +0 -633
- package/dist/chunks/wsl.mjs +0 -129
- package/dist/chunks/zero-config.mjs +0 -374
- package/dist/chunks/zsh.mjs +0 -182
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.mjs +0 -2199
- package/dist/i18n/locales/en/agent-teams.json +0 -18
- package/dist/i18n/locales/en/agentBrowser.json +0 -79
- package/dist/i18n/locales/en/agents.json +0 -135
- package/dist/i18n/locales/en/api.json +0 -63
- package/dist/i18n/locales/en/ccjk-agents.json +0 -33
- package/dist/i18n/locales/en/ccjk-all.json +0 -23
- package/dist/i18n/locales/en/ccjk-skills.json +0 -22
- package/dist/i18n/locales/en/ccjk.json +0 -276
- package/dist/i18n/locales/en/ccr.json +0 -65
- package/dist/i18n/locales/en/claude-md.json +0 -73
- package/dist/i18n/locales/en/cli.json +0 -152
- package/dist/i18n/locales/en/cloud-setup.json +0 -31
- package/dist/i18n/locales/en/cloud-sync.json +0 -147
- package/dist/i18n/locales/en/cloud.json +0 -40
- package/dist/i18n/locales/en/cloudPlugins.json +0 -118
- package/dist/i18n/locales/en/codex.json +0 -127
- package/dist/i18n/locales/en/cometix.json +0 -29
- package/dist/i18n/locales/en/common.json +0 -68
- package/dist/i18n/locales/en/config.json +0 -108
- package/dist/i18n/locales/en/configuration.json +0 -226
- package/dist/i18n/locales/en/context.json +0 -85
- package/dist/i18n/locales/en/dashboard.json +0 -78
- package/dist/i18n/locales/en/errors.json +0 -26
- package/dist/i18n/locales/en/evolution.json +0 -54
- package/dist/i18n/locales/en/hooks.json +0 -74
- package/dist/i18n/locales/en/hooksSync.json +0 -133
- package/dist/i18n/locales/en/installation.json +0 -83
- package/dist/i18n/locales/en/interview.json +0 -104
- package/dist/i18n/locales/en/language.json +0 -19
- package/dist/i18n/locales/en/lsp.json +0 -78
- package/dist/i18n/locales/en/marketplace.json +0 -116
- package/dist/i18n/locales/en/mcp.json +0 -178
- package/dist/i18n/locales/en/memory.json +0 -92
- package/dist/i18n/locales/en/menu.json +0 -143
- package/dist/i18n/locales/en/multi-config.json +0 -79
- package/dist/i18n/locales/en/notification.json +0 -307
- package/dist/i18n/locales/en/permissions.json +0 -95
- package/dist/i18n/locales/en/persistence.json +0 -127
- package/dist/i18n/locales/en/plugins.json +0 -146
- package/dist/i18n/locales/en/quick-actions.json +0 -78
- package/dist/i18n/locales/en/registry.json +0 -54
- package/dist/i18n/locales/en/remote.json +0 -93
- package/dist/i18n/locales/en/sandbox.json +0 -44
- package/dist/i18n/locales/en/setup.json +0 -44
- package/dist/i18n/locales/en/shencha.json +0 -14
- package/dist/i18n/locales/en/skills.json +0 -100
- package/dist/i18n/locales/en/skillsSync.json +0 -74
- package/dist/i18n/locales/en/smartGuide.json +0 -49
- package/dist/i18n/locales/en/stats.json +0 -20
- package/dist/i18n/locales/en/subagent.json +0 -69
- package/dist/i18n/locales/en/superpowers.json +0 -117
- package/dist/i18n/locales/en/team.json +0 -7
- package/dist/i18n/locales/en/thinking.json +0 -65
- package/dist/i18n/locales/en/tools.json +0 -42
- package/dist/i18n/locales/en/uninstall.json +0 -56
- package/dist/i18n/locales/en/updater.json +0 -29
- package/dist/i18n/locales/en/vim.json +0 -169
- package/dist/i18n/locales/en/workflow.json +0 -55
- package/dist/i18n/locales/en/workspace.json +0 -108
- package/dist/i18n/locales/zh-CN/agent-teams.json +0 -18
- package/dist/i18n/locales/zh-CN/agentBrowser.json +0 -79
- package/dist/i18n/locales/zh-CN/agents.json +0 -135
- package/dist/i18n/locales/zh-CN/api.json +0 -63
- package/dist/i18n/locales/zh-CN/ccjk-agents.json +0 -33
- package/dist/i18n/locales/zh-CN/ccjk-all.json +0 -23
- package/dist/i18n/locales/zh-CN/ccjk-skills.json +0 -22
- package/dist/i18n/locales/zh-CN/ccjk.json +0 -276
- package/dist/i18n/locales/zh-CN/ccr.json +0 -65
- package/dist/i18n/locales/zh-CN/claude-md.json +0 -73
- package/dist/i18n/locales/zh-CN/cli.json +0 -152
- package/dist/i18n/locales/zh-CN/cloud-setup.json +0 -31
- package/dist/i18n/locales/zh-CN/cloud-sync.json +0 -147
- package/dist/i18n/locales/zh-CN/cloud.json +0 -40
- package/dist/i18n/locales/zh-CN/cloudPlugins.json +0 -118
- package/dist/i18n/locales/zh-CN/codex.json +0 -127
- package/dist/i18n/locales/zh-CN/cometix.json +0 -29
- package/dist/i18n/locales/zh-CN/common.json +0 -68
- package/dist/i18n/locales/zh-CN/config.json +0 -108
- package/dist/i18n/locales/zh-CN/configuration.json +0 -224
- package/dist/i18n/locales/zh-CN/context.json +0 -85
- package/dist/i18n/locales/zh-CN/dashboard.json +0 -78
- package/dist/i18n/locales/zh-CN/errors.json +0 -26
- package/dist/i18n/locales/zh-CN/evolution.json +0 -54
- package/dist/i18n/locales/zh-CN/hooks.json +0 -74
- package/dist/i18n/locales/zh-CN/hooksSync.json +0 -133
- package/dist/i18n/locales/zh-CN/installation.json +0 -83
- package/dist/i18n/locales/zh-CN/interview.json +0 -104
- package/dist/i18n/locales/zh-CN/language.json +0 -19
- package/dist/i18n/locales/zh-CN/lsp.json +0 -78
- package/dist/i18n/locales/zh-CN/marketplace.json +0 -116
- package/dist/i18n/locales/zh-CN/mcp.json +0 -178
- package/dist/i18n/locales/zh-CN/memory.json +0 -92
- package/dist/i18n/locales/zh-CN/menu.json +0 -143
- package/dist/i18n/locales/zh-CN/multi-config.json +0 -79
- package/dist/i18n/locales/zh-CN/notification.json +0 -307
- package/dist/i18n/locales/zh-CN/permissions.json +0 -95
- package/dist/i18n/locales/zh-CN/persistence.json +0 -127
- package/dist/i18n/locales/zh-CN/plugins.json +0 -146
- package/dist/i18n/locales/zh-CN/quick-actions.json +0 -78
- package/dist/i18n/locales/zh-CN/registry.json +0 -54
- package/dist/i18n/locales/zh-CN/remote.json +0 -93
- package/dist/i18n/locales/zh-CN/sandbox.json +0 -44
- package/dist/i18n/locales/zh-CN/setup.json +0 -44
- package/dist/i18n/locales/zh-CN/shencha.json +0 -14
- package/dist/i18n/locales/zh-CN/skills.json +0 -100
- package/dist/i18n/locales/zh-CN/skillsSync.json +0 -74
- package/dist/i18n/locales/zh-CN/smartGuide.json +0 -49
- package/dist/i18n/locales/zh-CN/stats.json +0 -20
- package/dist/i18n/locales/zh-CN/subagent.json +0 -69
- package/dist/i18n/locales/zh-CN/superpowers.json +0 -117
- package/dist/i18n/locales/zh-CN/team.json +0 -7
- package/dist/i18n/locales/zh-CN/thinking.json +0 -65
- package/dist/i18n/locales/zh-CN/tools.json +0 -42
- package/dist/i18n/locales/zh-CN/uninstall.json +0 -56
- package/dist/i18n/locales/zh-CN/updater.json +0 -29
- package/dist/i18n/locales/zh-CN/vim.json +0 -169
- package/dist/i18n/locales/zh-CN/workflow.json +0 -55
- package/dist/i18n/locales/zh-CN/workspace.json +0 -108
- package/dist/index.d.mts +0 -5295
- package/dist/index.d.ts +0 -5295
- package/dist/index.mjs +0 -4941
- package/dist/shared/ccjk.B364Fu0N.mjs +0 -1819
- package/dist/shared/ccjk.BAGoDD49.mjs +0 -36
- package/dist/shared/ccjk.BBtCGd_g.mjs +0 -899
- package/dist/shared/ccjk.BFQ7yr5S.mjs +0 -16
- package/dist/shared/ccjk.BFxsJM0k.mjs +0 -599
- package/dist/shared/ccjk.BIxuVL3_.mjs +0 -25
- package/dist/shared/ccjk.BRZ9ww8S.mjs +0 -142
- package/dist/shared/ccjk.BoApaI4j.mjs +0 -28
- package/dist/shared/ccjk.BrPUmTqm.mjs +0 -266
- package/dist/shared/ccjk.BtB1e5jm.mjs +0 -171
- package/dist/shared/ccjk.BwfbSKN2.mjs +0 -1051
- package/dist/shared/ccjk.BxSmJ8B7.mjs +0 -243
- package/dist/shared/ccjk.Bx_rmYfN.mjs +0 -69
- package/dist/shared/ccjk.C2jHOZVP.mjs +0 -52
- package/dist/shared/ccjk.CL4Yat0G.mjs +0 -303
- package/dist/shared/ccjk.COweQ1RR.mjs +0 -5
- package/dist/shared/ccjk.CePkJq2S.mjs +0 -223
- package/dist/shared/ccjk.CfKKcvWy.mjs +0 -126
- package/dist/shared/ccjk.Cjgrln_h.mjs +0 -297
- package/dist/shared/ccjk.Cjj8SVrn.mjs +0 -54
- package/dist/shared/ccjk.CxpGa6MC.mjs +0 -2724
- package/dist/shared/ccjk.D5MFQT7w.mjs +0 -400
- package/dist/shared/ccjk.D6ycHbak.mjs +0 -270
- package/dist/shared/ccjk.D8ZLYSZZ.mjs +0 -299
- package/dist/shared/ccjk.DG_o24cZ.mjs +0 -88
- package/dist/shared/ccjk.DLLw-h4Y.mjs +0 -460
- package/dist/shared/ccjk.DOwtZMk8.mjs +0 -4019
- package/dist/shared/ccjk.DS7UESmF.mjs +0 -2451
- package/dist/shared/ccjk.DTdjs-qK.mjs +0 -1447
- package/dist/shared/ccjk.DXRAZcix.mjs +0 -66
- package/dist/shared/ccjk.DsYaCCx4.mjs +0 -317
- package/dist/shared/ccjk.J8YiPsOw.mjs +0 -259
- package/dist/shared/ccjk.KfSWcGlE.mjs +0 -38
- package/dist/shared/ccjk.RyizuzOI.mjs +0 -21
- package/dist/shared/ccjk.SPoXMvZD.mjs +0 -1242
- package/dist/shared/ccjk.T_cX87dY.mjs +0 -15
- package/dist/shared/ccjk.UIvifqNE.mjs +0 -1486
- package/dist/shared/ccjk._dESH4Rk.mjs +0 -111
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +0 -249
- package/dist/shared/ccjk.c-ETfBZ_.mjs +0 -617
- package/dist/shared/ccjk.gDEDGD_t.mjs +0 -38
- package/dist/shared/ccjk.hoqrwWdN.mjs +0 -333
- package/dist/shared/ccjk.waa2ikKJ.mjs +0 -351
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import a from '../chunks/index2.mjs';
|
|
2
|
-
|
|
3
|
-
class ExecutionTracer {
|
|
4
|
-
traces = /* @__PURE__ */ new Map();
|
|
5
|
-
currentSessionId = null;
|
|
6
|
-
/**
|
|
7
|
-
* Start a new trace session
|
|
8
|
-
*/
|
|
9
|
-
startSession(sessionId) {
|
|
10
|
-
this.currentSessionId = sessionId;
|
|
11
|
-
this.traces.set(sessionId, {
|
|
12
|
-
sessionId,
|
|
13
|
-
startTime: Date.now(),
|
|
14
|
-
events: [],
|
|
15
|
-
metadata: {
|
|
16
|
-
totalEvents: 0,
|
|
17
|
-
totalDuration: 0,
|
|
18
|
-
agentCount: 0,
|
|
19
|
-
toolCallCount: 0,
|
|
20
|
-
errorCount: 0
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* End current trace session
|
|
26
|
-
*/
|
|
27
|
-
endSession(sessionId) {
|
|
28
|
-
const sid = sessionId || this.currentSessionId;
|
|
29
|
-
if (!sid) return;
|
|
30
|
-
const trace = this.traces.get(sid);
|
|
31
|
-
if (trace) {
|
|
32
|
-
trace.endTime = Date.now();
|
|
33
|
-
trace.metadata.totalDuration = trace.endTime - trace.startTime;
|
|
34
|
-
}
|
|
35
|
-
if (sid === this.currentSessionId) {
|
|
36
|
-
this.currentSessionId = null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Log an event
|
|
41
|
-
*/
|
|
42
|
-
logEvent(type, data, options) {
|
|
43
|
-
const sessionId = options?.sessionId || this.currentSessionId;
|
|
44
|
-
if (!sessionId) {
|
|
45
|
-
throw new Error("No active trace session");
|
|
46
|
-
}
|
|
47
|
-
const trace = this.traces.get(sessionId);
|
|
48
|
-
if (!trace) {
|
|
49
|
-
throw new Error(`Trace session not found: ${sessionId}`);
|
|
50
|
-
}
|
|
51
|
-
const eventId = `${sessionId}-${trace.events.length}`;
|
|
52
|
-
const event = {
|
|
53
|
-
id: eventId,
|
|
54
|
-
sessionId,
|
|
55
|
-
timestamp: Date.now(),
|
|
56
|
-
type,
|
|
57
|
-
agentId: options?.agentId,
|
|
58
|
-
data,
|
|
59
|
-
duration: options?.duration,
|
|
60
|
-
parentId: options?.parentId
|
|
61
|
-
};
|
|
62
|
-
trace.events.push(event);
|
|
63
|
-
trace.metadata.totalEvents++;
|
|
64
|
-
if (type === "agent-start") {
|
|
65
|
-
trace.metadata.agentCount++;
|
|
66
|
-
} else if (type === "tool-call") {
|
|
67
|
-
trace.metadata.toolCallCount++;
|
|
68
|
-
} else if (type === "error") {
|
|
69
|
-
trace.metadata.errorCount++;
|
|
70
|
-
}
|
|
71
|
-
return eventId;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Log agent start
|
|
75
|
-
*/
|
|
76
|
-
logAgentStart(agentId, data = {}) {
|
|
77
|
-
return this.logEvent("agent-start", { agentId, ...data }, { agentId });
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Log agent end
|
|
81
|
-
*/
|
|
82
|
-
logAgentEnd(agentId, data = {}, duration) {
|
|
83
|
-
return this.logEvent("agent-end", { agentId, ...data }, { agentId, duration });
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Log decision
|
|
87
|
-
*/
|
|
88
|
-
logDecision(agentId, decision, reasoning) {
|
|
89
|
-
return this.logEvent("decision", { decision, reasoning }, { agentId });
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Log tool call
|
|
93
|
-
*/
|
|
94
|
-
logToolCall(tool, args, agentId) {
|
|
95
|
-
return this.logEvent("tool-call", { tool, args }, { agentId });
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Log tool result
|
|
99
|
-
*/
|
|
100
|
-
logToolResult(tool, result, duration, parentId) {
|
|
101
|
-
return this.logEvent("tool-result", { tool, result }, { duration, parentId });
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Log error
|
|
105
|
-
*/
|
|
106
|
-
logError(error, agentId) {
|
|
107
|
-
return this.logEvent("error", {
|
|
108
|
-
message: error.message,
|
|
109
|
-
stack: error.stack
|
|
110
|
-
}, { agentId });
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Get trace for session
|
|
114
|
-
*/
|
|
115
|
-
getTrace(sessionId) {
|
|
116
|
-
return this.traces.get(sessionId);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* List all traces
|
|
120
|
-
*/
|
|
121
|
-
listTraces() {
|
|
122
|
-
return Array.from(this.traces.values());
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Clear old traces (keep last N)
|
|
126
|
-
*/
|
|
127
|
-
cleanup(keepLast = 10) {
|
|
128
|
-
const traces = this.listTraces().sort((a, b) => b.startTime - a.startTime);
|
|
129
|
-
const toKeep = new Set(traces.slice(0, keepLast).map((t) => t.sessionId));
|
|
130
|
-
for (const [sessionId] of this.traces) {
|
|
131
|
-
if (!toKeep.has(sessionId)) {
|
|
132
|
-
this.traces.delete(sessionId);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Visualize trace as ASCII tree
|
|
138
|
-
*/
|
|
139
|
-
visualizeTrace(sessionId) {
|
|
140
|
-
const trace = this.traces.get(sessionId);
|
|
141
|
-
if (!trace) {
|
|
142
|
-
return a.red(`Trace not found: ${sessionId}`);
|
|
143
|
-
}
|
|
144
|
-
const lines = [];
|
|
145
|
-
lines.push(a.cyan.bold(`
|
|
146
|
-
\u{1F4CA} Execution Trace: ${sessionId}`));
|
|
147
|
-
lines.push(a.gray(`Started: ${new Date(trace.startTime).toISOString()}`));
|
|
148
|
-
if (trace.endTime) {
|
|
149
|
-
lines.push(a.gray(`Duration: ${trace.endTime - trace.startTime}ms`));
|
|
150
|
-
}
|
|
151
|
-
lines.push(a.gray(`Events: ${trace.metadata.totalEvents}`));
|
|
152
|
-
lines.push("");
|
|
153
|
-
const agentEvents = /* @__PURE__ */ new Map();
|
|
154
|
-
for (const event of trace.events) {
|
|
155
|
-
const agentId = event.agentId || "system";
|
|
156
|
-
if (!agentEvents.has(agentId)) {
|
|
157
|
-
agentEvents.set(agentId, []);
|
|
158
|
-
}
|
|
159
|
-
agentEvents.get(agentId).push(event);
|
|
160
|
-
}
|
|
161
|
-
for (const [agentId, events] of agentEvents) {
|
|
162
|
-
lines.push(a.yellow(`\u{1F916} ${agentId}`));
|
|
163
|
-
for (const event of events) {
|
|
164
|
-
const time = new Date(event.timestamp).toLocaleTimeString();
|
|
165
|
-
const icon = this.getEventIcon(event.type);
|
|
166
|
-
const color = this.getEventColor(event.type);
|
|
167
|
-
let line = ` ${icon} ${time} ${color(event.type)}`;
|
|
168
|
-
if (event.type === "decision") {
|
|
169
|
-
line += `: ${event.data.decision}`;
|
|
170
|
-
} else if (event.type === "tool-call") {
|
|
171
|
-
line += `: ${event.data.tool}(${JSON.stringify(event.data.args).slice(0, 50)}...)`;
|
|
172
|
-
} else if (event.type === "tool-result" && event.duration) {
|
|
173
|
-
line += `: ${event.data.tool} (${event.duration}ms)`;
|
|
174
|
-
} else if (event.type === "error") {
|
|
175
|
-
line += `: ${event.data.message}`;
|
|
176
|
-
}
|
|
177
|
-
lines.push(line);
|
|
178
|
-
}
|
|
179
|
-
lines.push("");
|
|
180
|
-
}
|
|
181
|
-
lines.push(a.cyan("\u{1F4C8} Summary"));
|
|
182
|
-
lines.push(` Agents: ${trace.metadata.agentCount}`);
|
|
183
|
-
lines.push(` Tool Calls: ${trace.metadata.toolCallCount}`);
|
|
184
|
-
lines.push(` Errors: ${trace.metadata.errorCount}`);
|
|
185
|
-
lines.push("");
|
|
186
|
-
return lines.join("\n");
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Get icon for event type
|
|
190
|
-
*/
|
|
191
|
-
getEventIcon(type) {
|
|
192
|
-
const icons = {
|
|
193
|
-
"agent-start": "\u25B6\uFE0F",
|
|
194
|
-
"agent-end": "\u23F9\uFE0F",
|
|
195
|
-
"decision": "\u{1F9E0}",
|
|
196
|
-
"tool-call": "\u{1F527}",
|
|
197
|
-
"tool-result": "\u2705",
|
|
198
|
-
"error": "\u274C",
|
|
199
|
-
"context-load": "\u{1F4E5}",
|
|
200
|
-
"context-save": "\u{1F4E4}"
|
|
201
|
-
};
|
|
202
|
-
return icons[type] || "\u2022";
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Get color function for event type
|
|
206
|
-
*/
|
|
207
|
-
getEventColor(type) {
|
|
208
|
-
const colors = {
|
|
209
|
-
"agent-start": a.green,
|
|
210
|
-
"agent-end": a.gray,
|
|
211
|
-
"decision": a.cyan,
|
|
212
|
-
"tool-call": a.blue,
|
|
213
|
-
"tool-result": a.green,
|
|
214
|
-
"error": a.red,
|
|
215
|
-
"context-load": a.yellow,
|
|
216
|
-
"context-save": a.yellow
|
|
217
|
-
};
|
|
218
|
-
return colors[type] || a.white;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
const executionTracer = new ExecutionTracer();
|
|
222
|
-
|
|
223
|
-
export { executionTracer as e };
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { CLAUDE_AGENTS_DIR, CCJK_CONFIG_DIR } from '../chunks/constants.mjs';
|
|
3
|
-
import { j as join } from './ccjk.bQ7Dh1g4.mjs';
|
|
4
|
-
|
|
5
|
-
const getProjectAgentsDir = (projectDir) => join(projectDir || process.cwd(), ".claude", "agents");
|
|
6
|
-
const GLOBAL_AGENTS_DIR = CLAUDE_AGENTS_DIR;
|
|
7
|
-
join(CCJK_CONFIG_DIR, "agents");
|
|
8
|
-
const AGENT_COLORS = ["blue", "green", "orange", "purple", "red", "yellow", "cyan", "pink"];
|
|
9
|
-
function agentToMarkdown(agent, options) {
|
|
10
|
-
const name = generateAgentId(agent);
|
|
11
|
-
const description = typeof agent.description === "string" ? agent.description : agent.description?.en || agent.description?.["zh-CN"] || "";
|
|
12
|
-
const tools = options?.tools || [];
|
|
13
|
-
if (agent.skills?.length) {
|
|
14
|
-
tools.push(...agent.skills.map((s) => s.skillId || s.pluginId));
|
|
15
|
-
}
|
|
16
|
-
if (agent.mcpServers?.length) {
|
|
17
|
-
tools.push(...agent.mcpServers.map((m) => `mcp__${m.serverName}`));
|
|
18
|
-
}
|
|
19
|
-
const color = options?.color || selectAgentColor(agent);
|
|
20
|
-
const frontmatter = [
|
|
21
|
-
"---",
|
|
22
|
-
`name: ${name}`,
|
|
23
|
-
`description: ${description}`
|
|
24
|
-
];
|
|
25
|
-
if (tools.length > 0) {
|
|
26
|
-
frontmatter.push(`tools: ${tools.join(", ")}`);
|
|
27
|
-
}
|
|
28
|
-
frontmatter.push(`color: ${color}`);
|
|
29
|
-
frontmatter.push("---");
|
|
30
|
-
const body = [];
|
|
31
|
-
if (agent.persona) {
|
|
32
|
-
body.push("");
|
|
33
|
-
body.push(agent.persona);
|
|
34
|
-
}
|
|
35
|
-
if (agent.instructions) {
|
|
36
|
-
body.push("");
|
|
37
|
-
body.push("## Instructions");
|
|
38
|
-
body.push("");
|
|
39
|
-
body.push(agent.instructions);
|
|
40
|
-
}
|
|
41
|
-
if (agent.capabilities?.length) {
|
|
42
|
-
body.push("");
|
|
43
|
-
body.push("## Capabilities");
|
|
44
|
-
body.push("");
|
|
45
|
-
for (const cap of agent.capabilities) {
|
|
46
|
-
body.push(`- ${formatCapability(cap)}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (agent.triggers?.length) {
|
|
50
|
-
body.push("");
|
|
51
|
-
body.push("## Triggers");
|
|
52
|
-
body.push("");
|
|
53
|
-
for (const trigger of agent.triggers) {
|
|
54
|
-
body.push(`- ${trigger}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return `${frontmatter.join("\n") + body.join("\n")}
|
|
58
|
-
`;
|
|
59
|
-
}
|
|
60
|
-
function selectAgentColor(agent) {
|
|
61
|
-
const caps = agent.capabilities || [];
|
|
62
|
-
if (caps.includes("code-generation") || caps.includes("code-review"))
|
|
63
|
-
return "blue";
|
|
64
|
-
if (caps.includes("testing"))
|
|
65
|
-
return "green";
|
|
66
|
-
if (caps.includes("debugging"))
|
|
67
|
-
return "orange";
|
|
68
|
-
if (caps.includes("deployment"))
|
|
69
|
-
return "purple";
|
|
70
|
-
if (caps.includes("documentation"))
|
|
71
|
-
return "cyan";
|
|
72
|
-
if (caps.includes("git-operations"))
|
|
73
|
-
return "yellow";
|
|
74
|
-
if (caps.includes("web-search") || caps.includes("api-integration"))
|
|
75
|
-
return "pink";
|
|
76
|
-
const hash = agent.id?.split("").reduce((a, c) => a + c.charCodeAt(0), 0) || 0;
|
|
77
|
-
return AGENT_COLORS[hash % AGENT_COLORS.length];
|
|
78
|
-
}
|
|
79
|
-
function formatCapability(cap) {
|
|
80
|
-
const labels = {
|
|
81
|
-
"code-generation": "Code Generation",
|
|
82
|
-
"code-review": "Code Review",
|
|
83
|
-
"testing": "Testing",
|
|
84
|
-
"documentation": "Documentation",
|
|
85
|
-
"deployment": "Deployment",
|
|
86
|
-
"debugging": "Debugging",
|
|
87
|
-
"refactoring": "Refactoring",
|
|
88
|
-
"git-operations": "Git Operations",
|
|
89
|
-
"file-management": "File Management",
|
|
90
|
-
"web-search": "Web Search",
|
|
91
|
-
"api-integration": "API Integration"
|
|
92
|
-
};
|
|
93
|
-
return labels[cap] || cap;
|
|
94
|
-
}
|
|
95
|
-
async function writeAgentFile(agent, options) {
|
|
96
|
-
const format = options?.format || "markdown";
|
|
97
|
-
const agentId = generateAgentId(agent);
|
|
98
|
-
const isGlobal = options?.global || false;
|
|
99
|
-
const agentsDir = isGlobal ? GLOBAL_AGENTS_DIR : getProjectAgentsDir(options?.projectDir);
|
|
100
|
-
const ext = format === "markdown" ? "md" : "json";
|
|
101
|
-
const fileName = `${agentId}.${ext}`;
|
|
102
|
-
const filePath = join(agentsDir, fileName);
|
|
103
|
-
if (!existsSync(agentsDir)) {
|
|
104
|
-
mkdirSync(agentsDir, { recursive: true });
|
|
105
|
-
}
|
|
106
|
-
let content;
|
|
107
|
-
if (format === "markdown") {
|
|
108
|
-
content = agentToMarkdown(agent, options);
|
|
109
|
-
} else {
|
|
110
|
-
content = JSON.stringify(agent, null, options?.pretty ? 2 : 0);
|
|
111
|
-
}
|
|
112
|
-
writeFileSync(filePath, content, "utf-8");
|
|
113
|
-
return filePath;
|
|
114
|
-
}
|
|
115
|
-
function generateAgentId(agent) {
|
|
116
|
-
if (agent.id) {
|
|
117
|
-
return agent.id.toLowerCase().replace(/\s+/g, "-");
|
|
118
|
-
}
|
|
119
|
-
const name = typeof agent.name === "string" ? agent.name : agent.name?.en || agent.name?.["zh-CN"] || "unknown-agent";
|
|
120
|
-
return name.toLowerCase().replace(/\s+/g, "-");
|
|
121
|
-
}
|
|
122
|
-
function getAgentsDir(projectDir) {
|
|
123
|
-
return getProjectAgentsDir(projectDir);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export { getAgentsDir as g, writeAgentFile as w };
|
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is not the set of all possible signals.
|
|
3
|
-
*
|
|
4
|
-
* It IS, however, the set of all signals that trigger
|
|
5
|
-
* an exit on either Linux or BSD systems. Linux is a
|
|
6
|
-
* superset of the signal names supported on BSD, and
|
|
7
|
-
* the unknown signals just fail to register, so we can
|
|
8
|
-
* catch that easily enough.
|
|
9
|
-
*
|
|
10
|
-
* Windows signals are a different set, since there are
|
|
11
|
-
* signals that terminate Windows processes, but don't
|
|
12
|
-
* terminate (or don't even exist) on Posix systems.
|
|
13
|
-
*
|
|
14
|
-
* Don't bother with SIGKILL. It's uncatchable, which
|
|
15
|
-
* means that we can't fire any callbacks anyway.
|
|
16
|
-
*
|
|
17
|
-
* If a user does happen to register a handler on a non-
|
|
18
|
-
* fatal signal like SIGWINCH or something, and then
|
|
19
|
-
* exit, it'll end up firing `process.emit('exit')`, so
|
|
20
|
-
* the handler will be fired anyway.
|
|
21
|
-
*
|
|
22
|
-
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
23
|
-
* artificially, inherently leave the process in a
|
|
24
|
-
* state from which it is not safe to try and enter JS
|
|
25
|
-
* listeners.
|
|
26
|
-
*/
|
|
27
|
-
const signals = [];
|
|
28
|
-
signals.push('SIGHUP', 'SIGINT', 'SIGTERM');
|
|
29
|
-
if (process.platform !== 'win32') {
|
|
30
|
-
signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT'
|
|
31
|
-
// should detect profiler and enable/disable accordingly.
|
|
32
|
-
// see #21
|
|
33
|
-
// 'SIGPROF'
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
if (process.platform === 'linux') {
|
|
37
|
-
signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Note: since nyc uses this module to output coverage, any lines
|
|
41
|
-
// that are in the direct sync flow of nyc's outputCoverage are
|
|
42
|
-
// ignored, since we can never get coverage for them.
|
|
43
|
-
// grab a reference to node's real process object right away
|
|
44
|
-
const processOk = (process) => !!process &&
|
|
45
|
-
typeof process === 'object' &&
|
|
46
|
-
typeof process.removeListener === 'function' &&
|
|
47
|
-
typeof process.emit === 'function' &&
|
|
48
|
-
typeof process.reallyExit === 'function' &&
|
|
49
|
-
typeof process.listeners === 'function' &&
|
|
50
|
-
typeof process.kill === 'function' &&
|
|
51
|
-
typeof process.pid === 'number' &&
|
|
52
|
-
typeof process.on === 'function';
|
|
53
|
-
const kExitEmitter = Symbol.for('signal-exit emitter');
|
|
54
|
-
const global = globalThis;
|
|
55
|
-
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
56
|
-
// teeny special purpose ee
|
|
57
|
-
class Emitter {
|
|
58
|
-
emitted = {
|
|
59
|
-
afterExit: false,
|
|
60
|
-
exit: false,
|
|
61
|
-
};
|
|
62
|
-
listeners = {
|
|
63
|
-
afterExit: [],
|
|
64
|
-
exit: [],
|
|
65
|
-
};
|
|
66
|
-
count = 0;
|
|
67
|
-
id = Math.random();
|
|
68
|
-
constructor() {
|
|
69
|
-
if (global[kExitEmitter]) {
|
|
70
|
-
return global[kExitEmitter];
|
|
71
|
-
}
|
|
72
|
-
ObjectDefineProperty(global, kExitEmitter, {
|
|
73
|
-
value: this,
|
|
74
|
-
writable: false,
|
|
75
|
-
enumerable: false,
|
|
76
|
-
configurable: false,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
on(ev, fn) {
|
|
80
|
-
this.listeners[ev].push(fn);
|
|
81
|
-
}
|
|
82
|
-
removeListener(ev, fn) {
|
|
83
|
-
const list = this.listeners[ev];
|
|
84
|
-
const i = list.indexOf(fn);
|
|
85
|
-
/* c8 ignore start */
|
|
86
|
-
if (i === -1) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
/* c8 ignore stop */
|
|
90
|
-
if (i === 0 && list.length === 1) {
|
|
91
|
-
list.length = 0;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
list.splice(i, 1);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
emit(ev, code, signal) {
|
|
98
|
-
if (this.emitted[ev]) {
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
this.emitted[ev] = true;
|
|
102
|
-
let ret = false;
|
|
103
|
-
for (const fn of this.listeners[ev]) {
|
|
104
|
-
ret = fn(code, signal) === true || ret;
|
|
105
|
-
}
|
|
106
|
-
if (ev === 'exit') {
|
|
107
|
-
ret = this.emit('afterExit', code, signal) || ret;
|
|
108
|
-
}
|
|
109
|
-
return ret;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
class SignalExitBase {
|
|
113
|
-
}
|
|
114
|
-
const signalExitWrap = (handler) => {
|
|
115
|
-
return {
|
|
116
|
-
onExit(cb, opts) {
|
|
117
|
-
return handler.onExit(cb, opts);
|
|
118
|
-
},
|
|
119
|
-
load() {
|
|
120
|
-
return handler.load();
|
|
121
|
-
},
|
|
122
|
-
unload() {
|
|
123
|
-
return handler.unload();
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
class SignalExitFallback extends SignalExitBase {
|
|
128
|
-
onExit() {
|
|
129
|
-
return () => { };
|
|
130
|
-
}
|
|
131
|
-
load() { }
|
|
132
|
-
unload() { }
|
|
133
|
-
}
|
|
134
|
-
class SignalExit extends SignalExitBase {
|
|
135
|
-
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
136
|
-
// so use a supported signal instead
|
|
137
|
-
/* c8 ignore start */
|
|
138
|
-
#hupSig = process$1.platform === 'win32' ? 'SIGINT' : 'SIGHUP';
|
|
139
|
-
/* c8 ignore stop */
|
|
140
|
-
#emitter = new Emitter();
|
|
141
|
-
#process;
|
|
142
|
-
#originalProcessEmit;
|
|
143
|
-
#originalProcessReallyExit;
|
|
144
|
-
#sigListeners = {};
|
|
145
|
-
#loaded = false;
|
|
146
|
-
constructor(process) {
|
|
147
|
-
super();
|
|
148
|
-
this.#process = process;
|
|
149
|
-
// { <signal>: <listener fn>, ... }
|
|
150
|
-
this.#sigListeners = {};
|
|
151
|
-
for (const sig of signals) {
|
|
152
|
-
this.#sigListeners[sig] = () => {
|
|
153
|
-
// If there are no other listeners, an exit is coming!
|
|
154
|
-
// Simplest way: remove us and then re-send the signal.
|
|
155
|
-
// We know that this will kill the process, so we can
|
|
156
|
-
// safely emit now.
|
|
157
|
-
const listeners = this.#process.listeners(sig);
|
|
158
|
-
let { count } = this.#emitter;
|
|
159
|
-
// This is a workaround for the fact that signal-exit v3 and signal
|
|
160
|
-
// exit v4 are not aware of each other, and each will attempt to let
|
|
161
|
-
// the other handle it, so neither of them do. To correct this, we
|
|
162
|
-
// detect if we're the only handler *except* for previous versions
|
|
163
|
-
// of signal-exit, and increment by the count of listeners it has
|
|
164
|
-
// created.
|
|
165
|
-
/* c8 ignore start */
|
|
166
|
-
const p = process;
|
|
167
|
-
if (typeof p.__signal_exit_emitter__ === 'object' &&
|
|
168
|
-
typeof p.__signal_exit_emitter__.count === 'number') {
|
|
169
|
-
count += p.__signal_exit_emitter__.count;
|
|
170
|
-
}
|
|
171
|
-
/* c8 ignore stop */
|
|
172
|
-
if (listeners.length === count) {
|
|
173
|
-
this.unload();
|
|
174
|
-
const ret = this.#emitter.emit('exit', null, sig);
|
|
175
|
-
/* c8 ignore start */
|
|
176
|
-
const s = sig === 'SIGHUP' ? this.#hupSig : sig;
|
|
177
|
-
if (!ret)
|
|
178
|
-
process.kill(process.pid, s);
|
|
179
|
-
/* c8 ignore stop */
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
this.#originalProcessReallyExit = process.reallyExit;
|
|
184
|
-
this.#originalProcessEmit = process.emit;
|
|
185
|
-
}
|
|
186
|
-
onExit(cb, opts) {
|
|
187
|
-
/* c8 ignore start */
|
|
188
|
-
if (!processOk(this.#process)) {
|
|
189
|
-
return () => { };
|
|
190
|
-
}
|
|
191
|
-
/* c8 ignore stop */
|
|
192
|
-
if (this.#loaded === false) {
|
|
193
|
-
this.load();
|
|
194
|
-
}
|
|
195
|
-
const ev = opts?.alwaysLast ? 'afterExit' : 'exit';
|
|
196
|
-
this.#emitter.on(ev, cb);
|
|
197
|
-
return () => {
|
|
198
|
-
this.#emitter.removeListener(ev, cb);
|
|
199
|
-
if (this.#emitter.listeners['exit'].length === 0 &&
|
|
200
|
-
this.#emitter.listeners['afterExit'].length === 0) {
|
|
201
|
-
this.unload();
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
load() {
|
|
206
|
-
if (this.#loaded) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
this.#loaded = true;
|
|
210
|
-
// This is the number of onSignalExit's that are in play.
|
|
211
|
-
// It's important so that we can count the correct number of
|
|
212
|
-
// listeners on signals, and don't wait for the other one to
|
|
213
|
-
// handle it instead of us.
|
|
214
|
-
this.#emitter.count += 1;
|
|
215
|
-
for (const sig of signals) {
|
|
216
|
-
try {
|
|
217
|
-
const fn = this.#sigListeners[sig];
|
|
218
|
-
if (fn)
|
|
219
|
-
this.#process.on(sig, fn);
|
|
220
|
-
}
|
|
221
|
-
catch (_) { }
|
|
222
|
-
}
|
|
223
|
-
this.#process.emit = (ev, ...a) => {
|
|
224
|
-
return this.#processEmit(ev, ...a);
|
|
225
|
-
};
|
|
226
|
-
this.#process.reallyExit = (code) => {
|
|
227
|
-
return this.#processReallyExit(code);
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
unload() {
|
|
231
|
-
if (!this.#loaded) {
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
this.#loaded = false;
|
|
235
|
-
signals.forEach(sig => {
|
|
236
|
-
const listener = this.#sigListeners[sig];
|
|
237
|
-
/* c8 ignore start */
|
|
238
|
-
if (!listener) {
|
|
239
|
-
throw new Error('Listener not defined for signal: ' + sig);
|
|
240
|
-
}
|
|
241
|
-
/* c8 ignore stop */
|
|
242
|
-
try {
|
|
243
|
-
this.#process.removeListener(sig, listener);
|
|
244
|
-
/* c8 ignore start */
|
|
245
|
-
}
|
|
246
|
-
catch (_) { }
|
|
247
|
-
/* c8 ignore stop */
|
|
248
|
-
});
|
|
249
|
-
this.#process.emit = this.#originalProcessEmit;
|
|
250
|
-
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
251
|
-
this.#emitter.count -= 1;
|
|
252
|
-
}
|
|
253
|
-
#processReallyExit(code) {
|
|
254
|
-
/* c8 ignore start */
|
|
255
|
-
if (!processOk(this.#process)) {
|
|
256
|
-
return 0;
|
|
257
|
-
}
|
|
258
|
-
this.#process.exitCode = code || 0;
|
|
259
|
-
/* c8 ignore stop */
|
|
260
|
-
this.#emitter.emit('exit', this.#process.exitCode, null);
|
|
261
|
-
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
262
|
-
}
|
|
263
|
-
#processEmit(ev, ...args) {
|
|
264
|
-
const og = this.#originalProcessEmit;
|
|
265
|
-
if (ev === 'exit' && processOk(this.#process)) {
|
|
266
|
-
if (typeof args[0] === 'number') {
|
|
267
|
-
this.#process.exitCode = args[0];
|
|
268
|
-
/* c8 ignore start */
|
|
269
|
-
}
|
|
270
|
-
/* c8 ignore start */
|
|
271
|
-
const ret = og.call(this.#process, ev, ...args);
|
|
272
|
-
/* c8 ignore start */
|
|
273
|
-
this.#emitter.emit('exit', this.#process.exitCode, null);
|
|
274
|
-
/* c8 ignore stop */
|
|
275
|
-
return ret;
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
return og.call(this.#process, ev, ...args);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
const process$1 = globalThis.process;
|
|
283
|
-
// wrap so that we call the method on the actual handler, without
|
|
284
|
-
// exporting it directly.
|
|
285
|
-
const {
|
|
286
|
-
/**
|
|
287
|
-
* Called when the process is exiting, whether via signal, explicit
|
|
288
|
-
* exit, or running out of stuff to do.
|
|
289
|
-
*
|
|
290
|
-
* If the global process object is not suitable for instrumentation,
|
|
291
|
-
* then this will be a no-op.
|
|
292
|
-
*
|
|
293
|
-
* Returns a function that may be used to unload signal-exit.
|
|
294
|
-
*/
|
|
295
|
-
onExit} = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
|
|
296
|
-
|
|
297
|
-
export { onExit as o };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { a as detectCodeToolType } from '../chunks/smart-defaults.mjs';
|
|
2
|
-
import { DEFAULT_CODE_TOOL_TYPE } from '../chunks/constants.mjs';
|
|
3
|
-
import { i18n } from '../chunks/index5.mjs';
|
|
4
|
-
import { readZcfConfigAsync } from '../chunks/ccjk-config.mjs';
|
|
5
|
-
|
|
6
|
-
const CODE_TYPE_ABBREVIATIONS = {
|
|
7
|
-
cc: "claude-code",
|
|
8
|
-
cx: "codex"
|
|
9
|
-
};
|
|
10
|
-
async function resolveCodeType(codeTypeParam) {
|
|
11
|
-
if (codeTypeParam) {
|
|
12
|
-
const normalizedParam = codeTypeParam.toLowerCase().trim();
|
|
13
|
-
if (normalizedParam in CODE_TYPE_ABBREVIATIONS) {
|
|
14
|
-
return CODE_TYPE_ABBREVIATIONS[normalizedParam];
|
|
15
|
-
}
|
|
16
|
-
if (isValidCodeType(normalizedParam)) {
|
|
17
|
-
return normalizedParam;
|
|
18
|
-
}
|
|
19
|
-
const validAbbreviations = Object.keys(CODE_TYPE_ABBREVIATIONS);
|
|
20
|
-
const validFullTypes = Object.values(CODE_TYPE_ABBREVIATIONS);
|
|
21
|
-
const validOptions = [...validAbbreviations, ...validFullTypes].join(", ");
|
|
22
|
-
let defaultValue = DEFAULT_CODE_TOOL_TYPE;
|
|
23
|
-
try {
|
|
24
|
-
const config = await readZcfConfigAsync();
|
|
25
|
-
if (config?.codeToolType && isValidCodeType(config.codeToolType)) {
|
|
26
|
-
defaultValue = config.codeToolType;
|
|
27
|
-
}
|
|
28
|
-
} catch {
|
|
29
|
-
}
|
|
30
|
-
throw new Error(
|
|
31
|
-
i18n.t("errors:invalidCodeType", { value: codeTypeParam, validOptions, defaultValue })
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
const config = await readZcfConfigAsync();
|
|
36
|
-
if (config?.codeToolType && isValidCodeType(config.codeToolType)) {
|
|
37
|
-
return config.codeToolType;
|
|
38
|
-
}
|
|
39
|
-
} catch {
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const freshDetected = detectCodeToolType();
|
|
43
|
-
if (isValidCodeType(freshDetected)) {
|
|
44
|
-
return freshDetected;
|
|
45
|
-
}
|
|
46
|
-
} catch {
|
|
47
|
-
}
|
|
48
|
-
return DEFAULT_CODE_TOOL_TYPE;
|
|
49
|
-
}
|
|
50
|
-
function isValidCodeType(value) {
|
|
51
|
-
return ["claude-code", "codex"].includes(value);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { resolveCodeType as r };
|