@songsid/agend 2.1.4-beta.4 → 2.1.4-beta.40
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-endpoint.js +1 -1
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/backend/antigravity.d.ts +9 -5
- package/dist/backend/antigravity.js +156 -31
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/backend/claude-code.d.ts +62 -23
- package/dist/backend/claude-code.js +296 -43
- package/dist/backend/claude-code.js.map +1 -1
- package/dist/backend/codex.d.ts +18 -0
- package/dist/backend/codex.js +148 -8
- 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 +2 -0
- package/dist/backend/kiro.js +24 -3
- package/dist/backend/kiro.js.map +1 -1
- package/dist/backend/opencode.d.ts +27 -11
- package/dist/backend/opencode.js +65 -41
- package/dist/backend/opencode.js.map +1 -1
- package/dist/backend/types.d.ts +45 -3
- package/dist/backend/types.js +12 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/channel/adapters/discord.d.ts +44 -2
- package/dist/channel/adapters/discord.js +526 -78
- package/dist/channel/adapters/discord.js.map +1 -1
- package/dist/channel/adapters/telegram.d.ts +30 -0
- package/dist/channel/adapters/telegram.js +212 -18
- 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/mcp-server.js +28 -25
- package/dist/channel/mcp-server.js.map +1 -1
- package/dist/channel/mcp-tools.js +4 -2
- package/dist/channel/mcp-tools.js.map +1 -1
- package/dist/channel/message-queue.js +62 -1
- package/dist/channel/message-queue.js.map +1 -1
- package/dist/channel/types.d.ts +31 -1
- package/dist/classic-channel-manager.d.ts +40 -3
- package/dist/classic-channel-manager.js +218 -31
- package/dist/classic-channel-manager.js.map +1 -1
- package/dist/cli.js +109 -37
- package/dist/cli.js.map +1 -1
- package/dist/config-validator.js +48 -7
- 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 +319 -9
- package/dist/daemon.js +1402 -255
- 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 +47 -0
- package/dist/fleet-manager.d.ts +265 -11
- package/dist/fleet-manager.js +2273 -455
- 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 +3 -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 +1 -0
- 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 +67 -0
- package/dist/instance-lifecycle.js +273 -8
- package/dist/instance-lifecycle.js.map +1 -1
- package/dist/instructions.d.ts +12 -0
- package/dist/instructions.js +35 -1
- package/dist/instructions.js.map +1 -1
- package/dist/locale.js +958 -288
- 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 +8 -0
- package/dist/outbound-handlers.js +101 -18
- package/dist/outbound-handlers.js.map +1 -1
- package/dist/outbound-schemas.d.ts +7 -1
- package/dist/outbound-schemas.js +9 -0
- package/dist/outbound-schemas.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/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 +42 -4
- package/dist/topic-commands.js +354 -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 +13 -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.js +24 -23
- 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 +19 -0
- package/dist/usage/providers.js +150 -74
- package/dist/usage/providers.js.map +1 -1
- package/dist/usage/usage-api.d.ts +8 -2
- package/dist/usage/usage-api.js +45 -23
- 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,8 @@ 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";
|
|
23
25
|
export declare function resolveReplyThreadId(argsThreadId: unknown, instanceConfig?: InstanceConfig): string | undefined;
|
|
24
26
|
/**
|
|
25
27
|
* Pure warm-cap victim selection (extracted for testability). Given the current
|
|
@@ -36,6 +38,25 @@ export declare function selectLruEvictions(warm: string[], cap: number, opts: {
|
|
|
36
38
|
isIdle: (name: string) => boolean;
|
|
37
39
|
lastInboundAt: (name: string) => number;
|
|
38
40
|
}): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Answer shape for `list_models`. `scope` reports where the LIST came from —
|
|
43
|
+
* "instance" only when it was read through that instance's own backend config,
|
|
44
|
+
* "global" for the account/CLI catalog — so a caller can tell an authoritative
|
|
45
|
+
* per-instance list from a best-effort account-wide one.
|
|
46
|
+
*/
|
|
47
|
+
export interface ModelCatalog {
|
|
48
|
+
backend: string;
|
|
49
|
+
scope: "instance" | "global";
|
|
50
|
+
/** Set whenever an instance was asked about, even if the list is global. */
|
|
51
|
+
instance?: string;
|
|
52
|
+
current_model: string | null;
|
|
53
|
+
models: import("./backend/types.js").ModelOption[];
|
|
54
|
+
/** "cache" = startup probe cache, "live" = probed now, "fallback" = none available. */
|
|
55
|
+
source: "cache" | "live" | "fallback";
|
|
56
|
+
probed_at?: string;
|
|
57
|
+
/** Caveat the caller should read before trusting the list. */
|
|
58
|
+
note?: string;
|
|
59
|
+
}
|
|
39
60
|
export interface DeliveryOptions {
|
|
40
61
|
/** Explicitly identify agent-to-agent delivery when metadata is unavailable. */
|
|
41
62
|
isCrossInstance?: boolean;
|
|
@@ -50,6 +71,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
50
71
|
private static sighupHandlerInstalled;
|
|
51
72
|
private children;
|
|
52
73
|
readonly lifecycle: InstanceLifecycle;
|
|
74
|
+
readonly stormWindow: StormWindow;
|
|
75
|
+
readonly spawnGate: SpawnGate;
|
|
53
76
|
/** Live view of lifecycle.daemons — used throughout; not deprecated. */
|
|
54
77
|
get daemons(): Map<string, import("./daemon.js").Daemon>;
|
|
55
78
|
fleetConfig: FleetConfig | null;
|
|
@@ -83,6 +106,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
83
106
|
costGuard: CostGuard | null;
|
|
84
107
|
private statuslineWatcher;
|
|
85
108
|
private dailySummary;
|
|
109
|
+
private dailyTipScheduler;
|
|
86
110
|
private webhookEmitter;
|
|
87
111
|
private topicIcons;
|
|
88
112
|
private lastActivity;
|
|
@@ -94,6 +118,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
94
118
|
private warmCapEvicting;
|
|
95
119
|
/** Per-instance tail keeps cross-instance and scheduled deliveries FIFO. */
|
|
96
120
|
private idleGatedDeliveryTails;
|
|
121
|
+
/**
|
|
122
|
+
* Per-instance cancellation epoch for deliveries which have not reached the
|
|
123
|
+
* daemon yet. A cancel advances the epoch; queued work captures the old value
|
|
124
|
+
* and becomes a no-op, while messages arriving after the click capture the new
|
|
125
|
+
* value and remain deliverable.
|
|
126
|
+
*/
|
|
127
|
+
private deliveryEpochs;
|
|
97
128
|
/** Non-user work must observe a fresh idle snapshot after the latest delivery. */
|
|
98
129
|
private lastDeliveryAt;
|
|
99
130
|
/** State-cache updates wake event-driven idle waiters without busy polling. */
|
|
@@ -106,6 +137,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
106
137
|
readonly replyDeduper: ReplyDeduper;
|
|
107
138
|
/** instanceName → what it is doing right now, when the backend can tell us. */
|
|
108
139
|
private instanceActivity;
|
|
140
|
+
/** instanceName → this turn's tool list (multi-line), for the bubble. */
|
|
141
|
+
private instanceProgress;
|
|
109
142
|
/** instanceName → tail of deliveries waiting for its IPC to come back. */
|
|
110
143
|
private ipcWaitTails;
|
|
111
144
|
/** instanceName → restart currently executing; concurrent callers join it. */
|
|
@@ -140,12 +173,14 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
140
173
|
private updateProgressTimer;
|
|
141
174
|
private updateProgressEditRunning;
|
|
142
175
|
private lastUpdateProgressText;
|
|
176
|
+
private updateCompletionTipText;
|
|
143
177
|
private eventLogPruneTimer;
|
|
144
178
|
private logRotateTimer;
|
|
145
179
|
/** Days of event/activity history to keep. */
|
|
146
180
|
private static readonly EVENT_LOG_RETENTION_DAYS;
|
|
147
181
|
private watchdogTimer;
|
|
148
182
|
private startedAt;
|
|
183
|
+
private stormOpenNotifyTimer;
|
|
149
184
|
private mirrorBuffer;
|
|
150
185
|
private mirrorTimer;
|
|
151
186
|
private sseClients;
|
|
@@ -153,6 +188,11 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
153
188
|
private viewToken;
|
|
154
189
|
private healthServerListening;
|
|
155
190
|
constructor(dataDir: string);
|
|
191
|
+
private spawnConcurrency;
|
|
192
|
+
/** Wire the one fleet-wide storm into notification and recovery surfaces. */
|
|
193
|
+
private bindStormWindowEvents;
|
|
194
|
+
private formatStormDelay;
|
|
195
|
+
stormSuppressed(kind: string): boolean;
|
|
156
196
|
private handleSighup;
|
|
157
197
|
private scheduleReconcile;
|
|
158
198
|
/**
|
|
@@ -222,6 +262,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
222
262
|
private isModelAdmin;
|
|
223
263
|
private handlePauseWakeSlash;
|
|
224
264
|
private handleUpdateSlash;
|
|
265
|
+
private handleTipsSlash;
|
|
225
266
|
/** Admin-only full conversation reset for fleet-topic and Classic instances. */
|
|
226
267
|
private handleClearSlash;
|
|
227
268
|
/** Get the adapter bound to an instance, falling back to primary adapter */
|
|
@@ -252,6 +293,14 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
252
293
|
bindInstanceAdapter(name: string, adapterId: string, fromInbound?: boolean): void;
|
|
253
294
|
getInstanceStatus(name: string): "running" | "paused" | "stopped" | "crashed";
|
|
254
295
|
getInstanceExecutionState(name: string): InstanceState | null;
|
|
296
|
+
/**
|
|
297
|
+
* Subscription providers currently relevant to this fleet. Stopped/crashed
|
|
298
|
+
* rows do not keep a usage card alive, while persisted paused instances do.
|
|
299
|
+
* Classic channels use their effective backend merge chain, not the raw row.
|
|
300
|
+
*/
|
|
301
|
+
getActiveUsageProviderIds(): ReadonlySet<string>;
|
|
302
|
+
/** Effective backends with a running or persisted-paused fleet/Classic instance. */
|
|
303
|
+
getActiveBackendIds(): ReadonlySet<string>;
|
|
255
304
|
isClassicInstance(name: string): boolean;
|
|
256
305
|
private cacheInstanceExecutionState;
|
|
257
306
|
private cancelIdleButtonRetirement;
|
|
@@ -268,7 +317,15 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
268
317
|
*/
|
|
269
318
|
private enforceWarmCap;
|
|
270
319
|
private waitForInstanceIdle;
|
|
320
|
+
/**
|
|
321
|
+
* Ask the daemon to capture the pane before answering, then wait for any state
|
|
322
|
+
* report produced after this request. The ordinary query is intentionally
|
|
323
|
+
* cache-only (idle gates call it frequently); this opt-in refresh is reserved
|
|
324
|
+
* for lifecycle decisions where a stale state would strand UI.
|
|
325
|
+
*/
|
|
326
|
+
private refreshInstanceExecutionState;
|
|
271
327
|
private deliverWithIdleGate;
|
|
328
|
+
private holdDeliveryForStorm;
|
|
272
329
|
/**
|
|
273
330
|
* Hand a payload to an instance's IPC, waiting out a *transient* disconnect.
|
|
274
331
|
*
|
|
@@ -362,6 +419,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
362
419
|
retryCount: number;
|
|
363
420
|
lastError?: string;
|
|
364
421
|
}>;
|
|
422
|
+
private bindAdapterHealth;
|
|
365
423
|
/**
|
|
366
424
|
* Real, checkable fleet health for `/health` and the operator.
|
|
367
425
|
*
|
|
@@ -390,6 +448,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
390
448
|
total: number;
|
|
391
449
|
connected: number;
|
|
392
450
|
states: Record<string, string>;
|
|
451
|
+
details: Record<string, AdapterHealthSnapshot>;
|
|
393
452
|
};
|
|
394
453
|
startupComplete: boolean;
|
|
395
454
|
/** See process-memory.ts: the fleet process and the whole service cgroup are
|
|
@@ -445,6 +504,10 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
445
504
|
private handleDecisionCrud;
|
|
446
505
|
/** Resolve display name for an instance, fallback to instance name. */
|
|
447
506
|
resolveDisplayName(instanceName: string): string;
|
|
507
|
+
/** Persist identity to the instance's actual config store. Classic instances
|
|
508
|
+
* are registry rows in classicBot.yaml, not fleet.yaml instance entries. */
|
|
509
|
+
private setInstanceDisplayName;
|
|
510
|
+
private setInstanceDescription;
|
|
448
511
|
private handleSetDisplayName;
|
|
449
512
|
private handleSetDescription;
|
|
450
513
|
handleScheduleCrudHttp(instance: string, op: string, args: Record<string, unknown>): Promise<unknown>;
|
|
@@ -465,9 +528,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
465
528
|
private startTopicCleanupPoller;
|
|
466
529
|
/**
|
|
467
530
|
* Patch only values changed in the effective config into the original YAML
|
|
468
|
-
* document. Unknown keys
|
|
531
|
+
* document. Unknown keys and comments remain untouched; redundant
|
|
532
|
+
* non-identity instance leaves are canonicalized to inheritance afterward.
|
|
469
533
|
*/
|
|
470
534
|
saveFleetConfig(explicitPatches?: RawConfigPatch[]): void;
|
|
535
|
+
/** One-time upgrade migration; invalid YAML is never rewritten. */
|
|
536
|
+
private slimFleetConfigAtStartup;
|
|
537
|
+
private writeFleetConfigBackup;
|
|
471
538
|
private patchFleetDocument;
|
|
472
539
|
removeInstance(name: string): Promise<void>;
|
|
473
540
|
startStatuslineWatcher(name: string): void;
|
|
@@ -548,13 +615,12 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
548
615
|
*/
|
|
549
616
|
private postNonceButtonPrompt;
|
|
550
617
|
/**
|
|
551
|
-
*
|
|
618
|
+
* Validate a nonce-armed callback and claim it exactly once.
|
|
552
619
|
*
|
|
553
620
|
* Returns:
|
|
554
621
|
* - null — the callback is not for this prefix; try the next handler
|
|
555
622
|
* - "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)
|
|
623
|
+
* - the entry+action — the click is authorized and claimed before any await
|
|
558
624
|
*
|
|
559
625
|
* A stale click (expired nonce, or a pre-upgrade button whose payload no
|
|
560
626
|
* longer parses) collapses the clicked message so the dead button stops
|
|
@@ -563,6 +629,23 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
563
629
|
private consumeNonceCallback;
|
|
564
630
|
/** Collapse a consumed prompt's buttons into a final status line. */
|
|
565
631
|
private retireNonceButtons;
|
|
632
|
+
private tipsEnabled;
|
|
633
|
+
private readTipState;
|
|
634
|
+
private pickAvailableTip;
|
|
635
|
+
private tipText;
|
|
636
|
+
private formatTip;
|
|
637
|
+
/** Persistently enable advanced tips through the admin-only slash command. */
|
|
638
|
+
unlockAdvancedTips(userId: string): boolean;
|
|
639
|
+
/** Post one fresh nonce-armed tip in a known General channel. */
|
|
640
|
+
promptTip(generalName: string, adapter: ChannelAdapter, chatId: string, threadId?: string): Promise<"posted" | "empty" | "unavailable">;
|
|
641
|
+
private promptAdvancedTipUnlock;
|
|
642
|
+
private sendTipToGeneral;
|
|
643
|
+
private handleTipDismiss;
|
|
644
|
+
private handleTipUnlock;
|
|
645
|
+
/** Post the destructive `/clear` confirmation in the invoking channel. */
|
|
646
|
+
promptClearConfirmation(instanceName: string, channelId: string, adapter: ChannelAdapter, chatId: string, threadId?: string): Promise<string | null>;
|
|
647
|
+
/** Consume `/clear` Confirm/Cancel exactly once; only Confirm reaches IPC. */
|
|
648
|
+
private handleClearConfirmation;
|
|
566
649
|
/**
|
|
567
650
|
* Drop every pending prompt that refers to an instance being stopped or
|
|
568
651
|
* restarted — a restart offer for an instance the operator just restarted
|
|
@@ -613,7 +696,7 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
613
696
|
*/
|
|
614
697
|
private handleCancelClick;
|
|
615
698
|
private hasCancelButton;
|
|
616
|
-
sendCancelButton(instanceName: string, correlationId?: string): Promise<void>;
|
|
699
|
+
sendCancelButton(instanceName: string, correlationId?: string, preserveProgress?: boolean): Promise<void>;
|
|
617
700
|
/**
|
|
618
701
|
* The cancel button's text for a given elapsed time.
|
|
619
702
|
*
|
|
@@ -623,6 +706,13 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
623
706
|
* and once the agent had replied once there was no sign it was still going.
|
|
624
707
|
*/
|
|
625
708
|
static progressText(elapsedMs: number, activity?: string | null, minElapsedMs?: number): string;
|
|
709
|
+
/** Render elapsed time consistently in live and retained progress bubbles. */
|
|
710
|
+
private static formatProgressElapsed;
|
|
711
|
+
/** Final read-only form of a bubble that contains semantic tool history.
|
|
712
|
+
* Neutral wording is intentional: the same retirement primitive is used for
|
|
713
|
+
* normal completion, a mid-turn bubble replacement, and user cancellation,
|
|
714
|
+
* so claiming every retained checkpoint is "completed" would be false. */
|
|
715
|
+
private composeRetiredBubbleText;
|
|
626
716
|
/**
|
|
627
717
|
* Make a tool summary safe to paste into a channel message.
|
|
628
718
|
*
|
|
@@ -640,6 +730,26 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
640
730
|
* never used to decide anything — purely what the user is shown.
|
|
641
731
|
*/
|
|
642
732
|
private cacheInstanceActivity;
|
|
733
|
+
/**
|
|
734
|
+
* Cache the turn's tool-progress list and push it into the instance's live
|
|
735
|
+
* bubble, coalesced so a burst of tool events cannot flood the Bot API
|
|
736
|
+
* (Telegram's flood limit is per-chat across ALL forum topics, so edits are
|
|
737
|
+
* rate-limited per bubble AND ride behind the daemon-side 3s coalescer).
|
|
738
|
+
*/
|
|
739
|
+
private cacheInstanceProgress;
|
|
740
|
+
/** At most one progress-driven edit per bubble per TOOL_PROGRESS_EDIT_MIN_MS. */
|
|
741
|
+
private scheduleProgressEdit;
|
|
742
|
+
/**
|
|
743
|
+
* The ONE composer for the bubble text. Both writers — the elapsed-time
|
|
744
|
+
* ticker and the tool-progress push — go through here; two independent
|
|
745
|
+
* renderers editing the same message is how the progress list used to get
|
|
746
|
+
* wiped by the next elapsed tick (#528 trap 2).
|
|
747
|
+
*/
|
|
748
|
+
private composeBubbleText;
|
|
749
|
+
/** Pure composition of header + tool list, exposed for tests. */
|
|
750
|
+
static bubbleText(elapsedMs: number, activity: string | undefined, minElapsedMs: number, progress: string | undefined): string;
|
|
751
|
+
/** Recompose and edit the bubble in place; skips when nothing changed. */
|
|
752
|
+
private refreshBubble;
|
|
643
753
|
/**
|
|
644
754
|
* Refresh the button's text in place while the instance keeps working.
|
|
645
755
|
*
|
|
@@ -652,10 +762,14 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
652
762
|
private startProgressTicker;
|
|
653
763
|
/**
|
|
654
764
|
* After a reply: give the instance REPLY_RETIRE_GRACE_MS to resume working; if
|
|
655
|
-
* it has not, retire its button.
|
|
656
|
-
*
|
|
765
|
+
* it has not, retire its button. The daemon is asked for a fresh pane capture
|
|
766
|
+
* before deciding. Reading only the transition cache stranded the first
|
|
767
|
+
* post-restart bubble when its startup "working" report never got a matching
|
|
768
|
+
* idle edge. Re-arming replaces the previous timer, so a burst of replies ends
|
|
769
|
+
* with exactly one pending check.
|
|
657
770
|
*/
|
|
658
771
|
private armReplyGrace;
|
|
772
|
+
private finishReplyGrace;
|
|
659
773
|
/** Retire (delete) every cancel button belonging to an instance. */
|
|
660
774
|
private retireInstanceButtons;
|
|
661
775
|
/** Begin retiring one button (delete + bounded retry on failure). Idempotent:
|
|
@@ -680,7 +794,9 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
680
794
|
private sweepOrphanedCancelButtons;
|
|
681
795
|
/** Re-attempt a failed button delete up to CANCEL_BTN_MAX_RETRIES times. */
|
|
682
796
|
private scheduleButtonRetry;
|
|
683
|
-
/**
|
|
797
|
+
/** Retire one cancel bubble via its own adapter. A bubble that accumulated
|
|
798
|
+
* tool progress is kept as a read-only history message; a plain bubble keeps
|
|
799
|
+
* the legacy delete/edit-to-checkmark behavior. Resolves on success and
|
|
684
800
|
* rejects on failure so the caller can retry. */
|
|
685
801
|
private deleteButtonMessage;
|
|
686
802
|
/** Retire all cancel buttons for an instance — on reply or cancel. */
|
|
@@ -704,6 +820,74 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
704
820
|
private reactDone;
|
|
705
821
|
/** Interrupt an instance's current generation (cancel button / /cancel). */
|
|
706
822
|
cancelInstance(instanceName: string): boolean;
|
|
823
|
+
getDeliveryEpoch(instanceName: string): number;
|
|
824
|
+
private isDeliveryEpochCurrent;
|
|
825
|
+
/** Invalidate work queued before a user cancel and wake idle-gate waiters. */
|
|
826
|
+
private cancelPendingDeliveries;
|
|
827
|
+
private activeLogin;
|
|
828
|
+
/** Post the backend chooser for a bare `/login`. Caller enforces admin. */
|
|
829
|
+
promptLoginBackends(chat: {
|
|
830
|
+
adapter: ChannelAdapter;
|
|
831
|
+
adapterId: string;
|
|
832
|
+
chatId: string;
|
|
833
|
+
threadId?: string;
|
|
834
|
+
}): Promise<void>;
|
|
835
|
+
/**
|
|
836
|
+
* Start a login session for one backend. Caller enforces admin.
|
|
837
|
+
* Returns a status line to post, or null when a confirmation prompt was
|
|
838
|
+
* posted instead (auth still valid — see the pre-check below).
|
|
839
|
+
*/
|
|
840
|
+
startLoginSession(backendArg: string, chat: {
|
|
841
|
+
adapter: ChannelAdapter;
|
|
842
|
+
adapterId: string;
|
|
843
|
+
chatId: string;
|
|
844
|
+
threadId?: string;
|
|
845
|
+
}, opts?: {
|
|
846
|
+
skipAuthCheck?: boolean;
|
|
847
|
+
}): Promise<string | null>;
|
|
848
|
+
/** Create the login window and session (pre-check already settled). */
|
|
849
|
+
private launchLoginSession;
|
|
850
|
+
/** `/login code <text>` — paste admin-supplied text into the login window. */
|
|
851
|
+
loginSubmitInput(text: string): Promise<string>;
|
|
852
|
+
/** `/login cancel` — abort the active session and remove its window. */
|
|
853
|
+
cancelLoginSession(): Promise<string>;
|
|
854
|
+
/**
|
|
855
|
+
* The URL (+ code) is a live credential: whoever completes it binds THEIR
|
|
856
|
+
* account to this fleet's CLI. Telegram gets an HTML spoiler (same treatment
|
|
857
|
+
* as the dashboard token); other adapters get plain text with the warning.
|
|
858
|
+
*/
|
|
859
|
+
private sendLoginSecret;
|
|
860
|
+
/**
|
|
861
|
+
* After a successful login: wake the paused instances of that backend AND
|
|
862
|
+
* restart the running ones — a live CLI holds the old token in memory and
|
|
863
|
+
* only re-reads credentials on process start (a paused instance's CLI is
|
|
864
|
+
* already dead, so waking it respawns with the new token for free).
|
|
865
|
+
*/
|
|
866
|
+
private recoverBackendInstances;
|
|
867
|
+
/** Backend chooser button → start that backend's login session. */
|
|
868
|
+
private handleLoginBackendSelect;
|
|
869
|
+
/** Re-login confirmation (auth pre-check said credentials still work). */
|
|
870
|
+
private handleLoginConfirm;
|
|
871
|
+
/** Kiro provider button → drive the CLI's arrow-key selector. */
|
|
872
|
+
private handleLoginMenuSelect;
|
|
873
|
+
private activeInstall;
|
|
874
|
+
/** Start a CLI install session. Caller enforces admin. */
|
|
875
|
+
startInstallSession(backendArg: string, chat: {
|
|
876
|
+
adapter: ChannelAdapter;
|
|
877
|
+
adapterId: string;
|
|
878
|
+
chatId: string;
|
|
879
|
+
threadId?: string;
|
|
880
|
+
}): Promise<string>;
|
|
881
|
+
/** `/install-cli cancel` — abort the active install and remove its window. */
|
|
882
|
+
cancelInstallSession(): Promise<string>;
|
|
883
|
+
/** `command -v` on a login shell, so PATH additions from rc files count. */
|
|
884
|
+
private verifyBinaryOnLoginShell;
|
|
885
|
+
/** "Sign in now?" button after a successful install. */
|
|
886
|
+
private handleInstallLoginConfirm;
|
|
887
|
+
/** Discord native `/login` slash — shared by every adapter dispatch block. */
|
|
888
|
+
private handleLoginSlash;
|
|
889
|
+
/** Discord native `/install-cli` slash — shared by every dispatch block. */
|
|
890
|
+
private handleInstallCliSlash;
|
|
707
891
|
queueMirrorMessage(text: string): void;
|
|
708
892
|
/** Push an SSE event to all connected Web UI clients. */
|
|
709
893
|
emitSseEvent(event: string, data: unknown): void;
|
|
@@ -724,8 +908,45 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
724
908
|
private static GENERAL_INSTRUCTIONS;
|
|
725
909
|
/** Ensure the general instance has its project instructions file + knowledge */
|
|
726
910
|
private ensureGeneralInstructions;
|
|
727
|
-
/**
|
|
911
|
+
/** Resolve the workspace path a backend actually uses before publishing knowledge. */
|
|
912
|
+
private resolveKnowledgeWorkDir;
|
|
913
|
+
/**
|
|
914
|
+
* Where each backend natively loads on-demand skills from, relative to the
|
|
915
|
+
* workspace. Backends without a native skill mechanism (opencode, grok,
|
|
916
|
+
* antigravity, gemini-cli) are deliberately absent: dropping files a CLI
|
|
917
|
+
* never reads is clutter, not capability. Unknown directories are ignored
|
|
918
|
+
* by older CLI versions, so publishing is fail-open across upgrades.
|
|
919
|
+
*/
|
|
920
|
+
private static SKILLS_DIR_SEGMENTS;
|
|
921
|
+
/** Copy general-knowledge steering + all role-eligible skills to General. */
|
|
728
922
|
private syncGeneralKnowledge;
|
|
923
|
+
/** Publish only the bundled skills eligible for an instance role. */
|
|
924
|
+
private syncRoleSkills;
|
|
925
|
+
/**
|
|
926
|
+
* Steering (always-on rules like core-rules.md). Kiro loads a native
|
|
927
|
+
* steering directory; every other backend gets the content embedded into
|
|
928
|
+
* its instructions file (CLAUDE.md / AGENTS.md / …) inside a managed marker
|
|
929
|
+
* block — the previous behavior dropped bare .md files in the workspace
|
|
930
|
+
* root, which no CLI ever read. The block is replaced in place on every
|
|
931
|
+
* sync, so rule updates reach EXISTING workspaces; everything the user
|
|
932
|
+
* wrote outside the markers is preserved byte-for-byte.
|
|
933
|
+
*/
|
|
934
|
+
private syncGeneralSteering;
|
|
935
|
+
private static STEERING_BLOCK_BEGIN;
|
|
936
|
+
private static STEERING_BLOCK_END;
|
|
937
|
+
/**
|
|
938
|
+
* Publish AgEnD's bundled skills into a CLI's native skills directory,
|
|
939
|
+
* owning ONLY what we published. A manifest records which skill names AgEnD
|
|
940
|
+
* wrote; a bundled rename/removal deletes the stale managed copy, while a
|
|
941
|
+
* skill the user created by hand is never listed and therefore never
|
|
942
|
+
* touched — even if a future bundle happens to reuse its name (the sync
|
|
943
|
+
* then skips it and logs, rather than overwrite the user's work). The sole
|
|
944
|
+
* migration exception is the pre-manifest Kiro General layout explicitly
|
|
945
|
+
* selected by adoptLegacyUnmanaged.
|
|
946
|
+
*/
|
|
947
|
+
private syncManagedSkills;
|
|
948
|
+
/** Read AgEnD's roles extension from SKILL.md YAML frontmatter. */
|
|
949
|
+
private readManagedSkillRoles;
|
|
729
950
|
/** Fetch forum topic icon stickers and pick emoji IDs for each state */
|
|
730
951
|
private resolveTopicIcons;
|
|
731
952
|
/** Set topic icon based on instance state */
|
|
@@ -768,6 +989,34 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
768
989
|
private probeCliEnvs;
|
|
769
990
|
/** Best-effort model list for `/model`: cached CLI env first, else live probe. Never throws. */
|
|
770
991
|
private getModelOptions;
|
|
992
|
+
/**
|
|
993
|
+
* Model catalog behind the `list_models` tool.
|
|
994
|
+
*
|
|
995
|
+
* The two scopes are not cosmetic. "global" is the account/CLI catalog served
|
|
996
|
+
* from the startup probe cache; "instance" is resolved through that instance's
|
|
997
|
+
* OWN backend config, and for a Codex instance on a custom provider that is a
|
|
998
|
+
* different catalog entirely — `listModels()` reads models_cache.json out of
|
|
999
|
+
* the instance's private CODEX_HOME. Answering such an instance with the
|
|
1000
|
+
* account list would name models its CLI rejects, which is exactly the
|
|
1001
|
+
* mistake this tool exists to prevent.
|
|
1002
|
+
*
|
|
1003
|
+
* `scope` always describes where the returned LIST came from, not what was
|
|
1004
|
+
* asked for: an instance query that falls back to the account catalog reports
|
|
1005
|
+
* scope "global" and says so in `note`, rather than implying instance-level
|
|
1006
|
+
* accuracy it does not have.
|
|
1007
|
+
*
|
|
1008
|
+
* Never throws — a model listing is an aid, and failing it must not fail a turn.
|
|
1009
|
+
*/
|
|
1010
|
+
listModelCatalog(opts?: {
|
|
1011
|
+
backend?: string;
|
|
1012
|
+
instanceName?: string;
|
|
1013
|
+
}): Promise<ModelCatalog>;
|
|
1014
|
+
/** The custom provider an instance overrides its backend with, if any. */
|
|
1015
|
+
private customProviderFor;
|
|
1016
|
+
/** Ask a backend for its catalog using ONE instance's real config. Never throws. */
|
|
1017
|
+
private instanceScopedModels;
|
|
1018
|
+
/** Account-wide catalog: probe cache first, live probe on miss. */
|
|
1019
|
+
private globalModelCatalog;
|
|
771
1020
|
/** `/model` slash handler (admin only). No arg → DC menu; `/model <name>` → apply directly. */
|
|
772
1021
|
/** Label an effort choice, marking the one currently configured. */
|
|
773
1022
|
private effortChoiceLabel;
|
|
@@ -785,6 +1034,10 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
785
1034
|
* Returns null on success (menu shown), or a fallback string to send.
|
|
786
1035
|
*/
|
|
787
1036
|
promptModelMenu(instanceName: string, userId: string, channelId: string, adapter: ChannelAdapter, chatId: string, threadId?: string): Promise<string | null>;
|
|
1037
|
+
/** Cached-or-live account catalog behind "/model → more models" (claude). */
|
|
1038
|
+
private claudeApiModelOptions;
|
|
1039
|
+
/** Replace a consumed "/model" menu with the full account catalog tier. */
|
|
1040
|
+
private expandClaudeModelMenu;
|
|
788
1041
|
/** Consume a `/model` selection callback. Returns true for all model-select ids (incl. stale). */
|
|
789
1042
|
private handleModelSelection;
|
|
790
1043
|
/** Apply a model to an instance: runtime paste (claude-code) or persist + restart (others). */
|
|
@@ -872,7 +1125,8 @@ export declare class FleetManager implements FleetContext, LifecycleContext, Arc
|
|
|
872
1125
|
/**
|
|
873
1126
|
* Hot-reload: re-read fleet.yaml and reconcile running instances.
|
|
874
1127
|
* Starts new, stops removed, restarts modified instances.
|
|
875
|
-
*
|
|
1128
|
+
* Whitelisted runtime fields are pushed into live daemons; all other instance
|
|
1129
|
+
* fields, plus cold fleet-level settings, retain restart semantics.
|
|
876
1130
|
*/
|
|
877
1131
|
private reconcileInstances;
|
|
878
1132
|
restartInstances(): Promise<void>;
|