@songsid/agend 2.1.4-beta.6 → 2.1.4-beta.60
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 +1 -1
- package/README.zh-TW.md +1 -1
- package/dist/agent-cli-instructions.md +2 -2
- package/dist/agent-endpoint.js +1 -1
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/backend/antigravity.d.ts +12 -8
- package/dist/backend/antigravity.js +189 -42
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/claude-code.d.ts +87 -23
- package/dist/backend/claude-code.js +361 -46
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex.d.ts +18 -0
- package/dist/backend/codex.js +143 -7
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/gemini-cli.js +2 -2
- package/dist/backend/gemini-cli.js.map +1 -1
- package/dist/backend/grok.js +2 -2
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/kiro.d.ts +52 -2
- package/dist/backend/kiro.js +267 -12
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/opencode.js +17 -4
- package/dist/backend/opencode.js.map +1 -1
- package/dist/backend/types.d.ts +122 -3
- package/dist/backend/types.js +5 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/backend-outage.d.ts +61 -0
- package/dist/backend-outage.js +71 -0
- package/dist/backend-outage.js.map +1 -0
- package/dist/channel/adapters/discord.d.ts +44 -2
- package/dist/channel/adapters/discord.js +529 -89
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +30 -0
- package/dist/channel/adapters/telegram.js +221 -19
- package/dist/channel/adapters/telegram.js.map +1 -1
- package/dist/channel/agy-mcp-launcher.d.ts +2 -0
- package/dist/channel/agy-mcp-launcher.js +28 -0
- package/dist/channel/agy-mcp-launcher.js.map +1 -0
- package/dist/channel/ipc-bridge.d.ts +2 -1
- package/dist/channel/ipc-bridge.js +33 -4
- package/dist/channel/ipc-bridge.js.map +1 -1
- package/dist/channel/markdown-chunk.d.ts +42 -0
- package/dist/channel/markdown-chunk.js +205 -0
- package/dist/channel/markdown-chunk.js.map +1 -0
- package/dist/channel/mcp-server.js +28 -25
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.js +6 -4
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/message-queue.js +64 -8
- package/dist/channel/message-queue.js.map +1 -1
- package/dist/channel/types.d.ts +31 -1
- package/dist/classic-channel-manager.d.ts +65 -0
- package/dist/classic-channel-manager.js +172 -3
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/cli.js +124 -83
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +16 -0
- package/dist/config-validator.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js +12 -1
- package/dist/config.js.map +1 -1
- package/dist/cross-instance-envelope.d.ts +6 -0
- package/dist/cross-instance-envelope.js +30 -0
- package/dist/cross-instance-envelope.js.map +1 -0
- package/dist/daemon.d.ts +506 -11
- package/dist/daemon.js +2162 -313
- package/dist/daemon.js.map +1 -1
- package/dist/doctor.d.ts +41 -0
- package/dist/doctor.js +267 -0
- package/dist/doctor.js.map +1 -0
- package/dist/fleet-context.d.ts +63 -0
- package/dist/fleet-context.js.map +1 -1
- package/dist/fleet-manager.d.ts +422 -12
- package/dist/fleet-manager.js +2961 -635
- package/dist/fleet-manager.js.map +1 -1
- package/dist/fleet-yaml-slim.d.ts +10 -0
- package/dist/fleet-yaml-slim.js +59 -0
- package/dist/fleet-yaml-slim.js.map +1 -0
- package/dist/general-knowledge/skills/backend-providers/SKILL.md +114 -0
- package/dist/general-knowledge/skills/cross-instance-messaging/SKILL.md +4 -1
- package/dist/general-knowledge/skills/delegation-playbook/SKILL.md +52 -0
- package/dist/general-knowledge/skills/development-workflow/SKILL.md +28 -0
- package/dist/general-knowledge/skills/fleet-config/SKILL.md +1 -0
- package/dist/general-knowledge/skills/fleet-health/SKILL.md +1 -0
- package/dist/general-knowledge/skills/fleet-restart/SKILL.md +1 -0
- package/dist/general-knowledge/skills/instance-lifecycle/SKILL.md +1 -0
- package/dist/general-knowledge/skills/model-discovery/SKILL.md +64 -16
- package/dist/general-knowledge/skills/multi-channel/SKILL.md +1 -0
- package/dist/general-knowledge/skills/scheduling/SKILL.md +1 -0
- package/dist/general-knowledge/skills/session-management/SKILL.md +172 -8
- package/dist/general-knowledge/skills/tui-effort/SKILL.md +1 -0
- package/dist/general-knowledge/skills/worker-collaboration/SKILL.md +30 -0
- package/dist/instance-lifecycle.d.ts +99 -0
- package/dist/instance-lifecycle.js +357 -11
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +12 -0
- package/dist/instructions.js +74 -3
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +1022 -310
- package/dist/locale.js.map +1 -1
- package/dist/login-flows.d.ts +91 -0
- package/dist/login-flows.js +170 -0
- package/dist/login-flows.js.map +1 -0
- package/dist/login-manager.d.ts +63 -0
- package/dist/login-manager.js +134 -0
- package/dist/login-manager.js.map +1 -0
- package/dist/network-family.d.ts +18 -0
- package/dist/network-family.js +20 -0
- package/dist/network-family.js.map +1 -0
- package/dist/outbound-handlers.d.ts +16 -1
- package/dist/outbound-handlers.js +174 -40
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +11 -3
- package/dist/outbound-schemas.js +11 -0
- package/dist/outbound-schemas.js.map +1 -1
- package/dist/pane-input-residue.d.ts +52 -0
- package/dist/pane-input-residue.js +107 -0
- package/dist/pane-input-residue.js.map +1 -0
- package/dist/process-memory.d.ts +6 -0
- package/dist/process-memory.js +45 -0
- package/dist/process-memory.js.map +1 -1
- package/dist/reply-dedup.d.ts +7 -8
- package/dist/reply-dedup.js +0 -0
- package/dist/reply-dedup.js.map +1 -1
- package/dist/restart-progress.d.ts +2 -0
- package/dist/restart-progress.js +3 -0
- package/dist/restart-progress.js.map +1 -1
- package/dist/scheduler/db.d.ts +12 -0
- package/dist/scheduler/db.js +59 -0
- package/dist/scheduler/db.js.map +1 -1
- package/dist/service-installer.d.ts +11 -0
- package/dist/service-installer.js +84 -18
- package/dist/service-installer.js.map +1 -1
- package/dist/settings-api.js +1 -1
- package/dist/settings-api.js.map +1 -1
- package/dist/setup-wizard.js +2 -2
- package/dist/setup-wizard.js.map +1 -1
- package/dist/spawn-gate.d.ts +30 -0
- package/dist/spawn-gate.js +79 -0
- package/dist/spawn-gate.js.map +1 -0
- package/dist/steer-capability.d.ts +1 -0
- package/dist/steer-capability.js +6 -0
- package/dist/steer-capability.js.map +1 -0
- package/dist/storm-window.d.ts +83 -0
- package/dist/storm-window.js +251 -0
- package/dist/storm-window.js.map +1 -0
- package/dist/tips.d.ts +44 -0
- package/dist/tips.js +355 -0
- package/dist/tips.js.map +1 -0
- package/dist/tmux-manager.d.ts +16 -0
- package/dist/tmux-manager.js +110 -25
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tool-progress.d.ts +40 -0
- package/dist/tool-progress.js +289 -0
- package/dist/tool-progress.js.map +1 -0
- package/dist/topic-commands.d.ts +45 -6
- package/dist/topic-commands.js +394 -66
- package/dist/topic-commands.js.map +1 -1
- package/dist/transcript-monitor.d.ts +15 -2
- package/dist/transcript-monitor.js +63 -17
- package/dist/transcript-monitor.js.map +1 -1
- package/dist/transcript-sources.d.ts +131 -0
- package/dist/transcript-sources.js +580 -0
- package/dist/transcript-sources.js.map +1 -0
- package/dist/types.d.ts +11 -0
- package/dist/ui/dashboard.html +55 -32
- package/dist/ui/settings.html +200 -60
- package/dist/ui/view.html +147 -30
- package/dist/usage/format-rich.d.ts +1 -1
- package/dist/usage/format-rich.js +28 -24
- package/dist/usage/format-rich.js.map +1 -1
- package/dist/usage/i18n-keys.d.ts +7 -0
- package/dist/usage/i18n-keys.js +34 -0
- package/dist/usage/i18n-keys.js.map +1 -0
- package/dist/usage/i18n.d.ts +5 -0
- package/dist/usage/i18n.js +27 -0
- package/dist/usage/i18n.js.map +1 -0
- package/dist/usage/providers.d.ts +21 -0
- package/dist/usage/providers.js +153 -75
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.d.ts +11 -3
- package/dist/usage/usage-api.js +61 -24
- package/dist/usage/usage-api.js.map +1 -1
- package/dist/workflow-templates/default.md +2 -1
- package/package.json +2 -2
package/dist/fleet-manager.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { EventLog } from "./event-log.js";
|
|
|
6
6
|
import { AdapterWorld } from "./adapter-world.js";
|
|
7
7
|
import { CostGuard } from "./cost-guard.js";
|
|
8
8
|
import { IpcClient } from "./channel/ipc-bridge.js";
|
|
9
|
-
import type { ChannelAdapter } from "./channel/types.js";
|
|
9
|
+
import type { AdapterHealthSnapshot, ChannelAdapter } from "./channel/types.js";
|
|
10
10
|
import { type Logger } from "./logger.js";
|
|
11
11
|
import { Scheduler } from "./scheduler/index.js";
|
|
12
12
|
import type { FleetContext } from "./fleet-context.js";
|
|
@@ -20,6 +20,9 @@ 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
22
|
import type { InstanceState } from "./backend/types.js";
|
|
23
|
+
import { StormWindow } from "./storm-window.js";
|
|
24
|
+
import { SpawnGate } from "./spawn-gate.js";
|
|
25
|
+
import { BackendOutageTracker } from "./backend-outage.js";
|
|
23
26
|
export declare function resolveReplyThreadId(argsThreadId: unknown, instanceConfig?: InstanceConfig): string | undefined;
|
|
24
27
|
/**
|
|
25
28
|
* Pure warm-cap victim selection (extracted for testability). Given the current
|
|
@@ -36,6 +39,25 @@ export declare function selectLruEvictions(warm: string[], cap: number, opts: {
|
|
|
36
39
|
isIdle: (name: string) => boolean;
|
|
37
40
|
lastInboundAt: (name: string) => number;
|
|
38
41
|
}): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Answer shape for `list_models`. `scope` reports where the LIST came from —
|
|
44
|
+
* "instance" only when it was read through that instance's own backend config,
|
|
45
|
+
* "global" for the account/CLI catalog — so a caller can tell an authoritative
|
|
46
|
+
* per-instance list from a best-effort account-wide one.
|
|
47
|
+
*/
|
|
48
|
+
export interface ModelCatalog {
|
|
49
|
+
backend: string;
|
|
50
|
+
scope: "instance" | "global";
|
|
51
|
+
/** Set whenever an instance was asked about, even if the list is global. */
|
|
52
|
+
instance?: string;
|
|
53
|
+
current_model: string | null;
|
|
54
|
+
models: import("./backend/types.js").ModelOption[];
|
|
55
|
+
/** "cache" = startup probe cache, "live" = probed now, "fallback" = none available. */
|
|
56
|
+
source: "cache" | "live" | "fallback";
|
|
57
|
+
probed_at?: string;
|
|
58
|
+
/** Caveat the caller should read before trusting the list. */
|
|
59
|
+
note?: string;
|
|
60
|
+
}
|
|
39
61
|
export interface DeliveryOptions {
|
|
40
62
|
/** Explicitly identify agent-to-agent delivery when metadata is unavailable. */
|
|
41
63
|
isCrossInstance?: boolean;
|
|
@@ -50,6 +72,10 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
50
72
|
private static sighupHandlerInstalled;
|
|
51
73
|
private children;
|
|
52
74
|
readonly lifecycle: InstanceLifecycle;
|
|
75
|
+
readonly stormWindow: StormWindow;
|
|
76
|
+
readonly spawnGate: SpawnGate;
|
|
77
|
+
/** Fleet-level backend reachability memory (fed by pty_error / startup panes). */
|
|
78
|
+
readonly backendOutage: BackendOutageTracker;
|
|
53
79
|
/** Live view of lifecycle.daemons — used throughout; not deprecated. */
|
|
54
80
|
get daemons(): Map<string, import("./daemon.js").Daemon>;
|
|
55
81
|
fleetConfig: FleetConfig | null;
|
|
@@ -83,6 +109,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
83
109
|
costGuard: CostGuard | null;
|
|
84
110
|
private statuslineWatcher;
|
|
85
111
|
private dailySummary;
|
|
112
|
+
private dailyTipScheduler;
|
|
86
113
|
private webhookEmitter;
|
|
87
114
|
private topicIcons;
|
|
88
115
|
private lastActivity;
|
|
@@ -94,6 +121,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
94
121
|
private warmCapEvicting;
|
|
95
122
|
/** Per-instance tail keeps cross-instance and scheduled deliveries FIFO. */
|
|
96
123
|
private idleGatedDeliveryTails;
|
|
124
|
+
/**
|
|
125
|
+
* Per-instance cancellation epoch for deliveries which have not reached the
|
|
126
|
+
* daemon yet. A cancel advances the epoch; queued work captures the old value
|
|
127
|
+
* and becomes a no-op, while messages arriving after the click capture the new
|
|
128
|
+
* value and remain deliverable.
|
|
129
|
+
*/
|
|
130
|
+
private deliveryEpochs;
|
|
97
131
|
/** Non-user work must observe a fresh idle snapshot after the latest delivery. */
|
|
98
132
|
private lastDeliveryAt;
|
|
99
133
|
/** State-cache updates wake event-driven idle waiters without busy polling. */
|
|
@@ -106,10 +140,34 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
106
140
|
readonly replyDeduper: ReplyDeduper;
|
|
107
141
|
/** instanceName → what it is doing right now, when the backend can tell us. */
|
|
108
142
|
private instanceActivity;
|
|
143
|
+
/** instanceName → this turn's tool list (multi-line), for the bubble. */
|
|
144
|
+
private instanceProgress;
|
|
109
145
|
/** instanceName → tail of deliveries waiting for its IPC to come back. */
|
|
110
146
|
private ipcWaitTails;
|
|
111
147
|
/** instanceName → restart currently executing; concurrent callers join it. */
|
|
112
148
|
private restartsInFlight;
|
|
149
|
+
/**
|
|
150
|
+
* Delayed automatic retries for instances whose startup failed. Before this a
|
|
151
|
+
* failed start was logged once and the instance stayed `stopped` until an
|
|
152
|
+
* operator noticed (2026-09-03: 4 kiro instances, all victims of the same
|
|
153
|
+
* backend outage during a post-update herd). instanceName → pending retry.
|
|
154
|
+
*/
|
|
155
|
+
private startupRetries;
|
|
156
|
+
/** Bumped by every explicit stop (incl. the stop half of a restart); fences the outage hand-off. */
|
|
157
|
+
private explicitStopGeneration;
|
|
158
|
+
/** instanceName → outage hand-off currently executing; a repeat joins it. */
|
|
159
|
+
private handOffsInFlight;
|
|
160
|
+
/** instanceName → explicit stop currently executing; the outage hand-off waits for it. */
|
|
161
|
+
private stopsInFlight;
|
|
162
|
+
/** Aggregation window for the "N instances failed to start" notice. */
|
|
163
|
+
private startupRetryNotices;
|
|
164
|
+
/** Backoff between automatic startup retries; the last step repeats while the backend is down. */
|
|
165
|
+
static readonly STARTUP_RETRY_BACKOFF_MS: number[];
|
|
166
|
+
/** Hard cap on automatic startup retries (3 backoff steps + up to 3 more during a backend outage). */
|
|
167
|
+
static readonly STARTUP_RETRY_MAX_ATTEMPTS = 6;
|
|
168
|
+
/** Re-check interval when a retry is due but the tmux storm window still blocks spawns. */
|
|
169
|
+
static readonly STARTUP_RETRY_STORM_DEFER_MS = 60000;
|
|
170
|
+
static readonly STARTUP_RETRY_NOTICE_AGGREGATE_MS = 1000;
|
|
113
171
|
private lastInboundMsg;
|
|
114
172
|
private topicArchiver;
|
|
115
173
|
controlClient: TmuxControlClient | null;
|
|
@@ -140,12 +198,14 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
140
198
|
private updateProgressTimer;
|
|
141
199
|
private updateProgressEditRunning;
|
|
142
200
|
private lastUpdateProgressText;
|
|
201
|
+
private updateCompletionTipText;
|
|
143
202
|
private eventLogPruneTimer;
|
|
144
203
|
private logRotateTimer;
|
|
145
204
|
/** Days of event/activity history to keep. */
|
|
146
205
|
private static readonly EVENT_LOG_RETENTION_DAYS;
|
|
147
206
|
private watchdogTimer;
|
|
148
207
|
private startedAt;
|
|
208
|
+
private stormOpenNotifyTimer;
|
|
149
209
|
private mirrorBuffer;
|
|
150
210
|
private mirrorTimer;
|
|
151
211
|
private sseClients;
|
|
@@ -153,6 +213,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
153
213
|
private viewToken;
|
|
154
214
|
private healthServerListening;
|
|
155
215
|
constructor(dataDir: string);
|
|
216
|
+
private spawnConcurrency;
|
|
217
|
+
/** Wire the one fleet-wide storm into notification and recovery surfaces. */
|
|
218
|
+
private bindStormWindowEvents;
|
|
219
|
+
private formatStormDelay;
|
|
220
|
+
stormSuppressed(kind: string): boolean;
|
|
156
221
|
private handleSighup;
|
|
157
222
|
private scheduleReconcile;
|
|
158
223
|
/**
|
|
@@ -222,6 +287,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
222
287
|
private isModelAdmin;
|
|
223
288
|
private handlePauseWakeSlash;
|
|
224
289
|
private handleUpdateSlash;
|
|
290
|
+
private handleTipsSlash;
|
|
225
291
|
/** Admin-only full conversation reset for fleet-topic and Classic instances. */
|
|
226
292
|
private handleClearSlash;
|
|
227
293
|
/** Get the adapter bound to an instance, falling back to primary adapter */
|
|
@@ -252,6 +318,14 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
252
318
|
bindInstanceAdapter(name: string, adapterId: string, fromInbound?: boolean): void;
|
|
253
319
|
getInstanceStatus(name: string): "running" | "paused" | "stopped" | "crashed";
|
|
254
320
|
getInstanceExecutionState(name: string): InstanceState | null;
|
|
321
|
+
/**
|
|
322
|
+
* Subscription providers currently relevant to this fleet. Stopped/crashed
|
|
323
|
+
* rows do not keep a usage card alive, while persisted paused instances do.
|
|
324
|
+
* Classic channels use their effective backend merge chain, not the raw row.
|
|
325
|
+
*/
|
|
326
|
+
getActiveUsageProviderIds(): ReadonlySet<string>;
|
|
327
|
+
/** Effective backends with a running or persisted-paused fleet/Classic instance. */
|
|
328
|
+
getActiveBackendIds(): ReadonlySet<string>;
|
|
255
329
|
isClassicInstance(name: string): boolean;
|
|
256
330
|
private cacheInstanceExecutionState;
|
|
257
331
|
private cancelIdleButtonRetirement;
|
|
@@ -268,7 +342,15 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
268
342
|
*/
|
|
269
343
|
private enforceWarmCap;
|
|
270
344
|
private waitForInstanceIdle;
|
|
345
|
+
/**
|
|
346
|
+
* Ask the daemon to capture the pane before answering, then wait for any state
|
|
347
|
+
* report produced after this request. The ordinary query is intentionally
|
|
348
|
+
* cache-only (idle gates call it frequently); this opt-in refresh is reserved
|
|
349
|
+
* for lifecycle decisions where a stale state would strand UI.
|
|
350
|
+
*/
|
|
351
|
+
private refreshInstanceExecutionState;
|
|
271
352
|
private deliverWithIdleGate;
|
|
353
|
+
private holdDeliveryForStorm;
|
|
272
354
|
/**
|
|
273
355
|
* Hand a payload to an instance's IPC, waiting out a *transient* disconnect.
|
|
274
356
|
*
|
|
@@ -288,6 +370,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
288
370
|
private sendWhenConnected;
|
|
289
371
|
/** Poll for the instance's IPC to come back, then send. Throws if it does not. */
|
|
290
372
|
private sendAfterIpcReturns;
|
|
373
|
+
/** Whether this target already has an ordinary non-user delivery in its FIFO. */
|
|
374
|
+
hasPendingIdleGatedDelivery(instanceName: string): boolean;
|
|
291
375
|
/** Single delivery facade: wake paused CLIs and serialize non-user work behind idle. */
|
|
292
376
|
deliverToInstance(instanceName: string, payload: Record<string, unknown>, options?: DeliveryOptions): Promise<void>;
|
|
293
377
|
/** Fleet admin is an explicit config allowlist entry, not merely an open/paired user. */
|
|
@@ -311,6 +395,65 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
311
395
|
* TODO: per-instance startup timeout (existing issue, not introduced here)
|
|
312
396
|
*/
|
|
313
397
|
private startInstancesWithConcurrency;
|
|
398
|
+
/**
|
|
399
|
+
* Start from an UNATTENDED path (fleet startup, full restart, config
|
|
400
|
+
* reconcile): nobody is watching the result, so a failure is logged and
|
|
401
|
+
* handed to the delayed automatic retry instead of leaving the instance
|
|
402
|
+
* `stopped` forever. Explicit operator/API starts call startInstance directly
|
|
403
|
+
* and keep their synchronous error. Returns whether the instance is up.
|
|
404
|
+
*/
|
|
405
|
+
private startInstanceUnattended;
|
|
406
|
+
/**
|
|
407
|
+
* Schedule attempt `attempt` (0-based) of the automatic startup retry for an
|
|
408
|
+
* instance whose start just failed. Backoff 1 → 5 → 15 min; while the
|
|
409
|
+
* instance's backend is known to be unreachable the 15-min step repeats up to
|
|
410
|
+
* STARTUP_RETRY_MAX_ATTEMPTS, after which we give up with one notice. Each
|
|
411
|
+
* retry re-checks the world (still configured, not running, not paused, no
|
|
412
|
+
* tmux storm) and runs through the SpawnGate as "recovery" — so a herd of
|
|
413
|
+
* failed instances comes back at the gate's concurrency, never all at once.
|
|
414
|
+
*/
|
|
415
|
+
scheduleStartupRetry(name: string, attempt: number): void;
|
|
416
|
+
/** Drop a pending automatic retry (an operator start/stop/restart supersedes it). */
|
|
417
|
+
cancelStartupRetry(name: string): void;
|
|
418
|
+
/** Pending automatic retry, if any (status display / tests). */
|
|
419
|
+
pendingStartupRetry(name: string): {
|
|
420
|
+
attempt: number;
|
|
421
|
+
} | null;
|
|
422
|
+
/**
|
|
423
|
+
* A daemon's crash-respawn hit the backend outage (startup_backend_unreachable):
|
|
424
|
+
* stop THAT daemon and schedule the delayed retry. Serialized against the
|
|
425
|
+
* operator paths: an in-flight restart is awaited first (it replaces the
|
|
426
|
+
* daemon itself), the stop is identity-checked so a fresh daemon registered
|
|
427
|
+
* meanwhile is never deleted, and an explicit stop/restart that began during
|
|
428
|
+
* the hand-off (generation bump) owns the outcome — no retry is scheduled
|
|
429
|
+
* behind an operator's back.
|
|
430
|
+
*/
|
|
431
|
+
handOffToStartupRetry(name: string, daemon: unknown): Promise<void>;
|
|
432
|
+
private runStartupRetry;
|
|
433
|
+
/** Fleet-topic (fleet.yaml) or ClassicBot (classic channel) — both are retryable; anything else is gone. */
|
|
434
|
+
private isConfiguredInstance;
|
|
435
|
+
/**
|
|
436
|
+
* Kind-aware start for the automatic retry: fleet-topic instances come from
|
|
437
|
+
* fleet.yaml, ClassicBot instances exist only in the classic channel manager
|
|
438
|
+
* and must be rebuilt through startClassicInstance (a fleet.yaml lookup alone
|
|
439
|
+
* silently dropped them — the retry timer fired and nothing happened).
|
|
440
|
+
*/
|
|
441
|
+
private startConfiguredInstance;
|
|
442
|
+
/**
|
|
443
|
+
* Unattended ClassicBot start (fleet startup batch, full-restart batch, the
|
|
444
|
+
* classicBot.yaml reconcile): same contract as startInstanceUnattended —
|
|
445
|
+
* failures are logged and handed to the delayed automatic retry, whose
|
|
446
|
+
* kind-aware startConfiguredInstance rebuilds the Classic instance. Returns
|
|
447
|
+
* whether the instance is up.
|
|
448
|
+
*/
|
|
449
|
+
private startClassicInstanceUnattended;
|
|
450
|
+
private backendNameOf;
|
|
451
|
+
/**
|
|
452
|
+
* One fleet-level notice per burst, not one per instance: a post-update herd
|
|
453
|
+
* fails many instances within the same second. Two notices per incident at
|
|
454
|
+
* most — "N failed, retrying in X" and, if it comes to that, "gave up on N".
|
|
455
|
+
*/
|
|
456
|
+
private queueStartupRetryNotice;
|
|
314
457
|
private runnableStartupCount;
|
|
315
458
|
private configuredStartupInstanceNames;
|
|
316
459
|
private restartProgressTarget;
|
|
@@ -362,6 +505,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
362
505
|
retryCount: number;
|
|
363
506
|
lastError?: string;
|
|
364
507
|
}>;
|
|
508
|
+
private bindAdapterHealth;
|
|
365
509
|
/**
|
|
366
510
|
* Real, checkable fleet health for `/health` and the operator.
|
|
367
511
|
*
|
|
@@ -390,6 +534,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
390
534
|
total: number;
|
|
391
535
|
connected: number;
|
|
392
536
|
states: Record<string, string>;
|
|
537
|
+
details: Record<string, AdapterHealthSnapshot>;
|
|
393
538
|
};
|
|
394
539
|
startupComplete: boolean;
|
|
395
540
|
/** See process-memory.ts: the fleet process and the whole service cgroup are
|
|
@@ -429,6 +574,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
429
574
|
* message actually went out — a failed delivery keeps them queued.
|
|
430
575
|
*/
|
|
431
576
|
private pendingReactionsMeta;
|
|
577
|
+
/**
|
|
578
|
+
* Why this adapter must ignore a bot/webhook message, or null to accept it.
|
|
579
|
+
* Pure: callers rely on being able to ask before claiming the dedup key.
|
|
580
|
+
*/
|
|
581
|
+
private botMessageDropReason;
|
|
432
582
|
private handleInboundMessage;
|
|
433
583
|
/** Handle outbound tool calls from a daemon instance */
|
|
434
584
|
/** Warn (but don't block) when rate limits are high. 30-min debounce per instance. */
|
|
@@ -445,6 +595,10 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
445
595
|
private handleDecisionCrud;
|
|
446
596
|
/** Resolve display name for an instance, fallback to instance name. */
|
|
447
597
|
resolveDisplayName(instanceName: string): string;
|
|
598
|
+
/** Persist identity to the instance's actual config store. Classic instances
|
|
599
|
+
* are registry rows in classicBot.yaml, not fleet.yaml instance entries. */
|
|
600
|
+
private setInstanceDisplayName;
|
|
601
|
+
private setInstanceDescription;
|
|
448
602
|
private handleSetDisplayName;
|
|
449
603
|
private handleSetDescription;
|
|
450
604
|
handleScheduleCrudHttp(instance: string, op: string, args: Record<string, unknown>): Promise<unknown>;
|
|
@@ -465,9 +619,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
465
619
|
private startTopicCleanupPoller;
|
|
466
620
|
/**
|
|
467
621
|
* Patch only values changed in the effective config into the original YAML
|
|
468
|
-
* document. Unknown keys
|
|
622
|
+
* document. Unknown keys and comments remain untouched; redundant
|
|
623
|
+
* non-identity instance leaves are canonicalized to inheritance afterward.
|
|
469
624
|
*/
|
|
470
625
|
saveFleetConfig(explicitPatches?: RawConfigPatch[]): void;
|
|
626
|
+
/** One-time upgrade migration; invalid YAML is never rewritten. */
|
|
627
|
+
private slimFleetConfigAtStartup;
|
|
628
|
+
private writeFleetConfigBackup;
|
|
471
629
|
private patchFleetDocument;
|
|
472
630
|
removeInstance(name: string): Promise<void>;
|
|
473
631
|
startStatuslineWatcher(name: string): void;
|
|
@@ -536,10 +694,30 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
536
694
|
* The log line is written by the caller regardless: if every adapter is down,
|
|
537
695
|
* the only notification path is the one that is broken.
|
|
538
696
|
*/
|
|
697
|
+
/**
|
|
698
|
+
* Surface ids that can never match into the operator's General topic.
|
|
699
|
+
*
|
|
700
|
+
* The load-time log is still silence for anyone not reading daemon.log, and a
|
|
701
|
+
* chat that never gets in with nothing said anywhere is exactly the failure
|
|
702
|
+
* this line of work exists to remove. notifyFleetError throttles by message
|
|
703
|
+
* text for 10 minutes and resolves its target from config, so the 30s reload
|
|
704
|
+
* poll cannot flood the topic and a down General does not swallow it.
|
|
705
|
+
*/
|
|
706
|
+
private reportClassicUnrecoverableIds;
|
|
539
707
|
notifyFleetError(text: string): void;
|
|
540
708
|
private static readonly FLEET_ERROR_THROTTLE_MS;
|
|
541
709
|
private fleetErrorNotices;
|
|
542
|
-
|
|
710
|
+
/**
|
|
711
|
+
* Post into an instance's topic. Returns whether a send was DISPATCHED — a
|
|
712
|
+
* target was resolved and sendText was called — so a caller that must not
|
|
713
|
+
* lose the message (notifyFleetError, which spends a throttle key) can tell
|
|
714
|
+
* that from silence. Existing callers ignore the result and are unaffected.
|
|
715
|
+
*
|
|
716
|
+
* Not a delivery guarantee: sendText is fire-and-forget, and a platform-side
|
|
717
|
+
* rejection surfaces only as a warn in its .catch. True delivery confirmation
|
|
718
|
+
* would have to make this async and change every caller.
|
|
719
|
+
*/
|
|
720
|
+
notifyInstanceTopic(instanceName: string, text: string, extraOpts?: import("./channel/types.js").SendOpts): boolean;
|
|
543
721
|
/**
|
|
544
722
|
* Post decision buttons whose callback ids are `<prefix><nonce>:<action>`.
|
|
545
723
|
* The entry is registered before the send and rolled back if the send
|
|
@@ -548,13 +726,12 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
548
726
|
*/
|
|
549
727
|
private postNonceButtonPrompt;
|
|
550
728
|
/**
|
|
551
|
-
*
|
|
729
|
+
* Validate a nonce-armed callback and claim it exactly once.
|
|
552
730
|
*
|
|
553
731
|
* Returns:
|
|
554
732
|
* - null — the callback is not for this prefix; try the next handler
|
|
555
733
|
* - "consumed" — for this prefix but stale/denied/malformed; stop dispatch
|
|
556
|
-
* - the entry+action — the click is authorized and
|
|
557
|
-
* from the map before any await, so double clicks cannot act twice)
|
|
734
|
+
* - the entry+action — the click is authorized and claimed before any await
|
|
558
735
|
*
|
|
559
736
|
* A stale click (expired nonce, or a pre-upgrade button whose payload no
|
|
560
737
|
* longer parses) collapses the clicked message so the dead button stops
|
|
@@ -563,6 +740,19 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
563
740
|
private consumeNonceCallback;
|
|
564
741
|
/** Collapse a consumed prompt's buttons into a final status line. */
|
|
565
742
|
private retireNonceButtons;
|
|
743
|
+
private tipsEnabled;
|
|
744
|
+
private readTipState;
|
|
745
|
+
private pickAvailableTip;
|
|
746
|
+
private tipText;
|
|
747
|
+
private formatTip;
|
|
748
|
+
/** Persistently enable advanced tips through the admin-only slash command. */
|
|
749
|
+
unlockAdvancedTips(userId: string): boolean;
|
|
750
|
+
/** Post one fresh nonce-armed tip in a known General channel. */
|
|
751
|
+
promptTip(generalName: string, adapter: ChannelAdapter, chatId: string, threadId?: string): Promise<"posted" | "empty" | "unavailable">;
|
|
752
|
+
private promptAdvancedTipUnlock;
|
|
753
|
+
private sendTipToGeneral;
|
|
754
|
+
private handleTipDismiss;
|
|
755
|
+
private handleTipUnlock;
|
|
566
756
|
/** Post the destructive `/clear` confirmation in the invoking channel. */
|
|
567
757
|
promptClearConfirmation(instanceName: string, channelId: string, adapter: ChannelAdapter, chatId: string, threadId?: string): Promise<string | null>;
|
|
568
758
|
/** Consume `/clear` Confirm/Cancel exactly once; only Confirm reaches IPC. */
|
|
@@ -617,7 +807,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
617
807
|
*/
|
|
618
808
|
private handleCancelClick;
|
|
619
809
|
private hasCancelButton;
|
|
620
|
-
sendCancelButton(instanceName: string, correlationId?: string): Promise<void>;
|
|
810
|
+
sendCancelButton(instanceName: string, correlationId?: string, preserveProgress?: boolean): Promise<void>;
|
|
621
811
|
/**
|
|
622
812
|
* The cancel button's text for a given elapsed time.
|
|
623
813
|
*
|
|
@@ -627,6 +817,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
627
817
|
* and once the agent had replied once there was no sign it was still going.
|
|
628
818
|
*/
|
|
629
819
|
static progressText(elapsedMs: number, activity?: string | null, minElapsedMs?: number): string;
|
|
820
|
+
/** Render elapsed time consistently in live and retained progress bubbles. */
|
|
821
|
+
private static formatProgressElapsed;
|
|
822
|
+
/** Final read-only form of a bubble that contains semantic tool history.
|
|
823
|
+
* Neutral wording is intentional: the same retirement primitive is used for
|
|
824
|
+
* normal completion, a mid-turn bubble replacement, and user cancellation,
|
|
825
|
+
* so claiming every retained checkpoint is "completed" would be false. */
|
|
826
|
+
private composeRetiredBubbleText;
|
|
630
827
|
/**
|
|
631
828
|
* Make a tool summary safe to paste into a channel message.
|
|
632
829
|
*
|
|
@@ -644,6 +841,26 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
644
841
|
* never used to decide anything — purely what the user is shown.
|
|
645
842
|
*/
|
|
646
843
|
private cacheInstanceActivity;
|
|
844
|
+
/**
|
|
845
|
+
* Cache the turn's tool-progress list and push it into the instance's live
|
|
846
|
+
* bubble, coalesced so a burst of tool events cannot flood the Bot API
|
|
847
|
+
* (Telegram's flood limit is per-chat across ALL forum topics, so edits are
|
|
848
|
+
* rate-limited per bubble AND ride behind the daemon-side 3s coalescer).
|
|
849
|
+
*/
|
|
850
|
+
private cacheInstanceProgress;
|
|
851
|
+
/** At most one progress-driven edit per bubble per TOOL_PROGRESS_EDIT_MIN_MS. */
|
|
852
|
+
private scheduleProgressEdit;
|
|
853
|
+
/**
|
|
854
|
+
* The ONE composer for the bubble text. Both writers — the elapsed-time
|
|
855
|
+
* ticker and the tool-progress push — go through here; two independent
|
|
856
|
+
* renderers editing the same message is how the progress list used to get
|
|
857
|
+
* wiped by the next elapsed tick (#528 trap 2).
|
|
858
|
+
*/
|
|
859
|
+
private composeBubbleText;
|
|
860
|
+
/** Pure composition of header + tool list, exposed for tests. */
|
|
861
|
+
static bubbleText(elapsedMs: number, activity: string | undefined, minElapsedMs: number, progress: string | undefined): string;
|
|
862
|
+
/** Recompose and edit the bubble in place; skips when nothing changed. */
|
|
863
|
+
private refreshBubble;
|
|
647
864
|
/**
|
|
648
865
|
* Refresh the button's text in place while the instance keeps working.
|
|
649
866
|
*
|
|
@@ -656,10 +873,14 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
656
873
|
private startProgressTicker;
|
|
657
874
|
/**
|
|
658
875
|
* After a reply: give the instance REPLY_RETIRE_GRACE_MS to resume working; if
|
|
659
|
-
* it has not, retire its button.
|
|
660
|
-
*
|
|
876
|
+
* it has not, retire its button. The daemon is asked for a fresh pane capture
|
|
877
|
+
* before deciding. Reading only the transition cache stranded the first
|
|
878
|
+
* post-restart bubble when its startup "working" report never got a matching
|
|
879
|
+
* idle edge. Re-arming replaces the previous timer, so a burst of replies ends
|
|
880
|
+
* with exactly one pending check.
|
|
661
881
|
*/
|
|
662
882
|
private armReplyGrace;
|
|
883
|
+
private finishReplyGrace;
|
|
663
884
|
/** Retire (delete) every cancel button belonging to an instance. */
|
|
664
885
|
private retireInstanceButtons;
|
|
665
886
|
/** Begin retiring one button (delete + bounded retry on failure). Idempotent:
|
|
@@ -684,7 +905,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
684
905
|
private sweepOrphanedCancelButtons;
|
|
685
906
|
/** Re-attempt a failed button delete up to CANCEL_BTN_MAX_RETRIES times. */
|
|
686
907
|
private scheduleButtonRetry;
|
|
687
|
-
/**
|
|
908
|
+
/** Retire one cancel bubble via its own adapter. A bubble that accumulated
|
|
909
|
+
* tool progress is kept as a read-only history message; a plain bubble keeps
|
|
910
|
+
* the legacy delete/edit-to-checkmark behavior. Resolves on success and
|
|
688
911
|
* rejects on failure so the caller can retry. */
|
|
689
912
|
private deleteButtonMessage;
|
|
690
913
|
/** Retire all cancel buttons for an instance — on reply or cancel. */
|
|
@@ -708,6 +931,123 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
708
931
|
private reactDone;
|
|
709
932
|
/** Interrupt an instance's current generation (cancel button / /cancel). */
|
|
710
933
|
cancelInstance(instanceName: string): boolean;
|
|
934
|
+
getDeliveryEpoch(instanceName: string): number;
|
|
935
|
+
private isDeliveryEpochCurrent;
|
|
936
|
+
/** Invalidate work queued before a user cancel and wake idle-gate waiters. */
|
|
937
|
+
private cancelPendingDeliveries;
|
|
938
|
+
private activeLogin;
|
|
939
|
+
/** Post the backend chooser for a bare `/login`. Caller enforces admin. */
|
|
940
|
+
promptLoginBackends(chat: {
|
|
941
|
+
adapter: ChannelAdapter;
|
|
942
|
+
adapterId: string;
|
|
943
|
+
chatId: string;
|
|
944
|
+
threadId?: string;
|
|
945
|
+
}): Promise<void>;
|
|
946
|
+
/**
|
|
947
|
+
* Ask the General topic to approve a ClassicBot access request.
|
|
948
|
+
*
|
|
949
|
+
* Two affirmative buttons rather than one, when the trigger identified a
|
|
950
|
+
* user. Allowing a group to talk and granting that person ClassicBot admin
|
|
951
|
+
* (start/stop/model on classic channels — NOT fleet admin, which reads
|
|
952
|
+
* fleet.yaml `channel.access.allowed_users`) have different blast radii, and
|
|
953
|
+
* bundling them would force anyone who wants only the cheap one to accept the
|
|
954
|
+
* expensive one or go edit YAML by hand.
|
|
955
|
+
*
|
|
956
|
+
* Built on postNonceButtonPrompt, so it inherits the canonical-address
|
|
957
|
+
* binding (#682) that makes these buttons answer in a Telegram General topic.
|
|
958
|
+
*/
|
|
959
|
+
private promptClassicApproval;
|
|
960
|
+
/**
|
|
961
|
+
* Apply an approved ClassicBot access request.
|
|
962
|
+
*
|
|
963
|
+
* Writes through ClassicChannelManager's typed mutators rather than handing
|
|
964
|
+
* General a YAML edit: the id is stored via String() so a Discord snowflake
|
|
965
|
+
* cannot land as a YAML integer and lose precision, the existing save() path
|
|
966
|
+
* is reused, in-memory state is correct immediately (no waiting on the 30s
|
|
967
|
+
* reload poll), and a click cannot silently do nothing because General
|
|
968
|
+
* happened to be paused. General is still told the outcome.
|
|
969
|
+
*/
|
|
970
|
+
private applyClassicApproval;
|
|
971
|
+
/** Consume a ClassicBot approval button. */
|
|
972
|
+
private handleClassicApproval;
|
|
973
|
+
/**
|
|
974
|
+
* Backend chooser for a bare `/install-cli`, mirroring promptLoginBackends so
|
|
975
|
+
* both commands feel the same. Built on postNonceButtonPrompt rather than the
|
|
976
|
+
* `/model` selection coordinator: that is the mechanism `/login` already uses,
|
|
977
|
+
* and the one whose canonical-address binding (#682) makes the buttons answer
|
|
978
|
+
* in a Telegram General topic.
|
|
979
|
+
*
|
|
980
|
+
* Unlike the login chooser this does NOT filter to backends the fleet already
|
|
981
|
+
* runs. Installing is how you get a backend you do not have yet, so filtering
|
|
982
|
+
* by configured backends would hide the only entry the admin came for.
|
|
983
|
+
*
|
|
984
|
+
* gemini-cli is omitted: it is deprecated (see backend/factory.ts). Typing
|
|
985
|
+
* `/install-cli gemini-cli` still works — this only stops recommending it.
|
|
986
|
+
*/
|
|
987
|
+
promptInstallBackends(chat: {
|
|
988
|
+
adapter: ChannelAdapter;
|
|
989
|
+
adapterId: string;
|
|
990
|
+
chatId: string;
|
|
991
|
+
threadId?: string;
|
|
992
|
+
}): Promise<void>;
|
|
993
|
+
/** Backend chooser button → start that backend's install session. */
|
|
994
|
+
private handleInstallBackendSelect;
|
|
995
|
+
/**
|
|
996
|
+
* Start a login session for one backend. Caller enforces admin.
|
|
997
|
+
* Returns a status line to post, or null when a confirmation prompt was
|
|
998
|
+
* posted instead (auth still valid — see the pre-check below).
|
|
999
|
+
*/
|
|
1000
|
+
startLoginSession(backendArg: string, chat: {
|
|
1001
|
+
adapter: ChannelAdapter;
|
|
1002
|
+
adapterId: string;
|
|
1003
|
+
chatId: string;
|
|
1004
|
+
threadId?: string;
|
|
1005
|
+
}, opts?: {
|
|
1006
|
+
skipAuthCheck?: boolean;
|
|
1007
|
+
}): Promise<string | null>;
|
|
1008
|
+
/** Create the login window and session (pre-check already settled). */
|
|
1009
|
+
private launchLoginSession;
|
|
1010
|
+
/** `/login code <text>` — paste admin-supplied text into the login window. */
|
|
1011
|
+
loginSubmitInput(text: string): Promise<string>;
|
|
1012
|
+
/** `/login cancel` — abort the active session and remove its window. */
|
|
1013
|
+
cancelLoginSession(): Promise<string>;
|
|
1014
|
+
/**
|
|
1015
|
+
* The URL (+ code) is a live credential: whoever completes it binds THEIR
|
|
1016
|
+
* account to this fleet's CLI. Telegram gets an HTML spoiler (same treatment
|
|
1017
|
+
* as the dashboard token); other adapters get plain text with the warning.
|
|
1018
|
+
*/
|
|
1019
|
+
private sendLoginSecret;
|
|
1020
|
+
/**
|
|
1021
|
+
* After a successful login: wake the paused instances of that backend AND
|
|
1022
|
+
* restart the running ones — a live CLI holds the old token in memory and
|
|
1023
|
+
* only re-reads credentials on process start (a paused instance's CLI is
|
|
1024
|
+
* already dead, so waking it respawns with the new token for free).
|
|
1025
|
+
*/
|
|
1026
|
+
private recoverBackendInstances;
|
|
1027
|
+
/** Backend chooser button → start that backend's login session. */
|
|
1028
|
+
private handleLoginBackendSelect;
|
|
1029
|
+
/** Re-login confirmation (auth pre-check said credentials still work). */
|
|
1030
|
+
private handleLoginConfirm;
|
|
1031
|
+
/** Kiro provider button → drive the CLI's arrow-key selector. */
|
|
1032
|
+
private handleLoginMenuSelect;
|
|
1033
|
+
private activeInstall;
|
|
1034
|
+
/** Start a CLI install session. Caller enforces admin. */
|
|
1035
|
+
startInstallSession(backendArg: string, chat: {
|
|
1036
|
+
adapter: ChannelAdapter;
|
|
1037
|
+
adapterId: string;
|
|
1038
|
+
chatId: string;
|
|
1039
|
+
threadId?: string;
|
|
1040
|
+
}): Promise<string>;
|
|
1041
|
+
/** `/install-cli cancel` — abort the active install and remove its window. */
|
|
1042
|
+
cancelInstallSession(): Promise<string>;
|
|
1043
|
+
/** `command -v` on a login shell, so PATH additions from rc files count. */
|
|
1044
|
+
private verifyBinaryOnLoginShell;
|
|
1045
|
+
/** "Sign in now?" button after a successful install. */
|
|
1046
|
+
private handleInstallLoginConfirm;
|
|
1047
|
+
/** Discord native `/login` slash — shared by every adapter dispatch block. */
|
|
1048
|
+
private handleLoginSlash;
|
|
1049
|
+
/** Discord native `/install-cli` slash — shared by every dispatch block. */
|
|
1050
|
+
private handleInstallCliSlash;
|
|
711
1051
|
queueMirrorMessage(text: string): void;
|
|
712
1052
|
/** Push an SSE event to all connected Web UI clients. */
|
|
713
1053
|
emitSseEvent(event: string, data: unknown): void;
|
|
@@ -728,8 +1068,45 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
728
1068
|
private static GENERAL_INSTRUCTIONS;
|
|
729
1069
|
/** Ensure the general instance has its project instructions file + knowledge */
|
|
730
1070
|
private ensureGeneralInstructions;
|
|
731
|
-
/**
|
|
1071
|
+
/** Resolve the workspace path a backend actually uses before publishing knowledge. */
|
|
1072
|
+
private resolveKnowledgeWorkDir;
|
|
1073
|
+
/**
|
|
1074
|
+
* Where each backend natively loads on-demand skills from, relative to the
|
|
1075
|
+
* workspace. Backends without a native skill mechanism (opencode, grok,
|
|
1076
|
+
* antigravity, gemini-cli) are deliberately absent: dropping files a CLI
|
|
1077
|
+
* never reads is clutter, not capability. Unknown directories are ignored
|
|
1078
|
+
* by older CLI versions, so publishing is fail-open across upgrades.
|
|
1079
|
+
*/
|
|
1080
|
+
private static SKILLS_DIR_SEGMENTS;
|
|
1081
|
+
/** Copy general-knowledge steering + all role-eligible skills to General. */
|
|
732
1082
|
private syncGeneralKnowledge;
|
|
1083
|
+
/** Publish only the bundled skills eligible for an instance role. */
|
|
1084
|
+
private syncRoleSkills;
|
|
1085
|
+
/**
|
|
1086
|
+
* Steering (always-on rules like core-rules.md). Kiro loads a native
|
|
1087
|
+
* steering directory; every other backend gets the content embedded into
|
|
1088
|
+
* its instructions file (CLAUDE.md / AGENTS.md / …) inside a managed marker
|
|
1089
|
+
* block — the previous behavior dropped bare .md files in the workspace
|
|
1090
|
+
* root, which no CLI ever read. The block is replaced in place on every
|
|
1091
|
+
* sync, so rule updates reach EXISTING workspaces; everything the user
|
|
1092
|
+
* wrote outside the markers is preserved byte-for-byte.
|
|
1093
|
+
*/
|
|
1094
|
+
private syncGeneralSteering;
|
|
1095
|
+
private static STEERING_BLOCK_BEGIN;
|
|
1096
|
+
private static STEERING_BLOCK_END;
|
|
1097
|
+
/**
|
|
1098
|
+
* Publish AgEnD's bundled skills into a CLI's native skills directory,
|
|
1099
|
+
* owning ONLY what we published. A manifest records which skill names AgEnD
|
|
1100
|
+
* wrote; a bundled rename/removal deletes the stale managed copy, while a
|
|
1101
|
+
* skill the user created by hand is never listed and therefore never
|
|
1102
|
+
* touched — even if a future bundle happens to reuse its name (the sync
|
|
1103
|
+
* then skips it and logs, rather than overwrite the user's work). The sole
|
|
1104
|
+
* migration exception is the pre-manifest Kiro General layout explicitly
|
|
1105
|
+
* selected by adoptLegacyUnmanaged.
|
|
1106
|
+
*/
|
|
1107
|
+
private syncManagedSkills;
|
|
1108
|
+
/** Read AgEnD's roles extension from SKILL.md YAML frontmatter. */
|
|
1109
|
+
private readManagedSkillRoles;
|
|
733
1110
|
/** Fetch forum topic icon stickers and pick emoji IDs for each state */
|
|
734
1111
|
private resolveTopicIcons;
|
|
735
1112
|
/** Set topic icon based on instance state */
|
|
@@ -772,6 +1149,34 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
772
1149
|
private probeCliEnvs;
|
|
773
1150
|
/** Best-effort model list for `/model`: cached CLI env first, else live probe. Never throws. */
|
|
774
1151
|
private getModelOptions;
|
|
1152
|
+
/**
|
|
1153
|
+
* Model catalog behind the `list_models` tool.
|
|
1154
|
+
*
|
|
1155
|
+
* The two scopes are not cosmetic. "global" is the account/CLI catalog served
|
|
1156
|
+
* from the startup probe cache; "instance" is resolved through that instance's
|
|
1157
|
+
* OWN backend config, and for a Codex instance on a custom provider that is a
|
|
1158
|
+
* different catalog entirely — `listModels()` reads models_cache.json out of
|
|
1159
|
+
* the instance's private CODEX_HOME. Answering such an instance with the
|
|
1160
|
+
* account list would name models its CLI rejects, which is exactly the
|
|
1161
|
+
* mistake this tool exists to prevent.
|
|
1162
|
+
*
|
|
1163
|
+
* `scope` always describes where the returned LIST came from, not what was
|
|
1164
|
+
* asked for: an instance query that falls back to the account catalog reports
|
|
1165
|
+
* scope "global" and says so in `note`, rather than implying instance-level
|
|
1166
|
+
* accuracy it does not have.
|
|
1167
|
+
*
|
|
1168
|
+
* Never throws — a model listing is an aid, and failing it must not fail a turn.
|
|
1169
|
+
*/
|
|
1170
|
+
listModelCatalog(opts?: {
|
|
1171
|
+
backend?: string;
|
|
1172
|
+
instanceName?: string;
|
|
1173
|
+
}): Promise<ModelCatalog>;
|
|
1174
|
+
/** The custom provider an instance overrides its backend with, if any. */
|
|
1175
|
+
private customProviderFor;
|
|
1176
|
+
/** Ask a backend for its catalog using ONE instance's real config. Never throws. */
|
|
1177
|
+
private instanceScopedModels;
|
|
1178
|
+
/** Account-wide catalog: probe cache first, live probe on miss. */
|
|
1179
|
+
private globalModelCatalog;
|
|
775
1180
|
/** `/model` slash handler (admin only). No arg → DC menu; `/model <name>` → apply directly. */
|
|
776
1181
|
/** Label an effort choice, marking the one currently configured. */
|
|
777
1182
|
private effortChoiceLabel;
|
|
@@ -789,6 +1194,10 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
789
1194
|
* Returns null on success (menu shown), or a fallback string to send.
|
|
790
1195
|
*/
|
|
791
1196
|
promptModelMenu(instanceName: string, userId: string, channelId: string, adapter: ChannelAdapter, chatId: string, threadId?: string): Promise<string | null>;
|
|
1197
|
+
/** Cached-or-live account catalog behind "/model → more models" (claude). */
|
|
1198
|
+
private claudeApiModelOptions;
|
|
1199
|
+
/** Replace a consumed "/model" menu with the full account catalog tier. */
|
|
1200
|
+
private expandClaudeModelMenu;
|
|
792
1201
|
/** Consume a `/model` selection callback. Returns true for all model-select ids (incl. stale). */
|
|
793
1202
|
private handleModelSelection;
|
|
794
1203
|
/** Apply a model to an instance: runtime paste (claude-code) or persist + restart (others). */
|
|
@@ -876,7 +1285,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
876
1285
|
/**
|
|
877
1286
|
* Hot-reload: re-read fleet.yaml and reconcile running instances.
|
|
878
1287
|
* Starts new, stops removed, restarts modified instances.
|
|
879
|
-
*
|
|
1288
|
+
* Whitelisted runtime fields are pushed into live daemons; all other instance
|
|
1289
|
+
* fields, plus cold fleet-level settings, retain restart semantics.
|
|
880
1290
|
*/
|
|
881
1291
|
private reconcileInstances;
|
|
882
1292
|
restartInstances(): Promise<void>;
|