teleton 0.8.2 → 0.8.4
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.md +230 -294
- package/dist/bootstrap-NNEI3Z5H.js +126 -0
- package/dist/{chunk-HEDJCLA6.js → chunk-35MX4ZUI.js} +2 -122
- package/dist/{chunk-57URFK6M.js → chunk-5LOHRZYY.js} +64 -15
- package/dist/{chunk-YOSUPUAJ.js → chunk-6OOHHJ4N.js} +1 -174
- package/dist/{chunk-W25Z7CM6.js → chunk-ALKAAG4O.js} +3 -3
- package/dist/chunk-CUE4UZXR.js +129 -0
- package/dist/{chunk-XBSCYMKM.js → chunk-G7PCW63M.js} +14 -14
- package/dist/{chunk-VYKW7FMV.js → chunk-GHMXWAXI.js} +1 -1
- package/dist/chunk-JROBTXWY.js +908 -0
- package/dist/{chunk-J73TA3UM.js → chunk-LVTKJQ7O.js} +7 -5
- package/dist/{chunk-GGXJLMOH.js → chunk-LZQOX6YY.js} +283 -1061
- package/dist/{chunk-7YKSXOQQ.js → chunk-NH2CNRKJ.js} +131 -241
- package/dist/chunk-NVKBBTI6.js +128 -0
- package/dist/{chunk-2IZU3REP.js → chunk-UMUONAD6.js} +143 -220
- package/dist/chunk-WTDAICGT.js +175 -0
- package/dist/{chunk-55SKE6YH.js → chunk-XDZDOKIF.js} +1 -1
- package/dist/cli/index.js +41 -24
- package/dist/{client-YOOHI776.js → client-5KD25NOP.js} +4 -3
- package/dist/index.js +14 -10
- package/dist/local-IHKJFQJS.js +9 -0
- package/dist/{memory-Q6EWGK2S.js → memory-QMJRM3XJ.js} +5 -3
- package/dist/{memory-hook-WUXJNVT5.js → memory-hook-VUNWZ3NY.js} +5 -4
- package/dist/{migrate-WFU6COBN.js → migrate-5VBAP52B.js} +3 -2
- package/dist/{server-YODFBZKG.js → server-AJCOURH7.js} +13 -10
- package/dist/{server-GYZXKIKU.js → server-WWGVDFPW.js} +38 -13
- package/dist/{setup-server-IZBUOJRU.js → setup-server-VDY64CWW.js} +5 -3
- package/dist/{store-7M4XV6M5.js → store-BY7S6IFN.js} +4 -3
- package/dist/{tool-index-NYH57UWP.js → tool-index-FTERJSZK.js} +2 -1
- package/package.json +1 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentLifecycle
|
|
3
|
+
} from "./chunk-NVKBBTI6.js";
|
|
1
4
|
import {
|
|
2
5
|
telegramGetMyGiftsExecutor,
|
|
3
6
|
telegramGetMyGiftsTool
|
|
@@ -22,21 +25,17 @@ import {
|
|
|
22
25
|
fromUnits,
|
|
23
26
|
getBlocklistConfig,
|
|
24
27
|
getDecimals,
|
|
25
|
-
getDefaultConfigPath,
|
|
26
28
|
getTriggersConfig,
|
|
27
29
|
hasStyledButtons,
|
|
28
30
|
listPluginSecretKeys,
|
|
29
|
-
loadConfig,
|
|
30
31
|
loadEnhancedPlugins,
|
|
31
32
|
loadSoul,
|
|
32
33
|
module_default,
|
|
33
34
|
parseHtml,
|
|
34
35
|
randomLong,
|
|
35
|
-
readRawConfig,
|
|
36
36
|
sanitizeForContext,
|
|
37
37
|
sanitizeForPrompt,
|
|
38
38
|
sendTon,
|
|
39
|
-
setNestedValue,
|
|
40
39
|
stripCustomEmoji,
|
|
41
40
|
toGrammyKeyboard,
|
|
42
41
|
toLong,
|
|
@@ -48,9 +47,8 @@ import {
|
|
|
48
47
|
validateWritePath,
|
|
49
48
|
withBlockchainRetry,
|
|
50
49
|
withTxLock,
|
|
51
|
-
writePluginSecret
|
|
52
|
-
|
|
53
|
-
} from "./chunk-GGXJLMOH.js";
|
|
50
|
+
writePluginSecret
|
|
51
|
+
} from "./chunk-LZQOX6YY.js";
|
|
54
52
|
import {
|
|
55
53
|
getCachedTonClient,
|
|
56
54
|
getKeyPair,
|
|
@@ -58,20 +56,17 @@ import {
|
|
|
58
56
|
getWalletAddress,
|
|
59
57
|
getWalletBalance,
|
|
60
58
|
invalidateTonClientCache,
|
|
61
|
-
loadTemplate,
|
|
62
59
|
loadWallet,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} from "./chunk-
|
|
68
|
-
import {
|
|
69
|
-
getEffectiveApiKey,
|
|
70
|
-
getProviderModel
|
|
71
|
-
} from "./chunk-J73TA3UM.js";
|
|
60
|
+
readRawConfig,
|
|
61
|
+
setNestedValue,
|
|
62
|
+
setToncenterApiKey,
|
|
63
|
+
writeRawConfig
|
|
64
|
+
} from "./chunk-JROBTXWY.js";
|
|
72
65
|
import {
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
getDefaultConfigPath,
|
|
67
|
+
loadConfig,
|
|
68
|
+
loadTemplate
|
|
69
|
+
} from "./chunk-NH2CNRKJ.js";
|
|
75
70
|
import {
|
|
76
71
|
ChatStore,
|
|
77
72
|
JOURNAL_SCHEMA,
|
|
@@ -84,7 +79,10 @@ import {
|
|
|
84
79
|
initializeMemory,
|
|
85
80
|
migrateFromMainDb,
|
|
86
81
|
openModuleDb
|
|
87
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-GHMXWAXI.js";
|
|
83
|
+
import {
|
|
84
|
+
getErrorMessage
|
|
85
|
+
} from "./chunk-3UFPFWYP.js";
|
|
88
86
|
import {
|
|
89
87
|
ELEVENLABS_TTS_URL,
|
|
90
88
|
GECKOTERMINAL_API_URL,
|
|
@@ -111,6 +109,13 @@ import {
|
|
|
111
109
|
WEB_FETCH_MAX_TEXT_LENGTH,
|
|
112
110
|
WEB_SEARCH_MAX_RESULTS
|
|
113
111
|
} from "./chunk-C4NKJT2Z.js";
|
|
112
|
+
import {
|
|
113
|
+
getEffectiveApiKey,
|
|
114
|
+
getProviderModel
|
|
115
|
+
} from "./chunk-LVTKJQ7O.js";
|
|
116
|
+
import {
|
|
117
|
+
getProviderMetadata
|
|
118
|
+
} from "./chunk-6OOHHJ4N.js";
|
|
114
119
|
import {
|
|
115
120
|
fetchWithTimeout
|
|
116
121
|
} from "./chunk-XQUHC3JZ.js";
|
|
@@ -18037,127 +18042,6 @@ var UserHookEvaluator = class {
|
|
|
18037
18042
|
}
|
|
18038
18043
|
};
|
|
18039
18044
|
|
|
18040
|
-
// src/agent/lifecycle.ts
|
|
18041
|
-
import { EventEmitter } from "events";
|
|
18042
|
-
var log136 = createLogger("Lifecycle");
|
|
18043
|
-
var AgentLifecycle = class extends EventEmitter {
|
|
18044
|
-
state = "stopped";
|
|
18045
|
-
error;
|
|
18046
|
-
startPromise = null;
|
|
18047
|
-
stopPromise = null;
|
|
18048
|
-
runningSince = null;
|
|
18049
|
-
registeredStartFn = null;
|
|
18050
|
-
registeredStopFn = null;
|
|
18051
|
-
getState() {
|
|
18052
|
-
return this.state;
|
|
18053
|
-
}
|
|
18054
|
-
getError() {
|
|
18055
|
-
return this.error;
|
|
18056
|
-
}
|
|
18057
|
-
getUptime() {
|
|
18058
|
-
if (this.state !== "running" || this.runningSince === null) {
|
|
18059
|
-
return null;
|
|
18060
|
-
}
|
|
18061
|
-
return Math.floor((Date.now() - this.runningSince) / 1e3);
|
|
18062
|
-
}
|
|
18063
|
-
/**
|
|
18064
|
-
* Register the start/stop callbacks so start()/stop() can be called without args.
|
|
18065
|
-
*/
|
|
18066
|
-
registerCallbacks(startFn, stopFn) {
|
|
18067
|
-
this.registeredStartFn = startFn;
|
|
18068
|
-
this.registeredStopFn = stopFn;
|
|
18069
|
-
}
|
|
18070
|
-
/**
|
|
18071
|
-
* Start the agent. Uses the provided callback or falls back to registered one.
|
|
18072
|
-
* - No-op if already running
|
|
18073
|
-
* - Returns existing promise if already starting
|
|
18074
|
-
* - Throws if currently stopping
|
|
18075
|
-
*/
|
|
18076
|
-
async start(startFn) {
|
|
18077
|
-
const fn = startFn ?? this.registeredStartFn;
|
|
18078
|
-
if (!fn) {
|
|
18079
|
-
throw new Error("No start function provided or registered");
|
|
18080
|
-
}
|
|
18081
|
-
if (this.state === "running") {
|
|
18082
|
-
return;
|
|
18083
|
-
}
|
|
18084
|
-
if (this.state === "starting") {
|
|
18085
|
-
return this.startPromise ?? Promise.resolve();
|
|
18086
|
-
}
|
|
18087
|
-
if (this.state === "stopping") {
|
|
18088
|
-
throw new Error("Cannot start while agent is stopping");
|
|
18089
|
-
}
|
|
18090
|
-
this.transition("starting");
|
|
18091
|
-
this.startPromise = (async () => {
|
|
18092
|
-
try {
|
|
18093
|
-
await fn();
|
|
18094
|
-
this.error = void 0;
|
|
18095
|
-
this.runningSince = Date.now();
|
|
18096
|
-
this.transition("running");
|
|
18097
|
-
} catch (err) {
|
|
18098
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
18099
|
-
this.error = message;
|
|
18100
|
-
this.runningSince = null;
|
|
18101
|
-
this.transition("stopped", message);
|
|
18102
|
-
throw err;
|
|
18103
|
-
} finally {
|
|
18104
|
-
this.startPromise = null;
|
|
18105
|
-
}
|
|
18106
|
-
})();
|
|
18107
|
-
return this.startPromise;
|
|
18108
|
-
}
|
|
18109
|
-
/**
|
|
18110
|
-
* Stop the agent. Uses the provided callback or falls back to registered one.
|
|
18111
|
-
* - No-op if already stopped
|
|
18112
|
-
* - Returns existing promise if already stopping
|
|
18113
|
-
* - If starting, waits for start to complete then stops
|
|
18114
|
-
*/
|
|
18115
|
-
async stop(stopFn) {
|
|
18116
|
-
const fn = stopFn ?? this.registeredStopFn;
|
|
18117
|
-
if (!fn) {
|
|
18118
|
-
throw new Error("No stop function provided or registered");
|
|
18119
|
-
}
|
|
18120
|
-
if (this.state === "stopped") {
|
|
18121
|
-
return;
|
|
18122
|
-
}
|
|
18123
|
-
if (this.state === "stopping") {
|
|
18124
|
-
return this.stopPromise ?? Promise.resolve();
|
|
18125
|
-
}
|
|
18126
|
-
if (this.state === "starting" && this.startPromise) {
|
|
18127
|
-
try {
|
|
18128
|
-
await this.startPromise;
|
|
18129
|
-
} catch {
|
|
18130
|
-
return;
|
|
18131
|
-
}
|
|
18132
|
-
}
|
|
18133
|
-
this.transition("stopping");
|
|
18134
|
-
this.stopPromise = (async () => {
|
|
18135
|
-
try {
|
|
18136
|
-
await fn();
|
|
18137
|
-
} catch (err) {
|
|
18138
|
-
log136.error({ err }, "Error during agent stop");
|
|
18139
|
-
} finally {
|
|
18140
|
-
this.runningSince = null;
|
|
18141
|
-
this.transition("stopped");
|
|
18142
|
-
this.stopPromise = null;
|
|
18143
|
-
}
|
|
18144
|
-
})();
|
|
18145
|
-
return this.stopPromise;
|
|
18146
|
-
}
|
|
18147
|
-
transition(newState, error) {
|
|
18148
|
-
this.state = newState;
|
|
18149
|
-
const event = {
|
|
18150
|
-
state: newState,
|
|
18151
|
-
timestamp: Date.now()
|
|
18152
|
-
};
|
|
18153
|
-
if (error !== void 0) {
|
|
18154
|
-
event.error = error;
|
|
18155
|
-
}
|
|
18156
|
-
log136.info(`Agent state: ${newState}${error ? ` (${error})` : ""}`);
|
|
18157
|
-
this.emit("stateChange", event);
|
|
18158
|
-
}
|
|
18159
|
-
};
|
|
18160
|
-
|
|
18161
18045
|
// src/bot/rate-limiter.ts
|
|
18162
18046
|
var PluginRateLimiter = class {
|
|
18163
18047
|
windows = /* @__PURE__ */ new Map();
|
|
@@ -18199,7 +18083,7 @@ var PluginRateLimiter = class {
|
|
|
18199
18083
|
};
|
|
18200
18084
|
|
|
18201
18085
|
// src/index.ts
|
|
18202
|
-
var
|
|
18086
|
+
var log136 = createLogger("App");
|
|
18203
18087
|
var TeletonApp = class {
|
|
18204
18088
|
config;
|
|
18205
18089
|
agent;
|
|
@@ -18293,13 +18177,52 @@ var TeletonApp = class {
|
|
|
18293
18177
|
getLifecycle() {
|
|
18294
18178
|
return this.lifecycle;
|
|
18295
18179
|
}
|
|
18180
|
+
// --- Public accessors for API-only bootstrap mode ---
|
|
18181
|
+
getAgent() {
|
|
18182
|
+
return this.agent;
|
|
18183
|
+
}
|
|
18184
|
+
getBridge() {
|
|
18185
|
+
return this.bridge;
|
|
18186
|
+
}
|
|
18187
|
+
getMemory() {
|
|
18188
|
+
return this.memory;
|
|
18189
|
+
}
|
|
18190
|
+
getToolRegistry() {
|
|
18191
|
+
return this.toolRegistry;
|
|
18192
|
+
}
|
|
18193
|
+
getPlugins() {
|
|
18194
|
+
return this.modules.filter((m) => this.toolRegistry.isPluginModule(m.name)).map((m) => ({ name: m.name, version: m.version ?? "0.0.0" }));
|
|
18195
|
+
}
|
|
18196
|
+
getWebuiConfig() {
|
|
18197
|
+
return this.config.webui;
|
|
18198
|
+
}
|
|
18199
|
+
getConfigPath() {
|
|
18200
|
+
return this.configPath;
|
|
18201
|
+
}
|
|
18202
|
+
/** Start agent subsystems without WebUI/API servers. For bootstrap mode. */
|
|
18203
|
+
async startAgentSubsystems() {
|
|
18204
|
+
this.lifecycle.registerCallbacks(
|
|
18205
|
+
() => this.startAgent(),
|
|
18206
|
+
() => this.stopAgent()
|
|
18207
|
+
);
|
|
18208
|
+
await this.lifecycle.start();
|
|
18209
|
+
}
|
|
18210
|
+
/** Stop agent subsystems and close database. For bootstrap mode. */
|
|
18211
|
+
async stopAgentSubsystems() {
|
|
18212
|
+
await this.lifecycle.stop();
|
|
18213
|
+
try {
|
|
18214
|
+
closeDatabase();
|
|
18215
|
+
} catch (e) {
|
|
18216
|
+
log136.error({ err: e }, "Database close failed");
|
|
18217
|
+
}
|
|
18218
|
+
}
|
|
18296
18219
|
/**
|
|
18297
18220
|
* Start the agent
|
|
18298
18221
|
*/
|
|
18299
18222
|
async start() {
|
|
18300
18223
|
const blue = "\x1B[34m";
|
|
18301
18224
|
const reset = "\x1B[0m";
|
|
18302
|
-
|
|
18225
|
+
log136.info(`
|
|
18303
18226
|
${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
|
|
18304
18227
|
\u2502 \u2502
|
|
18305
18228
|
\u2502 ______________ ________________ _ __ ___ _____________ ________ \u2502
|
|
@@ -18316,7 +18239,7 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18316
18239
|
);
|
|
18317
18240
|
if (this.config.webui.enabled) {
|
|
18318
18241
|
try {
|
|
18319
|
-
const { WebUIServer } = await import("./server-
|
|
18242
|
+
const { WebUIServer } = await import("./server-AJCOURH7.js");
|
|
18320
18243
|
const mcpServers = () => Object.entries(this.config.mcp.servers).map(([name, serverConfig]) => {
|
|
18321
18244
|
const type = serverConfig.command ? "stdio" : serverConfig.url ? "streamable-http" : "sse";
|
|
18322
18245
|
const target = serverConfig.command ?? serverConfig.url ?? "";
|
|
@@ -18363,13 +18286,13 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18363
18286
|
});
|
|
18364
18287
|
await this.webuiServer.start();
|
|
18365
18288
|
} catch (error) {
|
|
18366
|
-
|
|
18367
|
-
|
|
18289
|
+
log136.error({ err: error }, "\u274C Failed to start WebUI server");
|
|
18290
|
+
log136.warn("\u26A0\uFE0F Continuing without WebUI...");
|
|
18368
18291
|
}
|
|
18369
18292
|
}
|
|
18370
18293
|
if (this.config.api?.enabled) {
|
|
18371
18294
|
try {
|
|
18372
|
-
const { ApiServer: ApiServerClass } = await import("./server-
|
|
18295
|
+
const { ApiServer: ApiServerClass } = await import("./server-WWGVDFPW.js");
|
|
18373
18296
|
const mcpServers = () => Object.entries(this.config.mcp.servers).map(([name, serverConfig]) => {
|
|
18374
18297
|
const type = serverConfig.command ? "stdio" : serverConfig.url ? "streamable-http" : "sse";
|
|
18375
18298
|
const target = serverConfig.command ?? serverConfig.url ?? "";
|
|
@@ -18423,8 +18346,8 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18423
18346
|
process.stdout.write(JSON.stringify(creds) + "\n");
|
|
18424
18347
|
}
|
|
18425
18348
|
} catch (error) {
|
|
18426
|
-
|
|
18427
|
-
|
|
18349
|
+
log136.error({ err: error }, "Failed to start Management API server");
|
|
18350
|
+
log136.warn("Continuing without Management API...");
|
|
18428
18351
|
}
|
|
18429
18352
|
}
|
|
18430
18353
|
await this.lifecycle.start(() => this.startAgent());
|
|
@@ -18457,7 +18380,7 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18457
18380
|
}
|
|
18458
18381
|
this.modules.push(mod);
|
|
18459
18382
|
} catch (error) {
|
|
18460
|
-
|
|
18383
|
+
log136.error(
|
|
18461
18384
|
`\u274C Plugin "${mod.name}" failed to load: ${error instanceof Error ? error.message : error}`
|
|
18462
18385
|
);
|
|
18463
18386
|
}
|
|
@@ -18473,7 +18396,7 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18473
18396
|
if (mcp.count > 0) {
|
|
18474
18397
|
this.toolCount = this.toolRegistry.count;
|
|
18475
18398
|
mcpServerNames.push(...mcp.names);
|
|
18476
|
-
|
|
18399
|
+
log136.info(
|
|
18477
18400
|
`\u{1F50C} MCP: ${mcp.count} tools from ${mcp.names.length} server(s) (${mcp.names.join(", ")})`
|
|
18478
18401
|
);
|
|
18479
18402
|
}
|
|
@@ -18481,7 +18404,7 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18481
18404
|
}
|
|
18482
18405
|
this.toolRegistry.loadConfigFromDB(getDatabase().getDb());
|
|
18483
18406
|
if (this.config.tool_rag.enabled) {
|
|
18484
|
-
const { ToolIndex } = await import("./tool-index-
|
|
18407
|
+
const { ToolIndex } = await import("./tool-index-FTERJSZK.js");
|
|
18485
18408
|
const toolIndex2 = new ToolIndex(
|
|
18486
18409
|
getDatabase().getDb(),
|
|
18487
18410
|
this.memory.embedder,
|
|
@@ -18501,19 +18424,19 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18501
18424
|
const provider = this.config.agent.provider || "anthropic";
|
|
18502
18425
|
const providerMeta = getProviderMetadata(provider);
|
|
18503
18426
|
const allNames = [...moduleNames, ...pluginNames, ...mcpServerNames];
|
|
18504
|
-
|
|
18427
|
+
log136.info(
|
|
18505
18428
|
`\u{1F50C} ${this.toolCount} tools loaded (${allNames.join(", ")})${pluginToolCount > 0 ? ` \u2014 ${pluginToolCount} from plugins` : ""}`
|
|
18506
18429
|
);
|
|
18507
18430
|
if (providerMeta.toolLimit !== null && this.toolCount > providerMeta.toolLimit) {
|
|
18508
|
-
|
|
18431
|
+
log136.warn(
|
|
18509
18432
|
`\u26A0\uFE0F Tool count (${this.toolCount}) exceeds ${providerMeta.displayName} limit (${providerMeta.toolLimit})`
|
|
18510
18433
|
);
|
|
18511
18434
|
}
|
|
18512
|
-
const { migrateSessionsToDb } = await import("./migrate-
|
|
18435
|
+
const { migrateSessionsToDb } = await import("./migrate-5VBAP52B.js");
|
|
18513
18436
|
migrateSessionsToDb();
|
|
18514
18437
|
const { cleanupOldTranscripts } = await import("./transcript-IM7G25OS.js");
|
|
18515
18438
|
cleanupOldTranscripts(30);
|
|
18516
|
-
const { pruneOldSessions } = await import("./store-
|
|
18439
|
+
const { pruneOldSessions } = await import("./store-BY7S6IFN.js");
|
|
18517
18440
|
pruneOldSessions(30);
|
|
18518
18441
|
if (this.memory.embedder.warmup) {
|
|
18519
18442
|
await this.memory.embedder.warmup();
|
|
@@ -18525,7 +18448,7 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18525
18448
|
if (indexResult.indexed > 0) {
|
|
18526
18449
|
ftsResult = db2.rebuildFtsIndexes();
|
|
18527
18450
|
}
|
|
18528
|
-
import("./memory-hook-
|
|
18451
|
+
import("./memory-hook-VUNWZ3NY.js").then(
|
|
18529
18452
|
({ consolidateOldMemoryFiles }) => consolidateOldMemoryFiles({
|
|
18530
18453
|
apiKey: this.config.agent.api_key,
|
|
18531
18454
|
provider: this.config.agent.provider,
|
|
@@ -18533,29 +18456,29 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18533
18456
|
})
|
|
18534
18457
|
).then((r) => {
|
|
18535
18458
|
if (r.consolidated > 0)
|
|
18536
|
-
|
|
18537
|
-
}).catch((error) =>
|
|
18459
|
+
log136.info(`\u{1F9F9} Consolidated ${r.consolidated} old session memory files`);
|
|
18460
|
+
}).catch((error) => log136.warn({ err: error }, "Memory consolidation skipped"));
|
|
18538
18461
|
const toolIndex = this.toolRegistry.getToolIndex();
|
|
18539
18462
|
if (toolIndex) {
|
|
18540
18463
|
const t0 = Date.now();
|
|
18541
18464
|
const indexedCount = await toolIndex.indexAll(this.toolRegistry.getAll());
|
|
18542
|
-
|
|
18465
|
+
log136.info(`\u{1F50D} Tool RAG: ${indexedCount} tools indexed (${Date.now() - t0}ms)`);
|
|
18543
18466
|
}
|
|
18544
18467
|
this.agent.initializeContextBuilder(this.memory.embedder, db2.isVectorSearchReady());
|
|
18545
18468
|
if (this.config.agent.provider === "cocoon") {
|
|
18546
18469
|
try {
|
|
18547
|
-
const { registerCocoonModels } = await import("./client-
|
|
18470
|
+
const { registerCocoonModels } = await import("./client-5KD25NOP.js");
|
|
18548
18471
|
const port = this.config.cocoon?.port ?? 1e4;
|
|
18549
18472
|
const models = await registerCocoonModels(port);
|
|
18550
18473
|
if (models.length === 0) {
|
|
18551
18474
|
throw new Error(`No models found on port ${port}`);
|
|
18552
18475
|
}
|
|
18553
|
-
|
|
18476
|
+
log136.info(`Cocoon Network ready \u2014 ${models.length} model(s) on port ${port}`);
|
|
18554
18477
|
} catch (err) {
|
|
18555
|
-
|
|
18478
|
+
log136.error(
|
|
18556
18479
|
`Cocoon Network unavailable on port ${this.config.cocoon?.port ?? 1e4}: ${getErrorMessage(err)}`
|
|
18557
18480
|
);
|
|
18558
|
-
|
|
18481
|
+
log136.error("Start the Cocoon client first: cocoon start");
|
|
18559
18482
|
throw new Error(`Cocoon Network unavailable: ${getErrorMessage(err)}`);
|
|
18560
18483
|
}
|
|
18561
18484
|
}
|
|
@@ -18566,22 +18489,22 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18566
18489
|
}
|
|
18567
18490
|
if (this.config.agent.provider === "local" && this.config.agent.base_url) {
|
|
18568
18491
|
try {
|
|
18569
|
-
const { registerLocalModels } = await import("./client-
|
|
18492
|
+
const { registerLocalModels } = await import("./client-5KD25NOP.js");
|
|
18570
18493
|
const models = await registerLocalModels(this.config.agent.base_url);
|
|
18571
18494
|
if (models.length > 0) {
|
|
18572
|
-
|
|
18495
|
+
log136.info(`Discovered ${models.length} local model(s): ${models.join(", ")}`);
|
|
18573
18496
|
if (!this.config.agent.model || this.config.agent.model === "auto") {
|
|
18574
18497
|
this.config.agent.model = models[0];
|
|
18575
|
-
|
|
18498
|
+
log136.info(`Using local model: ${models[0]}`);
|
|
18576
18499
|
}
|
|
18577
18500
|
} else {
|
|
18578
|
-
|
|
18501
|
+
log136.warn("No models found on local LLM server \u2014 is it running?");
|
|
18579
18502
|
}
|
|
18580
18503
|
} catch (err) {
|
|
18581
|
-
|
|
18504
|
+
log136.error(
|
|
18582
18505
|
`Local LLM server unavailable at ${this.config.agent.base_url}: ${getErrorMessage(err)}`
|
|
18583
18506
|
);
|
|
18584
|
-
|
|
18507
|
+
log136.error("Start the LLM server first (e.g. ollama serve)");
|
|
18585
18508
|
throw new Error(`Local LLM server unavailable: ${getErrorMessage(err)}`);
|
|
18586
18509
|
}
|
|
18587
18510
|
}
|
|
@@ -18612,12 +18535,12 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18612
18535
|
startedModules.push(mod);
|
|
18613
18536
|
}
|
|
18614
18537
|
} catch (error) {
|
|
18615
|
-
|
|
18538
|
+
log136.error({ err: error }, "\u274C Module start failed, cleaning up started modules");
|
|
18616
18539
|
for (const mod of startedModules.reverse()) {
|
|
18617
18540
|
try {
|
|
18618
18541
|
await mod.stop?.();
|
|
18619
18542
|
} catch (e) {
|
|
18620
|
-
|
|
18543
|
+
log136.error({ err: e }, `\u26A0\uFE0F Module "${mod.name}" cleanup failed`);
|
|
18621
18544
|
}
|
|
18622
18545
|
}
|
|
18623
18546
|
throw error;
|
|
@@ -18629,10 +18552,10 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18629
18552
|
this.sdkDeps.grammyBot = activeDealBot.getBot();
|
|
18630
18553
|
this.sdkDeps.rateLimiter = rateLimiter;
|
|
18631
18554
|
inlineRouter.setGramJSBot(activeDealBot.getGramJSBot());
|
|
18632
|
-
|
|
18555
|
+
log136.info("\u{1F50C} Bot SDK: inline router installed");
|
|
18633
18556
|
}
|
|
18634
18557
|
if (hookRegistry.hasAnyHooks()) {
|
|
18635
|
-
const hookRunner = createHookRunner(hookRegistry, { logger:
|
|
18558
|
+
const hookRunner = createHookRunner(hookRegistry, { logger: log136 });
|
|
18636
18559
|
this.agent.setHookRunner(hookRunner);
|
|
18637
18560
|
this.hookRunner = hookRunner;
|
|
18638
18561
|
const activeHooks = [
|
|
@@ -18651,7 +18574,7 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18651
18574
|
"agent:stop"
|
|
18652
18575
|
];
|
|
18653
18576
|
const active = activeHooks.filter((n) => hookRegistry.hasHooks(n));
|
|
18654
|
-
|
|
18577
|
+
log136.info(`\u{1FA9D} Hook runner created (${active.join(", ")})`);
|
|
18655
18578
|
}
|
|
18656
18579
|
this.wirePluginEventHooks();
|
|
18657
18580
|
if (this.config.dev.hot_reload) {
|
|
@@ -18665,22 +18588,22 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18665
18588
|
});
|
|
18666
18589
|
this.pluginWatcher.start();
|
|
18667
18590
|
}
|
|
18668
|
-
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
18591
|
+
log136.info(`\u2705 SOUL.md loaded`);
|
|
18592
|
+
log136.info(`\u2705 Knowledge: ${indexResult.indexed} files, ${ftsResult.knowledge} chunks indexed`);
|
|
18593
|
+
log136.info(`\u2705 Telegram: @${username} connected`);
|
|
18594
|
+
log136.info(`\u2705 TON Blockchain: connected`);
|
|
18672
18595
|
if (this.config.tonapi_key) {
|
|
18673
|
-
|
|
18596
|
+
log136.info(`\u{1F511} TonAPI key configured`);
|
|
18674
18597
|
}
|
|
18675
|
-
|
|
18676
|
-
|
|
18677
|
-
|
|
18678
|
-
|
|
18679
|
-
|
|
18598
|
+
log136.info(`\u2705 DEXs: STON.fi, DeDust connected`);
|
|
18599
|
+
log136.info(`\u2705 Wallet: ${walletAddress || "not configured"}`);
|
|
18600
|
+
log136.info(`\u2705 Model: ${provider}/${this.config.agent.model}`);
|
|
18601
|
+
log136.info(`\u2705 Admins: ${this.config.telegram.admin_ids.join(", ")}`);
|
|
18602
|
+
log136.info(
|
|
18680
18603
|
`\u2705 Policy: DM ${this.config.telegram.dm_policy}, Groups ${this.config.telegram.group_policy}, Debounce ${this.config.telegram.debounce_ms}ms
|
|
18681
18604
|
`
|
|
18682
18605
|
);
|
|
18683
|
-
|
|
18606
|
+
log136.info("Teleton Agent is running! Press Ctrl+C to stop.");
|
|
18684
18607
|
this.startTime = Date.now();
|
|
18685
18608
|
this.messagesProcessed = 0;
|
|
18686
18609
|
if (this.hookRunner) {
|
|
@@ -18721,7 +18644,7 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18721
18644
|
}
|
|
18722
18645
|
},
|
|
18723
18646
|
(error, messages) => {
|
|
18724
|
-
|
|
18647
|
+
log136.error({ err: error }, `Error processing batch of ${messages.length} messages`);
|
|
18725
18648
|
}
|
|
18726
18649
|
);
|
|
18727
18650
|
if (!this.messageHandlersRegistered) {
|
|
@@ -18729,14 +18652,14 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18729
18652
|
try {
|
|
18730
18653
|
await this.debouncer.enqueue(message);
|
|
18731
18654
|
} catch (error) {
|
|
18732
|
-
|
|
18655
|
+
log136.error({ err: error }, "Error enqueueing message");
|
|
18733
18656
|
}
|
|
18734
18657
|
});
|
|
18735
18658
|
this.bridge.onServiceMessage(async (message) => {
|
|
18736
18659
|
try {
|
|
18737
18660
|
await this.debouncer.enqueue(message);
|
|
18738
18661
|
} catch (error) {
|
|
18739
|
-
|
|
18662
|
+
log136.error({ err: error }, "Error enqueueing service message");
|
|
18740
18663
|
}
|
|
18741
18664
|
});
|
|
18742
18665
|
this.messageHandlersRegistered = true;
|
|
@@ -18783,10 +18706,10 @@ ${blue} \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u250
|
|
|
18783
18706
|
writeRawConfig(raw, this.configPath);
|
|
18784
18707
|
const displayName = this.config.telegram.owner_name || "Unknown";
|
|
18785
18708
|
const displayUsername = this.config.telegram.owner_username ? ` (@${this.config.telegram.owner_username})` : "";
|
|
18786
|
-
|
|
18709
|
+
log136.info(`\u{1F464} Owner resolved: ${displayName}${displayUsername}`);
|
|
18787
18710
|
}
|
|
18788
18711
|
} catch (error) {
|
|
18789
|
-
|
|
18712
|
+
log136.warn(
|
|
18790
18713
|
`\u26A0\uFE0F Could not resolve owner info: ${error instanceof Error ? error.message : error}`
|
|
18791
18714
|
);
|
|
18792
18715
|
}
|
|
@@ -18855,7 +18778,7 @@ Task: "${taskDescription}"`;
|
|
|
18855
18778
|
if (this.adminHandler.isPaused()) return;
|
|
18856
18779
|
await this.messageHandler.handleMessage(message);
|
|
18857
18780
|
} catch (error) {
|
|
18858
|
-
|
|
18781
|
+
log136.error({ err: error }, "Error handling message");
|
|
18859
18782
|
}
|
|
18860
18783
|
}
|
|
18861
18784
|
/**
|
|
@@ -18865,19 +18788,19 @@ Task: "${taskDescription}"`;
|
|
|
18865
18788
|
const { getTaskStore } = await import("./tasks-WQIKXDX5.js");
|
|
18866
18789
|
const { executeScheduledTask } = await import("./task-executor-XBNJLUCS.js");
|
|
18867
18790
|
const { TaskDependencyResolver } = await import("./task-dependency-resolver-L6UUMTHK.js");
|
|
18868
|
-
const { getDatabase: getDatabase2 } = await import("./memory-
|
|
18791
|
+
const { getDatabase: getDatabase2 } = await import("./memory-QMJRM3XJ.js");
|
|
18869
18792
|
const db2 = getDatabase2().getDb();
|
|
18870
18793
|
const taskStore = getTaskStore(db2);
|
|
18871
18794
|
const match = message.text.match(/^\[TASK:([^\]]+)\]/);
|
|
18872
18795
|
if (!match) {
|
|
18873
|
-
|
|
18796
|
+
log136.warn(`Invalid task format: ${message.text}`);
|
|
18874
18797
|
return;
|
|
18875
18798
|
}
|
|
18876
18799
|
const taskId = match[1];
|
|
18877
18800
|
try {
|
|
18878
18801
|
const task = taskStore.getTask(taskId);
|
|
18879
18802
|
if (!task) {
|
|
18880
|
-
|
|
18803
|
+
log136.warn(`Task ${taskId} not found in database`);
|
|
18881
18804
|
await this.bridge.sendMessage({
|
|
18882
18805
|
chatId: message.chatId,
|
|
18883
18806
|
text: `\u26A0\uFE0F Task ${taskId} not found. It may have been deleted.`,
|
|
@@ -18886,11 +18809,11 @@ Task: "${taskDescription}"`;
|
|
|
18886
18809
|
return;
|
|
18887
18810
|
}
|
|
18888
18811
|
if (task.status === "cancelled" || task.status === "done" || task.status === "failed") {
|
|
18889
|
-
|
|
18812
|
+
log136.info(`\u23ED\uFE0F Task ${taskId} already ${task.status}, skipping`);
|
|
18890
18813
|
return;
|
|
18891
18814
|
}
|
|
18892
18815
|
if (!taskStore.canExecute(taskId)) {
|
|
18893
|
-
|
|
18816
|
+
log136.warn(`Task ${taskId} cannot execute yet - dependencies not satisfied`);
|
|
18894
18817
|
await this.bridge.sendMessage({
|
|
18895
18818
|
chatId: message.chatId,
|
|
18896
18819
|
text: `\u23F3 Task "${task.description}" is waiting for parent tasks to complete.`,
|
|
@@ -18933,13 +18856,13 @@ Task: "${taskDescription}"`;
|
|
|
18933
18856
|
});
|
|
18934
18857
|
}
|
|
18935
18858
|
taskStore.completeTask(taskId, response.content);
|
|
18936
|
-
|
|
18859
|
+
log136.info(`\u2705 Executed scheduled task ${taskId}: ${task.description}`);
|
|
18937
18860
|
if (!this.dependencyResolver) {
|
|
18938
18861
|
this.dependencyResolver = new TaskDependencyResolver(taskStore, this.bridge);
|
|
18939
18862
|
}
|
|
18940
18863
|
await this.dependencyResolver.onTaskComplete(taskId);
|
|
18941
18864
|
} catch (error) {
|
|
18942
|
-
|
|
18865
|
+
log136.error({ err: error }, "Error handling scheduled task");
|
|
18943
18866
|
try {
|
|
18944
18867
|
taskStore.failTask(taskId, getErrorMessage(error));
|
|
18945
18868
|
if (!this.dependencyResolver) {
|
|
@@ -18964,7 +18887,7 @@ Task: "${taskDescription}"`;
|
|
|
18964
18887
|
try {
|
|
18965
18888
|
await withHooks.onMessage(event);
|
|
18966
18889
|
} catch (err) {
|
|
18967
|
-
|
|
18890
|
+
log136.error(
|
|
18968
18891
|
`\u274C [${mod.name}] onMessage error: ${err instanceof Error ? err.message : err}`
|
|
18969
18892
|
);
|
|
18970
18893
|
}
|
|
@@ -18974,7 +18897,7 @@ Task: "${taskDescription}"`;
|
|
|
18974
18897
|
]);
|
|
18975
18898
|
const hookCount = this.modules.filter((m) => m.onMessage).length;
|
|
18976
18899
|
if (hookCount > 0) {
|
|
18977
|
-
|
|
18900
|
+
log136.info(`\u{1F517} ${hookCount} plugin onMessage hook(s) registered`);
|
|
18978
18901
|
}
|
|
18979
18902
|
if (!this.callbackHandlerRegistered) {
|
|
18980
18903
|
this.bridge.getClient().addCallbackQueryHandler(async (update) => {
|
|
@@ -18994,7 +18917,7 @@ Task: "${taskDescription}"`;
|
|
|
18994
18917
|
try {
|
|
18995
18918
|
await this.bridge.getClient().answerCallbackQuery(queryId, { message: text, alert });
|
|
18996
18919
|
} catch (err) {
|
|
18997
|
-
|
|
18920
|
+
log136.error(
|
|
18998
18921
|
`\u274C Failed to answer callback query: ${err instanceof Error ? err.message : err}`
|
|
18999
18922
|
);
|
|
19000
18923
|
}
|
|
@@ -19014,7 +18937,7 @@ Task: "${taskDescription}"`;
|
|
|
19014
18937
|
try {
|
|
19015
18938
|
await withHooks.onCallbackQuery(event);
|
|
19016
18939
|
} catch (err) {
|
|
19017
|
-
|
|
18940
|
+
log136.error(
|
|
19018
18941
|
`\u274C [${mod.name}] onCallbackQuery error: ${err instanceof Error ? err.message : err}`
|
|
19019
18942
|
);
|
|
19020
18943
|
}
|
|
@@ -19026,7 +18949,7 @@ Task: "${taskDescription}"`;
|
|
|
19026
18949
|
(m) => m.onCallbackQuery
|
|
19027
18950
|
).length;
|
|
19028
18951
|
if (cbCount > 0) {
|
|
19029
|
-
|
|
18952
|
+
log136.info(`\u{1F517} ${cbCount} plugin onCallbackQuery hook(s) registered`);
|
|
19030
18953
|
}
|
|
19031
18954
|
}
|
|
19032
18955
|
}
|
|
@@ -19034,26 +18957,26 @@ Task: "${taskDescription}"`;
|
|
|
19034
18957
|
* Stop the agent
|
|
19035
18958
|
*/
|
|
19036
18959
|
async stop() {
|
|
19037
|
-
|
|
18960
|
+
log136.info("\u{1F44B} Stopping Teleton AI...");
|
|
19038
18961
|
await this.lifecycle.stop(() => this.stopAgent());
|
|
19039
18962
|
if (this.webuiServer) {
|
|
19040
18963
|
try {
|
|
19041
18964
|
await this.webuiServer.stop();
|
|
19042
18965
|
} catch (e) {
|
|
19043
|
-
|
|
18966
|
+
log136.error({ err: e }, "\u26A0\uFE0F WebUI stop failed");
|
|
19044
18967
|
}
|
|
19045
18968
|
}
|
|
19046
18969
|
if (this.apiServer) {
|
|
19047
18970
|
try {
|
|
19048
18971
|
await this.apiServer.stop();
|
|
19049
18972
|
} catch (e) {
|
|
19050
|
-
|
|
18973
|
+
log136.error({ err: e }, "\u26A0\uFE0F Management API stop failed");
|
|
19051
18974
|
}
|
|
19052
18975
|
}
|
|
19053
18976
|
try {
|
|
19054
18977
|
closeDatabase();
|
|
19055
18978
|
} catch (e) {
|
|
19056
|
-
|
|
18979
|
+
log136.error({ err: e }, "\u26A0\uFE0F Database close failed");
|
|
19057
18980
|
}
|
|
19058
18981
|
}
|
|
19059
18982
|
/**
|
|
@@ -19071,46 +18994,46 @@ Task: "${taskDescription}"`;
|
|
|
19071
18994
|
};
|
|
19072
18995
|
await this.hookRunner.runObservingHook("agent:stop", agentStopEvent);
|
|
19073
18996
|
} catch (e) {
|
|
19074
|
-
|
|
18997
|
+
log136.error({ err: e }, "\u26A0\uFE0F agent:stop hook failed");
|
|
19075
18998
|
}
|
|
19076
18999
|
}
|
|
19077
19000
|
if (this.pluginWatcher) {
|
|
19078
19001
|
try {
|
|
19079
19002
|
await this.pluginWatcher.stop();
|
|
19080
19003
|
} catch (e) {
|
|
19081
|
-
|
|
19004
|
+
log136.error({ err: e }, "\u26A0\uFE0F Plugin watcher stop failed");
|
|
19082
19005
|
}
|
|
19083
19006
|
}
|
|
19084
19007
|
if (this.mcpConnections.length > 0) {
|
|
19085
19008
|
try {
|
|
19086
19009
|
await closeMcpServers(this.mcpConnections);
|
|
19087
19010
|
} catch (e) {
|
|
19088
|
-
|
|
19011
|
+
log136.error({ err: e }, "\u26A0\uFE0F MCP close failed");
|
|
19089
19012
|
}
|
|
19090
19013
|
}
|
|
19091
19014
|
if (this.debouncer) {
|
|
19092
19015
|
try {
|
|
19093
19016
|
await this.debouncer.flushAll();
|
|
19094
19017
|
} catch (e) {
|
|
19095
|
-
|
|
19018
|
+
log136.error({ err: e }, "\u26A0\uFE0F Debouncer flush failed");
|
|
19096
19019
|
}
|
|
19097
19020
|
}
|
|
19098
19021
|
try {
|
|
19099
19022
|
await this.messageHandler.drain();
|
|
19100
19023
|
} catch (e) {
|
|
19101
|
-
|
|
19024
|
+
log136.error({ err: e }, "\u26A0\uFE0F Message queue drain failed");
|
|
19102
19025
|
}
|
|
19103
19026
|
for (const mod of this.modules) {
|
|
19104
19027
|
try {
|
|
19105
19028
|
await mod.stop?.();
|
|
19106
19029
|
} catch (e) {
|
|
19107
|
-
|
|
19030
|
+
log136.error({ err: e }, `\u26A0\uFE0F Module "${mod.name}" stop failed`);
|
|
19108
19031
|
}
|
|
19109
19032
|
}
|
|
19110
19033
|
try {
|
|
19111
19034
|
await this.bridge.disconnect();
|
|
19112
19035
|
} catch (e) {
|
|
19113
|
-
|
|
19036
|
+
log136.error({ err: e }, "\u26A0\uFE0F Bridge disconnect failed");
|
|
19114
19037
|
}
|
|
19115
19038
|
}
|
|
19116
19039
|
};
|
|
@@ -19119,14 +19042,14 @@ async function main(configPath) {
|
|
|
19119
19042
|
try {
|
|
19120
19043
|
app = new TeletonApp(configPath);
|
|
19121
19044
|
} catch (error) {
|
|
19122
|
-
|
|
19045
|
+
log136.error(`Failed to initialize: ${error instanceof Error ? error.message : error}`);
|
|
19123
19046
|
process.exit(1);
|
|
19124
19047
|
}
|
|
19125
19048
|
process.on("unhandledRejection", (reason) => {
|
|
19126
|
-
|
|
19049
|
+
log136.error({ err: reason }, "\u26A0\uFE0F Unhandled promise rejection");
|
|
19127
19050
|
});
|
|
19128
19051
|
process.on("uncaughtException", (error) => {
|
|
19129
|
-
|
|
19052
|
+
log136.error({ err: error }, "\u{1F4A5} Uncaught exception");
|
|
19130
19053
|
process.exit(1);
|
|
19131
19054
|
});
|
|
19132
19055
|
let shutdownInProgress = false;
|
|
@@ -19134,7 +19057,7 @@ async function main(configPath) {
|
|
|
19134
19057
|
if (shutdownInProgress) return;
|
|
19135
19058
|
shutdownInProgress = true;
|
|
19136
19059
|
const forceExit = setTimeout(() => {
|
|
19137
|
-
|
|
19060
|
+
log136.error("\u26A0\uFE0F Shutdown timed out, forcing exit");
|
|
19138
19061
|
process.exit(1);
|
|
19139
19062
|
}, SHUTDOWN_TIMEOUT_MS);
|
|
19140
19063
|
forceExit.unref();
|
|
@@ -19148,7 +19071,7 @@ async function main(configPath) {
|
|
|
19148
19071
|
}
|
|
19149
19072
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
19150
19073
|
main().catch((error) => {
|
|
19151
|
-
|
|
19074
|
+
log136.fatal({ err: error }, "Fatal error");
|
|
19152
19075
|
process.exit(1);
|
|
19153
19076
|
});
|
|
19154
19077
|
}
|