@songsid/agend 2.1.5-beta.9 → 2.1.5
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/backend/claude-code.d.ts +12 -0
- package/dist/backend/claude-code.js +12 -0
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex.d.ts +25 -1
- package/dist/backend/codex.js +76 -0
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/kiro.js +30 -2
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/types.d.ts +48 -0
- package/dist/backend/types.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +17 -2
- package/dist/channel/adapters/discord.js +64 -5
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +41 -2
- package/dist/channel/adapters/telegram.js +116 -20
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/factory.js +6 -1
- package/dist/channel/factory.js.map +1 -1
- package/dist/channel/types.d.ts +33 -1
- package/dist/classic-channel-manager.d.ts +23 -3
- package/dist/classic-channel-manager.js +35 -0
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/config-validator.js +23 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -1
- package/dist/daemon.d.ts +143 -21
- package/dist/daemon.js +969 -185
- package/dist/daemon.js.map +1 -1
- package/dist/deadline.d.ts +23 -0
- package/dist/deadline.js +29 -0
- package/dist/deadline.js.map +1 -0
- package/dist/fleet-context.d.ts +15 -1
- package/dist/fleet-context.js.map +1 -1
- package/dist/fleet-manager.d.ts +178 -3
- package/dist/fleet-manager.js +759 -119
- package/dist/fleet-manager.js.map +1 -1
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +26 -2
- package/dist/instance-lifecycle.d.ts +8 -2
- package/dist/instance-lifecycle.js +47 -3
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instance-removal.d.ts +13 -0
- package/dist/instance-removal.js +14 -0
- package/dist/instance-removal.js.map +1 -0
- package/dist/instructions.js +2 -2
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +28 -2
- package/dist/locale.js.map +1 -1
- package/dist/login-controller.d.ts +31 -4
- package/dist/login-controller.js +52 -4
- package/dist/login-controller.js.map +1 -1
- package/dist/login-flows.d.ts +29 -0
- package/dist/login-flows.js +48 -1
- package/dist/login-flows.js.map +1 -1
- package/dist/outbound-handlers.d.ts +1 -0
- package/dist/outbound-handlers.js +118 -29
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +7 -0
- package/dist/outbound-schemas.js +3 -0
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pane-input-residue.d.ts +25 -2
- package/dist/pane-input-residue.js +31 -2
- package/dist/pane-input-residue.js.map +1 -1
- package/dist/restart-progress.js +3 -21
- package/dist/restart-progress.js.map +1 -1
- package/dist/settings-api.d.ts +1 -1
- package/dist/settings-api.js +38 -6
- package/dist/settings-api.js.map +1 -1
- package/dist/topic-commands.d.ts +27 -2
- package/dist/topic-commands.js +37 -6
- package/dist/topic-commands.js.map +1 -1
- package/dist/turn-reply-guard.d.ts +41 -0
- package/dist/turn-reply-guard.js +77 -0
- package/dist/turn-reply-guard.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/ui/dashboard.html +38 -10
- package/dist/ui/settings.html +93 -15
- package/dist/ui/view.html +35 -20
- package/dist/view-api.d.ts +1 -0
- package/dist/view-api.js +12 -2
- package/dist/view-api.js.map +1 -1
- package/dist/web-api.d.ts +22 -1
- package/dist/web-api.js +25 -1
- package/dist/web-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run work under a wall-clock deadline without cancelling it.
|
|
3
|
+
*
|
|
4
|
+
* Nothing here aborts anything — a tmux spawn or an HTTP call keeps going after
|
|
5
|
+
* its deadline passes; the caller simply stops waiting and can say so. That is
|
|
6
|
+
* the point: a step with no deadline cannot report anything while it hangs, so
|
|
7
|
+
* the user sees silence and assumes the whole operation is stuck (#722, and the
|
|
8
|
+
* post-login recovery that silently swallowed its own success message).
|
|
9
|
+
*
|
|
10
|
+
* Rejections are reported rather than thrown, so one failed step never takes
|
|
11
|
+
* the surrounding loop down with it, and are always observed — an abandoned
|
|
12
|
+
* promise that rejects later must not surface as an unhandled rejection.
|
|
13
|
+
*/
|
|
14
|
+
export type DeadlineResult<T> = {
|
|
15
|
+
status: "fulfilled";
|
|
16
|
+
value: T;
|
|
17
|
+
} | {
|
|
18
|
+
status: "rejected";
|
|
19
|
+
reason: unknown;
|
|
20
|
+
} | {
|
|
21
|
+
status: "timeout";
|
|
22
|
+
};
|
|
23
|
+
export declare function runBeforeDeadline<T>(start: () => Promise<T>, deadline: number): Promise<DeadlineResult<T>>;
|
package/dist/deadline.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Largest delay setTimeout honours; anything above is clamped to 1ms by Node. */
|
|
2
|
+
const MAX_TIMER_MS = 2_147_483_647;
|
|
3
|
+
export async function runBeforeDeadline(start, deadline) {
|
|
4
|
+
const remaining = deadline - Date.now();
|
|
5
|
+
if (remaining <= 0)
|
|
6
|
+
return { status: "timeout" };
|
|
7
|
+
let work;
|
|
8
|
+
try {
|
|
9
|
+
work = start();
|
|
10
|
+
}
|
|
11
|
+
catch (reason) {
|
|
12
|
+
// A synchronous throw from `start` is a rejection like any other.
|
|
13
|
+
return { status: "rejected", reason };
|
|
14
|
+
}
|
|
15
|
+
let timer;
|
|
16
|
+
const timeout = new Promise(resolve => {
|
|
17
|
+
// Node clamps a delay above the 32-bit maximum to 1ms — so a very distant
|
|
18
|
+
// deadline would fire IMMEDIATELY and report every step as timed out, the
|
|
19
|
+
// exact opposite of what the caller asked for. Cap instead.
|
|
20
|
+
timer = setTimeout(() => resolve({ status: "timeout" }), Math.min(remaining, MAX_TIMER_MS));
|
|
21
|
+
timer.unref?.();
|
|
22
|
+
});
|
|
23
|
+
const settled = work.then(value => ({ status: "fulfilled", value }), reason => ({ status: "rejected", reason }));
|
|
24
|
+
const result = await Promise.race([settled, timeout]);
|
|
25
|
+
if (timer)
|
|
26
|
+
clearTimeout(timer);
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=deadline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadline.js","sourceRoot":"","sources":["../src/deadline.ts"],"names":[],"mappings":"AAkBA,kFAAkF;AAClF,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAI,KAAuB,EAAE,QAAgB;IAClF,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACxC,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACjD,IAAI,IAAgB,CAAC;IACrB,IAAI,CAAC;QACH,IAAI,GAAG,KAAK,EAAE,CAAC;IACjB,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,kEAAkE;QAClE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IACxC,CAAC;IACD,IAAI,KAAgD,CAAC;IACrD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAoB,OAAO,CAAC,EAAE;QACvD,0EAA0E;QAC1E,0EAA0E;QAC1E,4DAA4D;QAC5D,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;QAC5F,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CACvB,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EACzC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAC3C,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,IAAI,KAAK;QAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/fleet-context.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { Scheduler } from "./scheduler/index.js";
|
|
|
5
5
|
import type { Logger } from "./logger.js";
|
|
6
6
|
import type { CostGuard } from "./cost-guard.js";
|
|
7
7
|
import type { ClassicChannelManager } from "./classic-channel-manager.js";
|
|
8
|
+
import type { ExplicitInstanceRemoval } from "./instance-removal.js";
|
|
8
9
|
export type RouteTarget = {
|
|
9
10
|
kind: "instance";
|
|
10
11
|
name: string;
|
|
@@ -88,7 +89,13 @@ export interface FleetContext {
|
|
|
88
89
|
saveFleetConfig(): void;
|
|
89
90
|
getInstanceDir(name: string): string;
|
|
90
91
|
createForumTopic(topicName: string, adapterId?: string): Promise<number | string>;
|
|
91
|
-
removeInstance(name: string): Promise<void>;
|
|
92
|
+
removeInstance(name: string, authorization: ExplicitInstanceRemoval): Promise<void>;
|
|
93
|
+
/** Quarantine a provider-confirmed missing topic without deleting user data. */
|
|
94
|
+
quarantineMissingTopic(threadId: string, target: RouteTarget, evidence: {
|
|
95
|
+
source: "provider-event" | "provider-probe";
|
|
96
|
+
adapterId?: string;
|
|
97
|
+
generation?: number;
|
|
98
|
+
}): void;
|
|
92
99
|
getAdapterStates?(): Map<string, {
|
|
93
100
|
status: string;
|
|
94
101
|
retryCount: number;
|
|
@@ -153,6 +160,13 @@ export interface FleetContext {
|
|
|
153
160
|
cancelInstallSession?(): Promise<string>;
|
|
154
161
|
/** Human-readable effective model for an instance (resolves inherited defaults). */
|
|
155
162
|
modelDisplayForInstance?(name: string): string;
|
|
163
|
+
/** How this instance's backend takes a reasoning-effort setting, if at all. */
|
|
164
|
+
effortStrategyFor?(name: string): "runtime" | "restart" | "unsupported";
|
|
165
|
+
/** Configured effort for an instance: per-instance, else fleet default, else none. */
|
|
166
|
+
resolveInstanceEffort?(name: string): {
|
|
167
|
+
effort: string | null;
|
|
168
|
+
source: "instance" | "fleet-default" | "unset";
|
|
169
|
+
};
|
|
156
170
|
/**
|
|
157
171
|
* Show a model-selection inline keyboard for the given instance in a TG topic.
|
|
158
172
|
* Returns a fallback text message if no model list is available (caller should send it).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-context.js","sourceRoot":"","sources":["../src/fleet-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fleet-context.js","sourceRoot":"","sources":["../src/fleet-context.ts"],"names":[],"mappings":"AAiCA,MAAM,UAAU,sBAAsB,CAAC,MAAmB;IACxD,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC;AACpC,CAAC"}
|
package/dist/fleet-manager.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { type OutboundContext } from "./outbound-handlers.js";
|
|
|
19
19
|
import { type RawConfigPatch } from "./settings-api.js";
|
|
20
20
|
import { type AgentEndpointContext } from "./agent-endpoint.js";
|
|
21
21
|
import { ClassicChannelManager } from "./classic-channel-manager.js";
|
|
22
|
+
import { type ExplicitInstanceRemoval } from "./instance-removal.js";
|
|
22
23
|
import type { InstanceState } from "./backend/types.js";
|
|
23
24
|
import { StormWindow } from "./storm-window.js";
|
|
24
25
|
import { SpawnGate } from "./spawn-gate.js";
|
|
@@ -66,6 +67,7 @@ export interface DeliveryOptions {
|
|
|
66
67
|
/** Test/operational override; normal deliveries use the 60 second backstop. */
|
|
67
68
|
idleTimeoutMs?: number;
|
|
68
69
|
}
|
|
70
|
+
export declare const LOGIN_CALLBACK_PREFIX = "login:";
|
|
69
71
|
/**
|
|
70
72
|
* Upper bound on a live probe driven by `/model`.
|
|
71
73
|
*
|
|
@@ -88,6 +90,15 @@ export interface DeliveryOptions {
|
|
|
88
90
|
* The wait is announced before it starts, so it reads as progress, not a stall.
|
|
89
91
|
*/
|
|
90
92
|
export declare const CLI_ENV_PROBE_DEADLINE_MS = 16000;
|
|
93
|
+
/**
|
|
94
|
+
* How many CLIs may cold-start at once, from BOTH memory and cores.
|
|
95
|
+
*
|
|
96
|
+
* Memory alone said 10 on any host with roughly 3GB free, so a three-core box
|
|
97
|
+
* started ten CLIs together, saturated the CPU, and healthy starts then missed
|
|
98
|
+
* their startup budget — which used to cost the user their conversation. Cores
|
|
99
|
+
* bound how many can actually make progress; memory bounds how many fit.
|
|
100
|
+
*/
|
|
101
|
+
export declare function deriveSpawnConcurrency(freeMemMB: number, cores: number): number;
|
|
91
102
|
export declare class FleetManager implements FleetContext, LifecycleContext, ArchiverContext, StatuslineWatcherContext, OutboundContext, AgentEndpointContext {
|
|
92
103
|
dataDir: string;
|
|
93
104
|
private static signalTarget;
|
|
@@ -124,6 +135,20 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
124
135
|
private reloadPending;
|
|
125
136
|
/** A running reconciliation; only one may mutate lifecycle/config state at a time. */
|
|
126
137
|
private reconcileInFlight;
|
|
138
|
+
/** Topology checks are serialized separately from config reconciliation. */
|
|
139
|
+
private topicCleanupInFlight;
|
|
140
|
+
private topicCleanupGeneration;
|
|
141
|
+
private topicProbeWarnings;
|
|
142
|
+
/**
|
|
143
|
+
* Consecutive unknown probe results per route (or per adapter for outage
|
|
144
|
+
* class reasons). A single transient never reaches the operator; only a
|
|
145
|
+
* streak of TOPIC_PROBE_UNKNOWN_ESCALATION does.
|
|
146
|
+
*/
|
|
147
|
+
private topicProbeUnknownStreak;
|
|
148
|
+
/** Unknown results in a row before the operator is told. 3 × 5 min poller = 15 min. */
|
|
149
|
+
static readonly TOPIC_PROBE_UNKNOWN_ESCALATION = 3;
|
|
150
|
+
/** Reasons that describe the adapter, not one topic — counted once per adapter. */
|
|
151
|
+
private static readonly TOPIC_PROBE_ADAPTER_SCOPED_REASONS;
|
|
127
152
|
logger: Logger;
|
|
128
153
|
private topicCommands;
|
|
129
154
|
sessionRegistry: Map<string, string>;
|
|
@@ -321,6 +346,26 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
321
346
|
getWorldForInstance(name: string): AdapterWorld | undefined;
|
|
322
347
|
/** Get channel config for a specific adapter (by id), falling back to primary */
|
|
323
348
|
getChannelConfig(adapterId?: string): import("./types.js").ChannelConfig | undefined;
|
|
349
|
+
/**
|
|
350
|
+
* The configured world that owns `chatId`, when that is provably NOT the
|
|
351
|
+
* world `target` lives in. Returns undefined when they agree, when there is
|
|
352
|
+
* nothing to check, or when no configured channel claims the id.
|
|
353
|
+
*
|
|
354
|
+
* Deliberately one-sided: only a POSITIVE match against another channel's
|
|
355
|
+
* group id counts as foreign. A chat id that matches nothing may still be
|
|
356
|
+
* legitimate for this world (a classic channel, a DM), and treating
|
|
357
|
+
* "unrecognised" as "wrong" would stop seeding for cases that work today.
|
|
358
|
+
*
|
|
359
|
+
* Read from config rather than the live worlds map on purpose: a channel
|
|
360
|
+
* whose adapter failed to start still owns its group id, and the coordinates
|
|
361
|
+
* are just as unusable by the target's adapter either way.
|
|
362
|
+
*
|
|
363
|
+
* This is the other half of what scheduleSourceAdapter fixed. That one stops
|
|
364
|
+
* the trigger NOTICE being sent through the wrong bot; this one stops the
|
|
365
|
+
* same coordinates being planted as the target instance's reply context,
|
|
366
|
+
* which is what made its own replies fail until someone spoke to it (#752).
|
|
367
|
+
*/
|
|
368
|
+
private scheduleChatWorldMismatch;
|
|
324
369
|
/** Get the group_id for an instance's bound adapter */
|
|
325
370
|
getGroupIdForInstance(name: string): string;
|
|
326
371
|
/** Configured primary adapter id. Never infer this from Map insertion order. */
|
|
@@ -402,8 +447,14 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
402
447
|
/** Fleet admin is an explicit config allowlist entry, not merely an open/paired user. */
|
|
403
448
|
isFleetAdmin(userId: string, adapterId?: string): boolean;
|
|
404
449
|
changeInstancePauseState(name: string, action: "pause" | "wake"): Promise<"paused" | "awake" | "not_idle">;
|
|
450
|
+
/** Deliver an already-resolved hot snapshot without depending on IPC timing. */
|
|
451
|
+
private applyHotConfigUpdate;
|
|
452
|
+
private classicBehaviorUpdate;
|
|
405
453
|
/** Apply a Settings edit to a ClassicBot channel without waiting for the poller. */
|
|
406
|
-
restartClassicInstanceFromSettings(instanceName: string): Promise<void>;
|
|
454
|
+
restartClassicInstanceFromSettings(instanceName: string, changedFields?: string[]): Promise<void>;
|
|
455
|
+
/** Reload classicBot.yaml once. Kept callable so the periodic production
|
|
456
|
+
* path is covered without relying on fake timers around startAll(). */
|
|
457
|
+
private reloadClassicConfigFromDisk;
|
|
407
458
|
startInstance(name: string, config: InstanceConfig, topicMode: boolean, kind?: "fleet-topic" | "classic",
|
|
408
459
|
/**
|
|
409
460
|
* Explicit starts (CLI/API) may resume a paused or failed daemon. Startup
|
|
@@ -674,6 +725,35 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
674
725
|
/** Side effects of a routed reply: cancel-button lifecycle, logs, SSE, chat log. */
|
|
675
726
|
private afterReplyRouted;
|
|
676
727
|
private handleScheduleTrigger;
|
|
728
|
+
/**
|
|
729
|
+
* The adapter that can actually post into a chat, found by its group.
|
|
730
|
+
*
|
|
731
|
+
* A schedule records where it was created (reply_chat_id) separately from
|
|
732
|
+
* what it triggers (target). Those need not share a platform: a Telegram
|
|
733
|
+
* group can schedule a Discord-topic instance. Picking the adapter from the
|
|
734
|
+
* target then sends a Telegram chat id through the Discord bot, which fails
|
|
735
|
+
* with Unknown Channel — the source topic never hears that its schedule ran.
|
|
736
|
+
*
|
|
737
|
+
* When several bots share one guild, the primary wins: a persona should not
|
|
738
|
+
* be the voice announcing fleet scheduling.
|
|
739
|
+
*/
|
|
740
|
+
private adapterForChat;
|
|
741
|
+
/**
|
|
742
|
+
* The adapter that can answer a schedule in the chat it was created from.
|
|
743
|
+
*
|
|
744
|
+
* A schedule records its creator (source) and its trigger (target) separately,
|
|
745
|
+
* and they need not share a platform — the live fleet has a Telegram group
|
|
746
|
+
* scheduling a Discord-topic instance. Routing by target sends a Telegram chat
|
|
747
|
+
* id through the Discord bot, which is one half of the Unknown Channel errors.
|
|
748
|
+
*
|
|
749
|
+
* The creator's own adapter comes first, and only when its world actually owns
|
|
750
|
+
* that chat. Classic keeps its own identity, so a schedule made from a
|
|
751
|
+
* persona-bound Classic channel is answered by that persona: the primary bot
|
|
752
|
+
* may not even have access there, and would be the wrong voice if it did.
|
|
753
|
+
* Falling back to the target's adapter is deliberately NOT an option — that is
|
|
754
|
+
* the misroute itself; callers say why they stayed silent instead.
|
|
755
|
+
*/
|
|
756
|
+
private scheduleSourceAdapter;
|
|
677
757
|
private notifySourceTopic;
|
|
678
758
|
private notifyScheduleFailure;
|
|
679
759
|
private handleScheduleCrud;
|
|
@@ -700,8 +780,56 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
700
780
|
private sessionPruneTimer;
|
|
701
781
|
private classicReloadTimer;
|
|
702
782
|
private botUserId;
|
|
703
|
-
/** Periodically check if bound topics still exist */
|
|
783
|
+
/** Periodically check if bound topics still exist. Never deletes user data. */
|
|
704
784
|
private startTopicCleanupPoller;
|
|
785
|
+
/** Coalesce timer ticks; an outage must not create overlapping destructive-looking scans. */
|
|
786
|
+
private scheduleTopicCleanup;
|
|
787
|
+
private confirmedProbeFence;
|
|
788
|
+
private sameProbeFence;
|
|
789
|
+
private topicProbeStreakKey;
|
|
790
|
+
/** A definite answer (present or missing) ends the unknown streak for that route and its adapter. */
|
|
791
|
+
private clearTopicProbeUnknownStreak;
|
|
792
|
+
/**
|
|
793
|
+
* Record one unknown probe result. Nothing here can touch quarantine or
|
|
794
|
+
* removal: unknown is always retained data. The only question is whether
|
|
795
|
+
* the operator hears about it, and a single transient (one flaky HTTP call
|
|
796
|
+
* out of dozens per pass) must not — only a streak does.
|
|
797
|
+
*
|
|
798
|
+
* Used directly for single-route events (channelDelete, the pre-action
|
|
799
|
+
* fence). The periodic scan goes through a TopicProbePass instead, so one
|
|
800
|
+
* pass over N routes of a dead adapter counts as ONE check, not N.
|
|
801
|
+
*/
|
|
802
|
+
private warnTopicProbeUnknown;
|
|
803
|
+
/** One scan's worth of probe outcomes, applied to the streaks after the loop. */
|
|
804
|
+
private newTopicProbePass;
|
|
805
|
+
private passTopicProbeUnknown;
|
|
806
|
+
private passTopicProbeDefinite;
|
|
807
|
+
/**
|
|
808
|
+
* Apply a pass: a definite answer resets its keys, and an adapter that
|
|
809
|
+
* answered for any route this pass is evidently alive, so an unknown for the
|
|
810
|
+
* same adapter key in the same pass does not count — regardless of the order
|
|
811
|
+
* the routes happened to be probed in.
|
|
812
|
+
*/
|
|
813
|
+
private applyTopicProbePass;
|
|
814
|
+
private noteTopicProbeUnknown;
|
|
815
|
+
/** One fixed-snapshot topology pass. Automatic evidence can only quarantine. */
|
|
816
|
+
private runTopicCleanup;
|
|
817
|
+
/**
|
|
818
|
+
* A gateway event is only a hint. Confirm it through the passive REST probe;
|
|
819
|
+
* reconnecting gateways have emitted false channelDelete events in practice.
|
|
820
|
+
*/
|
|
821
|
+
private handleProviderTopicClosed;
|
|
822
|
+
private bindTopicClosedHandler;
|
|
823
|
+
/**
|
|
824
|
+
* Remove only the volatile route. The instance config, daemon, schedules,
|
|
825
|
+
* teams, metadata directory, and working tree remain untouched until an
|
|
826
|
+
* authenticated explicit deletion is requested.
|
|
827
|
+
*/
|
|
828
|
+
quarantineMissingTopic(threadId: string, target: RouteTarget, evidence: {
|
|
829
|
+
source: "provider-event" | "provider-probe";
|
|
830
|
+
adapterId?: string;
|
|
831
|
+
generation?: number;
|
|
832
|
+
}): void;
|
|
705
833
|
/**
|
|
706
834
|
* Patch only values changed in the effective config into the original YAML
|
|
707
835
|
* document. Unknown keys and comments remain untouched; redundant
|
|
@@ -712,7 +840,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
712
840
|
private slimFleetConfigAtStartup;
|
|
713
841
|
private writeFleetConfigBackup;
|
|
714
842
|
private patchFleetDocument;
|
|
715
|
-
removeInstance(name: string): Promise<void>;
|
|
843
|
+
removeInstance(name: string, authorization: ExplicitInstanceRemoval): Promise<void>;
|
|
716
844
|
startStatuslineWatcher(name: string): void;
|
|
717
845
|
stopStatuslineWatcher(name: string): void;
|
|
718
846
|
reactMessageStatus(instanceName: string, chatId: string, messageId: string, emoji: string): void;
|
|
@@ -789,6 +917,31 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
789
917
|
* poll cannot flood the topic and a down General does not swallow it.
|
|
790
918
|
*/
|
|
791
919
|
private reportClassicUnrecoverableIds;
|
|
920
|
+
/**
|
|
921
|
+
* Where a fleet-wide notice can actually be posted, or null if nowhere.
|
|
922
|
+
*
|
|
923
|
+
* On Telegram a group id is itself a chat, so posting straight to it is
|
|
924
|
+
* right. On Discord it is a *guild* id, and sending there makes the adapter
|
|
925
|
+
* fetch a channel that does not exist — DiscordAPIError 10003 Unknown
|
|
926
|
+
* Channel. That is why the daily summary never arrived on a Discord fleet:
|
|
927
|
+
* it had been posting to the guild every night and only the catch handler
|
|
928
|
+
* ever saw it.
|
|
929
|
+
*
|
|
930
|
+
* Discord therefore needs a real channel: the General topic (resolved from
|
|
931
|
+
* config rather than findGeneralInstance, so a fleet-level fault can still be
|
|
932
|
+
* reported while the General daemon is down), else the adapter's configured
|
|
933
|
+
* general_channel_id. With neither, there is no safe target and the caller
|
|
934
|
+
* should say so rather than send into a guaranteed failure.
|
|
935
|
+
*/
|
|
936
|
+
private fleetNoticeTarget;
|
|
937
|
+
/**
|
|
938
|
+
* Post the daily summary where fleet-wide notices go.
|
|
939
|
+
*
|
|
940
|
+
* A named method rather than an inline closure so a test can drive the real
|
|
941
|
+
* thing: asserting on fleetNoticeTarget alone leaves the call site free to go
|
|
942
|
+
* back to posting at the bare group id, which is the defect this replaced.
|
|
943
|
+
*/
|
|
944
|
+
private postDailySummary;
|
|
792
945
|
notifyFleetError(text: string): void;
|
|
793
946
|
private static readonly FLEET_ERROR_THROTTLE_MS;
|
|
794
947
|
private fleetErrorNotices;
|
|
@@ -865,6 +1018,17 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
865
1018
|
* contain usernames or secret-adjacent text and stays in daemon.log.
|
|
866
1019
|
*/
|
|
867
1020
|
notifyInteractivePrompt(instanceName: string, kind: string): Promise<void>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Offer a one-tap re-login next to an auth alert.
|
|
1023
|
+
*
|
|
1024
|
+
* The alert already names the remedy in words (`/login <backend>`), which
|
|
1025
|
+
* still leaves the user to retype it somewhere. The button routes into the
|
|
1026
|
+
* same chooser `/login` uses, so pressing it starts the flow in place.
|
|
1027
|
+
*
|
|
1028
|
+
* Backends with no remote login flow (opencode logs in from a terminal) get
|
|
1029
|
+
* no button — the alert's own wording already tells them what to run.
|
|
1030
|
+
*/
|
|
1031
|
+
offerBackendLogin(targetInstance: string, backend: string): Promise<void>;
|
|
868
1032
|
/** Consume a General assist button exactly once. */
|
|
869
1033
|
private handleInteractivePromptAssist;
|
|
870
1034
|
/** Send a "🛑 Cancel" button to the instance's topic/channel after delivery. */
|
|
@@ -1125,6 +1289,17 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
1125
1289
|
* only re-reads credentials on process start (a paused instance's CLI is
|
|
1126
1290
|
* already dead, so waking it respawns with the new token for free).
|
|
1127
1291
|
*/
|
|
1292
|
+
/**
|
|
1293
|
+
* Wake/restart every instance of a backend after a successful re-login.
|
|
1294
|
+
*
|
|
1295
|
+
* Bounded by a wall-clock deadline. This used to be an unbounded sequential
|
|
1296
|
+
* loop, and the caller only built its "login completed" message AFTER it
|
|
1297
|
+
* returned — so with several instances (or one slow restart) the user was
|
|
1298
|
+
* told nothing at all for minutes, concluded the login had hung, and
|
|
1299
|
+
* restarted things by hand. Instances that do not finish in time are NOT
|
|
1300
|
+
* cancelled: they are still coming back, and are reported as pending so the
|
|
1301
|
+
* message can say so instead of implying failure.
|
|
1302
|
+
*/
|
|
1128
1303
|
private recoverBackendInstances;
|
|
1129
1304
|
/** Backend chooser button → start that backend's login session. */
|
|
1130
1305
|
private handleLoginBackendSelect;
|