@voltagent/core 1.1.0 → 1.1.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/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +30 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6943,6 +6943,12 @@ declare class VoltAgent {
|
|
|
6943
6943
|
* Shutdown telemetry (delegates to VoltAgentObservability)
|
|
6944
6944
|
*/
|
|
6945
6945
|
shutdownTelemetry(): Promise<void>;
|
|
6946
|
+
/**
|
|
6947
|
+
* Gracefully shutdown all VoltAgent resources
|
|
6948
|
+
* This includes stopping the server, suspending workflows, and shutting down telemetry
|
|
6949
|
+
* Useful for programmatic cleanup or when integrating with other frameworks
|
|
6950
|
+
*/
|
|
6951
|
+
shutdown(): Promise<void>;
|
|
6946
6952
|
}
|
|
6947
6953
|
|
|
6948
6954
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -6943,6 +6943,12 @@ declare class VoltAgent {
|
|
|
6943
6943
|
* Shutdown telemetry (delegates to VoltAgentObservability)
|
|
6944
6944
|
*/
|
|
6945
6945
|
shutdownTelemetry(): Promise<void>;
|
|
6946
|
+
/**
|
|
6947
|
+
* Gracefully shutdown all VoltAgent resources
|
|
6948
|
+
* This includes stopping the server, suspending workflows, and shutting down telemetry
|
|
6949
|
+
* Useful for programmatic cleanup or when integrating with other frameworks
|
|
6950
|
+
*/
|
|
6951
|
+
shutdown(): Promise<void>;
|
|
6946
6952
|
}
|
|
6947
6953
|
|
|
6948
6954
|
/**
|
package/dist/index.js
CHANGED
|
@@ -12879,11 +12879,10 @@ var VoltAgent = class {
|
|
|
12879
12879
|
* Setup graceful shutdown handlers
|
|
12880
12880
|
*/
|
|
12881
12881
|
setupShutdownHandlers() {
|
|
12882
|
-
const
|
|
12883
|
-
this.logger.info(`[VoltAgent] Received ${signal}
|
|
12882
|
+
const handleSignal = /* @__PURE__ */ __name(async (signal) => {
|
|
12883
|
+
this.logger.info(`[VoltAgent] Received ${signal}...`);
|
|
12884
12884
|
try {
|
|
12885
|
-
await this.
|
|
12886
|
-
this.logger.info("[VoltAgent] All workflows suspended, exiting...");
|
|
12885
|
+
await this.shutdown();
|
|
12887
12886
|
if (this.isSoleSignalHandler(signal)) {
|
|
12888
12887
|
process.exit(0);
|
|
12889
12888
|
}
|
|
@@ -12893,9 +12892,9 @@ var VoltAgent = class {
|
|
|
12893
12892
|
process.exit(1);
|
|
12894
12893
|
}
|
|
12895
12894
|
}
|
|
12896
|
-
}, "
|
|
12897
|
-
process.
|
|
12898
|
-
process.
|
|
12895
|
+
}, "handleSignal");
|
|
12896
|
+
process.once("SIGTERM", () => handleSignal("SIGTERM"));
|
|
12897
|
+
process.once("SIGINT", () => handleSignal("SIGINT"));
|
|
12899
12898
|
process.on("unhandledRejection", (reason) => {
|
|
12900
12899
|
this.logger.error("[VoltAgent] Unhandled Promise Rejection:", {
|
|
12901
12900
|
reason: reason instanceof Error ? reason.message : reason,
|
|
@@ -13052,6 +13051,30 @@ var VoltAgent = class {
|
|
|
13052
13051
|
await this.observability.shutdown();
|
|
13053
13052
|
}
|
|
13054
13053
|
}
|
|
13054
|
+
/**
|
|
13055
|
+
* Gracefully shutdown all VoltAgent resources
|
|
13056
|
+
* This includes stopping the server, suspending workflows, and shutting down telemetry
|
|
13057
|
+
* Useful for programmatic cleanup or when integrating with other frameworks
|
|
13058
|
+
*/
|
|
13059
|
+
async shutdown() {
|
|
13060
|
+
this.logger.info("[VoltAgent] Starting graceful shutdown...");
|
|
13061
|
+
try {
|
|
13062
|
+
if (this.serverInstance?.isRunning()) {
|
|
13063
|
+
this.logger.info("[VoltAgent] Stopping server...");
|
|
13064
|
+
await this.stopServer();
|
|
13065
|
+
}
|
|
13066
|
+
this.logger.info("[VoltAgent] Suspending active workflows...");
|
|
13067
|
+
await this.workflowRegistry.suspendAllActiveWorkflows();
|
|
13068
|
+
if (this.observability) {
|
|
13069
|
+
this.logger.info("[VoltAgent] Shutting down telemetry...");
|
|
13070
|
+
await this.shutdownTelemetry();
|
|
13071
|
+
}
|
|
13072
|
+
this.logger.info("[VoltAgent] Graceful shutdown complete");
|
|
13073
|
+
} catch (error) {
|
|
13074
|
+
this.logger.error("[VoltAgent] Error during shutdown:", { error });
|
|
13075
|
+
throw error;
|
|
13076
|
+
}
|
|
13077
|
+
}
|
|
13055
13078
|
};
|
|
13056
13079
|
|
|
13057
13080
|
// src/index.ts
|