@wrongstack/webui 0.299.0 → 0.300.0
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/assets/AgentRosterView-wkALMOGD.js +9 -0
- package/dist/assets/{AnalyticsDashboard-D58kSekC.js → AnalyticsDashboard-CIN35A_u.js} +1 -1
- package/dist/assets/AudienceMemoryPanel-BAY2Bh8z.js +3 -0
- package/dist/assets/ChangesView-CVWSTGmX.js +1 -0
- package/dist/assets/ChronicleDashboard-Bg3W7C9U.js +1 -0
- package/dist/assets/CodeEditor-CWY_6cQD.js +1 -0
- package/dist/assets/CodeMap-CjmKO0lB.js +1 -0
- package/dist/assets/CronJobsPanel-BinzTWNs.js +1 -0
- package/dist/assets/DeadCodeScanPanel-C3CgaNVv.js +2 -0
- package/dist/assets/DebugDashboard-BqUghn06.js +1 -0
- package/dist/assets/DesignGalleryView-CuWWQAlD.js +1 -0
- package/dist/assets/GoalView-2weuLiPM.js +1 -0
- package/dist/assets/KanbanView-DXYRrshJ.js +3 -0
- package/dist/assets/{MailboxDetailView-ZcKcOEAe.js → MailboxDetailView-aaHx9Nma.js} +1 -1
- package/dist/assets/MemoryManager-BgcicCyg.js +1 -0
- package/dist/assets/{ModelPicker-DvNLZzkm.js → ModelPicker-B3BqjJnT.js} +1 -1
- package/dist/assets/OfficeMapPanel-Ck8NUOEs.js +4 -0
- package/dist/assets/OfficeMapPanel-CpexsBed.css +1 -0
- package/dist/assets/{ProcessMonitor-2nSk6sXA.js → ProcessMonitor-CoMYZcdS.js} +1 -1
- package/dist/assets/{QueuePanel-4KBBWFxj.js → QueuePanel-CA3CVCO_.js} +1 -1
- package/dist/assets/{RefreshDebugView-D3XnE53y.js → RefreshDebugView-cqBtyNna.js} +1 -1
- package/dist/assets/RequirementIntakeView-BBtUk8mC.js +1 -0
- package/dist/assets/SageTabs-Di49i4Yu.js +2 -0
- package/dist/assets/SddHub-D8iV6l9A.js +2 -0
- package/dist/assets/SessionInspectView-DHC_xTzG.js +1 -0
- package/dist/assets/{SessionList-BeinIC-h.js → SessionList-DH-ZsHmv.js} +1 -1
- package/dist/assets/{SessionsDashboard-DEG_BylE.js → SessionsDashboard-Coi6htwg.js} +1 -1
- package/dist/assets/SetupScreen-CD2Sx4n9.js +1 -0
- package/dist/assets/{SkillDetailView-D7EQ2XtV.js → SkillDetailView-D7wSJWUX.js} +1 -1
- package/dist/assets/SpecsView-BRWSI1iV.js +1 -0
- package/dist/assets/TechStackView-BOjkuJLe.js +1 -0
- package/dist/assets/{TerminalPanel-BL9ZPGJt.js → TerminalPanel-Dg8WR5Un.js} +1 -1
- package/dist/assets/{Toaster-CJI70aa-.js → Toaster-DSKFSuK3.js} +1 -1
- package/dist/assets/activity-BWbV0byu.js +9 -0
- package/dist/assets/activity-Bjb_mil3.js +9 -0
- package/dist/assets/activity-Bze6njDy.js +9 -0
- package/dist/assets/activity-Ciqcr7Ps.js +9 -0
- package/dist/assets/activity-DA9hmVZV.js +9 -0
- package/dist/assets/activity-GdnS66AB.js +9 -0
- package/dist/assets/activity-eawh_OWs.js +9 -0
- package/dist/assets/{chat-DzPxYALH.js → chat-4NEOESoU.js} +1 -1
- package/dist/assets/{chat-DLn1hY01.js → chat-BSg62iwX.js} +1 -1
- package/dist/assets/{chat-OunddzYy.js → chat-Bb1TpPfJ.js} +1 -1
- package/dist/assets/{chat-DxLD17ER.js → chat-COLKjtcx.js} +1 -1
- package/dist/assets/{chat-DSEq1Bdz.js → chat-CfRKV9iX.js} +1 -1
- package/dist/assets/{chat-CwnuX7tG.js → chat-EbeT4kiS.js} +1 -1
- package/dist/assets/{chat-CRmMDzCb.js → chat-ux_gymOJ.js} +1 -1
- package/dist/assets/{common-DMM-xyW3.js → common-BXJbu5Y-.js} +1 -1
- package/dist/assets/{common-C9ikgX7d.js → common-BiNu_WzQ.js} +1 -1
- package/dist/assets/common-COVxQ0FV.js +1 -0
- package/dist/assets/{common-D29Zdkxb.js → common-Ch7JihXD.js} +1 -1
- package/dist/assets/{common-DoUBSHRY.js → common-DPaTeTls.js} +1 -1
- package/dist/assets/{common-vdwxzODB.js → common-DdGpRh8j.js} +1 -1
- package/dist/assets/{common-C5hY-d_0.js → common-pI6fYZW3.js} +1 -1
- package/dist/assets/i18n-C31PI0Up.js +2 -0
- package/dist/assets/index-5IWUhPO4.css +1 -0
- package/dist/assets/index-D1izXztg.js +132 -0
- package/dist/assets/{mailbox-store-D8TvJsuk.js → mailbox-store-Bc9ER3Ph.js} +1 -1
- package/dist/assets/{progress-ring-61A-xUEl.js → progress-ring-D_d6hn_4.js} +1 -1
- package/dist/assets/{roster-ws-Dfg_187V.js → roster-ws-D6dGRfC5.js} +1 -1
- package/dist/assets/settings-BKuhxUSF.js +1 -0
- package/dist/assets/settings-CeK0doV7.js +1 -0
- package/dist/assets/settings-DZ-H89lu.js +1 -0
- package/dist/assets/settings-DvrdpSdA.js +1 -0
- package/dist/assets/settings-SBUqq0ll.js +1 -0
- package/dist/assets/settings-W8t1ZrxM.js +1 -0
- package/dist/assets/settings-tOqZkk9R.js +1 -0
- package/dist/assets/stores-OBoFiAKe.js +7 -0
- package/dist/assets/ui-store-CE4-TlwB.js +1 -0
- package/dist/assets/useWebSocket-DuLtH2jI.js +29 -0
- package/dist/assets/{view-navigation-DxfiZrXS.js → view-navigation-DIDEcp4V.js} +1 -1
- package/dist/assets/ws-client-Bw1ixxwI.js +1 -0
- package/dist/components/AutonomyPicker.d.ts +1 -1
- package/dist/components/ChatView/auto-collapse.d.ts +42 -0
- package/dist/components/FallbackModal.d.ts +2 -0
- package/dist/components/KanbanVerificationDashboard.d.ts +0 -6
- package/dist/components/SettingsPanel/PluginToggleList.d.ts +11 -3
- package/dist/components/SettingsPanel/brain-section-options.d.ts +25 -55
- package/dist/components/TaskCard.d.ts +0 -1
- package/dist/components/TaskRiskPanel.d.ts +10 -3
- package/dist/components/TechStackView/shared.d.ts +11 -6
- package/dist/components/ThemeProvider.d.ts +6 -1
- package/dist/components/agent-roster-data.d.ts +2 -1
- package/dist/hooks/ws-handlers/files-mailbox-handlers.d.ts +1 -0
- package/dist/hooks/ws-handlers/misc-handlers.d.ts +13 -0
- package/dist/hooks/ws-handlers/session-handlers.d.ts +1 -0
- package/dist/index.css +30 -0
- package/dist/index.html +15 -15
- package/dist/index.js +25202 -11602
- package/dist/lib/file-icons.d.ts +3 -3
- package/dist/lib/palettes.d.ts +37 -0
- package/dist/lib/ws-client.d.ts +3 -3
- package/dist/providers.json +7 -7
- package/dist/stores/config-store.d.ts +9 -1
- package/dist/stores/context-editor-store.d.ts +9 -1
- package/dist/stores/fallback-store.d.ts +30 -0
- package/dist/stores/fleet-store.d.ts +13 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/local-prefs.d.ts +4 -0
- package/dist/stores/mailbox-store.d.ts +2 -0
- package/dist/types/client-message.d.ts +12 -1
- package/dist/types/protocol-core.d.ts +19 -0
- package/dist/types/runtime.d.ts +8 -0
- package/dist/types/server-message.d.ts +13 -2
- package/package.json +9 -9
- package/dist/assets/AgentRosterView-BqojERFR.js +0 -11
- package/dist/assets/AudienceMemoryPanel-Cc1UkbDl.js +0 -3
- package/dist/assets/ChangesView-BKU80ANq.js +0 -1
- package/dist/assets/ChronicleDashboard-CvCS1Dj1.js +0 -1
- package/dist/assets/CodeEditor-BHZQhx_8.js +0 -1
- package/dist/assets/CodeMap-qllGEFLB.js +0 -1
- package/dist/assets/CronJobsPanel-DD5mhZ4Q.js +0 -1
- package/dist/assets/DeadCodeScanPanel-PB-c8et_.js +0 -2
- package/dist/assets/DebugDashboard-Q8QiVflQ.js +0 -1
- package/dist/assets/DesignGalleryView-CGOtWO7s.js +0 -1
- package/dist/assets/GoalView-Dlk42vW7.js +0 -1
- package/dist/assets/KanbanView-DIP6kKmU.js +0 -3
- package/dist/assets/MemoryManager-B7620q_K.js +0 -1
- package/dist/assets/OfficeMapPanel-BFIF-EMt.css +0 -1
- package/dist/assets/OfficeMapPanel-DKJNTtOZ.js +0 -4
- package/dist/assets/RequirementIntakeView-BMxlf8bt.js +0 -1
- package/dist/assets/SageTabs-g1hO2hJ0.js +0 -2
- package/dist/assets/SddHub-Kv_TbTgT.js +0 -2
- package/dist/assets/SessionInspectView-PnKTvyvP.js +0 -1
- package/dist/assets/SetupScreen-DxJwZ1OZ.js +0 -1
- package/dist/assets/SpecsView-Fm7pYYcj.js +0 -1
- package/dist/assets/TechStackView-Bo_UenRF.js +0 -1
- package/dist/assets/activity-BCgOEWgR.js +0 -5
- package/dist/assets/activity-BQ0zqkw2.js +0 -5
- package/dist/assets/activity-CAovbq3e.js +0 -5
- package/dist/assets/activity-CFQyCvgu.js +0 -5
- package/dist/assets/activity-CdQf7zRK.js +0 -5
- package/dist/assets/activity-DACvyn2-.js +0 -5
- package/dist/assets/activity-DOwYydU-.js +0 -5
- package/dist/assets/common-BfVFjVhf.js +0 -1
- package/dist/assets/i18n-B0hsnanh.js +0 -2
- package/dist/assets/index-DHdO0CRE.js +0 -132
- package/dist/assets/index-DKrFQ76m.css +0 -1
- package/dist/assets/settings-B5xal2R3.js +0 -1
- package/dist/assets/settings-BHtFy8EG.js +0 -1
- package/dist/assets/settings-Bss5hBla.js +0 -1
- package/dist/assets/settings-BzrLCVRP.js +0 -1
- package/dist/assets/settings-C7RdvmLZ.js +0 -1
- package/dist/assets/settings-Dd94HoV6.js +0 -1
- package/dist/assets/settings-Dm9THFe8.js +0 -1
- package/dist/assets/stores-BptlyD_v.js +0 -7
- package/dist/assets/ui-store-BsBnjO3w.js +0 -1
- package/dist/assets/useWebSocket-Bc4S0N4r.js +0 -29
- package/dist/assets/ws-client-DqFoX4jJ.js +0 -1
- package/dist/lib/accent-colors.d.ts +0 -136
package/dist/lib/file-icons.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Returns a Tailwind text
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Returns a semantic Tailwind text-color class for a file extension.
|
|
3
|
+
* The classes resolve through WebUI theme tokens so file icons adapt to
|
|
4
|
+
* light/dark mode and the selected product palette.
|
|
5
5
|
*/
|
|
6
6
|
export declare function fileIconColor(name: string, isDirectory: boolean): string;
|
|
7
7
|
export declare function fileIcon(name: string): React.ComponentType<{
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color palette registry — the WebUI's "main color" system.
|
|
3
|
+
*
|
|
4
|
+
* Users can pick a palette on top of the light/dark theme toggle. The actual
|
|
5
|
+
* token values live in `index.css` as `:root[data-palette="…"]` /
|
|
6
|
+
* `.dark[data-palette="…"]` blocks (rendering is driven by `hsl(var(--token))`),
|
|
7
|
+
* so this module only describes the palettes for the picker UI: id, i18n
|
|
8
|
+
* label, and the two swatch colors that preview the palette's two brand
|
|
9
|
+
* signals. `applyPalette` toggles the `data-palette` attribute on `<html>`.
|
|
10
|
+
*
|
|
11
|
+
* To add a palette: add a CSS token block in `index.css`, an entry here (in
|
|
12
|
+
* the same order), and an i18n label key in all 7 locale files. The default
|
|
13
|
+
* "signal" palette needs no CSS block — it is the base token set.
|
|
14
|
+
*/
|
|
15
|
+
export type PaletteId = 'signal' | 'emerald-gold' | 'blue-navy' | 'purple-pink' | 'cyan-teal' | 'rose-copper' | 'indigo-amber';
|
|
16
|
+
export interface PaletteDefinition {
|
|
17
|
+
id: PaletteId;
|
|
18
|
+
/** i18n key for the palette name, e.g. 'settings:general.paletteEmeraldGold'. */
|
|
19
|
+
labelKey: string;
|
|
20
|
+
/** CSS color for the main (primary) swatch stripe — dark-mode value so it reads on both themes. */
|
|
21
|
+
swatch: string;
|
|
22
|
+
/** CSS color for the secondary (brand) swatch stripe. */
|
|
23
|
+
swatchSecondary: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const DEFAULT_PALETTE: PaletteId;
|
|
26
|
+
/** localStorage key for the persisted palette — shared by ThemeProvider and the config store's merge. */
|
|
27
|
+
export declare const PALETTE_STORAGE_KEY = "wrongstack-palette";
|
|
28
|
+
export declare const PALETTES: readonly PaletteDefinition[];
|
|
29
|
+
export declare function isPaletteId(value: unknown): value is PaletteId;
|
|
30
|
+
export declare function getPalette(value: unknown): PaletteDefinition;
|
|
31
|
+
/** Guarded read of a persisted palette id; invalid/missing/blocked storage
|
|
32
|
+
* falls back to `fallback`. Shared by ThemeProvider (initial state) and the
|
|
33
|
+
* config store's `merge` so the two persistence layers agree. */
|
|
34
|
+
export declare function readStoredPalette(storageKey: string, fallback: PaletteId): PaletteId;
|
|
35
|
+
/** Apply a palette to <html> by setting `data-palette`; removes it for the default. */
|
|
36
|
+
export declare function applyPalette(root: HTMLElement, palette: PaletteId): void;
|
|
37
|
+
//# sourceMappingURL=palettes.d.ts.map
|
package/dist/lib/ws-client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WSClientMessage, WSModelSwitchResult, WSServerMessage, WSUserMessageImage } from '../types';
|
|
2
2
|
import type { ProviderCustomModelWire } from '../types/client-message';
|
|
3
|
-
import type { ContextEditorMessage } from '../types/runtime';
|
|
3
|
+
import type { ContextEditorMessage, ContextEditorRemoval } from '../types/runtime';
|
|
4
4
|
import { type WsClientActionMethods } from './ws-client-actions';
|
|
5
5
|
import type { WSSendOptions } from './ws-client-contracts';
|
|
6
6
|
import { type EventHandler, type WsStatus } from './ws-client-utils';
|
|
@@ -154,8 +154,8 @@ declare class WrongStackWebSocketClientBase {
|
|
|
154
154
|
compactContext(aggressive?: boolean): void;
|
|
155
155
|
repairContext(): void;
|
|
156
156
|
openContextEditor(): void;
|
|
157
|
-
validateContextEditor(baseRevision: string, messages: ContextEditorMessage[], allowRepair: boolean): void;
|
|
158
|
-
applyContextEditor(baseRevision: string, messages: ContextEditorMessage[], allowRepair: boolean): void;
|
|
157
|
+
validateContextEditor(baseRevision: string, messages: ContextEditorMessage[], removals: ContextEditorRemoval[], allowRepair: boolean): void;
|
|
158
|
+
applyContextEditor(baseRevision: string, messages: ContextEditorMessage[], removals: ContextEditorRemoval[], allowRepair: boolean): void;
|
|
159
159
|
debugContext(options?: WSSendOptions): void;
|
|
160
160
|
listContextModes(): void;
|
|
161
161
|
switchContextMode(id: string): void;
|
package/dist/providers.json
CHANGED
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
"id": "
|
|
49
|
-
"name": "
|
|
48
|
+
"id": "ai-gateway",
|
|
49
|
+
"name": "Vercel AI Gateway",
|
|
50
50
|
"family": "openai-compatible",
|
|
51
|
-
"description": "
|
|
52
|
-
"icon": "
|
|
53
|
-
"color": "from-
|
|
54
|
-
"keyPlaceholder": "
|
|
55
|
-
"docsUrl": "https://
|
|
51
|
+
"description": "Every model behind one key — routed by Vercel AI Gateway",
|
|
52
|
+
"icon": "▲",
|
|
53
|
+
"color": "from-primary/12 to-primary/5 border-primary/30 hover:border-primary/50",
|
|
54
|
+
"keyPlaceholder": "vck_...",
|
|
55
|
+
"docsUrl": "https://vercel.com/docs/ai-gateway"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"id": "openrouter",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PaletteId } from '@/lib/palettes';
|
|
1
2
|
export interface ConfigState {
|
|
2
3
|
provider: string;
|
|
3
4
|
model: string;
|
|
@@ -21,6 +22,10 @@ export interface ConfigState {
|
|
|
21
22
|
lastError?: string | undefined;
|
|
22
23
|
};
|
|
23
24
|
theme: 'light' | 'dark' | 'system';
|
|
25
|
+
/** Selected color palette id — see `lib/palettes.ts` + `index.css` token
|
|
26
|
+
* blocks. Mirrors the ThemeProvider's `wrongstack-palette` localStorage
|
|
27
|
+
* entry so the choice survives reloads and cross-surface config reads. */
|
|
28
|
+
palette: PaletteId;
|
|
24
29
|
autoConnect: boolean;
|
|
25
30
|
/** Play a soft synthesized chime when run.result lands with status=done.
|
|
26
31
|
* Off by default — opt-in via the Command Palette. Persisted so the
|
|
@@ -29,8 +34,9 @@ export interface ConfigState {
|
|
|
29
34
|
soundOnComplete: boolean;
|
|
30
35
|
setProvider: (provider: string) => void;
|
|
31
36
|
setModel: (model: string) => void;
|
|
32
|
-
setConfig: (config: Partial<Omit<ConfigState, 'setProvider' | 'setModel' | 'setConfig' | 'setTheme'>>) => void;
|
|
37
|
+
setConfig: (config: Partial<Omit<ConfigState, 'setProvider' | 'setModel' | 'setConfig' | 'setTheme' | 'setPalette'>>) => void;
|
|
33
38
|
setTheme: (theme: 'light' | 'dark' | 'system') => void;
|
|
39
|
+
setPalette: (palette: PaletteId) => void;
|
|
34
40
|
setWsConnected: (connected: boolean) => void;
|
|
35
41
|
setWsStatus: (s: ConfigState['wsStatus']) => void;
|
|
36
42
|
setSoundOnComplete: (on: boolean) => void;
|
|
@@ -44,6 +50,7 @@ export declare const useConfigStore: import("zustand").UseBoundStore<Omit<import
|
|
|
44
50
|
model: string;
|
|
45
51
|
baseUrl: string | undefined;
|
|
46
52
|
theme: "dark" | "light" | "system";
|
|
53
|
+
palette: PaletteId;
|
|
47
54
|
autoConnect: boolean;
|
|
48
55
|
soundOnComplete: boolean;
|
|
49
56
|
}, unknown>>) => void;
|
|
@@ -57,6 +64,7 @@ export declare const useConfigStore: import("zustand").UseBoundStore<Omit<import
|
|
|
57
64
|
model: string;
|
|
58
65
|
baseUrl: string | undefined;
|
|
59
66
|
theme: "dark" | "light" | "system";
|
|
67
|
+
palette: PaletteId;
|
|
60
68
|
autoConnect: boolean;
|
|
61
69
|
soundOnComplete: boolean;
|
|
62
70
|
}, unknown>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ContextEditorMessage, ContextEditorMetrics, ContextEditorRepairPreview, ContextEditorValidationError, ContextEditorWarning, ContextEditorConflict, ContextEditorDiagnostics } from '@/types/runtime';
|
|
1
|
+
import type { ContextEditorMessage, ContextEditorMetrics, ContextEditorRemoval, ContextEditorRepairPreview, ContextEditorValidationError, ContextEditorWarning, ContextEditorConflict, ContextEditorDiagnostics } from '@/types/runtime';
|
|
2
2
|
export type ContextEditorPhase = 'closed' | 'loading_snapshot' | 'clean_snapshot' | 'dirty' | 'validating' | 'validated' | 'invalid' | 'conflicted' | 'applying' | 'applied_success' | 'apply_failed';
|
|
3
3
|
interface ReadonlyContext {
|
|
4
4
|
systemPromptTokens: number;
|
|
@@ -14,6 +14,7 @@ interface MessageBreakdownEntry {
|
|
|
14
14
|
preview: string;
|
|
15
15
|
blockCount: number | null;
|
|
16
16
|
warnings: ContextEditorWarning[];
|
|
17
|
+
pairedAssistantIndices: number[];
|
|
17
18
|
}
|
|
18
19
|
interface ValidationResult {
|
|
19
20
|
ok: boolean;
|
|
@@ -44,6 +45,9 @@ export interface ContextEditorState {
|
|
|
44
45
|
messageBreakdown: MessageBreakdownEntry[];
|
|
45
46
|
diagnostics: ContextEditorDiagnostics | null;
|
|
46
47
|
removeMessages: Set<number>;
|
|
48
|
+
/** Messages selected directly by the user, excluding required assistant pairing. */
|
|
49
|
+
explicitRemoveMessages: Set<number>;
|
|
50
|
+
removeRanges: ContextEditorRemoval[];
|
|
47
51
|
validation: ValidationResult | null;
|
|
48
52
|
appliedResult: AppliedResult | null;
|
|
49
53
|
errorMessage: string | null;
|
|
@@ -59,7 +63,10 @@ export interface ContextEditorActions {
|
|
|
59
63
|
diagnostics: ContextEditorDiagnostics;
|
|
60
64
|
}) => void;
|
|
61
65
|
toggleRemoveMessage: (index: number) => void;
|
|
66
|
+
markRangeForRemoval: (removal: ContextEditorRemoval) => void;
|
|
62
67
|
clearRemovals: () => void;
|
|
68
|
+
beginValidation: () => void;
|
|
69
|
+
beginApply: () => void;
|
|
63
70
|
setValidation: (result: ValidationResult) => void;
|
|
64
71
|
setApplied: (result: AppliedResult) => void;
|
|
65
72
|
setError: (message: string | null) => void;
|
|
@@ -68,6 +75,7 @@ export interface ContextEditorActions {
|
|
|
68
75
|
getProposedMessages: () => ContextEditorMessage[];
|
|
69
76
|
}
|
|
70
77
|
export type ContextEditorStore = ContextEditorState & ContextEditorActions;
|
|
78
|
+
export declare function findPairedAssistantIndices(messages: readonly ContextEditorMessage[], userIndex: number): number[];
|
|
71
79
|
export declare const useContextEditorStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ContextEditorStore>>;
|
|
72
80
|
export {};
|
|
73
81
|
//# sourceMappingURL=context-editor-store.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface FallbackCandidate {
|
|
2
|
+
providerId: string;
|
|
3
|
+
model: string;
|
|
4
|
+
}
|
|
5
|
+
export interface FallbackPendingState {
|
|
6
|
+
requestId: string;
|
|
7
|
+
from: {
|
|
8
|
+
providerId: string;
|
|
9
|
+
model: string;
|
|
10
|
+
};
|
|
11
|
+
status: number;
|
|
12
|
+
candidates: FallbackCandidate[];
|
|
13
|
+
autoSwitchSeconds: number;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
}
|
|
16
|
+
interface FallbackStore {
|
|
17
|
+
pending: FallbackPendingState | null;
|
|
18
|
+
selected: number;
|
|
19
|
+
/** Set the pending state from a WS event. */
|
|
20
|
+
setPending: (state: FallbackPendingState) => void;
|
|
21
|
+
/** Clear the pending state (switch happened or dismissed). */
|
|
22
|
+
clear: () => void;
|
|
23
|
+
/** Move the selection index (wraps). */
|
|
24
|
+
move: (delta: number) => void;
|
|
25
|
+
/** Set selection to a specific index. */
|
|
26
|
+
setSelected: (index: number) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare const useFallbackStore: import("zustand").UseBoundStore<import("zustand").StoreApi<FallbackStore>>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=fallback-store.d.ts.map
|
|
@@ -10,6 +10,13 @@ interface FleetState {
|
|
|
10
10
|
/** Current / max concurrency from server. */
|
|
11
11
|
fleetConcurrency: number;
|
|
12
12
|
fleetConcurrencyMax: number;
|
|
13
|
+
/** Lifetime spawn budget from server (issue #323). Undefined until first budget frame. */
|
|
14
|
+
fleetMaxSpawns: number | undefined;
|
|
15
|
+
fleetUsedSpawns: number | undefined;
|
|
16
|
+
fleetRemainingSpawns: number | undefined;
|
|
17
|
+
fleetBudgetSource: string | undefined;
|
|
18
|
+
fleetCheckpointMaxSpawns: number | undefined;
|
|
19
|
+
fleetCeilingMismatch: boolean;
|
|
13
20
|
/** Last 20 fleet events for the Fleet Monitor timeline. */
|
|
14
21
|
eventTimeline: FleetTimelineEvent[];
|
|
15
22
|
/** Agent conversation timeline entries (agent.timeline.message + agent.status_changed). */
|
|
@@ -38,6 +45,12 @@ export interface FleetSummary {
|
|
|
38
45
|
tokensOut: number;
|
|
39
46
|
concurrency: number;
|
|
40
47
|
concurrencyMax: number;
|
|
48
|
+
maxSpawns?: number | undefined;
|
|
49
|
+
usedSpawns?: number | undefined;
|
|
50
|
+
remainingSpawns?: number | undefined;
|
|
51
|
+
budgetSource?: string | undefined;
|
|
52
|
+
ceilingMismatch?: boolean | undefined;
|
|
53
|
+
checkpointMaxSpawns?: number | undefined;
|
|
41
54
|
}
|
|
42
55
|
/** Shallow comparison for zustand selector equality checks.
|
|
43
56
|
* Compares own enumerable string-keyed properties by reference.
|
package/dist/stores/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export type { ClientCounts, CurrentSessionStats, MailActivity } from './monitor-
|
|
|
29
29
|
export { useMonitorStore } from './monitor-store.js';
|
|
30
30
|
export { type BackgroundStyle, useOfficeMapStore } from './office-map-store.js';
|
|
31
31
|
export { type ProviderHealthEntry, type ProviderHealthState, useProviderStatusStore, } from './provider-status-store.js';
|
|
32
|
+
export { useFallbackStore } from './fallback-store.js';
|
|
33
|
+
export type { FallbackCandidate, FallbackPendingState } from './fallback-store.js';
|
|
32
34
|
export { type SddBoardFeedEntry, type SddBoardSnapshotUI, type SddBoardStatus, type SddBoardSummary, type SddLifecycleResultUI, useSddBoardStore, } from './sdd-board-store.js';
|
|
33
35
|
export { type SddWizardPhase, type SddWizardSnapshot, useSddWizardStore, } from './sdd-wizard-store.js';
|
|
34
36
|
export { useSessionStore } from './session-store.js';
|
|
@@ -96,6 +96,10 @@ export interface LocalPrefs {
|
|
|
96
96
|
showThinkingLogs: boolean;
|
|
97
97
|
/** Group consecutive tool calls into collapsible chips */
|
|
98
98
|
groupToolCalls: boolean;
|
|
99
|
+
/** Auto-collapse the chat input under the history when a session with
|
|
100
|
+
* messages loads (opt-in; off by default). When off, the input always
|
|
101
|
+
* starts expanded. Independent of the manual collapse/expand buttons. */
|
|
102
|
+
autoCollapseInput: boolean;
|
|
99
103
|
/** Show model reasoning/thinking blocks inline in the chat */
|
|
100
104
|
showModelReasoning: boolean;
|
|
101
105
|
/** Agent swarm panel placement: bottom, sidebar, or off */
|
|
@@ -71,6 +71,8 @@ interface MailboxState {
|
|
|
71
71
|
setMessages: (messages: MailboxMessage[]) => void;
|
|
72
72
|
setAgents: (agents: MailboxAgent[]) => void;
|
|
73
73
|
setLastCompaction: (result: MailboxCompactionResult | null) => void;
|
|
74
|
+
/** Drop one agent by id (mailbox.agent_deregistered push). */
|
|
75
|
+
removeAgent: (agentId: string) => void;
|
|
74
76
|
}
|
|
75
77
|
export declare const useMailboxStore: import("zustand").UseBoundStore<import("zustand").StoreApi<MailboxState>>;
|
|
76
78
|
/** Incomplete messages where no agent has acted yet (readByCount === 0).
|
|
@@ -2,7 +2,7 @@ import type { BrainConfigPatchWire } from './brain.js';
|
|
|
2
2
|
import type { ChronicleFacet, ChronicleMetricsView, ChronicleQuery } from './chronicle.js';
|
|
3
3
|
import type { WSCollabAnnotate, WSCollabGrantControl, WSCollabInjectTool, WSCollabJoin, WSCollabLeave, WSCollabRequestPause, WSCollabResolve, WSCollabResume } from './collab.js';
|
|
4
4
|
import type { SessionScopedPayload, WSUserMessage } from './protocol-core.js';
|
|
5
|
-
import type { ContextEditorMessage, WSModelSwitch, WSToolConfirmResult } from './runtime.js';
|
|
5
|
+
import type { ContextEditorMessage, ContextEditorRemoval, WSModelSwitch, WSToolConfirmResult } from './runtime.js';
|
|
6
6
|
import type { SageAnchor, SageScope, SageStatus, WSMemorySageForFileRequest } from './sage.js';
|
|
7
7
|
import type { OAuthKind, WSCompletionRequest } from './system.js';
|
|
8
8
|
/** Metadata persisted by the custom-provider model editor in provider add/update messages. */
|
|
@@ -370,6 +370,7 @@ export type WSClientMessageCore = WSUserMessage | WSToolConfirmResult | {
|
|
|
370
370
|
payload: SessionScopedPayload & {
|
|
371
371
|
baseRevision: string;
|
|
372
372
|
messages: ContextEditorMessage[];
|
|
373
|
+
removals: ContextEditorRemoval[];
|
|
373
374
|
allowRepair: boolean;
|
|
374
375
|
};
|
|
375
376
|
} | {
|
|
@@ -377,6 +378,7 @@ export type WSClientMessageCore = WSUserMessage | WSToolConfirmResult | {
|
|
|
377
378
|
payload: SessionScopedPayload & {
|
|
378
379
|
baseRevision: string;
|
|
379
380
|
messages: ContextEditorMessage[];
|
|
381
|
+
removals: ContextEditorRemoval[];
|
|
380
382
|
allowRepair: boolean;
|
|
381
383
|
};
|
|
382
384
|
} | {
|
|
@@ -1190,6 +1192,15 @@ export type WSClientMessageCore = WSUserMessage | WSToolConfirmResult | {
|
|
|
1190
1192
|
payload: {
|
|
1191
1193
|
template: string;
|
|
1192
1194
|
};
|
|
1195
|
+
} | {
|
|
1196
|
+
type: 'model.fallback_choice';
|
|
1197
|
+
payload: {
|
|
1198
|
+
requestId: string;
|
|
1199
|
+
providerId?: string | undefined;
|
|
1200
|
+
model?: string | undefined;
|
|
1201
|
+
/** When true, auto-switch to the next candidate (countdown expired or Esc). */
|
|
1202
|
+
autoSwitch?: boolean | undefined;
|
|
1203
|
+
};
|
|
1193
1204
|
} | {
|
|
1194
1205
|
type: 'webui.shutdown';
|
|
1195
1206
|
};
|
|
@@ -238,6 +238,25 @@ export interface WSProviderFallback {
|
|
|
238
238
|
};
|
|
239
239
|
status: number;
|
|
240
240
|
providerSwitched: boolean;
|
|
241
|
+
/** Gate correlation id — present when a fallback gate mediated the switch. */
|
|
242
|
+
requestId?: string | undefined;
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
export interface WSProviderFallbackPending {
|
|
246
|
+
type: 'provider.fallback_pending';
|
|
247
|
+
payload: SessionScopedPayload & {
|
|
248
|
+
from: {
|
|
249
|
+
providerId: string;
|
|
250
|
+
model: string;
|
|
251
|
+
};
|
|
252
|
+
status: number;
|
|
253
|
+
candidates: Array<{
|
|
254
|
+
providerId: string;
|
|
255
|
+
model: string;
|
|
256
|
+
}>;
|
|
257
|
+
autoSwitchSeconds: number;
|
|
258
|
+
requestId: string;
|
|
259
|
+
timestamp: number;
|
|
241
260
|
};
|
|
242
261
|
}
|
|
243
262
|
export interface WSProviderStatusChanged {
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -113,6 +113,13 @@ export interface ContextEditorMessage {
|
|
|
113
113
|
content: string | ContextEditorContentBlock[];
|
|
114
114
|
ts?: string | undefined;
|
|
115
115
|
}
|
|
116
|
+
/** A whole-message removal, or a character range in string/text-block content. blockIndex only identifies a text block; it is not a whole-block deletion. */
|
|
117
|
+
export interface ContextEditorRemoval {
|
|
118
|
+
messageIndex: number;
|
|
119
|
+
blockIndex?: number | undefined;
|
|
120
|
+
start?: number | undefined;
|
|
121
|
+
end?: number | undefined;
|
|
122
|
+
}
|
|
116
123
|
export interface ContextEditorMetrics {
|
|
117
124
|
messages: number;
|
|
118
125
|
blocks: number;
|
|
@@ -168,6 +175,7 @@ export interface WSContextEditorSnapshot {
|
|
|
168
175
|
preview: string;
|
|
169
176
|
blockCount: number | null;
|
|
170
177
|
warnings: ContextEditorWarning[];
|
|
178
|
+
pairedAssistantIndices: number[];
|
|
171
179
|
}>;
|
|
172
180
|
diagnostics: ContextEditorDiagnostics;
|
|
173
181
|
};
|
|
@@ -3,12 +3,12 @@ import type { ChronicleFacet, ChronicleFacetValue, ChronicleGraphResult, Chronic
|
|
|
3
3
|
import type { WSCollabAnnotationAdded, WSCollabAnnotationResolved, WSCollabEvent, WSCollabInjectionGranted, WSCollabParticipantJoined, WSCollabParticipantLeft, WSCollabPauseGranted, WSCollabPauseReleased, WSCollabState } from './collab.js';
|
|
4
4
|
import type { ConnectionsHealthReport, ServiceActionResult } from './connections.js';
|
|
5
5
|
import type { WSAgentStatusChanged, WSAgentTimelineMessage, WSEternalIteration, WSGoalAssessResult, WSGoalLifecycle, WSGoalList, WSGoalProgress, WSGoalState, WSKanbanResult, WSKanbanTaskActivity, WSModesList, WSWorktreeCleanupResult, WSWorktreeDiffResult, WSWorktreeEvent, WSWorktreeMergeResult, WSWorktreeOrphans, WSWorktreeState } from './goal-kanban-worktree.js';
|
|
6
|
-
import type { SessionScopedPayload, WSCodeMapToolExecuted, WSCodeMapToolStarted, WSIterationCompleted, WSIterationLimitReached, WSIterationStarted, WSProviderActiveBlocked, WSProviderError, WSProviderFallback, WSProviderResponse, WSProviderRetry, WSProviderStatusChanged, WSProviderStatusSnapshot, WSProviderStreamError, WSRunResult, WSSessionEnd, WSSessionStart, WSTextDelta, WSThinkingDelta, WSToolExecuted, WSToolProgress, WSToolUseStart } from './protocol-core.js';
|
|
6
|
+
import type { SessionScopedPayload, WSCodeMapToolExecuted, WSCodeMapToolStarted, WSIterationCompleted, WSIterationLimitReached, WSIterationStarted, WSProviderActiveBlocked, WSProviderError, WSProviderFallback, WSProviderFallbackPending, WSProviderResponse, WSProviderRetry, WSProviderStatusChanged, WSProviderStatusSnapshot, WSProviderStreamError, WSRunResult, WSSessionEnd, WSSessionStart, WSTextDelta, WSThinkingDelta, WSToolExecuted, WSToolProgress, WSToolUseStart } from './protocol-core.js';
|
|
7
7
|
import type { WSCompactionFailed, WSContextCompacted, WSContextDebug, WSContextEditorApplied, WSContextEditorSnapshot, WSContextEditorValidation, WSContextMaxContext, WSContextModeChanged, WSContextModesList, WSContextPct, WSContextRepaired, WSDelegateCompleted, WSDelegateStarted, WSError, WSMemoryList, WSSessionStats, WSTokenCostEstimateUnavailable, WSTokenThreshold, WSToolConfirmNeeded, WSToolLoopDetected, WSToolsList, WSTrustPersisted } from './runtime.js';
|
|
8
8
|
import type { WSMemorySageBackfillRecoverable, WSMemorySageCandidateResolve, WSMemorySageDelete, WSMemorySageForFile, WSMemorySageGet, WSMemorySageGraph, WSMemorySageList, WSMemorySageListPage, WSMemorySageRecover, WSMemorySageRemember, WSMemorySageUpdate } from './sage.js';
|
|
9
9
|
import type { WSDesignList, WSDesignMaterialize, WSDesignSet, WSDesignState, WSDesignSwap, WSDesignTune, WSDesignUse, WSDesignVerify, WSSkillContent, WSSkillsCreated, WSSkillsEdited, WSSkillsExported, WSSkillsInstalled, WSSkillsList, WSSkillsUninstalled, WSSkillsUpdated } from './skills-design.js';
|
|
10
10
|
import type { WSAuthOAuthStatus, WSCatalogModelSearchResult, WSCompletionResult, WSDiagGet, WSFilesList, WSKeyOperationResult, WSModelSwitchResult, WSProviderCatalog, WSProviderModels, WSProviderProbe, WSSavedProviders, WSSessionsList, WSSessionInspect, WSSideEffects, WSStatsGet, WSTodosCleared, WSTodosUpdated } from './system.js';
|
|
11
|
-
export type WSServerMessage = WSSessionStart | WSSessionEnd | WSTextDelta | WSThinkingDelta | WSToolUseStart | WSToolProgress | WSToolExecuted | WSCodeMapToolStarted | WSCodeMapToolExecuted | WSIterationStarted | WSIterationCompleted | WSIterationLimitReached | WSProviderResponse | WSProviderRetry | WSProviderError | WSProviderFallback | WSProviderStatusChanged | WSProviderStatusSnapshot | WSProviderActiveBlocked | WSProviderStreamError | WSRunResult | WSSessionStats | WSError | WSToolConfirmNeeded | WSTrustPersisted | WSToolLoopDetected | WSDelegateStarted | WSDelegateCompleted | WSContextDebug | WSContextCompacted | WSCompactionFailed | WSContextRepaired | WSContextEditorSnapshot | WSContextEditorValidation | WSContextEditorApplied | WSContextPct | WSContextMaxContext | WSTokenThreshold | WSTokenCostEstimateUnavailable | WSContextModesList | WSContextModeChanged | WSToolsList | WSMemoryList | WSMemorySageList | WSMemorySageListPage | WSMemorySageGet | WSMemorySageGraph | WSMemorySageUpdate | WSMemorySageRemember | WSMemorySageDelete | WSMemorySageRecover | WSMemorySageCandidateResolve | WSMemorySageBackfillRecoverable | WSMemorySageForFile | WSSkillsList | WSSkillContent | WSDesignList | WSDesignUse | WSDesignState | WSDesignSet | WSDesignTune | WSDesignSwap | WSDesignMaterialize | WSDesignVerify | WSSkillsInstalled | WSSkillsUninstalled | WSSkillsUpdated | WSSkillsCreated | WSSkillsEdited | WSSkillsExported | WSDiagGet | WSStatsGet | {
|
|
11
|
+
export type WSServerMessage = WSSessionStart | WSSessionEnd | WSTextDelta | WSThinkingDelta | WSToolUseStart | WSToolProgress | WSToolExecuted | WSCodeMapToolStarted | WSCodeMapToolExecuted | WSIterationStarted | WSIterationCompleted | WSIterationLimitReached | WSProviderResponse | WSProviderRetry | WSProviderError | WSProviderFallback | WSProviderFallbackPending | WSProviderStatusChanged | WSProviderStatusSnapshot | WSProviderActiveBlocked | WSProviderStreamError | WSRunResult | WSSessionStats | WSError | WSToolConfirmNeeded | WSTrustPersisted | WSToolLoopDetected | WSDelegateStarted | WSDelegateCompleted | WSContextDebug | WSContextCompacted | WSCompactionFailed | WSContextRepaired | WSContextEditorSnapshot | WSContextEditorValidation | WSContextEditorApplied | WSContextPct | WSContextMaxContext | WSTokenThreshold | WSTokenCostEstimateUnavailable | WSContextModesList | WSContextModeChanged | WSToolsList | WSMemoryList | WSMemorySageList | WSMemorySageListPage | WSMemorySageGet | WSMemorySageGraph | WSMemorySageUpdate | WSMemorySageRemember | WSMemorySageDelete | WSMemorySageRecover | WSMemorySageCandidateResolve | WSMemorySageBackfillRecoverable | WSMemorySageForFile | WSSkillsList | WSSkillContent | WSDesignList | WSDesignUse | WSDesignState | WSDesignSet | WSDesignTune | WSDesignSwap | WSDesignMaterialize | WSDesignVerify | WSSkillsInstalled | WSSkillsUninstalled | WSSkillsUpdated | WSSkillsCreated | WSSkillsEdited | WSSkillsExported | WSDiagGet | WSStatsGet | {
|
|
12
12
|
type: 'connections.health_result';
|
|
13
13
|
payload: ConnectionsHealthReport;
|
|
14
14
|
} | {
|
|
@@ -246,6 +246,9 @@ export type WSServerMessage = WSSessionStart | WSSessionEnd | WSTextDelta | WSTh
|
|
|
246
246
|
} | {
|
|
247
247
|
type: 'mailbox.agent_registered';
|
|
248
248
|
payload: Record<string, unknown>;
|
|
249
|
+
} | {
|
|
250
|
+
type: 'mailbox.agent_deregistered';
|
|
251
|
+
payload: Record<string, unknown>;
|
|
249
252
|
} | {
|
|
250
253
|
type: 'mailbox.messages';
|
|
251
254
|
payload: {
|
|
@@ -520,6 +523,14 @@ export type WSServerMessage = WSSessionStart | WSSessionEnd | WSTextDelta | WSTh
|
|
|
520
523
|
payload: SessionScopedPayload & {
|
|
521
524
|
fleetConcurrency: number;
|
|
522
525
|
fleetConcurrencyMax: number;
|
|
526
|
+
maxSpawns?: number;
|
|
527
|
+
usedSpawns?: number;
|
|
528
|
+
remainingSpawns?: number;
|
|
529
|
+
maxSpawnsSource?: string;
|
|
530
|
+
maxConcurrentSource?: string;
|
|
531
|
+
effectiveSource?: string;
|
|
532
|
+
checkpointMaxSpawns?: number;
|
|
533
|
+
ceilingMismatch?: boolean;
|
|
523
534
|
};
|
|
524
535
|
} | {
|
|
525
536
|
type: 'budget.threshold_reached';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/webui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.300.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Browser-based WebUI for WrongStack — React + Vite frontend. The WebSocket backend lives in the separate @wrongstack/webui-server package (extracted in PR #018b to remove the CLI -> @wrongstack/webui/server cross-package edge).",
|
|
6
6
|
"keywords": [
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"tailwind-merge": "^3.6.0",
|
|
77
77
|
"virtua": "^0.49.3",
|
|
78
78
|
"zustand": "^5.0.14",
|
|
79
|
-
"@wrongstack/
|
|
80
|
-
"@wrongstack/
|
|
81
|
-
"@wrongstack/
|
|
82
|
-
"@wrongstack/
|
|
83
|
-
"@wrongstack/
|
|
84
|
-
"@wrongstack/
|
|
79
|
+
"@wrongstack/providers": "0.300.0",
|
|
80
|
+
"@wrongstack/plugins": "0.300.0",
|
|
81
|
+
"@wrongstack/tools": "0.300.0",
|
|
82
|
+
"@wrongstack/kanban": "0.300.0",
|
|
83
|
+
"@wrongstack/core": "0.300.0",
|
|
84
|
+
"@wrongstack/webui-server": "0.300.0"
|
|
85
85
|
},
|
|
86
86
|
"optionalDependencies": {
|
|
87
87
|
"node-pty": "1.2.0-beta.14"
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"typescript": "^7.0.2",
|
|
104
104
|
"vite": "^8.1.5",
|
|
105
105
|
"vitest": "^4.1.10",
|
|
106
|
-
"@wrongstack/sdd": "0.
|
|
106
|
+
"@wrongstack/sdd": "0.300.0"
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|
|
109
109
|
"dev": "vite",
|
|
@@ -111,6 +111,6 @@
|
|
|
111
111
|
"typecheck": "tsc --noEmit",
|
|
112
112
|
"test": "vitest run",
|
|
113
113
|
"test:watch": "vitest",
|
|
114
|
-
"test:coverage": "vitest run --coverage"
|
|
114
|
+
"test:coverage": "node ../../scripts/run-vitest-coverage.mjs run --coverage"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-CtOyUCdF.js";import{Ai as n,Ii as r,Oa as i,Ot as a,Qi as o,Wi as s,Wt as c,Xr as l,Zt as u,an as d,da as f,dt as p,ft as m,hr as h,ir as g,jt as _,la as v,lt as y,pr as b,tn as x,ua as S,ut as C,vi as w,vn as T,yi as E,za as D}from"./vendor-BuarzSSb.js";import{n as O}from"./ui-store-BsBnjO3w.js";import{t as k}from"./ws-client-DqFoX4jJ.js";import{t as A}from"./utils-B-9lSDIn.js";import{C as j}from"./stores-BptlyD_v.js";import{n as M}from"./Toaster-CJI70aa-.js";import{n as N,t as P}from"./ModelPicker-DvNLZzkm.js";import{s as F}from"./index-DHdO0CRE.js";import{t as I}from"./roster-ws-Dfg_187V.js";var L=e(D(),1),R=y(),z=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],B=[[`timeoutMs`,`Total timeout (ms)`],[`idleTimeoutMs`,`Idle timeout (ms)`],[`maxIterations`,`Max iterations`],[`maxToolCalls`,`Max tool calls`],[`maxTokens`,`Max tokens`],[`maxCostUsd`,`Max cost (USD)`]];function V(e){return`${e.provider}/${e.model}`}function H(e){let t=e.indexOf(`/`);return t<0?{provider:``,model:e}:{provider:e.slice(0,t),model:e.slice(t+1)}}function U(e){return Array.isArray(e)?e.join(`, `):``}function W(e){return[...new Set(e.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean))]}function G({initialConfig:e,systemProtected:t,saving:n,onSave:r,onCancel:i}){let[a,o]=(0,L.useState)(()=>structuredClone(e)),s=N(!0),c=a.modelPolicy,l=(0,L.useMemo)(()=>(c?.allowed??[]).map(V),[c?.allowed]),d=(0,L.useMemo)(()=>(c?.fallbacks??[]).map(V),[c?.fallbacks]),f=e=>o(t=>({...t,...e})),p=(e,t)=>{let n=W(t);o(t=>{let r={...t};return n.length?r[e]=n:delete r[e],r})},m=(e,t)=>{o(n=>{let r={...n.budget??{}};t===``?delete r[e]:r[e]=Number(t);let i={...n};return Object.keys(r).length?i.budget=r:delete i.budget,i})},h=e=>{let t=e.map(H),n=new Set(e);o(e=>({...e,modelPolicy:{allowed:t,fallbacks:(e.modelPolicy?.fallbacks??[]).filter(e=>n.has(V(e))),strict:e.modelPolicy?.strict??!0}}))};return(0,R.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-border bg-card/40 p-4`,children:[t&&(0,R.jsxs)(`div`,{className:`flex gap-2 rounded-md border border-amber-500/30 bg-amber-500/5 p-2 text-[11px] text-muted-foreground`,children:[(0,R.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-amber-500`}),(0,R.jsx)(`span`,{children:`Protected system agent: required tools and capabilities are retained, minimum budgets are enforced, working hours remain advisory, and emergency model recovery stays enabled so core operations cannot be disabled.`})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold`,children:`Provider and model policy`}),(0,R.jsx)(P,{candidates:s,provider:a.provider,value:a.model,placeholder:`Use project default model`,resetLabel:`Use project default`,onReset:()=>{o(e=>{let t={...e};return delete t.provider,delete t.model,t})},onPick:(e,t)=>{let n=`${t}/${e}`;f({provider:t,model:e}),c&&!l.includes(n)&&h([...l,n])}}),(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:!!c,onChange:e=>{if(e.target.checked){let e=a.provider&&a.model?[{provider:a.provider,model:a.model}]:s[0]?[{provider:s[0].provider,model:s[0].model}]:[];e.length&&f({modelPolicy:{allowed:e,strict:!0}})}else o(e=>{let t={...e};return delete t.modelPolicy,t})}}),`Restrict this agent to an explicit model allowlist`]}),c&&(0,R.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Allowed models`}),(0,R.jsx)(F,{value:l,candidates:s,onChange:h,placeholder:`Add allowed model`,emptyHint:`At least one model is required`})]}),(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-medium`,children:`Ordered fallback chain`}),(0,R.jsx)(F,{value:d,candidates:s,onChange:e=>{let t=[...new Set([...l,...e])];o(n=>({...n,modelPolicy:{allowed:t.map(H),fallbacks:e.map(H),strict:n.modelPolicy?.strict??!0}}))},placeholder:`Add fallback model`,emptyHint:`No fallback; primary failure stops the task`})]})]})]}),(0,R.jsx)(`section`,{className:`grid gap-3 sm:grid-cols-3`,children:[[`tools`,`Tools`,`read_file, search, bash`],[`skillNames`,`Skills`,`security-check, browser`],[`allowedCapabilities`,`Capabilities`,`fs.read, fs.write`]].map(([e,t,n])=>(0,R.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:t}),(0,R.jsx)(`textarea`,{value:U(a[e]),onChange:t=>p(e,t.target.value),placeholder:n,className:`h-20 w-full resize-y rounded border border-border bg-background p-2 font-mono`})]},e))}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold`,children:`Workspace and isolation`}),(0,R.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,R.jsx)(`span`,{children:`Project-relative working directory`}),(0,R.jsx)(`input`,{value:a.cwd??``,onChange:e=>f({cwd:e.target.value||void 0}),placeholder:`packages/webui`,className:`h-8 w-full rounded border border-border bg-background px-2 font-mono`})]}),(0,R.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,R.jsx)(`span`,{children:`Git worktree isolation`}),(0,R.jsxs)(`select`,{value:String(a.worktree??`auto`),onChange:e=>f({worktree:e.target.value}),className:`h-8 w-full rounded border border-border bg-background px-2`,children:[(0,R.jsx)(`option`,{value:`auto`,children:`Automatic`}),(0,R.jsx)(`option`,{value:`required`,children:`Required`}),(0,R.jsx)(`option`,{value:`off`,children:`Off`})]})]})]})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold`,children:`Limits`}),(0,R.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:B.map(([e,t])=>(0,R.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,R.jsx)(`span`,{children:t}),(0,R.jsx)(`input`,{type:`number`,min:`0`,step:e===`maxCostUsd`?`0.01`:`1`,value:a.budget?.[e]??``,onChange:t=>m(e,t.target.value),className:`h-8 w-full rounded border border-border bg-background px-2`})]},e))})]}),(0,R.jsxs)(`section`,{className:`space-y-2`,children:[(0,R.jsxs)(`label`,{className:`flex items-center gap-2 text-xs font-semibold`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:!!a.availability,onChange:e=>{e.target.checked?f({availability:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,days:[1,2,3,4,5],start:`09:00`,end:`18:00`,mode:t?`advisory`:`enforce`}}):o(e=>{let t={...e};return delete t.availability,t})}}),`Working hours`]}),a.availability&&(0,R.jsxs)(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:z.map((e,t)=>(0,R.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px]`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:a.availability?.days.includes(t)??!1,onChange:e=>{let n=a.availability;if(!n)return;let r=e.target.checked?[...new Set([...n.days,t])].sort():n.days.filter(e=>e!==t);f({availability:{...n,days:r}})}}),e]},e))}),(0,R.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:[(0,R.jsx)(`input`,{value:a.availability.timezone,onChange:e=>f({availability:{...a.availability,timezone:e.target.value}}),placeholder:`Europe/Kiev`,className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,R.jsx)(`input`,{type:`time`,value:a.availability.start,onChange:e=>f({availability:{...a.availability,start:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,R.jsx)(`input`,{type:`time`,value:a.availability.end,onChange:e=>f({availability:{...a.availability,end:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,R.jsxs)(`select`,{value:t?`advisory`:a.availability.mode??`enforce`,disabled:t,onChange:e=>f({availability:{...a.availability,mode:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`,children:[(0,R.jsx)(`option`,{value:`enforce`,children:`Enforce`}),(0,R.jsx)(`option`,{value:`advisory`,children:`Advisory`})]})]})]})]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:n||!!(c&&c.allowed.length===0),onClick:()=>r(a),className:`rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground disabled:opacity-50`,children:n?`Saving…`:`Save runtime policy`}),(0,R.jsx)(`button`,{type:`button`,onClick:i,className:`rounded border border-border px-3 py-1.5 text-xs hover:bg-accent`,children:`Cancel`})]})]})}var K=[{id:`live`,icon:(0,R.jsx)(i,{className:`h-4 w-4`}),label:`Live Fleet`},{id:`catalog`,icon:(0,R.jsx)(S,{className:`h-4 w-4`}),label:`Roster Catalog`},{id:`learning`,icon:(0,R.jsx)(f,{className:`h-4 w-4`}),label:`Self-Learning`},{id:`customize`,icon:(0,R.jsx)(x,{className:`h-4 w-4`}),label:`Customization`}],q=[{role:`generic`,name:`Generic Project Agent`,summary:`Flexible template that can be cloned into independently learning project roles.`,tools:0,budget:{maxIterations:2500,maxToolCalls:7500}},{role:`audit-log`,name:`Audit Log`,summary:`Analyzes session logs, event streams, and system traces.`,tools:12,budget:{timeoutMs:108e5,maxIterations:2500,maxToolCalls:7500}},{role:`bug-hunter`,name:`Bug Hunter`,summary:`Scans code for bugs, code smells, and anti-patterns.`,tools:15,budget:{timeoutMs:18e6,maxIterations:4e3,maxToolCalls:1e4}},{role:`refactor-planner`,name:`Refactor Planner`,summary:`Analyzes code structure and produces phased refactoring plans.`,tools:14,budget:{timeoutMs:144e5,maxIterations:3e3,maxToolCalls:9e3}},{role:`security-scanner`,name:`Security Scanner`,summary:`Scans code, configs, and dependencies for security issues.`,tools:18,budget:{timeoutMs:18e6,maxIterations:4e3,maxToolCalls:1e4}},{role:`critic`,name:`Critic`,summary:`Evaluates decisions, plans, and implementations.`,tools:10,budget:{timeoutMs:108e5,maxIterations:2e3,maxToolCalls:5e3}},{role:`shadow-agent`,name:`Shadow Agent`,summary:`Background monitoring agent that watches fleet health.`,tools:8,budget:{timeoutMs:36e6,maxIterations:500,maxToolCalls:2e3}},{role:`executor`,name:`Executor`,summary:`General-purpose task executor for delegated work.`,tools:20,budget:{timeoutMs:72e5,maxIterations:1500,maxToolCalls:4e3}},{role:`chimera`,name:`Chimera`,summary:`Post-session code quality review of changed files.`,tools:10,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`researcher`,name:`Researcher`,summary:`Web research and data gathering specialist.`,tools:8,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`tech-stack`,name:`Tech Stack Validator`,summary:`Validates package/library/framework choices.`,tools:9,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`orchestrator`,name:`Orchestrator`,summary:`Coordinates multi-agent task execution.`,tools:12,budget:{timeoutMs:144e5,maxIterations:3e3,maxToolCalls:8e3}},{role:`supervisor`,name:`Supervisor`,summary:`Oversees subagent execution and handles escalations.`,tools:10,budget:{timeoutMs:144e5,maxIterations:2e3,maxToolCalls:6e3}},{role:`quality-gate`,name:`Quality Gate`,summary:`Enforces quality gates on implementations.`,tools:8,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`architect`,name:`Architect`,summary:`Makes design and architecture decisions.`,tools:14,budget:{timeoutMs:144e5,maxIterations:3e3,maxToolCalls:8e3}},{role:`prompt-engineer`,name:`Prompt Engineer`,summary:`Designs and optimizes system prompts.`,tools:8,budget:{timeoutMs:72e5,maxIterations:1e3,maxToolCalls:3e3}},{role:`mnemosyne`,name:`Mnemosyne`,summary:`Memory curator — reviews and maintains SAGE integrity.`,tools:6,budget:{timeoutMs:72e5,maxIterations:500,maxToolCalls:2e3}},{role:`autophase`,name:`AutoPhase`,summary:`Manages multi-phase autonomous task execution.`,tools:10,budget:{timeoutMs:144e5,maxIterations:2e3,maxToolCalls:6e3}}];function J({customStats:e,rosterLoading:t,onRefresh:n}){return(0,R.jsx)(`div`,{className:`shrink-0 border-b border-border/70 bg-card/80 px-4 py-2.5`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-nowrap min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 shrink-0 rounded-lg bg-primary/10`,children:(0,R.jsx)(b,{className:`h-4 w-4 text-primary`})}),(0,R.jsxs)(`div`,{className:`min-w-0 overflow-hidden`,children:[(0,R.jsx)(`h1`,{className:`text-sm font-semibold truncate`,children:`Agent Roster`}),(0,R.jsxs)(`p`,{className:`text-[10px] text-muted-foreground truncate`,children:[e.filter(e=>e.exists||e.hasIdentity||e.hasConfig||e.hasKnowledge).length,` `,`customized · `,e.reduce((e,t)=>e+t.entryCount,0),` learned entries`]})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[t&&(0,R.jsx)(g,{className:`h-4 w-4 animate-spin text-muted-foreground shrink-0`}),(0,R.jsxs)(`button`,{type:`button`,onClick:n,className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 text-[10px] hover:bg-accent transition-colors shrink-0 whitespace-nowrap`,title:`Refresh roster data`,children:[(0,R.jsx)(T,{className:`h-3 w-3`}),` Refresh`]})]})]})})}function Y({activeTab:e,onTabChange:t}){return(0,R.jsx)(`div`,{className:`shrink-0 border-b border-border/50 bg-muted/20 px-3 flex gap-0`,children:K.map(n=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(n.id),className:A(`flex items-center gap-1.5 px-3 py-2 text-[10px] font-medium border-b-2 transition-colors`,e===n.id?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground/30`),children:[n.icon,n.label]},n.id))})}function X({customStats:e,onRefresh:n}){let[r,i]=(0,L.useState)(null),[o,l]=(0,L.useState)(null),[u,d]=(0,L.useState)({}),[p,m]=(0,L.useState)(``),[h,_]=(0,L.useState)(null),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(!1),[T,E]=(0,L.useState)(null),[D,j]=(0,L.useState)(!1),[N,P]=(0,L.useState)(!1),F=(0,L.useMemo)(()=>[...e].sort((e,t)=>e.role.localeCompare(t.role)),[e]),z=(0,L.useMemo)(()=>r?F.find(e=>e.role===r):null,[r,F]),B=(0,L.useCallback)(async e=>{x(!0),l(null);try{let t=await I(`agent-roster.read-learned`,{role:e});l(t.entries??[]),d({})}catch{}x(!1)},[]),V=(0,L.useCallback)(async()=>{if(!r||!o)return;y(!0);let e=o.filter((e,t)=>u[t]!==`drop`).join(`
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
`);try{await I(`agent-roster.update-learned`,{role:r,content:e}),l(null),d({})}catch{}y(!1)},[r,o,u]),H=(0,L.useCallback)(async()=>{if(!(!r||!p.trim())){_(null),y(!0);try{let e=`> Taught ${new Date().toISOString().slice(0,10)}\n\n${p.trim()}`;(await I(`agent-roster.append-learned`,{role:r,content:e})).success?(_({ok:!0,msg:`Saved to learned.md`}),m(``),n()):_({ok:!1,msg:`Save failed`})}catch(e){_({ok:!1,msg:e instanceof Error?e.message:`Failed`})}y(!1)}},[n,r,p]),U=(0,L.useCallback)(async(e,t)=>{y(!0),_(null);try{let r=await I(`agent-roster.update-learning`,{role:e,enabled:t});if(r.error)throw Error(r.error);_({ok:!0,msg:t?`Automatic learning resumed`:`Automatic learning paused`}),n()}catch(e){_({ok:!1,msg:e instanceof Error?e.message:`Policy update failed`})}finally{y(!1)}},[n]),W=(0,L.useCallback)(async e=>{try{let t=await I(`agent-roster.read-consolidated`,{role:e});E(t.isConsolidated?t.content:null)}catch{E(null)}},[]),G=(0,L.useCallback)(async e=>{j(!0),_(null);try{let r=await I(`agent-roster.consolidate`,{role:e});if(r.error)throw Error(r.error);if(r.rawEntryCount===0){_({ok:!1,msg:`No raw entries to optimize yet.`});return}if(r.consolidated){await n(),await W(e),_({ok:!0,msg:`Optimized. Consolidated knowledge updated.`}),M.success(r.model?`Learnings consolidated with ${r.model}.`:`Learnings consolidated.`);return}if(r.emptySynthesis){_({ok:!1,msg:`The model returned an empty result. Nothing was changed — try again.`}),M.error(`Optimization produced an empty result. Try again.`);return}let i=r.instruction;if(!i)throw Error(`No consolidation instruction generated`);let a=t.getState();a.addMessage({role:`user`,content:i}),a.setLoading(!0),k().sendMessage(i);let o=O.getState();o.setSidebarOpen(!1),o.setCurrentView(`chat`),_({ok:!0,msg:`No active model on server — optimization sent to chat agent instead.`}),M.info(`No active model on server. Optimization sent to the chat agent.`)}catch(e){_({ok:!1,msg:e instanceof Error?e.message:`Optimization failed`}),M.error(e instanceof Error?e.message:`Optimization failed`)}finally{j(!1)}},[n,W]),K=(0,L.useCallback)(async e=>{if(e.length!==0){P(!0),_(null);try{let n=[],i=0,a=0,o=``,s=[];for(let t of e)try{let e=await I(`agent-roster.consolidate`,{role:t});e.error?(a++,o=e.error):e.consolidated?n.push(t):e.rawEntryCount===0?i++:e.emptySynthesis?(a++,o=`Model returned an empty result`):e.instruction?s.push({role:t,instruction:e.instruction}):(a++,o=`No consolidation produced`)}catch(e){a++,o=e instanceof Error?e.message:String(e)}if(r&&n.includes(r)&&await W(r),s.length>0){let e=`Optimize the learned data for ${s.length} agent${s.length>1?`s`:``}. For each agent below, read its raw learned entries, synthesize them into a single narrowly-scoped document preserving every fact, and save the result to its consolidated.md file.\n\n`+s.map(e=>`## Agent: ${e.role}\n\n${e.instruction}`).join(`
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
`),n=t.getState();n.addMessage({role:`user`,content:e}),n.setLoading(!0),k().sendMessage(e);let r=O.getState();r.setSidebarOpen(!1),r.setCurrentView(`chat`)}if(n.length===0&&s.length===0){if(a>0){let t=i>0?` ${i} skipped.`:``,n=`Bulk consolidate failed for ${a} of ${e.length} agent${e.length>1?`s`:``}.${o?` Last error: ${o}`:``}${t}`;_({ok:!1,msg:n});return}let t=i>0?`Bulk optimize: ${i} skipped (no entries to optimize).`:`No agents had optimizable entries.`;_({ok:!0,msg:t}),M.info(t,6e3);return}let c=[];n.length>0&&c.push(`${n.length} consolidated`),s.length>0&&c.push(`${s.length} sent to chat`),i>0&&c.push(`${i} skipped`),a>0&&c.push(`${a} failed`);let l=`Bulk optimize: ${c.join(`, `)}.`;_({ok:a===0,msg:l}),n.length>0&&s.length===0?M.success(l,6e3):M.info(l,6e3)}catch(e){_({ok:!1,msg:e instanceof Error?e.message:`Bulk optimization failed`}),M.error(e instanceof Error?e.message:`Bulk optimization failed`)}finally{P(!1)}}},[r,W]);return F.length===0?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-muted-foreground`,children:(0,R.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,R.jsx)(w,{className:`h-10 w-10 mx-auto opacity-30`}),(0,R.jsx)(`p`,{className:`text-sm`,children:`No self-learning data yet`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:`Learning entries appear when agents capture output`})]})}):(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:A(`flex flex-col min-h-0 min-w-0 overflow-hidden border-r border-border/50`,r?`w-80 shrink-0`:`flex-1`),children:[(0,R.jsxs)(`div`,{className:`shrink-0 px-3 py-2 border-b border-border/50`,children:[(0,R.jsxs)(`h3`,{className:`text-xs font-semibold flex items-center gap-1.5`,children:[(0,R.jsx)(w,{className:`h-3.5 w-3.5 text-brand-2`}),`All Roster Agents`]}),(()=>{let e=F.filter(e=>e.needsSummarization);return e.length===0?null:(0,R.jsxs)(`div`,{className:`mt-2 flex flex-col gap-1.5 rounded border border-warning/40 bg-warning/10 px-2 py-1.5`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(C,{className:`h-3 w-3 text-warning shrink-0`}),(0,R.jsxs)(`span`,{className:`text-[10px] text-warning leading-tight`,children:[e.length,` agent`,e.length>1?`s`:``,` need`,e.length===1?`s`:``,` optimization`]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{let t=e[0];t&&(i(t.role),l(null),E(null))},className:`ml-auto text-[9px] text-warning underline hover:text-warning/80 shrink-0`,children:`review →`})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>K(e.map(e=>e.role)),disabled:N,className:`flex items-center justify-center gap-1 rounded bg-warning/20 border border-warning/40 px-2 py-1 text-[10px] font-medium text-warning hover:bg-warning/30 transition-colors disabled:opacity-50`,children:[N?(0,R.jsx)(g,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(C,{className:`h-3 w-3`}),N?`Optimizing…`:`Optimize All (${e.length})`]})]})})()]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:F.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{i(e.role),l(null),E(null)},className:A(`w-full text-left rounded-lg border px-3 py-2 transition-colors`,r===e.role?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30`,e.needsSummarization&&r!==e.role&&`border-warning/40`),children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold`,children:e.role}),(0,R.jsx)(`span`,{className:A(`text-[9px] tabular-nums`,e.learningEnabled?`text-success`:`text-muted-foreground`),children:e.learningEnabled?`learning`:`paused`})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-[9px] text-muted-foreground`,children:[(0,R.jsxs)(`span`,{className:`tabular-nums`,children:[e.entryCount,` entries`]}),e.sessionCaptureCount>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsxs)(`span`,{className:`text-success tabular-nums`,children:[`+`,e.sessionCaptureCount]})]}),e.lastCapture&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsx)(`span`,{children:new Date(e.lastCapture).toLocaleDateString()})]}),e.needsSummarization&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-warning font-medium`,children:[(0,R.jsx)(C,{className:`h-2.5 w-2.5`}),`optimize`]})]})]},e.role))})]}),(0,R.jsxs)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:[!r&&(0,R.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:`Select an agent to view learning details`}),r&&z&&(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h3`,{className:`text-base font-semibold`,children:r}),(0,R.jsx)(`div`,{className:`flex gap-1`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>U(r,!z.learningEnabled),disabled:v,className:A(`inline-flex items-center gap-1 rounded border px-2 py-1 text-[10px] transition-colors disabled:opacity-50`,z.learningEnabled?`border-success/40 text-success hover:bg-success/10`:`border-border/50 text-muted-foreground hover:bg-accent`),children:[(0,R.jsx)(w,{className:`h-3 w-3`}),` `,z.learningEnabled?`Learning on`:`Learning paused`]})})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Entries`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:z.entryCount})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Size`}),(0,R.jsxs)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:[z.totalBytes,`B`]})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Last Capture`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:z.lastCapture?new Date(z.lastCapture).toLocaleDateString():`—`})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Lifetime Captures`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:z.lifetimeCaptureCount})]})]}),z.needsSummarization&&(0,R.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-warning bg-warning/10 rounded-lg px-3 py-2.5`,children:[(0,R.jsx)(a,{className:`h-4 w-4 shrink-0`}),(0,R.jsxs)(`span`,{className:`flex-1`,children:[`Learned data exceeds soft limit (`,z.totalBytes.toLocaleString(),`B / 8,192B). Optimize to synthesize raw entries into a consolidated document and reduce context volume.`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>G(r),disabled:D,className:`inline-flex items-center gap-1 rounded bg-warning/20 text-warning border border-warning/40 px-2.5 py-1 text-[10px] font-medium hover:bg-warning/30 transition-colors disabled:opacity-50 shrink-0`,children:[D?(0,R.jsx)(g,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(C,{className:`h-3 w-3`}),D?`Optimizing…`:`Optimize Now`]})]}),(0,R.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,R.jsx)(c,{className:`h-4 w-4 text-primary`}),(0,R.jsx)(`span`,{className:`text-xs font-semibold`,children:`Optimize Learnings`})]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>G(r),disabled:D||z.entryCount===0,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,title:z.entryCount===0?`No raw entries to optimize`:`Synthesize raw entries into a consolidated, narrowly-scoped document`,children:[D?(0,R.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}):(0,R.jsx)(C,{className:`h-3.5 w-3.5`}),D?`Optimizing…`:`Optimize`]})]}),(0,R.jsxs)(`p`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:[`Synthesizes all `,z.entryCount,` raw entries into a single reviewed document — narrowly scoped to this agent's skills, preserving every fact but reducing context volume. The result replaces raw entries in the agent's prompt.`]}),z.isConsolidated&&z.consolidation&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground pt-1 border-t border-border/50`,children:[(0,R.jsx)(s,{className:`h-3 w-3 text-success`}),(0,R.jsxs)(`span`,{children:[`Consolidated`,` `,new Date(z.consolidation.consolidatedAt).toLocaleDateString(),` ·`,` `,z.consolidation.sourceBytes,`B →`,` `,z.consolidation.consolidatedBytes,`B`,z.consolidation.sourceEntryCount<z.entryCount&&(0,R.jsxs)(`span`,{className:`text-warning ml-1`,children:[`· `,z.entryCount-z.consolidation.sourceEntryCount,` `,`new pending`]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{T===null?W(r):E(null)},className:`ml-auto underline text-primary hover:text-primary/80`,children:T===null?`View`:`Hide`})]}),T!==null&&(0,R.jsxs)(`div`,{className:`mt-2 max-h-72 overflow-y-auto rounded border border-border/50 bg-background/50 p-2`,children:[(0,R.jsxs)(`div`,{className:`text-[10px] text-muted-foreground mb-1 font-medium`,children:[`Consolidated knowledge for `,r]}),(0,R.jsx)(`pre`,{className:`text-[10px] whitespace-pre-wrap font-sans leading-relaxed`,children:T||`(empty)`})]})]}),z.entryCount>0&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>B(r),disabled:b,className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[b?(0,R.jsx)(g,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(S,{className:`h-3 w-3`}),`Review Learned Entries (`,z.entryCount,`)`]})}),o&&(0,R.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`span`,{className:`text-xs font-medium`,children:[o.filter((e,t)=>u[t]!==`drop`).length,`/`,o.length,` kept`]}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:V,disabled:v,className:`inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[10px] text-primary-foreground hover:bg-primary/90 transition-colors`,children:v?`Applying…`:`Apply Selection`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{l(null),d({})},className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 text-[10px] hover:bg-accent transition-colors`,children:`Cancel`})]})]}),(0,R.jsx)(`div`,{className:`max-h-72 overflow-y-auto space-y-2`,children:o.map((e,t)=>{let n=u[t]??`keep`,r=e.length>200?e.slice(0,200)+`…`:e;return(0,R.jsx)(`div`,{className:A(`rounded-lg border p-2 transition-colors`,n===`drop`?`border-destructive/40 bg-destructive/5 opacity-60`:`border-border`),children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,R.jsx)(`pre`,{className:`text-[10px] whitespace-pre-wrap flex-1 leading-relaxed font-sans`,children:r}),(0,R.jsxs)(`div`,{className:`flex gap-1 shrink-0`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(e=>({...e,[t]:`keep`})),className:A(`px-2 py-1 text-[9px] rounded`,n===`keep`?`bg-success/20 text-success`:`bg-muted text-muted-foreground`),children:`Keep`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>d(e=>({...e,[t]:`drop`})),className:A(`px-2 py-1 text-[9px] rounded`,n===`drop`?`bg-destructive/20 text-destructive`:`bg-muted text-muted-foreground`),children:`Drop`})]})]})},t)})})]})]}),(0,R.jsxs)(`div`,{className:`space-y-2 pt-4 border-t border-border`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1 text-sm font-medium`,children:[(0,R.jsx)(f,{className:`h-4 w-4 text-brand-2`}),` Teach this agent`]}),(0,R.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Describe a command, pattern, or behavior you want this agent to remember.`}),(0,R.jsx)(`textarea`,{className:`w-full h-20 text-xs p-2 bg-card border border-border rounded resize-y`,value:p,onChange:e=>m(e.target.value),placeholder:`e.g. Always use pnpm for this project`}),(0,R.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:H,disabled:!p.trim()||v,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,children:[(0,R.jsx)(f,{className:`h-3.5 w-3.5`}),` Teach`]}),h&&(0,R.jsx)(`span`,{className:A(`text-xs`,h.ok?`text-success`:`text-destructive`),children:h.msg})]})]})]})]})]})}function ee({customStats:e,catalog:t}){let[n,r]=(0,L.useState)(``),[a,s]=(0,L.useState)(null),c=(0,L.useMemo)(()=>new Set(e.filter(e=>e.exists||e.hasIdentity||e.hasConfig||e.hasKnowledge).map(e=>e.role)),[e]),u=(0,L.useMemo)(()=>{if(!n.trim())return t;let e=n.toLowerCase();return t.filter(t=>t.role.includes(e)||t.name.toLowerCase().includes(e)||t.summary.toLowerCase().includes(e))},[t,n]),f=(0,L.useCallback)(t=>e.find(e=>e.role===t),[e]),m=u;return(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`shrink-0 px-3 py-2 border-b border-border/50`,children:(0,R.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-background px-3 py-1.5`,children:[(0,R.jsx)(d,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,R.jsx)(`input`,{type:`text`,value:n,onChange:e=>r(e.target.value),placeholder:`Search agents by name, role, or description…`,className:`flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground/50`}),n&&(0,R.jsx)(`button`,{type:`button`,onClick:()=>r(``),className:`text-muted-foreground hover:text-foreground`,children:(0,R.jsx)(p,{className:`h-3 w-3`})})]})}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[(0,R.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2`,children:m.map(e=>{let t=f(e.role),n=c.has(e.role),r=a===e.role;return(0,R.jsxs)(`div`,{className:A(`rounded-lg border bg-card transition-colors`,r?`border-primary/40 ring-1 ring-primary/20`:`border-border/60 hover:border-primary/30`),children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>s(r?null:e.role),className:`w-full text-left p-3`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,R.jsx)(v,{className:`h-4 w-4 shrink-0 text-primary`}),(0,R.jsx)(`span`,{className:`text-sm font-semibold truncate`,children:e.name}),(0,R.jsxs)(`code`,{className:`text-[9px] text-muted-foreground font-mono shrink-0`,children:[`@`,e.role]})]}),(0,R.jsx)(o,{className:A(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,r&&`rotate-180`)})]}),(0,R.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-1 leading-relaxed line-clamp-2`,children:e.summary}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[(0,R.jsxs)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,children:[e.tools,` tools`]}),e.budget.maxIterations&&(0,R.jsxs)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,children:[e.budget.maxIterations.toLocaleString(),` max it`]}),n&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 rounded bg-brand-2/10 px-1 py-0.5 text-[8px] text-brand-2 font-medium`,children:[(0,R.jsx)(l,{className:`h-2.5 w-2.5`}),` Customized`]}),t?.needsSummarization&&(0,R.jsx)(`span`,{className:`text-[9px] text-warning`,children:`⚠ Needs summary`})]})]}),r&&(0,R.jsxs)(`div`,{className:`border-t border-border/50 px-3 py-2 space-y-2`,children:[(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,R.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,R.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:`Max Iterations`}),(0,R.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.maxIterations?.toLocaleString()??`—`})]}),(0,R.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,R.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:`Timeout`}),(0,R.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.timeoutMs?`${Math.round(e.budget.timeoutMs/6e4)}m`:`—`})]}),(0,R.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,R.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:`Max Tool Calls`}),(0,R.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.maxToolCalls?.toLocaleString()??`—`})]}),(0,R.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,R.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:`Customized`}),(0,R.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:n?`Yes`:`No`})]})]}),n&&t&&(0,R.jsxs)(`div`,{className:`rounded bg-accent/30 p-2 space-y-1`,children:[(0,R.jsx)(`span`,{className:`text-[9px] font-medium text-muted-foreground`,children:`Project Customizations`}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[9px]`,children:[t.hasIdentity&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,R.jsx)(l,{className:`h-2.5 w-2.5 text-primary`}),` identity.md`]}),t.entryCount>0&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,R.jsx)(w,{className:`h-2.5 w-2.5 text-brand-2`}),` `,t.entryCount,` `,`learned entries`]}),t.hasConfig&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,R.jsx)(x,{className:`h-2.5 w-2.5 text-muted-foreground`}),` config.json`]}),t.sessionCaptureCount>0&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,R.jsx)(i,{className:`h-2.5 w-2.5 text-success`}),` `,t.sessionCaptureCount,` session captures`]})]})]})]})]},e.role)})}),m.length===0&&(0,R.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-40 text-muted-foreground`,children:[(0,R.jsx)(d,{className:`h-8 w-8 mb-2 opacity-30`}),(0,R.jsxs)(`p`,{className:`text-sm`,children:[`No agents match "`,n,`"`]})]})]}),(0,R.jsxs)(`div`,{className:`shrink-0 border-t border-border/50 px-3 py-2 text-[10px] text-muted-foreground flex items-center gap-2`,children:[(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`strong`,{children:t.length}),` roster roles`]}),(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsxs)(`span`,{className:`text-brand-2`,children:[(0,R.jsx)(`strong`,{children:c.size}),` customized`]}),(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`strong`,{children:e.reduce((e,t)=>e+t.entryCount,0)}),` total learned entries`]})]})]})}var Z={running:{led:`bg-success`,badge:`bg-success/12 text-success`,icon:(0,R.jsx)(`span`,{className:`led text-success led-pulse`}),color:`text-success`},completed:{led:`bg-success`,badge:`bg-success/12 text-success`,icon:(0,R.jsx)(s,{className:`h-3.5 w-3.5`}),color:`text-success`},failed:{led:`bg-destructive`,badge:`bg-destructive/15 text-destructive`,icon:(0,R.jsx)(r,{className:`h-3.5 w-3.5`}),color:`text-destructive`},timeout:{led:`bg-warning`,badge:`bg-muted text-muted-foreground`,icon:(0,R.jsx)(n,{className:`h-3.5 w-3.5`}),color:`text-warning`},stopped:{led:`bg-muted-foreground`,badge:`bg-muted text-muted-foreground`,icon:(0,R.jsx)(`span`,{className:`led text-muted-foreground`}),color:`text-muted-foreground`},idle:{led:`bg-muted-foreground`,badge:`bg-muted text-muted-foreground`,icon:(0,R.jsx)(`span`,{className:`led text-muted-foreground`}),color:`text-muted-foreground`}};function Q(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m ${t%60}s`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function $(e){if(e==null||!Number.isFinite(e)||e<=0)return`$0`;if(e<.01){let t=e.toFixed(5);return t===`0.00000`?`$0`:`$`+t.replace(/(\d)0+$/,`$1`).replace(/\.$/,``)}return`$`+e.toFixed(3)}function te({nowTick:e}){let t=j(e=>e.agents),n=j(e=>e.leaderId),[r,i]=(0,L.useState)(null),[a,o]=(0,L.useState)(`all`),s=(0,L.useMemo)(()=>{let e=Array.from(t.values());return e.sort((e,t)=>{let n=e.status===`running`?0:1,r=t.status===`running`?0:1;return n===r?t.startedAt-e.startedAt:n-r}),a===`all`?e:a===`running`?e.filter(e=>e.status===`running`):a===`done`?e.filter(e=>e.status===`completed`):a===`failed`?e.filter(e=>e.status===`failed`||e.status===`timeout`):e},[t,a]),c=(0,L.useMemo)(()=>{let e=0,n=0,r=0;for(let i of t.values())i.status===`running`?e++:i.status===`completed`?n++:(i.status===`failed`||i.status===`timeout`)&&r++;return{running:e,completed:n,failed:r,total:t.size}},[t]),l=j(e=>e.clearFinishedAgents),u=r?s.find(e=>e.id===r):null,d=(0,L.useCallback)(e=>{let t=O.getState();e?(t.setInspectorFocusedAgentId(e),t.setInspectorTab(`agents`)):t.setInspectorTab(`fleet`),t.setInspectorOpen(!0)},[]);return s.length===0?(0,R.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-muted-foreground`,children:(0,R.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,R.jsx)(v,{className:`h-10 w-10 mx-auto opacity-30`}),(0,R.jsx)(`p`,{className:`text-sm`,children:`No active fleet agents`}),(0,R.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:`Agents appear here when subagents spawn`})]})}):(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:A(`flex flex-col min-h-0 min-w-0 overflow-hidden`,u?`w-80 shrink-0 border-r border-border/50`:`flex-1`),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0 px-3 py-2 border-b border-border/50`,children:[[`all`,`running`,`done`,`failed`].map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(e),className:A(`rounded px-2 py-0.5 text-[10px] font-medium transition-colors`,a===e?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),children:[e===`all`&&`All (${c.total})`,e===`running`&&`Running (${c.running})`,e===`done`&&`Done (${c.completed})`,e===`failed`&&`Failed (${c.failed})`]},e)),(0,R.jsx)(`span`,{className:`flex-1`}),c.completed+c.failed>0&&(0,R.jsxs)(`button`,{type:`button`,onClick:l,className:`inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors`,children:[(0,R.jsx)(_,{className:`h-2.5 w-2.5`}),` Clear`]})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:s.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>i(r===e.id?null:e.id),className:A(`w-full text-left rounded-lg border px-3 py-2 transition-colors flex items-center gap-2`,r===e.id?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30 hover:bg-primary/[0.03]`),children:[(0,R.jsx)(`span`,{className:A(`led shrink-0`,Z[e.status]?.led??`bg-muted-foreground`,e.status===`running`&&`led-pulse`)}),(0,R.jsx)(`span`,{className:`text-xs font-semibold min-w-0 truncate max-w-[7rem]`,children:e.name}),e.id===n&&(0,R.jsx)(E,{className:`h-3 w-3 shrink-0 text-warning`}),e.model&&(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground font-mono truncate max-w-[6rem] shrink-0`,children:e.model}),(0,R.jsxs)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums shrink-0`,children:[e.iteration,`it · `,e.toolCalls,`t`]}),e.status===`running`&&(0,R.jsx)(`span`,{className:`text-[9px] text-primary tabular-nums shrink-0 ml-auto`,children:Q(Date.now()-e.startedAt)}),e.status!==`running`&&(0,R.jsx)(`span`,{className:A(`text-[9px] tabular-nums shrink-0 ml-auto`,Z[e.status]?.color??`text-muted-foreground`),children:e.status}),e.costUsd>0&&(0,R.jsx)(`span`,{className:`text-[9px] text-success tabular-nums font-medium shrink-0`,children:$(e.costUsd)}),e.status===`running`&&e.currentTool&&(0,R.jsxs)(`span`,{className:`text-[9px] text-primary font-mono truncate max-w-[6rem] shrink-0`,children:[`→ `,e.currentTool]})]},e.id))}),(0,R.jsxs)(`div`,{className:`shrink-0 border-t border-border/50 px-3 py-2 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`font-medium tabular-nums`,children:c.total}),` agents total`,(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsx)(`span`,{className:`text-success tabular-nums`,children:c.running}),` running`,(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsx)(`span`,{className:`tabular-nums`,children:c.completed}),` done`,c.failed>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,R.jsx)(`span`,{className:`text-destructive tabular-nums`,children:c.failed}),` failed`]}),(0,R.jsx)(`span`,{className:`flex-1`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>d(),className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 hover:bg-accent transition-colors`,children:[(0,R.jsx)(h,{className:`h-3 w-3`}),`Fleet Inspector`]})]})]}),u&&(0,R.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:(0,R.jsx)(ne,{agent:u,nowTick:e})})]})}function ne({agent:e,nowTick:t}){let n=e.status===`running`?Q(t-e.startedAt):e.completedAt?Q(e.completedAt-e.startedAt):`-`,r=Math.min(100,Math.max(0,e.ctxPct)),i=e.currentTool||e.lastTool,a=j(e=>e.leaderId);return(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10`,children:(0,R.jsx)(v,{className:`h-5 w-5 text-primary`})}),(0,R.jsxs)(`div`,{children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-base font-semibold`,children:e.name}),e.id===a&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-warning/30 bg-warning/10 px-1.5 py-0.5 text-[9px] font-medium text-warning`,children:[(0,R.jsx)(E,{className:`h-2.5 w-2.5`}),` Leader`]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:A(`led`,Z[e.status]?.led,e.status===`running`&&`led-pulse`)}),(0,R.jsx)(`span`,{children:e.status}),e.model&&(0,R.jsxs)(`span`,{children:[`· `,e.provider,`/`,e.model]}),(0,R.jsxs)(`span`,{children:[`· `,n]})]})]})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Iterations`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:e.iteration})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Tool Calls`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:e.toolCalls})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Cost`}),(0,R.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5 text-success`,children:$(e.costUsd)})]}),(0,R.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,R.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:`Context`}),(0,R.jsxs)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:[r,`%`]})]})]}),e.maxContext>0&&(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex justify-between text-[10px]`,children:[(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:`Context Window`}),(0,R.jsxs)(`span`,{className:A(`tabular font-medium`,r>=85?`text-destructive`:r>=70?`text-warning`:`text-success`),children:[e.ctxTokens.toLocaleString(),` / `,e.maxContext.toLocaleString(),` tokens`]})]}),(0,R.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-muted`,children:(0,R.jsx)(`div`,{className:A(`h-full rounded-full transition-all`,r>=85?`bg-destructive`:r>=70?`bg-warning`:`bg-primary`),style:{width:`${Math.max(2,r)}%`}})})]}),i&&(0,R.jsxs)(`div`,{className:A(`flex items-center gap-2 rounded-lg border px-3 py-2`,e.status===`running`?`border-primary/30 bg-primary/[0.04]`:`border-border bg-muted/30`),children:[(0,R.jsx)(m,{className:A(`h-4 w-4`,e.status===`running`?`text-primary animate-pulse`:`text-muted-foreground`)}),(0,R.jsx)(`span`,{className:`text-sm font-mono`,children:e.currentTool??e.lastTool}),(0,R.jsx)(`span`,{className:`text-[10px] text-muted-foreground ml-auto`,children:e.currentTool?`Running`:`Last tool`})]}),e.error&&(0,R.jsxs)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3`,children:[(0,R.jsx)(`span`,{className:`text-[10px] font-semibold text-destructive uppercase tracking-wider`,children:`Error`}),(0,R.jsx)(`p`,{className:`text-xs text-destructive/90 mt-1`,children:e.error.message})]}),e.toolLog.length>0&&(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsxs)(`span`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:[`Tool Log (`,e.toolLog.length,`)`]}),(0,R.jsx)(`div`,{className:`space-y-0.5`,children:e.toolLog.slice(0,10).map((e,t)=>(0,R.jsxs)(`div`,{className:A(`flex items-center gap-2 rounded px-2 py-1 text-[10px] font-mono`,e.ok?`bg-muted/30`:`bg-destructive/5 border border-destructive/20`),children:[(0,R.jsx)(`span`,{className:A(`led shrink-0`,e.ok?`text-success`:`text-destructive`)}),(0,R.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,R.jsxs)(`span`,{className:`tabular text-muted-foreground`,children:[e.durationMs,`ms`]}),!e.ok&&(0,R.jsx)(`span`,{className:`text-destructive`,children:`✗`})]},`${e.name}-${t}`))})]}),e.budgetWarning&&(0,R.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg bg-warning/10 border border-warning/25 text-xs`,children:[(0,R.jsx)(C,{className:`h-3.5 w-3.5 text-warning shrink-0`}),(0,R.jsxs)(`span`,{className:`text-warning`,children:[`Budget: `,e.budgetWarning.kind,` limit (`,e.budgetWarning.used,`/`,e.budgetWarning.limit,`)`]})]})]})}function re(){let[e,t]=(0,L.useState)([]),[n,r]=(0,L.useState)(q),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(null),c=(0,L.useCallback)(async()=>{a(!0),s(null);try{let e=await I(`agent-roster.list`,{});e.stats&&t(e.stats),e.catalog?.length&&r(e.catalog)}catch(e){s(e instanceof Error?e.message:`Failed to load roster`)}a(!1)},[]);return(0,L.useEffect)(()=>{c()},[c]),(0,L.useEffect)(()=>{let e=null,t=k().on(`agent-roster.updated`,()=>{e&&clearTimeout(e),e=setTimeout(()=>{e=null,c()},300)});return()=>{e&&clearTimeout(e),t()}},[c]),{customStats:e,catalog:n,rosterLoading:i,rosterError:o,loadRoster:c}}function ie({customStats:e,catalog:n,onRefresh:r}){let[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(null),[d,f]=(0,L.useState)(``),[p,m]=(0,L.useState)(null),[h,g]=(0,L.useState)(!1),[v,y]=(0,L.useState)(null),[b,C]=(0,L.useState)(!1),[T,E]=(0,L.useState)({name:``,role:``,baseRole:`generic`,purpose:``,taskTypes:``}),D=(0,L.useMemo)(()=>i?e.find(e=>e.role===i):null,[i,e]),j=(0,L.useMemo)(()=>{let e=n.find(e=>e.role===i);return e?.systemProtected??!e?.custom},[n,i]),M=(0,L.useCallback)(async(e,t)=>{g(!0),y(null),a(e);try{let n=await I(`agent-roster.read-customization`,{role:e});f(t===`config`?`${JSON.stringify(n.config??{},null,2)}\n`:n[t]??``),s(t),m(null)}catch(e){y(e instanceof Error?e.message:`Failed to load customization`)}finally{g(!1)}},[]),N=(0,L.useCallback)(async e=>{g(!0),y(null),a(e);try{let t=await I(`agent-roster.read-customization`,{role:e});m(t.config??{}),s(null)}catch(e){y(e instanceof Error?e.message:`Failed to load runtime policy`)}finally{g(!1)}},[]),P=(0,L.useCallback)(async e=>{if(i){g(!0),y(null);try{await I(`agent-roster.update-config`,{role:i,config:e}),m(null),r()}catch(e){y(e instanceof Error?e.message:`Runtime policy save failed`)}finally{g(!1)}}},[r,i]),F=(0,L.useCallback)(async()=>{if(!(!i||!o)){g(!0);try{let e={identity:`agent-roster.update-identity`,learned:`agent-roster.update-learned`,config:`agent-roster.update-config`},t={role:i};if(o===`config`)try{t.config=JSON.parse(d)}catch{y(`config.json must contain valid JSON`),g(!1);return}else t.content=d;await I(e[o],t),s(null),y(null),r()}catch(e){y(e instanceof Error?e.message:`Save failed`)}g(!1)}},[i,o,d,r]),z=(0,L.useCallback)(async()=>{if(i)try{let e=await I(`agent-roster.llm-improve`,{role:i,prompt:`Improve this agent for optimal project performance`});if(!e.instruction)throw Error(`No improvement instruction generated`);let n=t.getState();n.addMessage({role:`user`,content:e.instruction}),n.setLoading(!0),k().sendMessage(e.instruction);let r=O.getState();r.setSidebarOpen(!1),r.setCurrentView(`chat`)}catch(e){y(e instanceof Error?e.message:`LLM improvement failed`)}},[i]),B=(0,L.useCallback)(async e=>{if(window.confirm(`Reset all project-specific data for agent "${e}"?`))try{await I(`agent-roster.reset`,{role:e}),a(null),r()}catch{}},[r]),V=(0,L.useCallback)(async()=>{let e=T.taskTypes.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean);g(!0),y(null);try{let t=await I(`agent-roster.create`,{name:T.name,role:T.role,baseRole:T.baseRole,purpose:T.purpose,taskTypes:e});C(!1),E({name:``,role:``,baseRole:`generic`,purpose:``,taskTypes:``}),a(t.role),r()}catch(e){y(e instanceof Error?e.message:`Agent creation failed`)}finally{g(!1)}},[T,r]),H=(0,L.useMemo)(()=>[...e].sort((e,t)=>{let n=+!!e.hasIdentity+ +(e.entryCount>0)+ +!!e.hasConfig;return+!!t.hasIdentity+ +(t.entryCount>0)+ +!!t.hasConfig-n}),[e]);return(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,R.jsxs)(`div`,{className:`w-80 shrink-0 border-r border-border/50 flex flex-col overflow-hidden`,children:[(0,R.jsx)(`div`,{className:`shrink-0 border-b border-border/50 px-3 py-2`,children:(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold`,children:[(0,R.jsx)(x,{className:`h-3.5 w-3.5`}),`Project Agents`]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>{C(!0),a(null),m(null),y(null)},className:`rounded border border-primary/40 px-1.5 py-1 text-[9px] text-primary hover:bg-primary/10`,children:`+ Clone`})]})}),(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:[H.map(e=>(0,R.jsxs)(`button`,{type:`button`,onClick:()=>{a(e.role),m(null),s(null)},className:A(`w-full text-left rounded-lg border px-3 py-2 transition-colors`,i===e.role?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30`),children:[(0,R.jsx)(`div`,{className:`text-xs font-semibold`,children:e.role}),(0,R.jsxs)(`div`,{className:`flex gap-2 mt-0.5 text-[9px] text-muted-foreground`,children:[e.hasIdentity&&(0,R.jsx)(`span`,{className:`text-primary`,children:`id`}),e.entryCount>0&&(0,R.jsxs)(`span`,{className:`text-brand-2`,children:[e.entryCount,`e`]}),e.hasConfig&&(0,R.jsx)(`span`,{children:`cfg`})]})]},e.role)),H.length===0&&(0,R.jsx)(`div`,{className:`text-[10px] text-muted-foreground text-center py-4`,children:`No customizations yet`})]})]}),(0,R.jsxs)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:[b&&(0,R.jsxs)(`div`,{className:`max-w-2xl space-y-4`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`text-base font-semibold`,children:`Create or Clone Project Agent`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Inherit any roster agent as a template, then develop an independent identity, runtime policy and learned history.`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Clone from roster role`}),(0,R.jsx)(`select`,{value:T.baseRole,onChange:e=>E(t=>({...t,baseRole:e.target.value})),className:`h-9 w-full rounded border border-border bg-card px-2`,children:[...n].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,R.jsxs)(`option`,{value:e.role,children:[e.name,` (`,e.role,`)`]},e.role))}),(0,R.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`Prompt, tools, skills and defaults are inherited. Learning and later edits remain isolated to the new agent.`})]}),(0,R.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`label`,{className:`space-y-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Display name`}),(0,R.jsx)(`input`,{value:T.name,onChange:e=>E(t=>({...t,name:e.target.value})),placeholder:`ABC`,className:`h-9 w-full rounded border border-border bg-card px-2`})]}),(0,R.jsxs)(`label`,{className:`space-y-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Role id (optional)`}),(0,R.jsx)(`input`,{value:T.role,onChange:e=>E(t=>({...t,role:e.target.value})),placeholder:`abc (generated from name)`,className:`h-9 w-full rounded border border-border bg-card px-2 font-mono`})]})]}),(0,R.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Purpose`}),(0,R.jsx)(`textarea`,{value:T.purpose,onChange:e=>E(t=>({...t,purpose:e.target.value})),placeholder:`Own X, Y and Z workflows for this project and verify their results.`,className:`h-24 w-full resize-y rounded border border-border bg-card p-2`})]}),(0,R.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:`Task types (comma or one per line)`}),(0,R.jsx)(`textarea`,{value:T.taskTypes,onChange:e=>E(t=>({...t,taskTypes:e.target.value})),placeholder:`X workflow
|
|
10
|
-
Y analysis
|
|
11
|
-
Z verification`,className:`h-24 w-full resize-y rounded border border-border bg-card p-2`})]}),v&&(0,R.jsx)(`p`,{className:`text-xs text-destructive`,children:v}),(0,R.jsxs)(`div`,{className:`flex gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:V,disabled:h||!T.name.trim()||T.purpose.trim().length<10||!T.taskTypes.trim(),className:`rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground disabled:opacity-50`,children:h?`Creating…`:`Clone Agent`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>C(!1),className:`rounded border border-border px-3 py-1.5 text-xs hover:bg-accent`,children:`Cancel`})]})]}),!b&&!i&&(0,R.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:`Select an agent to edit customizations`}),!b&&i&&D&&(0,R.jsxs)(`div`,{className:`space-y-4 max-w-2xl`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsx)(`h3`,{className:`text-base font-semibold`,children:i}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:z,className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 text-[10px] hover:bg-accent transition-colors`,children:[(0,R.jsx)(c,{className:`h-3 w-3 text-brand-2`}),` LLM Improve`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>B(i),className:`inline-flex items-center gap-1 rounded border border-destructive/30 px-2 py-1 text-[10px] text-destructive hover:bg-destructive/10 transition-colors`,children:[(0,R.jsx)(_,{className:`h-3 w-3`}),` Reset`]})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[D.hasIdentity&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-2 py-1 text-[10px] text-primary`,children:[(0,R.jsx)(l,{className:`h-3 w-3`}),` identity.md`]}),D.hasConfig&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[10px] text-muted-foreground`,children:[(0,R.jsx)(x,{className:`h-3 w-3`}),` config.json`]}),D.hasKnowledge&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[10px] text-muted-foreground`,children:[(0,R.jsx)(w,{className:`h-3 w-3`}),` knowledge.json`]}),D.entryCount>0&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-brand-2/10 px-2 py-1 text-[10px] text-brand-2`,children:[(0,R.jsx)(S,{className:`h-3 w-3`}),` `,D.entryCount,` learned entries`]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>M(i,`identity`),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[(0,R.jsx)(l,{className:`h-3.5 w-3.5`}),` Edit identity.md`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>M(i,`learned`),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[(0,R.jsx)(S,{className:`h-3.5 w-3.5`}),` Edit learned.md`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>N(i),className:`inline-flex items-center gap-1 rounded border border-primary/40 bg-primary/5 px-3 py-1.5 text-xs text-primary hover:bg-primary/10 transition-colors`,children:[(0,R.jsx)(u,{className:`h-3.5 w-3.5`}),` Runtime policy`]}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>M(i,`config`),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:[(0,R.jsx)(x,{className:`h-3.5 w-3.5`}),` Edit config.json`]})]}),v&&(0,R.jsx)(`p`,{className:`text-xs text-destructive`,children:v}),p&&(0,R.jsx)(G,{initialConfig:p,systemProtected:j,saving:h,onSave:P,onCancel:()=>m(null)},i),o&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,R.jsxs)(`span`,{className:`text-xs font-medium`,children:[o,`.md / `,o,`.json`]}),(0,R.jsxs)(`div`,{className:`flex gap-1`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:F,disabled:h,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,children:h?`Saving…`:`Save`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>s(null),className:`inline-flex items-center gap-1 rounded border border-border/50 px-3 py-1.5 text-xs hover:bg-accent transition-colors`,children:`Cancel`})]})]}),(0,R.jsx)(`textarea`,{className:`w-full h-48 font-mono text-xs p-2 bg-card border border-border rounded resize-y`,value:d,onChange:e=>f(e.target.value),placeholder:o===`config`?`{ "tools": [...], "budget": {...} }`:`# Project identity for ${i}\n\nDescribe this agent's role…`})]})]})]})]})}function ae({className:e}){let[t,n]=(0,L.useState)(`live`),[r,i]=(0,L.useState)(Date.now()),{customStats:o,catalog:s,rosterLoading:c,rosterError:l,loadRoster:u}=re();return(0,L.useEffect)(()=>{let e=setInterval(()=>{document.hidden||i(Date.now())},2e3);return()=>clearInterval(e)},[]),(0,R.jsxs)(`div`,{className:A(`flex h-full min-h-0 min-w-0 w-full flex-col overflow-hidden`,e),children:[(0,R.jsx)(J,{customStats:o,rosterLoading:c,onRefresh:u}),(0,R.jsx)(Y,{activeTab:t,onTabChange:n}),(0,R.jsxs)(`div`,{className:`flex min-h-0 min-w-0 w-full flex-1 overflow-hidden bg-background/50`,children:[l&&(0,R.jsxs)(`div`,{className:`flex items-center justify-center w-full text-destructive text-xs gap-2`,children:[(0,R.jsx)(a,{className:`h-4 w-4`}),l,(0,R.jsx)(`button`,{type:`button`,onClick:u,className:`underline`,children:`Retry`})]}),t===`live`&&(0,R.jsx)(te,{nowTick:r}),t===`catalog`&&(0,R.jsx)(ee,{customStats:o,catalog:s}),t===`learning`&&(0,R.jsx)(X,{customStats:o,onRefresh:u}),t===`customize`&&(0,R.jsx)(ie,{customStats:o,catalog:s,onRefresh:u})]})]})}export{ae as AgentRosterView};
|