@phuetz/code-buddy 2.1.0 → 2.2.0
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.fr.md +2 -2
- package/README.md +3 -2
- package/codebuddy-runtime.json +4 -4
- package/dist/agent/execution/agent-executor.js +16 -5
- package/dist/agent/execution/tool-selection-strategy.d.ts +7 -0
- package/dist/agent/execution/tool-selection-strategy.js +13 -0
- package/dist/codebuddy/fleet-tool-defs.d.ts +1 -0
- package/dist/codebuddy/fleet-tool-defs.js +31 -0
- package/dist/codebuddy/providers/provider-openai-compat.d.ts +7 -0
- package/dist/codebuddy/providers/provider-openai-compat.js +28 -0
- package/dist/commands/handlers/missing-handlers.js +8 -0
- package/dist/commands/mcp.d.ts +13 -0
- package/dist/commands/mcp.js +62 -21
- package/dist/config/model-tools.js +99 -0
- package/dist/doctor/integrations.d.ts +18 -0
- package/dist/doctor/integrations.js +14 -0
- package/dist/errors/crash-handler.js +2 -0
- package/dist/mcp/client.d.ts +11 -0
- package/dist/mcp/client.js +62 -3
- package/dist/mcp/mcp-oauth-constants.d.ts +8 -0
- package/dist/mcp/mcp-oauth-constants.js +9 -0
- package/dist/mcp/mcp-oauth-provider.d.ts +80 -0
- package/dist/mcp/mcp-oauth-provider.js +241 -0
- package/dist/mcp/mcp-oauth.d.ts +60 -1
- package/dist/mcp/mcp-oauth.js +241 -65
- package/dist/mcp/transports.d.ts +4 -0
- package/dist/mcp/transports.js +52 -3
- package/dist/services/prompt-builder.js +3 -1
- package/dist/services/runtime-settings-context.d.ts +8 -0
- package/dist/services/runtime-settings-context.js +11 -1
- package/dist/tools/metadata.js +9 -0
- package/dist/tools/peer-tool-invoke-tool.d.ts +61 -0
- package/dist/tools/peer-tool-invoke-tool.js +396 -0
- package/dist/tools/registry/fleet-tools.d.ts +12 -3
- package/dist/tools/registry/fleet-tools.js +116 -4
- package/dist/tools/registry/index.d.ts +1 -1
- package/dist/tools/registry/index.js +2 -2
- package/dist/utils/config-validation/schema.d.ts +2 -2
- package/dist/utils/graceful-shutdown.d.ts +8 -0
- package/dist/utils/graceful-shutdown.js +23 -7
- package/package.json +1 -1
|
@@ -12,6 +12,22 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { logger, getLogger } from './logger.js';
|
|
14
14
|
import { DisposableManager, registerDisposable } from './disposable.js';
|
|
15
|
+
import { EXIT_CODES } from './exit-codes.js';
|
|
16
|
+
/**
|
|
17
|
+
* Exit code after a shutdown signal. Only an explicit headless run (`-p`, loop,
|
|
18
|
+
* try: CODEBUDDY_HEADLESS=true) reports SIGINT as 130 (USER_CANCELLED), so a
|
|
19
|
+
* script can tell an interruption from success. Servers and daemons whose stdout
|
|
20
|
+
* is merely not a TTY (systemd) keep exit 0: a normal SIGTERM stop must not be
|
|
21
|
+
* reported as a failure and trigger Restart=on-failure.
|
|
22
|
+
*/
|
|
23
|
+
export function signalExitCode(signal, env = process.env) {
|
|
24
|
+
if (env.CODEBUDDY_HEADLESS !== 'true')
|
|
25
|
+
return 0;
|
|
26
|
+
return signal === 'SIGINT' ? EXIT_CODES.USER_CANCELLED : 0;
|
|
27
|
+
}
|
|
28
|
+
function shutdownProgressStream() {
|
|
29
|
+
return process.stdout.isTTY ? process.stdout : process.stderr;
|
|
30
|
+
}
|
|
15
31
|
const DEFAULT_OPTIONS = {
|
|
16
32
|
timeoutMs: 30000, // 30 seconds max before force exit
|
|
17
33
|
forceExitOnTimeout: true,
|
|
@@ -69,7 +85,7 @@ export class GracefulShutdownManager {
|
|
|
69
85
|
// Show user-friendly message
|
|
70
86
|
logger.info(`Received ${signal}. Shutting down gracefully...`);
|
|
71
87
|
try {
|
|
72
|
-
await this.shutdown({ exitCode:
|
|
88
|
+
await this.shutdown({ exitCode: signalExitCode(signal) });
|
|
73
89
|
}
|
|
74
90
|
catch (error) {
|
|
75
91
|
logger.error('Error during shutdown', error instanceof Error ? error : new Error(String(error)));
|
|
@@ -232,7 +248,7 @@ export class GracefulShutdownManager {
|
|
|
232
248
|
for (const handler of this.handlers) {
|
|
233
249
|
try {
|
|
234
250
|
if (showProgress) {
|
|
235
|
-
|
|
251
|
+
shutdownProgressStream().write(` [shutdown] ${handler.name}...`);
|
|
236
252
|
}
|
|
237
253
|
logger.debug(`Running shutdown handler: ${handler.name}`);
|
|
238
254
|
const result = handler.handler();
|
|
@@ -241,14 +257,14 @@ export class GracefulShutdownManager {
|
|
|
241
257
|
}
|
|
242
258
|
this.completedHandlers.add(handler.name);
|
|
243
259
|
if (showProgress) {
|
|
244
|
-
|
|
260
|
+
shutdownProgressStream().write(' done\n');
|
|
245
261
|
}
|
|
246
262
|
logger.debug(`Completed shutdown handler: ${handler.name}`);
|
|
247
263
|
}
|
|
248
264
|
catch (error) {
|
|
249
265
|
this.completedHandlers.add(handler.name); // Mark as completed even on error
|
|
250
266
|
if (showProgress) {
|
|
251
|
-
|
|
267
|
+
shutdownProgressStream().write(' failed\n');
|
|
252
268
|
}
|
|
253
269
|
logger.error(`Error in shutdown handler ${handler.name}:`, error instanceof Error ? error : new Error(String(error)));
|
|
254
270
|
// Continue with other handlers even if one fails
|
|
@@ -257,18 +273,18 @@ export class GracefulShutdownManager {
|
|
|
257
273
|
// Then, dispose all registered disposables
|
|
258
274
|
try {
|
|
259
275
|
if (showProgress) {
|
|
260
|
-
|
|
276
|
+
shutdownProgressStream().write(' [shutdown] disposing resources...');
|
|
261
277
|
}
|
|
262
278
|
logger.debug('Disposing all registered resources...');
|
|
263
279
|
await DisposableManager.getInstance().disposeAll();
|
|
264
280
|
if (showProgress) {
|
|
265
|
-
|
|
281
|
+
shutdownProgressStream().write(' done\n');
|
|
266
282
|
}
|
|
267
283
|
logger.debug('All resources disposed');
|
|
268
284
|
}
|
|
269
285
|
catch (error) {
|
|
270
286
|
if (showProgress) {
|
|
271
|
-
|
|
287
|
+
shutdownProgressStream().write(' failed\n');
|
|
272
288
|
}
|
|
273
289
|
logger.error('Error disposing resources:', error instanceof Error ? error : new Error(String(error)));
|
|
274
290
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phuetz/code-buddy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "AI coding agent with terminal and HTTP interfaces, optional Cowork desktop integration, multi-provider routing, tools, fleet collaboration and inspectable memory. See release notes for supported integrations and limits.",
|
|
5
5
|
"author": "Patrice Huetz <patrice.huetz@gmail.com>",
|
|
6
6
|
"repository": {
|