Skip to content

Commit 123bb22

Browse files
committed
add cleanup in default command.
1 parent 098bc28 commit 123bb22

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/cli/src/commands/$default.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ export const command: CommandModule<SharedOptions, DefaultArgs> = {
109109
// Use command line option if provided, otherwise use config value
110110
tokenTracker.tokenCache = config.tokenCache;
111111

112+
const backgroundTools = new BackgroundTools('mainAgent');
113+
112114
try {
113115
// Early API key check based on model provider
114116
const providerSettings =
@@ -209,7 +211,7 @@ export const command: CommandModule<SharedOptions, DefaultArgs> = {
209211
model: config.model,
210212
maxTokens: config.maxTokens,
211213
temperature: config.temperature,
212-
backgroundTools: new BackgroundTools('mainAgent'),
214+
backgroundTools,
213215
});
214216

215217
const output =
@@ -225,6 +227,8 @@ export const command: CommandModule<SharedOptions, DefaultArgs> = {
225227
);
226228
// Capture the error with Sentry
227229
captureException(error);
230+
} finally {
231+
await backgroundTools.cleanup();
228232
}
229233

230234
logger.log(

0 commit comments

Comments
 (0)