@songsid/agend 2.1.2-beta.50 → 2.1.2-beta.51
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/fleet-manager.d.ts
CHANGED
|
@@ -304,6 +304,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
304
304
|
*/
|
|
305
305
|
private startInstancesWithConcurrency;
|
|
306
306
|
private runnableStartupCount;
|
|
307
|
+
private configuredStartupInstanceNames;
|
|
307
308
|
private restartProgressTarget;
|
|
308
309
|
stopInstance(name: string): Promise<void>;
|
|
309
310
|
/** Restart a single instance, reloading fleet.yaml first to pick up config changes. */
|
package/dist/fleet-manager.js
CHANGED
|
@@ -1156,11 +1156,7 @@ export class FleetManager {
|
|
|
1156
1156
|
});
|
|
1157
1157
|
}
|
|
1158
1158
|
runnableStartupCount(fleet, includeClassic) {
|
|
1159
|
-
const names =
|
|
1160
|
-
if (includeClassic) {
|
|
1161
|
-
for (const channel of this.classicChannels?.getAll() ?? [])
|
|
1162
|
-
names.add(channel.instanceName);
|
|
1163
|
-
}
|
|
1159
|
+
const names = this.configuredStartupInstanceNames(fleet, includeClassic);
|
|
1164
1160
|
let count = 0;
|
|
1165
1161
|
for (const name of names) {
|
|
1166
1162
|
if (!this.lifecycle.isPaused(name))
|
|
@@ -1168,6 +1164,14 @@ export class FleetManager {
|
|
|
1168
1164
|
}
|
|
1169
1165
|
return count;
|
|
1170
1166
|
}
|
|
1167
|
+
configuredStartupInstanceNames(fleet, includeClassic) {
|
|
1168
|
+
const names = new Set(Object.keys(fleet.instances));
|
|
1169
|
+
if (includeClassic) {
|
|
1170
|
+
for (const channel of this.classicChannels?.getAll() ?? [])
|
|
1171
|
+
names.add(channel.instanceName);
|
|
1172
|
+
}
|
|
1173
|
+
return [...names];
|
|
1174
|
+
}
|
|
1171
1175
|
restartProgressTarget() {
|
|
1172
1176
|
const generalName = this.findGeneralInstance();
|
|
1173
1177
|
if (!generalName)
|
|
@@ -1691,13 +1695,11 @@ export class FleetManager {
|
|
|
1691
1695
|
for (const name of Object.keys(fleet.instances)) {
|
|
1692
1696
|
this.startStatuslineWatcher(name);
|
|
1693
1697
|
}
|
|
1694
|
-
await progressStart;
|
|
1695
|
-
const progressCompleted = await startupProgress.finish();
|
|
1696
1698
|
// Notify General topic that fleet is up
|
|
1697
|
-
const
|
|
1698
|
-
const total =
|
|
1699
|
-
const started = this.daemons.
|
|
1700
|
-
const allNotRunning =
|
|
1699
|
+
const configuredNames = this.configuredStartupInstanceNames(fleet, topicMode);
|
|
1700
|
+
const total = configuredNames.length;
|
|
1701
|
+
const started = configuredNames.filter(name => this.daemons.has(name)).length;
|
|
1702
|
+
const allNotRunning = configuredNames.filter(name => !this.daemons.has(name));
|
|
1701
1703
|
const pausedNames = allNotRunning.filter(n => this.lifecycle.isPaused(n));
|
|
1702
1704
|
const failedNames = allNotRunning.filter(n => !this.lifecycle.isPaused(n));
|
|
1703
1705
|
const generalName = this.findGeneralInstance();
|
|
@@ -1705,6 +1707,14 @@ export class FleetManager {
|
|
|
1705
1707
|
const { createRequire } = await import("node:module");
|
|
1706
1708
|
const _require = createRequire(import.meta.url);
|
|
1707
1709
|
const agendVersion = _require("../package.json").version ?? "unknown";
|
|
1710
|
+
await progressStart;
|
|
1711
|
+
const progressCompleted = await startupProgress.finish({
|
|
1712
|
+
running: started,
|
|
1713
|
+
total,
|
|
1714
|
+
version: agendVersion,
|
|
1715
|
+
pausedNames,
|
|
1716
|
+
failedNames,
|
|
1717
|
+
});
|
|
1708
1718
|
if (!progressCompleted && this.adapter && fleet.channel?.group_id) {
|
|
1709
1719
|
let text;
|
|
1710
1720
|
if (failedNames.length === 0 && pausedNames.length === 0) {
|
|
@@ -3185,7 +3195,11 @@ export class FleetManager {
|
|
|
3185
3195
|
user_id: msg.userId,
|
|
3186
3196
|
ts: msg.timestamp.toISOString(),
|
|
3187
3197
|
thread_id: "",
|
|
3188
|
-
|
|
3198
|
+
// Fleet instances have an authoritative adapter binding. Multiple
|
|
3199
|
+
// bots in one guild can observe the same inbound message, so the
|
|
3200
|
+
// adapter whose event wins dedup is not necessarily the bot that
|
|
3201
|
+
// owns this instance.
|
|
3202
|
+
adapter_id: this.getInstanceAdapterId(generalInstance) ?? msg.adapterId,
|
|
3189
3203
|
source: msg.source,
|
|
3190
3204
|
...(msg.replyToText ? { reply_to_text: msg.replyToText } : {}),
|
|
3191
3205
|
...generalReactions.meta,
|
|
@@ -3281,7 +3295,9 @@ export class FleetManager {
|
|
|
3281
3295
|
user_id: msg.userId,
|
|
3282
3296
|
ts: msg.timestamp.toISOString(),
|
|
3283
3297
|
thread_id: msg.threadId ?? "",
|
|
3284
|
-
|
|
3298
|
+
// Canonicalize the reply context to the configured world. Whichever
|
|
3299
|
+
// sibling bot wins inbound dedup must not decide which bot replies.
|
|
3300
|
+
adapter_id: this.getInstanceAdapterId(instanceName) ?? msg.adapterId,
|
|
3285
3301
|
source: msg.source,
|
|
3286
3302
|
...(msg.replyToText ? { reply_to_text: msg.replyToText } : {}),
|
|
3287
3303
|
...reactions.meta,
|
|
@@ -6776,16 +6792,23 @@ When users create specialized instances, suggest these configurations:
|
|
|
6776
6792
|
}
|
|
6777
6793
|
}
|
|
6778
6794
|
this.logger.info("Graceful restart complete");
|
|
6779
|
-
const
|
|
6795
|
+
const configuredNames = this.configuredStartupInstanceNames(fleet, topicMode);
|
|
6796
|
+
const total = configuredNames.length;
|
|
6797
|
+
const started = configuredNames.filter(name => this.daemons.has(name)).length;
|
|
6798
|
+
const allNotRunning2 = configuredNames.filter(name => !this.daemons.has(name));
|
|
6799
|
+
const pausedNames2 = allNotRunning2.filter(n => this.lifecycle.isPaused(n));
|
|
6800
|
+
const failedNames = allNotRunning2.filter(n => !this.lifecycle.isPaused(n));
|
|
6801
|
+
const { createRequire } = await import("node:module");
|
|
6802
|
+
const _require2 = createRequire(import.meta.url);
|
|
6803
|
+
const agendVersion2 = _require2("../package.json").version ?? "unknown";
|
|
6804
|
+
const progressCompleted = await restartProgress.finish({
|
|
6805
|
+
running: started,
|
|
6806
|
+
total,
|
|
6807
|
+
version: agendVersion2,
|
|
6808
|
+
pausedNames: pausedNames2,
|
|
6809
|
+
failedNames,
|
|
6810
|
+
});
|
|
6780
6811
|
if (groupId && this.adapter) {
|
|
6781
|
-
const total = Object.keys(fleet.instances).length;
|
|
6782
|
-
const started = this.daemons.size;
|
|
6783
|
-
const allNotRunning2 = Object.keys(fleet.instances).filter(n => !this.daemons.has(n));
|
|
6784
|
-
const pausedNames2 = allNotRunning2.filter(n => this.lifecycle.isPaused(n));
|
|
6785
|
-
const failedNames = allNotRunning2.filter(n => !this.lifecycle.isPaused(n));
|
|
6786
|
-
const { createRequire } = await import("node:module");
|
|
6787
|
-
const _require2 = createRequire(import.meta.url);
|
|
6788
|
-
const agendVersion2 = _require2("../package.json").version ?? "unknown";
|
|
6789
6812
|
let restartText;
|
|
6790
6813
|
if (failedNames.length === 0 && pausedNames2.length === 0) {
|
|
6791
6814
|
restartText = t("fleet.ready", started, total, agendVersion2);
|