@wrongstack/webui 0.303.0 → 0.305.1
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-D21dmPj3.js +9 -0
- package/dist/assets/{AnalyticsDashboard-CMs176Dp.js → AnalyticsDashboard-BKW5jxN7.js} +1 -1
- package/dist/assets/{AudienceMemoryPanel-BRXM47H1.js → AudienceMemoryPanel-DvdyvikT.js} +2 -2
- package/dist/assets/ChangesView-BFv5V-2K.js +1 -0
- package/dist/assets/{ChronicleDashboard-DPI_5S2R.js → ChronicleDashboard-BgFFTJ9c.js} +1 -1
- package/dist/assets/CodeEditor-BcB3ieu2.js +1 -0
- package/dist/assets/CodeMap-CnlnHM8P.js +1 -0
- package/dist/assets/{ConfirmModal-DXy17_uy.js → ConfirmModal-BD6pUkAB.js} +1 -1
- package/dist/assets/{CronJobsPanel-C_bGieGQ.js → CronJobsPanel-DzRNjwf_.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-hkBvamWn.js → DeadCodeScanPanel-Dp6vW6pV.js} +2 -2
- package/dist/assets/{DebugDashboard-CDWJ9nLR.js → DebugDashboard-BvX4wPHr.js} +1 -1
- package/dist/assets/DesignGalleryView-BtH9po91.js +1 -0
- package/dist/assets/GoalView-Dt18_qkp.js +1 -0
- package/dist/assets/KanbanView-CmXysTwU.js +3 -0
- package/dist/assets/MailboxDetailView-B7Rpq-q5.js +1 -0
- package/dist/assets/{MemoryDrawer-D2Yq9oba.js → MemoryDrawer-CQifV69f.js} +1 -1
- package/dist/assets/MemoryManager-52A6Porm.js +1 -0
- package/dist/assets/{ModelPicker-BazB-GbH.js → ModelPicker-BzO5YWvC.js} +1 -1
- package/dist/assets/OfficeMapPanel-B_r043GV.js +4 -0
- package/dist/assets/{ProcessMonitor-BTjaxnO-.js → ProcessMonitor-BXLvlOm5.js} +1 -1
- package/dist/assets/{QueuePanel-BOD9qtHp.js → QueuePanel-BnslTb01.js} +1 -1
- package/dist/assets/{RefreshDebugView-DfbZ-vgF.js → RefreshDebugView-DTO6YlTY.js} +1 -1
- package/dist/assets/RequirementIntakeView-CjEUqwkC.js +1 -0
- package/dist/assets/SageTabs-CZAYUZRL.js +2 -0
- package/dist/assets/{SddFlowGraph-DWphr6Tr.js → SddFlowGraph-B-5J7zOV.js} +1 -1
- package/dist/assets/SddHub-B8uS39mj.js +2 -0
- package/dist/assets/{SessionInspectView-DqrSHseG.js → SessionInspectView-C9f4pdyH.js} +1 -1
- package/dist/assets/SessionList-CiUBVr04.js +1 -0
- package/dist/assets/{SessionsDashboard-CUj2WSYM.js → SessionsDashboard-D-jy0eZl.js} +1 -1
- package/dist/assets/SetupScreen-CfFpbarK.js +1 -0
- package/dist/assets/SkillDetailView-W220T6zf.js +3 -0
- package/dist/assets/{SpecsView-Cl4vpAoL.js → SpecsView-DOTFvg9y.js} +1 -1
- package/dist/assets/{TechStackView-DsFV85XT.js → TechStackView-Bar55FH0.js} +1 -1
- package/dist/assets/{TerminalPanel-GraS3zw1.js → TerminalPanel-BAg6jaIM.js} +1 -1
- package/dist/assets/{Toaster-D76T-Ld4.js → Toaster-Dic3369l.js} +1 -1
- package/dist/assets/{activity-CZIixoel.js → activity-BI4XyF_x.js} +3 -3
- package/dist/assets/{activity-BwEBEQ51.js → activity-Dg9Q9kwt.js} +3 -3
- package/dist/assets/{activity-BnTQWNPX.js → activity-Dr_u3dOm.js} +3 -3
- package/dist/assets/{activity-CRMLR4a3.js → activity-Dzgvt4Nh.js} +3 -3
- package/dist/assets/{activity-Xqrt9v4z.js → activity-IttuV5ar.js} +3 -3
- package/dist/assets/{activity-BLSyJfTr.js → activity-L2_b8Uan.js} +3 -3
- package/dist/assets/{activity-C-9I3_s4.js → activity-gB90peLu.js} +3 -3
- package/dist/assets/{button-ELs5xgtQ.js → button-DvHe5h9X.js} +1 -1
- package/dist/assets/{chat-store-CBJ1gc8n.js → chat-store-RzAVkc8a.js} +2 -2
- package/dist/assets/{codemap-activity-store-D67-genN.js → codemap-activity-store-DBdfN0ix.js} +1 -1
- package/dist/assets/codemap-index-store-45CkVCxN.js +1 -0
- package/dist/assets/{dialog-CfAoIH8P.js → dialog-jbs7gu-q.js} +1 -1
- package/dist/assets/{empty-state-BDwjdvMh.js → empty-state-D-ojp6Gp.js} +1 -1
- package/dist/assets/i18n-nlW2iAya.js +2 -0
- package/dist/assets/{index-DHsJniTZ.css → index-mNf-KFcC.css} +1 -1
- package/dist/assets/index-o8LMiiBK.js +132 -0
- package/dist/assets/{input-DSTQkMEh.js → input-oJ0Gehqp.js} +1 -1
- package/dist/assets/{mailbox-store-CKpkM0H1.js → mailbox-store-BuLRsYu3.js} +1 -1
- package/dist/assets/{roster-ws-a3-SO1Yb.js → roster-ws-DobwmzEj.js} +1 -1
- package/dist/assets/{session-store-Ce4Dck2K.js → session-store-DkPaOIhe.js} +1 -1
- package/dist/assets/{settings-Orwkg3lH.js → settings-4A6zNjep.js} +1 -1
- package/dist/assets/{settings-BlMNd_AC.js → settings-Bq1PPj3V.js} +1 -1
- package/dist/assets/{settings-DyIEVRJT.js → settings-BxL8m0v6.js} +1 -1
- package/dist/assets/{settings-ClpzPWKE.js → settings-CZR4viP9.js} +1 -1
- package/dist/assets/{settings-CyYYbmdR.js → settings-L8hBHrGD.js} +1 -1
- package/dist/assets/{settings-BUtmAZBV.js → settings-t7_uBgp_.js} +1 -1
- package/dist/assets/{settings-XRC0dC9D.js → settings-uLdezc9e.js} +1 -1
- package/dist/assets/{shared-D368RBth.js → shared-CiaNczO0.js} +1 -1
- package/dist/assets/{stores-BATHCuMN.js → stores-liE4mt_C.js} +2 -2
- package/dist/assets/{ui-store-BGNdg1e4.js → ui-store-FVcXVdRC.js} +1 -1
- package/dist/assets/useWebSocket-DZ-NnXn0.js +29 -0
- package/dist/assets/utils-D1fGupR8.js +1 -0
- package/dist/assets/{vendor-GiKfK4Iw.js → vendor-AeHpGMaG.js} +30 -30
- package/dist/assets/{view-navigation-FdnvQSOv.js → view-navigation-D-afwlSZ.js} +1 -1
- package/dist/assets/ws-client-B7j8isQb.js +1 -0
- package/dist/components/KanbanContractGraphPanel.d.ts +6 -1
- package/dist/components/KanbanTaskInspectorChrome.d.ts +62 -0
- package/dist/components/MemoryManager/MemoryDetail.d.ts +1 -1
- package/dist/components/MemoryManager/ReviewQueue.d.ts +25 -0
- package/dist/components/SettingsPanel/ToolsSection.d.ts +1 -0
- package/dist/components/agent-roster-data.d.ts +12 -0
- package/dist/hooks/useWebSocket.d.ts +3 -0
- package/dist/index.html +23 -23
- package/dist/index.js +5488 -4370
- package/dist/lib/kanban-cleaner.d.ts +20 -1
- package/dist/lib/ws-client-actions.d.ts +3 -0
- package/dist/lib/ws-client-utils.d.ts +12 -1
- package/dist/lib/ws-client.d.ts +27 -0
- package/dist/stores/kanban-store.d.ts +4 -1
- package/dist/stores/local-prefs.d.ts +1 -1
- package/dist/stores/session-store.d.ts +2 -0
- package/dist/stores/ui-store.d.ts +3 -3
- package/dist/types/client-message.d.ts +5 -0
- package/dist/types/sage.d.ts +13 -0
- package/dist/types/server-message.d.ts +2 -2
- package/dist/types/system.d.ts +2 -0
- package/package.json +9 -9
- package/dist/assets/AgentRosterView-BnnhSRau.js +0 -9
- package/dist/assets/ChangesView-DxAQY4v4.js +0 -1
- package/dist/assets/CodeEditor-9Fu9hRrw.js +0 -1
- package/dist/assets/CodeMap-B7YGx2G0.js +0 -1
- package/dist/assets/DesignGalleryView-BG-p6kFX.js +0 -1
- package/dist/assets/GoalView-CCklBpTx.js +0 -1
- package/dist/assets/KanbanView-Dzvn9y79.js +0 -3
- package/dist/assets/MailboxDetailView-7dtt5joR.js +0 -1
- package/dist/assets/MemoryManager-CL5AiyKr.js +0 -1
- package/dist/assets/OfficeMapPanel-Dtb75DlY.js +0 -4
- package/dist/assets/RequirementIntakeView-CeZFJlrn.js +0 -1
- package/dist/assets/SageTabs-BlK58zgb.js +0 -2
- package/dist/assets/SddHub-ZRkMmA7e.js +0 -2
- package/dist/assets/SessionList-DLoIKc1b.js +0 -1
- package/dist/assets/SetupScreen-B_2CuLeR.js +0 -1
- package/dist/assets/SkillDetailView-ChspOaAw.js +0 -3
- package/dist/assets/codemap-index-store-ByAYIzQA.js +0 -1
- package/dist/assets/i18n-BvFgJYE2.js +0 -2
- package/dist/assets/index-BTRQG7C5.js +0 -132
- package/dist/assets/useWebSocket-B2opfRwA.js +0 -29
- package/dist/assets/utils-CUCQrODG.js +0 -1
- package/dist/assets/ws-client-CGEB75Dy.js +0 -1
|
@@ -1,6 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `kanban-cleaner.ts` — the WebUI half of the Kanban Cleaner audit.
|
|
3
|
+
*
|
|
4
|
+
* Must produce the same verdicts as `packages/tui/src/kanban-audit.ts` for the
|
|
5
|
+
* same board. That is enforced by
|
|
6
|
+
* `packages/cli/tests/kanban-cleaner-parity.test.ts`, which runs a shared
|
|
7
|
+
* corpus through both and compares the `taskId:code:severity` triples. Only
|
|
8
|
+
* three differences are deliberate, all of them API shape rather than verdict:
|
|
9
|
+
* the TUI copy also accepts `liveAgentIdentities`, returns eight extra summary
|
|
10
|
+
* fields this side fills from live queue health instead, and exports
|
|
11
|
+
* `summarizeAuditHeadline` / `topAuditIssues`. Messages may differ; codes and
|
|
12
|
+
* severities may not.
|
|
13
|
+
*/
|
|
1
14
|
import type { KanbanBoard } from '@wrongstack/kanban';
|
|
2
15
|
export type KanbanAuditSeverity = 'error' | 'warning';
|
|
3
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The audit vocabulary, as a runtime value so the parity test can compare the
|
|
18
|
+
* two implementations' code sets instead of trusting that both type unions
|
|
19
|
+
* were edited together.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ALL_AUDIT_CODES: readonly ['abandoned-running-task', 'board-oversized', 'missing-assignee', 'missing-description', 'missing-due-date', 'missing-labels', 'missing-subtasks', 'missing-success-criteria', 'skipped-lifecycle-state', 'stale-review', 'stale-running-task'];
|
|
22
|
+
export type KanbanAuditIssueCode = (typeof ALL_AUDIT_CODES)[number];
|
|
4
23
|
export interface KanbanAuditIssue {
|
|
5
24
|
id: string;
|
|
6
25
|
taskId: string;
|
|
@@ -17,6 +17,9 @@ export interface WsClientActionMethods {
|
|
|
17
17
|
limit?: number;
|
|
18
18
|
cursor?: string;
|
|
19
19
|
}, options?: WSSendOptions): void;
|
|
20
|
+
listMemoryCandidates(params?: {
|
|
21
|
+
includeResolved?: boolean;
|
|
22
|
+
}, options?: WSSendOptions): void;
|
|
20
23
|
getSage(id: string, options?: WSSendOptions): void;
|
|
21
24
|
getSageGraph(query: string, params?: {
|
|
22
25
|
maxDepth?: number;
|
|
@@ -46,7 +46,18 @@ export declare function pipeViz(msg: WSServerMessage): void;
|
|
|
46
46
|
* `optional` keys are checked only when present.
|
|
47
47
|
*/
|
|
48
48
|
export declare function safePayload<T extends Record<string, unknown>>(msg: WSServerMessage, required: Record<string, 'string' | 'number' | 'boolean' | 'object' | 'array'>, optional?: Record<string, 'string' | 'number' | 'boolean' | 'object' | 'array'>): T | null;
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Per-prompt bookkeeping record. The `expiresAtMs` field lets `ws-client`
|
|
51
|
+
* sweep stale entries from `pendingConfirms` on every insert and on
|
|
52
|
+
* disconnect — a closed-and-unresolved prompt (panel unmounted, view
|
|
53
|
+
* switched, tab backgrounded) would otherwise leak the entry for the
|
|
54
|
+
* lifetime of the WebUI tab. The map is keyed by a server-issued id; the
|
|
55
|
+
* stored value exists only to carry the TTL.
|
|
56
|
+
* RAM-leak audit 2026-08-11, MEDIUM.
|
|
57
|
+
*/
|
|
58
|
+
export type PendingConfirm = {
|
|
59
|
+
expiresAtMs: number;
|
|
60
|
+
};
|
|
50
61
|
export type WsStatus = {
|
|
51
62
|
state: 'connecting';
|
|
52
63
|
} | {
|
package/dist/lib/ws-client.d.ts
CHANGED
|
@@ -38,6 +38,19 @@ declare class WrongStackWebSocketClientBase {
|
|
|
38
38
|
/** Count-only limits are ineffective for image/base64 payloads. */
|
|
39
39
|
private static readonly MAX_QUEUED_CHARS;
|
|
40
40
|
private pendingConfirms;
|
|
41
|
+
/**
|
|
42
|
+
* Wall-clock TTL for a `pendingConfirms` entry. The map is keyed by a
|
|
43
|
+
* server-issued id and is only deleted by `sendConfirm`; a permission
|
|
44
|
+
* prompt that the user dismisses without sending a decision (panel
|
|
45
|
+
* unmounted, view switched, tab backgrounded) would otherwise leak the
|
|
46
|
+
* key for the lifetime of the WebUI tab. The entry's stored value is
|
|
47
|
+
* an empty object, so the leak is symbolic — but the unbounded key
|
|
48
|
+
* space is the actual risk, swept here on every insert + on disconnect.
|
|
49
|
+
* 60s is generous for a human-perceived permission prompt and matches
|
|
50
|
+
* the typical reconnect window.
|
|
51
|
+
* RAM-leak audit 2026-08-11, MEDIUM.
|
|
52
|
+
*/
|
|
53
|
+
private static readonly PENDING_CONFIRM_TTL_MS;
|
|
41
54
|
private sessionId;
|
|
42
55
|
private sessionSwapPending;
|
|
43
56
|
/** Stored last close reason / error message so the UI can show "what
|
|
@@ -94,6 +107,20 @@ declare class WrongStackWebSocketClientBase {
|
|
|
94
107
|
*/
|
|
95
108
|
private flushMessageQueue;
|
|
96
109
|
private handleMessage;
|
|
110
|
+
/**
|
|
111
|
+
* Drop `pendingConfirms` entries whose TTL has passed. Entries are
|
|
112
|
+
* created when a `tool.confirm_needed` message arrives and only
|
|
113
|
+
* removed when the user calls `sendConfirm`; if the user dismisses the
|
|
114
|
+
* prompt UI without responding, the entry would otherwise sit until
|
|
115
|
+
* the WebUI page is closed. A 60s TTL is generous for a permission
|
|
116
|
+
* prompt — anything unresolved by then is treated as abandoned.
|
|
117
|
+
*
|
|
118
|
+
* Runs inline on each new `tool.confirm_needed` insert (cheap: the
|
|
119
|
+
* map is bounded by the number of prompts the user can have open
|
|
120
|
+
* concurrently) and is also called from `disconnect()` during
|
|
121
|
+
* teardown.
|
|
122
|
+
*/
|
|
123
|
+
private sweepExpiredPendingConfirms;
|
|
97
124
|
private emit;
|
|
98
125
|
send(message: WSClientMessage, options?: WSSendOptions): boolean;
|
|
99
126
|
/** Consume one UI-originated response that must not be mirrored into chat. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KanbanBoard, KanbanBoardSummary, KanbanQueueHealth, KanbanSupervisorSnapshot, KanbanWorkbenchSnapshot } from '@wrongstack/kanban';
|
|
1
|
+
import type { KanbanBoard, KanbanBoardHistoryEntry, KanbanBoardSummary, KanbanQueueHealth, KanbanSupervisorSnapshot, KanbanWorkbenchSnapshot } from '@wrongstack/kanban';
|
|
2
2
|
export interface KanbanResultPayload {
|
|
3
3
|
success: boolean;
|
|
4
4
|
data?: unknown;
|
|
@@ -21,6 +21,9 @@ interface KanbanState {
|
|
|
21
21
|
verificationActivity: Record<string, {
|
|
22
22
|
startedAt: number;
|
|
23
23
|
}>;
|
|
24
|
+
/** Board-level history for the active board (created/updated/deleted/…). */
|
|
25
|
+
boardHistory: KanbanBoardHistoryEntry[];
|
|
26
|
+
fetchBoardHistory: (boardId: string) => void;
|
|
24
27
|
setLoading: (loading: boolean) => void;
|
|
25
28
|
setActiveBoardId: (id: string | null) => void;
|
|
26
29
|
setError: (error: string | null) => void;
|
|
@@ -74,7 +74,7 @@ export interface LocalPrefs {
|
|
|
74
74
|
/** Context window mode — matches core's config.context.mode. */
|
|
75
75
|
contextMode: 'balanced' | 'frugal' | 'deep';
|
|
76
76
|
/** Token-saving mode — matches core's config.features.tokenSavingMode. */
|
|
77
|
-
tokenSavingTier: 'off' | 'minimal' | 'light' | 'medium' | 'aggressive';
|
|
77
|
+
tokenSavingTier: 'auto' | 'off' | 'minimal' | 'light' | 'medium' | 'aggressive';
|
|
78
78
|
/** Max concurrent subagents */
|
|
79
79
|
maxConcurrent: number;
|
|
80
80
|
/** Terminal title animation */
|
|
@@ -65,6 +65,8 @@ interface SessionState {
|
|
|
65
65
|
content: string;
|
|
66
66
|
status: 'pending' | 'in_progress' | 'completed';
|
|
67
67
|
activeForm?: string | undefined;
|
|
68
|
+
/** Board-derived titles of the unfinished work this row waits on. */
|
|
69
|
+
blockedBy?: string[] | undefined;
|
|
68
70
|
kanbanBoardId?: string | undefined;
|
|
69
71
|
kanbanTaskId?: string | undefined;
|
|
70
72
|
}>;
|
|
@@ -102,7 +102,9 @@ interface UIState {
|
|
|
102
102
|
settingsActiveTab: string;
|
|
103
103
|
/** Generic per-view scroll positions — keyed by view name, restored on remount. */
|
|
104
104
|
scrollPositions: Record<string, number>;
|
|
105
|
-
/**
|
|
105
|
+
/** In-memory chat input draft — survives view navigation (e.g. Settings → Chat) but
|
|
106
|
+
* is intentionally NOT persisted to localStorage, so it does not reappear on a
|
|
107
|
+
* fresh page load or when starting a new session. */
|
|
106
108
|
draftInput: string;
|
|
107
109
|
setDraftInput: (text: string) => void;
|
|
108
110
|
setProcessMonitorOpen: (open: boolean) => void;
|
|
@@ -299,7 +301,6 @@ export declare const useUIStore: import("zustand").UseBoundStore<Omit<import("zu
|
|
|
299
301
|
dockSection: DockSection | null;
|
|
300
302
|
settingsActiveTab: string;
|
|
301
303
|
scrollPositions: Record<string, number>;
|
|
302
|
-
draftInput: string;
|
|
303
304
|
}, unknown>>) => void;
|
|
304
305
|
clearStorage: () => void;
|
|
305
306
|
rehydrate: () => Promise<void> | void;
|
|
@@ -359,7 +360,6 @@ export declare const useUIStore: import("zustand").UseBoundStore<Omit<import("zu
|
|
|
359
360
|
dockSection: DockSection | null;
|
|
360
361
|
settingsActiveTab: string;
|
|
361
362
|
scrollPositions: Record<string, number>;
|
|
362
|
-
draftInput: string;
|
|
363
363
|
}, unknown>>;
|
|
364
364
|
};
|
|
365
365
|
}>;
|
|
@@ -576,6 +576,11 @@ export type WSClientMessageCore = WSUserMessage | {
|
|
|
576
576
|
limit?: number | undefined;
|
|
577
577
|
cursor?: string | undefined;
|
|
578
578
|
};
|
|
579
|
+
} | {
|
|
580
|
+
type: 'memory.sage.listCandidates';
|
|
581
|
+
payload?: {
|
|
582
|
+
includeResolved?: boolean | undefined;
|
|
583
|
+
} | undefined;
|
|
579
584
|
} | {
|
|
580
585
|
type: 'memory.sage.get';
|
|
581
586
|
payload: {
|
package/dist/types/sage.d.ts
CHANGED
|
@@ -71,6 +71,13 @@ export interface WSMemorySageListPage {
|
|
|
71
71
|
error?: string | undefined;
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
+
export interface WSMemorySageListCandidates {
|
|
75
|
+
type: 'memory.sage.listCandidates';
|
|
76
|
+
payload: {
|
|
77
|
+
candidates?: MemoryCandidateEntry[] | undefined;
|
|
78
|
+
error?: string | undefined;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
74
81
|
export interface WSMemorySageGet {
|
|
75
82
|
type: 'memory.sage.get';
|
|
76
83
|
payload: {
|
|
@@ -211,6 +218,12 @@ export interface MemoryCandidateEntry {
|
|
|
211
218
|
}>;
|
|
212
219
|
createdAt: string;
|
|
213
220
|
updatedAt: string;
|
|
221
|
+
/** Memory this proposal targets (hygiene / triage). */
|
|
222
|
+
targetMemoryId?: string | undefined;
|
|
223
|
+
reviewReason?: string | undefined;
|
|
224
|
+
suggestedAction?: 'delete' | 'archive' | 'update' | 'investigate' | undefined;
|
|
225
|
+
memoryId?: string | undefined;
|
|
226
|
+
reason?: string | undefined;
|
|
214
227
|
}
|
|
215
228
|
export interface WSMemorySageBackfillRecoverable {
|
|
216
229
|
type: 'memory.sage.backfillRecoverable';
|
|
@@ -5,10 +5,10 @@ import type { ConnectionsHealthReport, ServiceActionResult } from './connections
|
|
|
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
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, WSTopicAdviceResult, WSTrustPersisted } from './runtime.js';
|
|
8
|
-
import type { WSMemorySageBackfillRecoverable, WSMemorySageCandidateResolve, WSMemorySageDelete, WSMemorySageForFile, WSMemorySageGet, WSMemorySageGraph, WSMemorySageList, WSMemorySageListPage, WSMemorySageRecover, WSMemorySageRemember, WSMemorySageUpdate } from './sage.js';
|
|
8
|
+
import type { WSMemorySageBackfillRecoverable, WSMemorySageCandidateResolve, WSMemorySageDelete, WSMemorySageForFile, WSMemorySageGet, WSMemorySageGraph, WSMemorySageList, WSMemorySageListCandidates, 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, WSSessionInspect, WSSessionsList, 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 | WSProviderFallbackPending | WSProviderStatusChanged | WSProviderStatusSnapshot | WSProviderActiveBlocked | WSProviderStreamError | WSRunResult | WSSessionStats | WSError | WSToolConfirmNeeded | WSTrustPersisted | WSToolLoopDetected | WSDelegateStarted | WSDelegateCompleted | WSContextDebug | WSContextCompacted | WSCompactionFailed | WSContextRepaired | WSContextEditorSnapshot | WSContextEditorValidation | WSContextEditorApplied | WSContextPct | WSTopicAdviceResult | 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 | WSTopicAdviceResult | WSContextMaxContext | WSTokenThreshold | WSTokenCostEstimateUnavailable | WSContextModesList | WSContextModeChanged | WSToolsList | WSMemoryList | WSMemorySageList | WSMemorySageListPage | WSMemorySageListCandidates | 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
|
} | {
|
package/dist/types/system.d.ts
CHANGED
|
@@ -328,6 +328,8 @@ export interface WSTodosUpdated {
|
|
|
328
328
|
content: string;
|
|
329
329
|
status: 'pending' | 'in_progress' | 'completed';
|
|
330
330
|
activeForm?: string | undefined;
|
|
331
|
+
/** Board-derived titles of the unfinished work this row waits on. */
|
|
332
|
+
blockedBy?: string[] | undefined;
|
|
331
333
|
kanbanBoardId?: string | undefined;
|
|
332
334
|
kanbanTaskId?: string | undefined;
|
|
333
335
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/webui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.305.1",
|
|
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/kanban": "0.305.1",
|
|
80
|
+
"@wrongstack/core": "0.305.1",
|
|
81
|
+
"@wrongstack/webui-server": "0.305.1",
|
|
82
|
+
"@wrongstack/tools": "0.305.1",
|
|
83
|
+
"@wrongstack/plugins": "0.305.1",
|
|
84
|
+
"@wrongstack/providers": "0.305.1"
|
|
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.305.1"
|
|
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": "node ../../scripts/run-vitest-coverage.mjs run --coverage"
|
|
114
|
+
"test:coverage": "node ../../scripts/coverage-lock.mjs node ../../scripts/run-vitest-coverage.mjs run --coverage"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./chat-store-CBJ1gc8n.js";import{$i as n,Ba as r,Fa as i,Gi as a,Li as o,Ot as s,Wt as c,Zr as l,Zt as u,an as d,ar as f,bi as p,da as m,dt as h,fa as g,ft as _,gr as v,ji as y,jt as b,ka as x,lt as S,mr as C,tn as w,ua as T,ut as E,vn as D,yi as O}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{t as k}from"./ws-client-CGEB75Dy.js";import{t as A}from"./utils-CUCQrODG.js";import{T as j}from"./stores-BATHCuMN.js";import{n as M}from"./ui-store-BGNdg1e4.js";import{i as N}from"./view-navigation-FdnvQSOv.js";import{n as P}from"./Toaster-D76T-Ld4.js";import{n as F,t as I}from"./ModelPicker-BazB-GbH.js";import{s as L}from"./index-BTRQG7C5.js";import{t as R}from"./roster-ws-a3-SO1Yb.js";var z=e(r(),1),B=S(),V=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],H=[[`timeoutMs`,`Total timeout (ms)`],[`idleTimeoutMs`,`Idle timeout (ms)`],[`maxIterations`,`Max iterations`],[`maxToolCalls`,`Max tool calls`],[`maxTokens`,`Max tokens`],[`maxCostUsd`,`Max cost (USD)`]];function U(e){return`${e.provider}/${e.model}`}function W(e){let t=e.indexOf(`/`);return t<0?{provider:``,model:e}:{provider:e.slice(0,t),model:e.slice(t+1)}}function G(e){return Array.isArray(e)?e.join(`, `):``}function K(e){return[...new Set(e.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean))]}function q({initialConfig:e,systemProtected:t,saving:n,onSave:r,onCancel:a}){let{t:o}=i(),[s,c]=(0,z.useState)(()=>structuredClone(e)),l=F(!0),d=s.modelPolicy,f=(0,z.useMemo)(()=>(d?.allowed??[]).map(U),[d?.allowed]),p=(0,z.useMemo)(()=>(d?.fallbacks??[]).map(U),[d?.fallbacks]),m=e=>c(t=>({...t,...e})),h=(e,t)=>{let n=K(t);c(t=>{let r={...t};return n.length?r[e]=n:delete r[e],r})},g=(e,t)=>{c(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})},_=e=>{let t=e.map(W),n=new Set(e);c(e=>({...e,modelPolicy:{allowed:t,fallbacks:(e.modelPolicy?.fallbacks??[]).filter(e=>n.has(U(e))),strict:e.modelPolicy?.strict??!0}}))};return(0,B.jsxs)(`div`,{className:`space-y-4 rounded-lg border border-border bg-card/40 p-4`,children:[t&&(0,B.jsxs)(`div`,{className:`flex gap-2 rounded-md border border-warning/30 bg-warning/5 p-2 text-[11px] text-muted-foreground`,children:[(0,B.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-warning`}),(0,B.jsx)(`span`,{children:o(`activity:runtimePolicy.protectedSystemAgentRequiredToolsAnd`)})]}),(0,B.jsxs)(`section`,{className:`space-y-2`,children:[(0,B.jsx)(`h4`,{className:`text-xs font-semibold`,children:o(`activity:runtimePolicy.providerAndModelPolicy`)}),(0,B.jsx)(I,{candidates:l,provider:s.provider,value:s.model,placeholder:o(`activity:runtimePolicy.useProjectDefaultModel`),resetLabel:`Use project default`,onReset:()=>{c(e=>{let t={...e};return delete t.provider,delete t.model,t})},onPick:(e,t)=>{let n=`${t}/${e}`;m({provider:t,model:e}),d&&!f.includes(n)&&_([...f,n])}}),(0,B.jsxs)(`label`,{className:`flex items-center gap-2 text-[11px]`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:!!d,onChange:e=>{if(e.target.checked){let e=s.provider&&s.model?[{provider:s.provider,model:s.model}]:l[0]?[{provider:l[0].provider,model:l[0].model}]:[];e.length&&m({modelPolicy:{allowed:e,strict:!0}})}else c(e=>{let t={...e};return delete t.modelPolicy,t})}}),o(`activity:runtimePolicy.restrictThisAgentToAnExplicit`)]}),d&&(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`span`,{className:`text-[10px] font-medium`,children:o(`activity:runtimePolicy.allowedModels`)}),(0,B.jsx)(L,{value:f,candidates:l,onChange:_,placeholder:o(`activity:runtimePolicy.addAllowedModel`),emptyHint:`At least one model is required`})]}),(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsx)(`span`,{className:`text-[10px] font-medium`,children:o(`activity:runtimePolicy.orderedFallbackChain`)}),(0,B.jsx)(L,{value:p,candidates:l,onChange:e=>{let t=[...new Set([...f,...e])];c(n=>({...n,modelPolicy:{allowed:t.map(W),fallbacks:e.map(W),strict:n.modelPolicy?.strict??!0}}))},placeholder:o(`activity:runtimePolicy.addFallbackModel`),emptyHint:`No fallback; primary failure stops the task`})]})]})]}),(0,B.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,B.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:t}),(0,B.jsx)(`textarea`,{value:G(s[e]),onChange:t=>h(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,B.jsxs)(`section`,{className:`space-y-2`,children:[(0,B.jsx)(`h4`,{className:`text-xs font-semibold`,children:o(`activity:runtimePolicy.workspaceAndIsolation`)}),(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,B.jsx)(`span`,{children:o(`activity:runtimePolicy.projectRelativeWorkingDirectory`)}),(0,B.jsx)(`input`,{value:s.cwd??``,onChange:e=>m({cwd:e.target.value||void 0}),placeholder:o(`activity:runtimePolicy.packagesWebui`),className:`h-8 w-full rounded border border-border bg-background px-2 font-mono`})]}),(0,B.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,B.jsx)(`span`,{children:o(`activity:runtimePolicy.gitWorktreeIsolation`)}),(0,B.jsxs)(`select`,{value:String(s.worktree??`auto`),onChange:e=>m({worktree:e.target.value}),className:`h-8 w-full rounded border border-border bg-background px-2`,children:[(0,B.jsx)(`option`,{value:`auto`,children:o(`activity:runtimePolicy.automatic`)}),(0,B.jsx)(`option`,{value:`required`,children:o(`activity:runtimePolicy.required`)}),(0,B.jsx)(`option`,{value:`off`,children:o(`activity:runtimePolicy.off`)})]})]})]})]}),(0,B.jsxs)(`section`,{className:`space-y-2`,children:[(0,B.jsx)(`h4`,{className:`text-xs font-semibold`,children:o(`activity:runtimePolicy.limits`)}),(0,B.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:H.map(([e,t])=>(0,B.jsxs)(`label`,{className:`space-y-1 text-[10px]`,children:[(0,B.jsx)(`span`,{children:t}),(0,B.jsx)(`input`,{type:`number`,min:`0`,step:e===`maxCostUsd`?`0.01`:`1`,value:s.budget?.[e]??``,onChange:t=>g(e,t.target.value),className:`h-8 w-full rounded border border-border bg-background px-2`})]},e))})]}),(0,B.jsxs)(`section`,{className:`space-y-2`,children:[(0,B.jsxs)(`label`,{className:`flex items-center gap-2 text-xs font-semibold`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:!!s.availability,onChange:e=>{e.target.checked?m({availability:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,days:[1,2,3,4,5],start:`09:00`,end:`18:00`,mode:t?`advisory`:`enforce`}}):c(e=>{let t={...e};return delete t.availability,t})}}),o(`activity:runtimePolicy.workingHours`)]}),s.availability&&(0,B.jsxs)(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[(0,B.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:V.map((e,t)=>(0,B.jsxs)(`label`,{className:`flex items-center gap-1 text-[10px]`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:s.availability?.days.includes(t)??!1,onChange:e=>{let n=s.availability;if(!n)return;let r=e.target.checked?[...new Set([...n.days,t])].sort():n.days.filter(e=>e!==t);m({availability:{...n,days:r}})}}),e]},e))}),(0,B.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:[(0,B.jsx)(`input`,{value:s.availability.timezone,onChange:e=>m({availability:{...s.availability,timezone:e.target.value}}),placeholder:o(`activity:runtimePolicy.europeKiev`),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,B.jsx)(`input`,{type:`time`,value:s.availability.start,onChange:e=>m({availability:{...s.availability,start:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,B.jsx)(`input`,{type:`time`,value:s.availability.end,onChange:e=>m({availability:{...s.availability,end:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`}),(0,B.jsxs)(`select`,{value:t?`advisory`:s.availability.mode??`enforce`,disabled:t,onChange:e=>m({availability:{...s.availability,mode:e.target.value}}),className:`h-8 rounded border border-border bg-background px-2 text-[10px]`,children:[(0,B.jsx)(`option`,{value:`enforce`,children:o(`activity:runtimePolicy.enforce`)}),(0,B.jsx)(`option`,{value:`advisory`,children:o(`activity:runtimePolicy.advisory`)})]})]})]})]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(`button`,{type:`button`,disabled:n||!!(d&&d.allowed.length===0),onClick:()=>r(s),className:`rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground disabled:opacity-50`,children:n?`Saving…`:`Save runtime policy`}),(0,B.jsx)(`button`,{type:`button`,onClick:a,className:`rounded border border-border px-3 py-1.5 text-xs hover:bg-accent`,children:o(`activity:runtimePolicy.cancel`)})]})]})}var ee=[{id:`live`,icon:(0,B.jsx)(x,{className:`h-4 w-4`}),labelKey:`activity:agentRoster.tabLive`},{id:`catalog`,icon:(0,B.jsx)(m,{className:`h-4 w-4`}),labelKey:`activity:agentRoster.tabCatalog`},{id:`learning`,icon:(0,B.jsx)(g,{className:`h-4 w-4`}),labelKey:`activity:agentRoster.tabLearning`},{id:`customize`,icon:(0,B.jsx)(w,{className:`h-4 w-4`}),labelKey:`activity:agentRoster.tabCustomize`}],te=[{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 ne({customStats:e,rosterLoading:t,onRefresh:n}){let{t:r}=i();return(0,B.jsx)(`div`,{className:`shrink-0 border-b border-border/70 bg-card/80 px-4 py-2.5`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-nowrap min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-center w-8 h-8 shrink-0 rounded-lg bg-primary/10`,children:(0,B.jsx)(C,{className:`h-4 w-4 text-primary`})}),(0,B.jsxs)(`div`,{className:`min-w-0 overflow-hidden`,children:[(0,B.jsx)(`h1`,{className:`text-sm font-semibold truncate`,children:r(`activity:agentRoster.heading`)}),(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground truncate`,children:r(`activity:agentRoster.headerSummary`,{customized:e.filter(e=>e.exists||e.hasIdentity||e.hasConfig||e.hasKnowledge).length,entries:e.reduce((e,t)=>e+t.entryCount,0)})})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[t&&(0,B.jsx)(f,{className:`h-4 w-4 animate-spin text-muted-foreground shrink-0`}),(0,B.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:r(`activity:agentRoster.refreshRosterData`),children:[(0,B.jsx)(D,{className:`h-3 w-3`}),` `,r(`common:action.refresh`)]})]})]})})}function re({activeTab:e,onTabChange:t}){let{t:n}=i();return(0,B.jsx)(`div`,{className:`shrink-0 border-b border-border/50 bg-muted/20 px-3 flex gap-0`,children:ee.map(r=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>t(r.id),className:A(`flex items-center gap-1.5 px-3 py-2 text-[10px] font-medium border-b-2 transition-colors`,e===r.id?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground/30`),children:[r.icon,n(r.labelKey)]},r.id))})}var ie={size:`buffer reached the size threshold`,"pending-skills":`directives are waiting to reach their skill`,disabled:`auto-optimization is off`,"learning-paused":`learning is paused for this agent`,"too-few-entries":`not enough directives yet`,"below-threshold":`below the threshold`,"cooling-down":`recently optimized — cooling down`};function J({customStats:e,onRefresh:n}){let{t:r}=i(),[o,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(null),[p,h]=(0,z.useState)({}),[_,v]=(0,z.useState)(``),[y,b]=(0,z.useState)(null),[x,S]=(0,z.useState)(!1),[C,w]=(0,z.useState)(!1),[T,D]=(0,z.useState)(null),[j,N]=(0,z.useState)(!1),[F,I]=(0,z.useState)(!1),[L,V]=(0,z.useState)(null),[H,U]=(0,z.useState)(null),[W,G]=(0,z.useState)(null),K=(0,z.useMemo)(()=>[...e].sort((e,t)=>e.role.localeCompare(t.role)),[e]),q=(0,z.useMemo)(()=>o?K.find(e=>e.role===o):null,[o,K]),ee=(0,z.useCallback)(async e=>{w(!0),d(null);try{let t=await R(`agent-roster.read-learned`,{role:e});d(t.entries??[]),h({})}catch{}w(!1)},[]),te=(0,z.useCallback)(async()=>{if(!o||!u)return;S(!0);let e=u.filter((e,t)=>p[t]!==`drop`).join(`
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
`);try{await R(`agent-roster.update-learned`,{role:o,content:e}),d(null),h({})}catch{}S(!1)},[o,u,p]),ne=(0,z.useCallback)(async()=>{if(!(!o||!_.trim())){b(null),S(!0);try{let e=`> Taught ${new Date().toISOString().slice(0,10)}\n\n${_.trim()}`;(await R(`agent-roster.append-learned`,{role:o,content:e})).success?(b({ok:!0,msg:r(`activity:customRoster.behaviorSaved`)}),v(``),n()):b({ok:!1,msg:r(`activity:agentRoster.saveFailed`)})}catch(e){b({ok:!1,msg:e instanceof Error?e.message:r(`activity:agentRoster.failed`)})}S(!1)}},[n,o,_]),re=(0,z.useCallback)(async(e,t)=>{S(!0),b(null);try{let i=await R(`agent-roster.update-learning`,{role:e,enabled:t});if(i.error)throw Error(i.error);b({ok:!0,msg:r(t?`activity:agentRoster.learningResumed`:`activity:agentRoster.autoLearningPaused`)}),n()}catch(e){b({ok:!1,msg:e instanceof Error?e.message:r(`activity:agentRoster.policyUpdateFailed`)})}finally{S(!1)}},[n]),J=(0,z.useCallback)(async e=>{try{let t=await R(`agent-roster.auto-optimize-status`,{role:e}),n=t.roles?.find(t=>t.role===e);U(n?{enabled:t.policy?.enabled!==!1,eligible:n.eligible,reason:n.reason}:null)}catch{U(null)}},[]),Y=(0,z.useCallback)(async e=>{try{let t=await R(`agent-roster.skills`,{role:e});V(t.skills??[])}catch{V([])}},[]),X=(0,z.useCallback)(async(e,t)=>{if(W?.skill===t){G(null);return}try{let n=await R(`agent-roster.read-skill`,{role:e,skill:t});G({skill:t,content:n.content??``})}catch{G({skill:t,content:``})}},[W]),Z=(0,z.useCallback)(async(e,t,n)=>{try{await R(`agent-roster.pin-skill`,{role:e,skill:t,pinned:n}),await Y(e)}catch{}},[Y]),Q=(0,z.useCallback)(async e=>{try{let t=await R(`agent-roster.read-consolidated`,{role:e});D(t.isConsolidated?t.content:null)}catch{D(null)}},[]),$=(0,z.useCallback)(async e=>{N(!0),b(null);try{let i=await R(`agent-roster.consolidate`,{role:e});if(i.error)throw Error(i.error);if(i.rawEntryCount===0){b({ok:!1,msg:r(`activity:agentRoster.noRawEntries`)});return}if(i.consolidated){await n(),await Q(e),await Y(e),await J(e),b({ok:!0,msg:r(`activity:agentRoster.optimizedOk`)}),P.success(i.model?r(`activity:agentRoster.consolidatedWithModel`,{model:i.model}):r(`activity:agentRoster.consolidatedPlain`));return}if(i.emptySynthesis){b({ok:!1,msg:r(`activity:agentRoster.emptySynthesis`)}),P.error(r(`activity:agentRoster.optimizationEmptyToast`));return}let a=i.instruction;if(!a)throw Error(`No consolidation instruction generated`);let o=t.getState();o.addMessage({role:`user`,content:a}),o.setLoading(!0),k().sendMessage(a);let s=M.getState();s.setSidebarOpen(!1),s.setCurrentView(`chat`),b({ok:!0,msg:r(`activity:agentRoster.noActiveModelMsg`)}),P.info(r(`activity:agentRoster.noActiveModelToast`))}catch(e){b({ok:!1,msg:e instanceof Error?e.message:r(`activity:agentRoster.optimizationFailed`)}),P.error(e instanceof Error?e.message:r(`activity:agentRoster.optimizationFailed`))}finally{N(!1)}},[n,Q,Y,J]),ae=(0,z.useCallback)(async e=>{if(e.length!==0){I(!0),b(null);try{let n=[],r=0,i=0,a=``,s=[];for(let t of e)try{let e=await R(`agent-roster.consolidate`,{role:t});e.error?(i++,a=e.error):e.consolidated?n.push(t):e.rawEntryCount===0?r++:e.emptySynthesis?(i++,a=`Model returned an empty result`):e.instruction?s.push({role:t,instruction:e.instruction}):(i++,a=`No consolidation produced`)}catch(e){i++,a=e instanceof Error?e.message:String(e)}if(o&&n.includes(o)&&await Q(o),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=M.getState();r.setSidebarOpen(!1),r.setCurrentView(`chat`)}if(n.length===0&&s.length===0){if(i>0){let t=r>0?` ${r} skipped.`:``,n=`Bulk consolidate failed for ${i} of ${e.length} agent${e.length>1?`s`:``}.${a?` Last error: ${a}`:``}${t}`;b({ok:!1,msg:n});return}let t=r>0?`Bulk optimize: ${r} skipped (no entries to optimize).`:`No agents had optimizable entries.`;b({ok:!0,msg:t}),P.info(t,6e3);return}let c=[];n.length>0&&c.push(`${n.length} consolidated`),s.length>0&&c.push(`${s.length} sent to chat`),r>0&&c.push(`${r} skipped`),i>0&&c.push(`${i} failed`);let l=`Bulk optimize: ${c.join(`, `)}.`;b({ok:i===0,msg:l}),n.length>0&&s.length===0?P.success(l,6e3):P.info(l,6e3)}catch(e){b({ok:!1,msg:e instanceof Error?e.message:r(`activity:agentRoster.bulkOptimizationFailed`)}),P.error(e instanceof Error?e.message:r(`activity:agentRoster.bulkOptimizationFailed`))}finally{I(!1)}}},[o,Q]);return K.length===0?(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-muted-foreground`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,B.jsx)(O,{className:`h-10 w-10 mx-auto opacity-30`}),(0,B.jsx)(`p`,{className:`text-sm`,children:r(`activity:agentRoster.noSelfLearningDataYet`)}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:r(`activity:agentRoster.learningsEmpty`)})]})}):(0,B.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:A(`flex flex-col min-h-0 min-w-0 overflow-hidden border-r border-border/50`,o?`w-80 shrink-0`:`flex-1`),children:[(0,B.jsxs)(`div`,{className:`shrink-0 px-3 py-2 border-b border-border/50`,children:[(0,B.jsxs)(`h3`,{className:`text-xs font-semibold flex items-center gap-1.5`,children:[(0,B.jsx)(O,{className:`h-3.5 w-3.5 text-brand-2`}),r(`activity:agentRoster.allRosterAgents`)]}),(()=>{let e=K.filter(e=>e.needsSummarization);return e.length===0?null:(0,B.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,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(E,{className:`h-3 w-3 text-warning shrink-0`}),(0,B.jsxs)(`span`,{className:`text-[10px] text-warning leading-tight`,children:[e.length,` agent`,e.length>1?`s`:``,` need`,e.length===1?`s`:``,` optimization`]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{let t=e[0];t&&(l(t.role),d(null),D(null),G(null),Y(t.role),J(t.role))},className:`ml-auto text-[9px] text-warning underline hover:text-warning/80 shrink-0`,children:r(`activity:agentRoster.review`)})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>ae(e.map(e=>e.role)),disabled:F,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:[F?(0,B.jsx)(f,{className:`h-3 w-3 animate-spin`}):(0,B.jsx)(E,{className:`h-3 w-3`}),F?r(`activity:agentRoster.optimizing`):r(`activity:agentRoster.optimizeAll`,{count:e.length})]})]})})()]}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:K.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{l(e.role),d(null),D(null),G(null),Y(e.role),J(e.role)},className:A(`w-full text-left rounded-lg border px-3 py-2 transition-colors`,o===e.role?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30`,e.needsSummarization&&o!==e.role&&`border-warning/40`),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`text-xs font-semibold`,children:e.role}),(0,B.jsx)(`span`,{className:A(`text-[9px] tabular-nums`,e.learningEnabled?`text-success`:`text-muted-foreground`),children:e.learningEnabled?r(`activity:agentRoster.learning`):r(`activity:agentRoster.paused`)})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mt-1 text-[9px] text-muted-foreground`,children:[(0,B.jsxs)(`span`,{className:`tabular-nums`,children:[e.entryCount,` entries`]}),e.sessionCaptureCount>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,B.jsxs)(`span`,{className:`text-success tabular-nums`,children:[`+`,e.sessionCaptureCount]})]}),e.lastCapture&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,B.jsx)(`span`,{children:new Date(e.lastCapture).toLocaleDateString()})]}),e.needsSummarization&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-warning font-medium`,children:[(0,B.jsx)(E,{className:`h-2.5 w-2.5`}),`optimize`]})]})]},e.role))})]}),(0,B.jsxs)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:[!o&&(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:r(`activity:agentRoster.selectAnAgentToViewLearning`)}),o&&q&&(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h3`,{className:`text-base font-semibold`,children:o}),(0,B.jsx)(`div`,{className:`flex gap-1`,children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>re(o,!q.learningEnabled),disabled:x,className:A(`inline-flex items-center gap-1 rounded border px-2 py-1 text-[10px] transition-colors disabled:opacity-50`,q.learningEnabled?`border-success/40 text-success hover:bg-success/10`:`border-border/50 text-muted-foreground hover:bg-accent`),children:[(0,B.jsx)(O,{className:`h-3 w-3`}),` `,q.learningEnabled?r(`activity:agentRoster.learningOn`):r(`activity:agentRoster.learningPaused`)]})})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.entries`)}),(0,B.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:q.entryCount})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.size`)}),(0,B.jsxs)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:[q.totalBytes,`B`]})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.lastCapture`)}),(0,B.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:q.lastCapture?new Date(q.lastCapture).toLocaleDateString():`—`})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.lifetimeCaptures`)}),(0,B.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:q.lifetimeCaptureCount})]})]}),q.needsSummarization&&(0,B.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-warning bg-warning/10 rounded-lg px-3 py-2.5`,children:[(0,B.jsx)(s,{className:`h-4 w-4 shrink-0`}),(0,B.jsx)(`span`,{className:`flex-1`,children:r(`activity:agentRoster.learningsLimitExceeded`,{bytes:q.totalBytes.toLocaleString()})}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>$(o),disabled:j,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:[j?(0,B.jsx)(f,{className:`h-3 w-3 animate-spin`}):(0,B.jsx)(E,{className:`h-3 w-3`}),j?r(`activity:agentRoster.optimizing`):`Optimize Now`]})]}),(0,B.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(c,{className:`h-4 w-4 text-primary`}),(0,B.jsx)(`span`,{className:`text-xs font-semibold`,children:r(`activity:agentRoster.optimizeLearnings`)})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>$(o),disabled:j||q.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:q.entryCount===0?`No raw entries to optimize`:`Synthesize raw entries into a consolidated, narrowly-scoped document`,children:[j?(0,B.jsx)(f,{className:`h-3.5 w-3.5 animate-spin`}):(0,B.jsx)(E,{className:`h-3.5 w-3.5`}),j?r(`activity:agentRoster.optimizing`):`Optimize`]})]}),H&&(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px]`,children:[(0,B.jsx)(`span`,{className:A(`inline-block h-1.5 w-1.5 rounded-full`,H.enabled?H.eligible?`bg-warning`:`bg-success`:`bg-muted-foreground`)}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:H.enabled?H.eligible?`Queued automatically: ${ie[H.reason]??H.reason}.`:`Automatic — ${ie[H.reason]??H.reason}.`:`Automatic optimization is off — run it manually.`})]}),(0,B.jsxs)(`p`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:[`Synthesizes all `,q.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.`]}),q.isConsolidated&&q.consolidation&&(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground pt-1 border-t border-border/50`,children:[(0,B.jsx)(a,{className:`h-3 w-3 text-success`}),(0,B.jsxs)(`span`,{children:[`Consolidated`,` `,new Date(q.consolidation.consolidatedAt).toLocaleDateString(),` ·`,` `,q.consolidation.sourceBytes,`B →`,` `,q.consolidation.consolidatedBytes,`B`,q.consolidation.sourceEntryCount<q.entryCount&&(0,B.jsxs)(`span`,{className:`text-warning ml-1`,children:[`· `,q.entryCount-q.consolidation.sourceEntryCount,` `,r(`activity:agentRoster.newPending`)]})]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{T===null?Q(o):D(null)},className:`ml-auto underline text-primary hover:text-primary/80`,children:T===null?r(`activity:agentRoster.viewAction`):`Hide`})]}),T!==null&&(0,B.jsxs)(`div`,{className:`mt-2 max-h-72 overflow-y-auto rounded border border-border/50 bg-background/50 p-2`,children:[(0,B.jsxs)(`div`,{className:`text-[10px] text-muted-foreground mb-1 font-medium`,children:[`Consolidated knowledge for `,o]}),(0,B.jsx)(`pre`,{className:`text-[10px] whitespace-pre-wrap font-sans leading-relaxed`,children:T||`(empty)`})]})]}),L&&L.length>0&&(0,B.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(g,{className:`h-4 w-4 text-brand-2`}),(0,B.jsx)(`span`,{className:`text-xs font-semibold`,children:`Skills`}),(0,B.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[L.filter(e=>e.developed).length,` of `,L.length,` developed for this project`]})]}),(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:`A developed skill carries a project addendum injected right after the bundled skill body — the agent reads one skill, refined for this codebase. Pin a skill to keep it loaded regardless of ranking.`}),(0,B.jsx)(`div`,{className:`space-y-1`,children:L.map(e=>(0,B.jsxs)(`div`,{className:`rounded border border-border/60`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>X(o,e.skill),disabled:!e.developed,className:A(`text-[11px] font-mono text-left flex-1 truncate`,e.developed?`text-primary hover:underline`:`text-muted-foreground cursor-default`),title:e.developed?`View the project addendum`:`No project addendum yet — capture a directive tagged with this skill, then Optimize`,children:e.skill}),e.developed&&(0,B.jsx)(`span`,{className:`text-[9px] rounded bg-success/15 text-success px-1.5 py-0.5`,children:`developed`}),e.affinity&&(0,B.jsxs)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,children:[e.affinity.learned>0&&`${e.affinity.learned} learned · `,e.affinity.succeeded,`✓/`,e.affinity.failed,`✗`]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>Z(o,e.skill,!e.affinity?.pinned),className:A(`text-[9px] rounded border px-1.5 py-0.5 transition-colors`,e.affinity?.pinned?`border-primary/50 text-primary`:`border-border/50 text-muted-foreground hover:bg-accent`),children:e.affinity?.pinned?`pinned`:`pin`})]}),W?.skill===e.skill&&(0,B.jsx)(`div`,{className:`max-h-60 overflow-y-auto border-t border-border/50 bg-background/50 p-2`,children:(0,B.jsx)(`pre`,{className:`text-[10px] whitespace-pre-wrap font-sans leading-relaxed`,children:W.content||`(empty)`})})]},e.skill))})]}),q.entryCount>0&&(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>ee(o),disabled:C,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:[C?(0,B.jsx)(f,{className:`h-3 w-3 animate-spin`}):(0,B.jsx)(m,{className:`h-3 w-3`}),`Review Learned Entries (`,q.entryCount,`)`]})}),u&&(0,B.jsxs)(`div`,{className:`space-y-2 border border-border rounded-lg p-3 bg-card`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`span`,{className:`text-xs font-medium`,children:[u.filter((e,t)=>p[t]!==`drop`).length,`/`,u.length,` kept`]}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:te,disabled:x,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:x?r(`activity:agentRoster.applying`):`Apply Selection`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{d(null),h({})},className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 text-[10px] hover:bg-accent transition-colors`,children:r(`activity:agentRoster.cancel`)})]})]}),(0,B.jsx)(`div`,{className:`max-h-72 overflow-y-auto space-y-2`,children:u.map((e,t)=>{let n=p[t]??`keep`,i=e.length>200?e.slice(0,200)+`…`:e;return(0,B.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,B.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,B.jsx)(`pre`,{className:`text-[10px] whitespace-pre-wrap flex-1 leading-relaxed font-sans`,children:i}),(0,B.jsxs)(`div`,{className:`flex gap-1 shrink-0`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>h(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:r(`activity:agentRoster.keep`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>h(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:r(`activity:agentRoster.drop`)})]})]})},t)})})]})]}),(0,B.jsxs)(`div`,{className:`space-y-2 pt-4 border-t border-border`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 text-sm font-medium`,children:[(0,B.jsx)(g,{className:`h-4 w-4 text-brand-2`}),` `,r(`activity:agentRoster.teachThisAgent`)]}),(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:r(`activity:agentRoster.describeACommandPatternOrBehavior`)}),(0,B.jsx)(`textarea`,{className:`w-full h-20 text-xs p-2 bg-card border border-border rounded resize-y`,value:_,onChange:e=>v(e.target.value),placeholder:r(`activity:agentRoster.eGAlwaysUsePnpmForThisProject`)}),(0,B.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:ne,disabled:!_.trim()||x,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,B.jsx)(g,{className:`h-3.5 w-3.5`}),` `,r(`activity:agentRoster.teach`)]}),y&&(0,B.jsx)(`span`,{className:A(`text-xs`,y.ok?`text-success`:`text-destructive`),children:y.msg})]})]})]})]})]})}function Y({customStats:e,catalog:t}){let{t:r}=i(),a=(0,z.useCallback)(e=>r(`activity:rosterRoles.${e.role}.name`,{defaultValue:e.name}),[r]),o=(0,z.useCallback)(e=>r(`activity:rosterRoles.${e.role}.summary`,{defaultValue:e.summary}),[r]),[s,c]=(0,z.useState)(``),[u,f]=(0,z.useState)(null),p=(0,z.useMemo)(()=>new Set(e.filter(e=>e.exists||e.hasIdentity||e.hasConfig||e.hasKnowledge).map(e=>e.role)),[e]),m=(0,z.useMemo)(()=>{if(!s.trim())return t;let e=s.toLowerCase();return t.filter(t=>t.role.includes(e)||a(t).toLowerCase().includes(e)||o(t).toLowerCase().includes(e))},[t,s,a,o]),g=(0,z.useCallback)(t=>e.find(e=>e.role===t),[e]),_=m;return(0,B.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`shrink-0 px-3 py-2 border-b border-border/50`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-background px-3 py-1.5`,children:[(0,B.jsx)(d,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,B.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:r(`activity:agentRoster.searchPlaceholder`),className:`flex-1 bg-transparent text-xs outline-none placeholder:text-muted-foreground/50`}),s&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>c(``),className:`text-muted-foreground hover:text-foreground`,children:(0,B.jsx)(h,{className:`h-3 w-3`})})]})}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[(0,B.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2`,children:_.map(e=>{let t=g(e.role),i=p.has(e.role),s=u===e.role;return(0,B.jsxs)(`div`,{className:A(`rounded-lg border bg-card transition-colors`,s?`border-primary/40 ring-1 ring-primary/20`:`border-border/60 hover:border-primary/30`),children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>f(s?null:e.role),className:`w-full text-left p-3`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,B.jsx)(T,{className:`h-4 w-4 shrink-0 text-primary`}),(0,B.jsx)(`span`,{className:`text-sm font-semibold truncate`,children:a(e)}),(0,B.jsxs)(`code`,{className:`text-[9px] text-muted-foreground font-mono shrink-0`,children:[`@`,e.role]})]}),(0,B.jsx)(n,{className:A(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,s&&`rotate-180`)})]}),(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-1 leading-relaxed line-clamp-2`,children:o(e)}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 mt-1.5`,children:[(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,children:r(`activity:agentRoster.toolsCount`,{count:e.tools})}),e.budget.maxIterations&&(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums`,children:r(`activity:agentRoster.maxItShort`,{count:e.budget.maxIterations,value:e.budget.maxIterations.toLocaleString()})}),i&&(0,B.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,B.jsx)(l,{className:`h-2.5 w-2.5`}),` `,r(`activity:agentRoster.customizedBadge`)]}),t?.needsSummarization&&(0,B.jsx)(`span`,{className:`text-[9px] text-warning`,children:r(`activity:agentRoster.needsSummary`)})]})]}),s&&(0,B.jsxs)(`div`,{className:`border-t border-border/50 px-3 py-2 space-y-2`,children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,B.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,B.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.maxIterations`)}),(0,B.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.maxIterations?.toLocaleString()??`—`})]}),(0,B.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,B.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.timeout`)}),(0,B.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.timeoutMs?`${Math.round(e.budget.timeoutMs/6e4)}m`:`—`})]}),(0,B.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,B.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.maxToolCalls`)}),(0,B.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:e.budget.maxToolCalls?.toLocaleString()??`—`})]}),(0,B.jsxs)(`div`,{className:`rounded bg-muted/30 p-1.5`,children:[(0,B.jsx)(`span`,{className:`text-[8px] text-muted-foreground uppercase tracking-wider`,children:r(`activity:agentRoster.customizedBadge`)}),(0,B.jsx)(`div`,{className:`text-xs font-mono mt-0.5`,children:r(i?`common:action.yes`:`common:action.no`)})]})]}),i&&t&&(0,B.jsxs)(`div`,{className:`rounded bg-accent/30 p-2 space-y-1`,children:[(0,B.jsx)(`span`,{className:`text-[9px] font-medium text-muted-foreground`,children:r(`activity:agentRoster.projectCustomizations`)}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[9px]`,children:[t.hasIdentity&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,B.jsx)(l,{className:`h-2.5 w-2.5 text-primary`}),` identity.md`]}),t.entryCount>0&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,B.jsx)(O,{className:`h-2.5 w-2.5 text-brand-2`}),` `,r(`activity:agentRoster.learnedEntriesCount`,{count:t.entryCount})]}),t.hasConfig&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,B.jsx)(w,{className:`h-2.5 w-2.5 text-muted-foreground`}),` config.json`]}),t.sessionCaptureCount>0&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,B.jsx)(x,{className:`h-2.5 w-2.5 text-success`}),` `,r(`activity:agentRoster.sessionCapturesCount`,{count:t.sessionCaptureCount})]})]})]})]})]},e.role)})}),_.length===0&&(0,B.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-40 text-muted-foreground`,children:[(0,B.jsx)(d,{className:`h-8 w-8 mb-2 opacity-30`}),(0,B.jsx)(`p`,{className:`text-sm`,children:r(`activity:agentRoster.noAgentsMatch`,{query:s})})]})]}),(0,B.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,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:t.length}),` `,r(`activity:agentRoster.footerRosterRoles`,{count:t.length})]}),(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,B.jsxs)(`span`,{className:`text-brand-2`,children:[(0,B.jsx)(`strong`,{children:p.size}),` `,r(`activity:agentRoster.footerCustomized`,{count:p.size})]}),(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`strong`,{children:e.reduce((e,t)=>e+t.entryCount,0)}),` `,r(`activity:agentRoster.footerTotalLearned`,{count:e.reduce((e,t)=>e+t.entryCount,0)})]})]})]})}var X={running:{led:`bg-success`,badge:`bg-success/12 text-success`,icon:(0,B.jsx)(`span`,{className:`led text-success led-pulse`}),color:`text-success`},completed:{led:`bg-success`,badge:`bg-success/12 text-success`,icon:(0,B.jsx)(a,{className:`h-3.5 w-3.5`}),color:`text-success`},failed:{led:`bg-destructive`,badge:`bg-destructive/15 text-destructive`,icon:(0,B.jsx)(o,{className:`h-3.5 w-3.5`}),color:`text-destructive`},timeout:{led:`bg-warning`,badge:`bg-muted text-muted-foreground`,icon:(0,B.jsx)(y,{className:`h-3.5 w-3.5`}),color:`text-warning`},stopped:{led:`bg-muted-foreground`,badge:`bg-muted text-muted-foreground`,icon:(0,B.jsx)(`span`,{className:`led text-muted-foreground`}),color:`text-muted-foreground`},idle:{led:`bg-muted-foreground`,badge:`bg-muted text-muted-foreground`,icon:(0,B.jsx)(`span`,{className:`led text-muted-foreground`}),color:`text-muted-foreground`}};function Z(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 Q(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 $({nowTick:e}){let{t}=i(),n=j(e=>e.agents),r=j(e=>e.leaderId),[a,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(`all`),l=(0,z.useMemo)(()=>{let e=Array.from(n.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}),s===`all`?e:s===`running`?e.filter(e=>e.status===`running`):s===`done`?e.filter(e=>e.status===`completed`):s===`failed`?e.filter(e=>e.status===`failed`||e.status===`timeout`):e},[n,s]),u=(0,z.useMemo)(()=>{let e=0,t=0,r=0;for(let i of n.values())i.status===`running`?e++:i.status===`completed`?t++:(i.status===`failed`||i.status===`timeout`)&&r++;return{running:e,completed:t,failed:r,total:n.size}},[n]),d=j(e=>e.clearFinishedAgents),f=a?l.find(e=>e.id===a):null,m=(0,z.useCallback)(e=>{let t=M.getState();e?(t.setInspectorFocusedAgentId(e),t.setInspectorTab(`agents`)):t.setInspectorTab(`fleet`),t.setInspectorOpen(!0)},[]);return l.length===0?(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-muted-foreground`,children:(0,B.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,B.jsx)(T,{className:`h-10 w-10 mx-auto opacity-30`}),(0,B.jsx)(`p`,{className:`text-sm`,children:t(`activity:agentRoster.noActiveFleetAgents`)}),(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:t(`activity:agentRoster.liveEmpty`)})]})}):(0,B.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:A(`flex flex-col min-h-0 min-w-0 overflow-hidden`,f?`w-80 shrink-0 border-r border-border/50`:`flex-1`),children:[(0,B.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,B.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:A(`rounded px-2 py-0.5 text-[10px] font-medium transition-colors`,s===e?`bg-primary/10 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted/50`),children:[e===`all`&&t(`activity:agentRoster.filterAll`,{count:u.total}),e===`running`&&t(`activity:agentRoster.filterRunning`,{count:u.running}),e===`done`&&t(`activity:agentRoster.filterDone`,{count:u.completed}),e===`failed`&&t(`activity:agentRoster.filterFailed`,{count:u.failed})]},e)),(0,B.jsx)(`span`,{className:`flex-1`}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>N(`agents`),className:`inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors`,title:t(`activity:agentRoster.openAgentsPanel`),children:[(0,B.jsx)(T,{className:`h-3 w-3`}),t(`activity:agentRoster.openAgentsPanel`)]}),u.completed+u.failed>0&&(0,B.jsxs)(`button`,{type:`button`,onClick:d,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,B.jsx)(b,{className:`h-2.5 w-2.5`}),` `,t(`activity:agentRoster.clear`)]})]}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:l.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>o(a===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`,a===e.id?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30 hover:bg-primary/[0.03]`),children:[(0,B.jsx)(`span`,{className:A(`led shrink-0`,X[e.status]?.led??`bg-muted-foreground`,e.status===`running`&&`led-pulse`)}),(0,B.jsx)(`span`,{className:`text-xs font-semibold min-w-0 truncate max-w-[7rem]`,children:e.name}),e.id===r&&(0,B.jsx)(p,{className:`h-3 w-3 shrink-0 text-warning`}),e.model&&(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground font-mono truncate max-w-[6rem] shrink-0`,children:e.model}),(0,B.jsxs)(`span`,{className:`text-[9px] text-muted-foreground tabular-nums shrink-0`,children:[e.iteration,`it · `,e.toolCalls,`t`]}),e.status===`running`&&(0,B.jsx)(`span`,{className:`text-[9px] text-primary tabular-nums shrink-0 ml-auto`,children:Z(Date.now()-e.startedAt)}),e.status!==`running`&&(0,B.jsx)(`span`,{className:A(`text-[9px] tabular-nums shrink-0 ml-auto`,X[e.status]?.color??`text-muted-foreground`),children:e.status}),e.costUsd>0&&(0,B.jsx)(`span`,{className:`text-[9px] text-success tabular-nums font-medium shrink-0`,children:Q(e.costUsd)}),e.status===`running`&&e.currentTool&&(0,B.jsxs)(`span`,{className:`text-[9px] text-primary font-mono truncate max-w-[6rem] shrink-0`,children:[`→ `,e.currentTool]})]},e.id))}),(0,B.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,B.jsx)(`span`,{className:`font-medium tabular-nums`,children:u.total}),` `,t(`activity:agentRoster.agentsTotal`),(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,B.jsx)(`span`,{className:`text-success tabular-nums`,children:u.running}),` running`,(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:u.completed}),` done`,u.failed>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,B.jsx)(`span`,{className:`text-destructive tabular-nums`,children:u.failed}),` failed`]}),(0,B.jsx)(`span`,{className:`flex-1`}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>m(),className:`inline-flex items-center gap-1 rounded border border-border/50 px-2 py-1 hover:bg-accent transition-colors`,children:[(0,B.jsx)(v,{className:`h-3 w-3`}),t(`activity:agentRoster.fleetInspector`)]})]})]}),f&&(0,B.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:(0,B.jsx)(ae,{agent:f,nowTick:e})})]})}function ae({agent:e,nowTick:t}){let{t:n}=i(),r=e.status===`running`?Z(t-e.startedAt):e.completedAt?Z(e.completedAt-e.startedAt):`-`,a=Math.min(100,Math.max(0,e.ctxPct)),o=e.currentTool||e.lastTool,s=j(e=>e.leaderId);return(0,B.jsxs)(`div`,{className:`space-y-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-center w-10 h-10 rounded-lg bg-primary/10`,children:(0,B.jsx)(T,{className:`h-5 w-5 text-primary`})}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`text-base font-semibold`,children:e.name}),e.id===s&&(0,B.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,B.jsx)(p,{className:`h-2.5 w-2.5`}),` `,n(`activity:agentRoster.leader`)]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,B.jsx)(`span`,{className:A(`led`,X[e.status]?.led,e.status===`running`&&`led-pulse`)}),(0,B.jsx)(`span`,{children:e.status}),e.model&&(0,B.jsxs)(`span`,{children:[`· `,e.provider,`/`,e.model]}),(0,B.jsxs)(`span`,{children:[`· `,r]})]})]})]}),(0,B.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:n(`activity:agentRoster.iterations`)}),(0,B.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:e.iteration})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:n(`activity:agentRoster.toolCalls`)}),(0,B.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:e.toolCalls})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:n(`activity:agentRoster.cost`)}),(0,B.jsx)(`div`,{className:`text-lg font-mono font-semibold mt-0.5 text-success`,children:Q(e.costUsd)})]}),(0,B.jsxs)(`div`,{className:`rounded-lg border bg-card p-2`,children:[(0,B.jsx)(`span`,{className:`text-[9px] text-muted-foreground uppercase tracking-wider`,children:n(`activity:agentRoster.context`)}),(0,B.jsxs)(`div`,{className:`text-lg font-mono font-semibold mt-0.5`,children:[a,`%`]})]})]}),e.maxContext>0&&(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(`div`,{className:`flex justify-between text-[10px]`,children:[(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:n(`activity:agentRoster.contextWindow`)}),(0,B.jsxs)(`span`,{className:A(`tabular font-medium`,a>=85?`text-destructive`:a>=70?`text-warning`:`text-success`),children:[e.ctxTokens.toLocaleString(),` / `,e.maxContext.toLocaleString(),` tokens`]})]}),(0,B.jsx)(`div`,{className:`h-2 w-full overflow-hidden rounded-full bg-muted`,children:(0,B.jsx)(`div`,{className:A(`h-full rounded-full transition-all`,a>=85?`bg-destructive`:a>=70?`bg-warning`:`bg-primary`),style:{width:`${Math.max(2,a)}%`}})})]}),o&&(0,B.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,B.jsx)(_,{className:A(`h-4 w-4`,e.status===`running`?`text-primary animate-pulse`:`text-muted-foreground`)}),(0,B.jsx)(`span`,{className:`text-sm font-mono`,children:e.currentTool??e.lastTool}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground ml-auto`,children:e.currentTool?n(`activity:agentRoster.running`):`Last tool`})]}),e.error&&(0,B.jsxs)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3`,children:[(0,B.jsx)(`span`,{className:`text-[10px] font-semibold text-destructive uppercase tracking-wider`,children:n(`activity:agentRoster.error`)}),(0,B.jsx)(`p`,{className:`text-xs text-destructive/90 mt-1`,children:e.error.message})]}),e.toolLog.length>0&&(0,B.jsxs)(`div`,{className:`space-y-1`,children:[(0,B.jsxs)(`span`,{className:`text-[10px] font-semibold text-muted-foreground uppercase tracking-wider`,children:[`Tool Log (`,e.toolLog.length,`)`]}),(0,B.jsx)(`div`,{className:`space-y-0.5`,children:e.toolLog.slice(0,10).map((e,t)=>(0,B.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,B.jsx)(`span`,{className:A(`led shrink-0`,e.ok?`text-success`:`text-destructive`)}),(0,B.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,B.jsxs)(`span`,{className:`tabular text-muted-foreground`,children:[e.durationMs,`ms`]}),!e.ok&&(0,B.jsx)(`span`,{className:`text-destructive`,children:`✗`})]},`${e.name}-${t}`))})]}),e.budgetWarning&&(0,B.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,B.jsx)(E,{className:`h-3.5 w-3.5 text-warning shrink-0`}),(0,B.jsxs)(`span`,{className:`text-warning`,children:[`Budget: `,e.budgetWarning.kind,` limit (`,e.budgetWarning.used,`/`,e.budgetWarning.limit,`)`]})]})]})}function oe(){let[e,t]=(0,z.useState)([]),[n,r]=(0,z.useState)(te),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(null),c=(0,z.useCallback)(async()=>{a(!0),s(null);try{let e=await R(`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,z.useEffect)(()=>{c()},[c]),(0,z.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 se({customStats:e,catalog:n,onRefresh:r}){let{t:a}=i(),[o,s]=(0,z.useState)(null),[d,f]=(0,z.useState)(null),[p,h]=(0,z.useState)(``),[g,_]=(0,z.useState)(null),[v,y]=(0,z.useState)(!1),[x,S]=(0,z.useState)(null),[C,T]=(0,z.useState)(!1),[E,D]=(0,z.useState)({name:``,role:``,baseRole:`generic`,purpose:``,taskTypes:``}),j=(0,z.useMemo)(()=>o?e.find(e=>e.role===o):null,[o,e]),N=(0,z.useMemo)(()=>{let e=n.find(e=>e.role===o);return e?.systemProtected??!e?.custom},[n,o]),P=(0,z.useCallback)(async(e,t)=>{y(!0),S(null),s(e);try{let n=await R(`agent-roster.read-customization`,{role:e});h(t===`config`?`${JSON.stringify(n.config??{},null,2)}\n`:n[t]??``),f(t),_(null)}catch(e){S(e instanceof Error?e.message:a(`activity:agentRoster.loadCustomizationFailed`))}finally{y(!1)}},[]),F=(0,z.useCallback)(async e=>{y(!0),S(null),s(e);try{let t=await R(`agent-roster.read-customization`,{role:e});_(t.config??{}),f(null)}catch(e){S(e instanceof Error?e.message:a(`activity:agentRoster.loadRuntimePolicyFailed`))}finally{y(!1)}},[]),I=(0,z.useCallback)(async e=>{if(o){y(!0),S(null);try{await R(`agent-roster.update-config`,{role:o,config:e}),_(null),r()}catch(e){S(e instanceof Error?e.message:a(`activity:agentRoster.runtimePolicySaveFailed`))}finally{y(!1)}}},[r,o]),L=(0,z.useCallback)(async()=>{if(!(!o||!d)){y(!0);try{let e={identity:`agent-roster.update-identity`,learned:`agent-roster.update-learned`,config:`agent-roster.update-config`},t={role:o};if(d===`config`)try{t.config=JSON.parse(p)}catch{S(`config.json must contain valid JSON`),y(!1);return}else t.content=p;await R(e[d],t),f(null),S(null),r()}catch(e){S(e instanceof Error?e.message:a(`activity:agentRoster.saveFailed`))}y(!1)}},[o,d,p,r]),V=(0,z.useCallback)(async()=>{if(o)try{let e=await R(`agent-roster.llm-improve`,{role:o,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=M.getState();r.setSidebarOpen(!1),r.setCurrentView(`chat`)}catch(e){S(e instanceof Error?e.message:a(`activity:agentRoster.llmImprovementFailed`))}},[o]),H=(0,z.useCallback)(async e=>{if(window.confirm(a(`activity:agentRoster.resetConfirm`,{role:e})))try{await R(`agent-roster.reset`,{role:e}),s(null),r()}catch{}},[r]),U=(0,z.useCallback)(async()=>{let e=E.taskTypes.split(/[\n,]+/).map(e=>e.trim()).filter(Boolean);y(!0),S(null);try{let t=await R(`agent-roster.create`,{name:E.name,role:E.role,baseRole:E.baseRole,purpose:E.purpose,taskTypes:e});T(!1),D({name:``,role:``,baseRole:`generic`,purpose:``,taskTypes:``}),s(t.role),r()}catch(e){S(e instanceof Error?e.message:a(`activity:agentRoster.agentCreationFailed`))}finally{y(!1)}},[E,r]),W=(0,z.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,B.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,B.jsxs)(`div`,{className:`w-80 shrink-0 border-r border-border/50 flex flex-col overflow-hidden`,children:[(0,B.jsx)(`div`,{className:`shrink-0 border-b border-border/50 px-3 py-2`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold`,children:[(0,B.jsx)(w,{className:`h-3.5 w-3.5`}),a(`activity:agentRoster.projectAgents`)]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>{T(!0),s(null),_(null),S(null)},className:`rounded border border-primary/40 px-1.5 py-1 text-[9px] text-primary hover:bg-primary/10`,children:a(`activity:agentRoster.clone`)})]})}),(0,B.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2 space-y-1`,children:[W.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{s(e.role),_(null),f(null)},className:A(`w-full text-left rounded-lg border px-3 py-2 transition-colors`,o===e.role?`border-primary/50 bg-primary/[0.06]`:`border-border/60 hover:border-primary/30`),children:[(0,B.jsx)(`div`,{className:`text-xs font-semibold`,children:e.role}),(0,B.jsxs)(`div`,{className:`flex gap-2 mt-0.5 text-[9px] text-muted-foreground`,children:[e.hasIdentity&&(0,B.jsx)(`span`,{className:`text-primary`,children:`id`}),e.entryCount>0&&(0,B.jsxs)(`span`,{className:`text-brand-2`,children:[e.entryCount,`e`]}),e.hasConfig&&(0,B.jsx)(`span`,{children:`cfg`})]})]},e.role)),W.length===0&&(0,B.jsx)(`div`,{className:`text-[10px] text-muted-foreground text-center py-4`,children:a(`activity:agentRoster.noCustomizations`)})]})]}),(0,B.jsxs)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:[C&&(0,B.jsxs)(`div`,{className:`max-w-2xl space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-base font-semibold`,children:a(`activity:agentRoster.createOrCloneTitle`)}),(0,B.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:a(`activity:agentRoster.createOrCloneHint`)})]}),(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:a(`activity:agentRoster.cloneFromRole`)}),(0,B.jsx)(`select`,{value:E.baseRole,onChange:e=>D(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,B.jsxs)(`option`,{value:e.role,children:[e.name,` (`,e.role,`)`]},e.role))}),(0,B.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:a(`activity:agentRoster.cloneHint`)})]}),(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`label`,{className:`space-y-1 text-xs`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:a(`activity:agentRoster.displayName`)}),(0,B.jsx)(`input`,{value:E.name,onChange:e=>D(t=>({...t,name:e.target.value})),placeholder:a(`activity:agentRoster.abc`),className:`h-9 w-full rounded border border-border bg-card px-2`})]}),(0,B.jsxs)(`label`,{className:`space-y-1 text-xs`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:a(`activity:agentRoster.roleIdOptional`)}),(0,B.jsx)(`input`,{value:E.role,onChange:e=>D(t=>({...t,role:e.target.value})),placeholder:a(`activity:agentRoster.abcGeneratedFromName`),className:`h-9 w-full rounded border border-border bg-card px-2 font-mono`})]})]}),(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:a(`activity:agentRoster.purpose`)}),(0,B.jsx)(`textarea`,{value:E.purpose,onChange:e=>D(t=>({...t,purpose:e.target.value})),placeholder:a(`activity:agentRoster.descriptionPlaceholder`),className:`h-24 w-full resize-y rounded border border-border bg-card p-2`})]}),(0,B.jsxs)(`label`,{className:`block space-y-1 text-xs`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:a(`activity:agentRoster.taskTypesCommaOrOnePer`)}),(0,B.jsx)(`textarea`,{value:E.taskTypes,onChange:e=>D(t=>({...t,taskTypes:e.target.value})),placeholder:a(`activity:agentRoster.taskTypesPlaceholder`),className:`h-24 w-full resize-y rounded border border-border bg-card p-2`})]}),x&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,children:x}),(0,B.jsxs)(`div`,{className:`flex gap-2`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:U,disabled:v||!E.name.trim()||E.purpose.trim().length<10||!E.taskTypes.trim(),className:`rounded bg-primary px-3 py-1.5 text-xs text-primary-foreground disabled:opacity-50`,children:v?a(`activity:agentRoster.creating`):`Clone Agent`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>T(!1),className:`rounded border border-border px-3 py-1.5 text-xs hover:bg-accent`,children:a(`activity:agentRoster.cancel`)})]})]}),!C&&!o&&(0,B.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:a(`activity:agentRoster.selectAnAgentToEditCustomizations`)}),!C&&o&&j&&(0,B.jsxs)(`div`,{className:`space-y-4 max-w-2xl`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`h3`,{className:`text-base font-semibold`,children:o}),(0,B.jsxs)(`div`,{className:`flex gap-1`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:V,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,B.jsx)(c,{className:`h-3 w-3 text-brand-2`}),` `,a(`activity:agentRoster.llmImprove`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>H(o),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,B.jsx)(b,{className:`h-3 w-3`}),` `,a(`activity:agentRoster.reset`)]})]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[j.hasIdentity&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-2 py-1 text-[10px] text-primary`,children:[(0,B.jsx)(l,{className:`h-3 w-3`}),` identity.md`]}),j.hasConfig&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[10px] text-muted-foreground`,children:[(0,B.jsx)(w,{className:`h-3 w-3`}),` config.json`]}),j.hasKnowledge&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[10px] text-muted-foreground`,children:[(0,B.jsx)(O,{className:`h-3 w-3`}),` knowledge.json`]}),j.entryCount>0&&(0,B.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,B.jsx)(m,{className:`h-3 w-3`}),` `,j.entryCount,` learned entries`]})]}),(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>P(o,`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,B.jsx)(l,{className:`h-3.5 w-3.5`}),` `,a(`activity:agentRoster.editIdentityMd`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>P(o,`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,B.jsx)(m,{className:`h-3.5 w-3.5`}),` `,a(`activity:agentRoster.editLearnedMd`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>F(o),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,B.jsx)(u,{className:`h-3.5 w-3.5`}),` `,a(`activity:agentRoster.runtimePolicy`)]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>P(o,`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,B.jsx)(w,{className:`h-3.5 w-3.5`}),` `,a(`activity:agentRoster.editConfigJson`)]})]}),x&&(0,B.jsx)(`p`,{className:`text-xs text-destructive`,children:x}),g&&(0,B.jsx)(q,{initialConfig:g,systemProtected:N,saving:v,onSave:I,onCancel:()=>_(null)},o),d&&(0,B.jsxs)(`div`,{className:`space-y-2`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`span`,{className:`text-xs font-medium`,children:[d,`.md / `,d,`.json`]}),(0,B.jsxs)(`div`,{className:`flex gap-1`,children:[(0,B.jsx)(`button`,{type:`button`,onClick:L,disabled: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:a(v?`activity:agentRoster.saving`:`common:action.save`)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>f(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:a(`activity:agentRoster.cancel`)})]})]}),(0,B.jsx)(`textarea`,{className:`w-full h-48 font-mono text-xs p-2 bg-card border border-border rounded resize-y`,value:p,onChange:e=>h(e.target.value),placeholder:d===`config`?`{ "tools": [...], "budget": {...} }`:`# Project identity for ${o}\n\nDescribe this agent's role…`})]})]})]})]})}function ce({className:e}){let{t}=i(),[n,r]=(0,z.useState)(`live`),[a,o]=(0,z.useState)(Date.now()),{customStats:c,catalog:l,rosterLoading:u,rosterError:d,loadRoster:f}=oe();return(0,z.useEffect)(()=>{let e=setInterval(()=>{document.hidden||o(Date.now())},2e3);return()=>clearInterval(e)},[]),(0,B.jsxs)(`div`,{className:A(`flex h-full min-h-0 min-w-0 w-full flex-col overflow-hidden`,e),children:[(0,B.jsx)(ne,{customStats:c,rosterLoading:u,onRefresh:f}),(0,B.jsx)(re,{activeTab:n,onTabChange:r}),(0,B.jsxs)(`div`,{className:`flex min-h-0 min-w-0 w-full flex-1 overflow-hidden bg-background/50`,children:[d&&(0,B.jsxs)(`div`,{className:`flex items-center justify-center w-full text-destructive text-xs gap-2`,children:[(0,B.jsx)(s,{className:`h-4 w-4`}),d,(0,B.jsx)(`button`,{type:`button`,onClick:f,className:`underline`,children:t(`activity:agentRoster.retry`)})]}),n===`live`&&(0,B.jsx)($,{nowTick:a}),n===`catalog`&&(0,B.jsx)(Y,{customStats:c,catalog:l}),n===`learning`&&(0,B.jsx)(J,{customStats:c,onRefresh:f}),n===`customize`&&(0,B.jsx)(se,{customStats:c,catalog:l,onRefresh:f})]})]})}export{ce as AgentRosterView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ba as t,Di as n,Fa as r,ar as i,b as a,dn as o,ea as s,ii as c,lt as l,un as u,vn as d}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{a as f,n as p,t as m}from"./monaco-BLUV5g0U.js";import{t as h}from"./ws-client-CGEB75Dy.js";import{t as g}from"./utils-CUCQrODG.js";import{I as _,b as v}from"./stores-BATHCuMN.js";import{v as y}from"./index-BTRQG7C5.js";import{t as b}from"./empty-state-BDwjdvMh.js";import{t as x}from"./monaco-theme-DSeCDzQy.js";var S=e(t(),1),C=l();p.config({monaco:m});var w={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,json:`json`,css:`css`,scss:`scss`,html:`html`,md:`markdown`,py:`python`,go:`go`,rs:`rust`,java:`java`,c:`c`,cpp:`cpp`,cs:`csharp`,rb:`ruby`,php:`php`,sh:`shell`,bash:`shell`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sql:`sql`};function T(e){return w[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function E({path:e,oldText:t,newText:n}){let{t:o}=r(),c=(0,S.useRef)(null),[l,d]=(0,S.useState)(!1),[p,m]=(0,S.useState)(!1),[g,v]=(0,S.useState)(null);(0,S.useEffect)(()=>{d(!1),m(!1),v(null)},[]);let y=(0,S.useCallback)(e=>{c.current=e,f.setTheme(x()),e.getModifiedEditor().onDidChangeModelContent(()=>d(!0))},[]),b=(0,S.useCallback)(()=>{let t=c.current?.getModifiedEditor().getValue();if(t==null)return;m(!0);let n=h(_.getState().wsUrl),r=n.on(`files.written`,t=>{t.type===`files.written`&&t.payload.filePath===e&&(r(),clearTimeout(i),m(!1),t.payload.success&&(d(!1),v(Date.now())))}),i=setTimeout(()=>{r(),m(!1)},5e3);n.send({type:`files.write`,payload:{filePath:e,content:t}})},[e]),w=T(e);return(0,C.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,C.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2 px-2 py-1.5 border-b border-border/40`,children:[(0,C.jsx)(`span`,{className:`text-xs font-mono text-muted-foreground truncate`,children:e}),(0,C.jsxs)(`button`,{type:`button`,onClick:b,disabled:!l||p,className:`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md border border-border text-xs font-medium disabled:opacity-40 enabled:hover:bg-muted transition-colors`,title:o(`activity:monacoDiff.applyTitle`),children:[p?(0,C.jsx)(i,{className:`h-3.5 w-3.5 animate-spin`}):g&&!l?(0,C.jsx)(s,{className:`h-3.5 w-3.5 text-success`}):(0,C.jsx)(u,{className:`h-3.5 w-3.5`}),o(p?`activity:monacoDiff.applying`:g&&!l?`activity:monacoDiff.applied`:`activity:monacoDiff.apply`)]})]}),(0,C.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,C.jsx)(a,{original:t,modified:n,language:w,theme:x(),onMount:y,options:{renderSideBySide:!0,readOnly:!1,originalEditable:!1,minimap:{enabled:!1},fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0}})})]})}var D=1e4;function O({className:e}){let{t}=r(),a=v(e=>e.selectedPath),s=v(e=>e.diff),l=v(e=>e.loadingDiff),[u,f]=(0,S.useState)(`unified`),[p,m]=(0,S.useState)(!1),x=!!a&&(l||!s);(0,S.useEffect)(()=>{if(m(!1),!x)return;let e=setTimeout(()=>m(!0),D);return()=>clearTimeout(e)},[x,a]);let w=()=>{a&&(m(!1),v.getState().setDiffLoading(!0),h(_.getState().wsUrl).getGitDiff?.(a))};if(!a)return(0,C.jsx)(b,{icon:(0,C.jsx)(c,{className:`h-6 w-6`}),title:t(`activity:changesView.sourceChanges`),description:t(`activity:changes.selectPrompt`),className:e});let T=s&&!s.error&&!s.binary&&!s.tooLarge;return(0,C.jsx)(`div`,{className:g(`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[hsl(var(--surface-2)/0.45)] p-3`,e),children:(0,C.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border/70 bg-card/75 shadow-sm`,children:[(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border/70 px-3 py-2`,children:[(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`div`,{className:`text-[10px] font-semibold uppercase text-muted-foreground`,children:t(`activity:changesView.sourceControl`)}),(0,C.jsx)(`div`,{className:`truncate font-mono text-xs text-foreground`,title:a,children:a})]}),T&&(0,C.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>f(`unified`),title:t(`activity:changes.unifiedTitle`),className:g(`inline-flex h-8 items-center gap-1 rounded-md border px-2 text-xs transition-colors`,u===`unified`?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-muted`),children:[(0,C.jsx)(o,{className:`h-3.5 w-3.5`}),` `,t(`activity:changes.unified`)]}),(0,C.jsxs)(`button`,{type:`button`,onClick:()=>f(`edit`),title:t(`activity:changes.editTitle`),className:g(`inline-flex h-8 items-center gap-1 rounded-md border px-2 text-xs transition-colors`,u===`edit`?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-muted`),children:[(0,C.jsx)(n,{className:`h-3.5 w-3.5`}),` `,t(`activity:changes.edit`)]})]})]}),(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:l||!s?p?(0,C.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center gap-3 p-4 text-center`,children:[(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`activity:changes.diffTimeout`)}),(0,C.jsxs)(`button`,{type:`button`,onClick:w,className:`inline-flex h-8 items-center gap-1.5 rounded-md border border-border px-3 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,C.jsx)(d,{className:`h-3.5 w-3.5`}),` `,t(`common:action.retry`)]})]}):(0,C.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[(0,C.jsx)(i,{className:`h-4 w-4 animate-spin`}),` `,t(`activity:changes.loadingDiff`)]}):s.error?(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-destructive`,children:s.error}):s.binary?(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:t(`activity:changes.binary`)}):s.tooLarge?(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:t(`activity:changes.tooLarge`)}):u===`edit`?(0,C.jsx)(E,{path:s.path,oldText:s.oldText??``,newText:s.newText??``},s.path):(0,C.jsx)(y,{oldText:s.oldText,newText:s.newText,caption:s.path,fill:!0})})]})})}export{O as ChangesView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{$i as t,Ba as n,Fa as r,Ii as i,Pr as a,Qt as o,Vt as s,Wi as c,Xi as l,Zr as u,ar as d,ci as f,dt as p,ii as m,in as h,ka as g,lt as _,or as v,sa as y,ua as b,vn as ee,y as x,yt as S}from"./vendor-GiKfK4Iw.js";import"./i18n-BvFgJYE2.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./monaco-BLUV5g0U.js";import{t as te}from"./ws-client-CGEB75Dy.js";import{t as k}from"./utils-CUCQrODG.js";import{i as ne}from"./codemap-activity-store-D67-genN.js";import{I as re,N as A,c as ie,j,p as ae}from"./stores-BATHCuMN.js";import{o as M}from"./view-navigation-FdnvQSOv.js";import{O as N,v as oe,y as P}from"./index-BTRQG7C5.js";import{t as F}from"./empty-state-BDwjdvMh.js";import{t as I}from"./monaco-theme-DSeCDzQy.js";import{t as se}from"./MemoryDrawer-D2Yq9oba.js";var L={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,css:`css`,html:`html`,svg:`xml`,md:`markdown`,yml:`yaml`,yaml:`yaml`,toml:`toml`,sh:`shell`,bash:`shell`,ps1:`powershell`,py:`python`,rs:`rust`,go:`go`,rb:`ruby`,java:`java`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sql:`sql`,xml:`xml`},R=Array.from(new Set(Object.values(L))).filter(e=>e!==`plaintext`),z=12e3,B=4e3,ce=5e3,V=1e4;function H(e){return L[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function U(e){return e.match(/([A-Za-z_$][\w$]*)$/)?.[1]??``}function W(e,t){return e.triggerCharacter?!0:t.length>=3}function G(e,t){return e.triggerCharacter===`.`||!e.triggerCharacter&&/^(findBy|findAllBy|create|update|delete|remove|get[A-Z_]|set[A-Z_]|use[A-Z_])/.test(t)}function K(e){return[e.filePath,e.language,e.lineNumber,e.column,e.versionId??``,e.triggerCharacter??``,e.linePrefix.slice(-160),e.suffix.slice(0,160)].join(`\0`)}var q=e(n(),1),J=_();function le(e){let t=new Set,n=new Set,r=new Set,i=new Set,a=new Set,o,s;for(let c of e)c.sessionId&&t.add(c.sessionId),c.taskId&&n.add(c.taskId),c.boardId&&r.add(c.boardId),c.toolName&&i.add(c.toolName),c.modelId&&a.add(c.modelId),(!o||c.occurredAt<o)&&(o=c.occurredAt),(!s||c.occurredAt>s)&&(s=c.occurredAt);return{mutations:e.length,sessions:t.size,tasks:n.size,boards:r.size,tools:[...i],models:[...a],firstAt:o,lastAt:s}}var Y=150,ue=224,de=38,X=/(write|edit|update|create|delete|rename|modified|changed)/i;function Z(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/\/{2,}/g,`/`).toLowerCase()}function Q(e,t){let n=Z(e),r=Z(t);return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function fe(e,t=Date.now()){let n=e.filter(e=>t-e.at<=30*6e4),r=n.filter(e=>X.test(e.action)),i=new Set(n.map(e=>e.sessionId).filter(Boolean)).size,a=new Set(n.map(e=>e.actor).filter(Boolean)).size,o=new Set(n.map(e=>e.taskId).filter(Boolean)).size;return{level:r.length>=8||r.length>=4&&a>=3?`churn`:r.length>0?`active`:`quiet`,mutationCount:r.length,sessionCount:i,actorCount:a,taskCount:o}}function $(e){return typeof e==`string`&&e.length>0?e:void 0}function pe(e){let t=Date.parse(e.occurredAt??e.observedAt);return Number.isFinite(t)?t:Date.now()}function me(e){let t=e.attributes??{},n=$(t.operation)??e.eventType,r=e.scope.agentId,i=e.runtime?.providerId,a=e.runtime?.modelId;return{id:e.eventId,at:pe(e),action:n,actor:r??i??$(t.actor)??`external`,source:$(t.source)??e.tags?.collector??`chronicle`,summary:[e.eventType,i&&a?`${i}/${a}`:i,e.outcome].filter(Boolean).join(` · `),sessionId:e.scope.sessionId,agentId:r,taskId:e.scope.taskId??$(t.taskId),boardId:$(t.boardId)??e.scope.boardId,tool:$(t.toolName),status:e.outcome,raw:e}}function he(e){return{id:e.id??`${e.filePath}:${e.timestamp}:${e.type}`,at:e.timestamp,action:e.type,actor:e.agentName??e.agent??e.agentId??`external`,source:e.source??`live`,summary:e.summary,sessionId:e.sessionId,agentId:e.agentId,tool:e.toolName,status:e.status,raw:e}}function ge(e){let t=new Set;return e.sort((e,t)=>t.at-e.at).filter(e=>{let n=`${e.id}:${e.at}`;return t.has(n)?!1:(t.add(n),!0)})}function _e(e){return e?e.split(/\r?\n/).length:0}function ve(e){return new TextEncoder().encode(e).length}function ye(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function be(e){return e.length>18?`${e.slice(0,8)}…${e.slice(-6)}`:e}function xe(e,t){let n=P(e,t);return n?{added:n.filter(e=>e.kind===`add`).length,removed:n.filter(e=>e.kind===`del`).length,large:!1}:{added:0,removed:0,large:!0}}function Se({file:e}){let{t:n}=r(),[i,o]=(0,q.useState)(!0),[u,d]=(0,q.useState)(ue),[p,h]=(0,q.useState)(`overview`),[_,b]=(0,q.useState)([]),[x,S]=(0,q.useState)([]),[C,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(null),[D,O]=(0,q.useState)(null),A=(0,q.useRef)(null),j=re(e=>e.wsUrl),M=ne(e=>e.history),N=ne(e=>e.activeOperations),P=ae(e=>e.activeBoard),F=ie(e=>e.snapshot),I=(0,q.useMemo)(()=>te(j),[j]),L=(0,q.useCallback)(()=>{E(null),w(!0),typeof I.getGitDiff==`function`&&I.getGitDiff(e.path);let t=typeof I.supportsCapability==`function`?I.supportsCapability.bind(I):null;t?.(`chronicle.query`)?I.send({type:`chronicle.query`,payload:{query:{path:e.path,resourceKind:`file`,order:`desc`,limit:150}}}):w(!1),t?.(`chronicle.metrics`)&&I.send({type:`chronicle.metrics`,payload:{view:`files`,path:e.path,limit:1e3}})},[I,e.path]);(0,q.useEffect)(()=>{b([]),S([]),O(null);let t=I.on(`chronicle.query_result`,t=>{if(t.type!==`chronicle.query_result`)return;let n=t.payload.events.filter(t=>t.resource?.path&&Q(t.resource.path,e.path));t.payload.events.length>0&&n.length===0||(b(n),w(!1))}),n=I.on(`chronicle.metrics_result`,t=>{t.type!==`chronicle.metrics_result`||t.payload.view!==`files`||S(t.payload.data.filter(t=>Q(t.path,e.path)))}),r=I.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(E(e.payload.message),w(!1))}),i=I.on(`git.diff`,t=>{if(t.type!==`git.diff`||!Q(t.payload.path,e.path))return;let n=t.payload;if(n.error||n.binary||n.tooLarge){O({text:e.savedContent,available:!1,error:n.error});return}O({text:n.oldText??``,available:!0})});return L(),()=>{t(),n(),r(),i()}},[I,e.path,e.savedContent,L]),(0,q.useEffect)(()=>{let e=e=>{if(!A.current)return;let t=A.current.startY-e.clientY,n=Math.max(Y,Math.floor(window.innerHeight*.62));d(Math.min(n,Math.max(Y,A.current.startHeight+t)))},t=()=>{A.current=null,document.body.style.cursor=``,document.body.style.userSelect=``};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t)}},[]);let R=(0,q.useMemo)(()=>{let t=[];for(let[n,r]of M)Q(n,e.path)&&t.push(...r);for(let n of N.values())t.push(...n.filter(t=>Q(t.filePath,e.path)));return t},[N,e.path,M]),z=(0,q.useMemo)(()=>ge([...R.map(he),..._.map(me)]),[_,R]),B=(0,q.useMemo)(()=>fe(z),[z]),ce=(0,q.useMemo)(()=>le(x),[x]),V=D?.text??e.savedContent,H=(0,q.useMemo)(()=>xe(V,e.content),[V,e.content]),U=(0,q.useMemo)(()=>[...new Set(z.map(e=>e.sessionId).filter(e=>!!e))],[z]),W=(0,q.useMemo)(()=>[...new Set(z.map(e=>e.actor).filter(Boolean))],[z]),G=(0,q.useMemo)(()=>[...new Set(z.map(e=>e.taskId).filter(e=>!!e))],[z]),K=(0,q.useCallback)(e=>{let t=P?.tasks.find(t=>t.id===e),n=F?.tasks.find(t=>t.id===e||t.shortId===e);return t?.title??n?.title??e},[P,F]),X=e=>{i||o(!0),A.current={startY:e.clientY,startHeight:i?u:Y},document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`},Z=[{id:`overview`,label:n(`activity:fileActivity.overview`),icon:(0,J.jsx)(g,{})},{id:`changes`,label:n(`activity:fileActivity.changes`),icon:(0,J.jsx)(m,{})},{id:`context`,label:n(`activity:fileActivity.context`),icon:(0,J.jsx)(v,{})},{id:`logs`,label:n(`activity:fileActivity.logs`),icon:(0,J.jsx)(s,{})},{id:`memory`,label:n(`activity:fileActivity.memory`),icon:(0,J.jsx)(y,{})}];return(0,J.jsxs)(`section`,{className:`flex shrink-0 flex-col overflow-hidden border-t border-border bg-card/95 shadow-[0_-10px_30px_hsl(var(--background)/0.24)] backdrop-blur`,style:{height:i?u:de},"data-testid":`file-activity-drawer`,children:[(0,J.jsx)(`button`,{type:`button`,"aria-label":n(`activity:fileActivity.resizeHint`),className:`group relative block h-2 w-full cursor-ns-resize touch-none`,onPointerDown:X,onDoubleClick:()=>{o(!0),d(ue)},title:n(`activity:fileActivity.resizeHint`),children:(0,J.jsx)(`span`,{className:`absolute left-1/2 top-0.5 h-1 w-10 -translate-x-1/2 rounded-full bg-border transition-colors group-hover:bg-primary/60`})}),(0,J.jsxs)(`header`,{className:`flex h-[30px] min-w-0 items-center gap-2 border-b border-border/70 px-2.5`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`inline-flex min-w-0 items-center gap-1.5 rounded px-1.5 py-1 text-[11px] font-semibold hover:bg-muted`,"aria-expanded":i,children:[(0,J.jsx)(f,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,J.jsx)(`span`,{className:`truncate`,children:n(`activity:fileActivity.title`)}),i?(0,J.jsx)(t,{className:`h-3 w-3`}):(0,J.jsx)(l,{className:`h-3 w-3`})]}),(0,J.jsx)(`span`,{className:`hidden h-3 w-px bg-border sm:block`}),(0,J.jsx)(Ce,{label:`${_e(e.content)} ${n(`activity:fileActivity.lines`)}`}),(0,J.jsx)(Ce,{label:ye(ve(e.content))}),!H.large&&(H.added>0||H.removed>0)&&(0,J.jsxs)(`span`,{className:`hidden items-center gap-1 font-mono text-[10px] md:flex`,children:[(0,J.jsxs)(`span`,{className:`text-success`,children:[`+`,H.added]}),(0,J.jsxs)(`span`,{className:`text-destructive`,children:[`−`,H.removed]})]}),(0,J.jsxs)(`span`,{className:k(`ml-auto inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[9px] font-semibold uppercase tracking-wide`,B.level===`churn`&&`bg-destructive/10 text-destructive`,B.level===`active`&&`bg-warning/10 text-warning`,B.level===`quiet`&&`bg-success/10 text-success`),children:[(0,J.jsx)(c,{className:`h-2.5 w-2.5`}),n(`activity:fileActivity.level.${B.level}`)]}),(0,J.jsx)(`span`,{className:`hidden text-[9px] text-muted-foreground lg:inline`,children:n(`activity:fileActivity.evidenceCount`,{count:z.length})}),i&&(0,J.jsx)(`button`,{type:`button`,onClick:L,className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,title:n(`activity:fileActivity.refresh`),children:(0,J.jsx)(ee,{className:k(`h-3.5 w-3.5`,C&&`animate-spin`)})})]}),i&&(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-0.5 border-b border-border/60 bg-muted/20 px-2`,children:[Z.map(e=>(0,J.jsxs)(`button`,{type:`button`,onClick:()=>h(e.id),className:k(`inline-flex h-7 items-center gap-1.5 border-b-2 px-2 text-[10px] transition-colors [&>svg]:h-3 [&>svg]:w-3`,p===e.id?`border-primary font-medium text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:[e.icon,e.label]},e.id)),T&&(0,J.jsx)(`span`,{className:`ml-auto truncate px-2 text-[9px] text-warning`,children:T})]}),(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[p===`overview`&&(0,J.jsx)(we,{analysis:B,lifetime:ce,records:z,sessions:U,agents:W,tasks:G,taskLabel:K}),p===`changes`&&(0,J.jsxs)(`div`,{className:`h-full min-h-[120px] p-2`,children:[(0,J.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-2 text-[9px] text-muted-foreground`,children:[(0,J.jsx)(a,{className:`h-3 w-3`}),(0,J.jsx)(`span`,{children:D?.available?n(`activity:fileActivity.gitToBuffer`):n(`activity:fileActivity.savedToBuffer`)}),e.dirty&&(0,J.jsx)(`span`,{className:`rounded bg-warning/10 px-1.5 py-0.5 text-warning`,children:n(`activity:fileActivity.unsaved`)}),D?.error&&(0,J.jsx)(`span`,{className:`truncate text-warning`,children:D.error})]}),(0,J.jsx)(`div`,{className:`h-[calc(100%-24px)] min-h-[90px]`,children:(0,J.jsx)(oe,{oldText:V,newText:e.content,caption:e.path,fill:!0})})]}),p===`context`&&(0,J.jsx)(Ee,{sessions:U,agents:W,tasks:G,records:z,taskLabel:K,boardTitle:P?.title??F?.title}),p===`logs`&&(0,J.jsx)(ke,{records:z,loading:C}),p===`memory`&&(0,J.jsx)(`div`,{className:`h-full min-h-[120px]`,children:(0,J.jsx)(se,{filePath:e.path,open:!0,onClose:()=>h(`overview`)})})]})]})]})}function Ce({label:e}){return(0,J.jsx)(`span`,{className:`hidden whitespace-nowrap font-mono text-[9px] text-muted-foreground sm:inline`,children:e})}function we({analysis:e,lifetime:t,records:n,sessions:i,agents:a,tasks:s,taskLabel:c}){let{t:l}=r();return(0,J.jsxs)(`div`,{className:`grid min-h-full grid-cols-1 gap-2 p-2 lg:grid-cols-[minmax(360px,.9fr)_minmax(420px,1.35fr)]`,children:[(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5`,children:[{label:l(`activity:fileActivity.mutations30m`),value:e.mutationCount,icon:(0,J.jsx)(m,{})},{label:l(`activity:fileActivity.sessions`),value:i.length,icon:(0,J.jsx)(S,{})},{label:l(`activity:fileActivity.actors`),value:a.length,icon:(0,J.jsx)(b,{})},{label:l(`activity:fileActivity.linkedWork`),value:s.length,icon:(0,J.jsx)(v,{})}].map(e=>(0,J.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-background/45 px-2 py-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1 text-[9px] text-muted-foreground [&>svg]:h-3 [&>svg]:w-3`,children:[e.icon,(0,J.jsx)(`span`,{className:`truncate`,children:e.label})]}),(0,J.jsx)(`div`,{className:`mt-0.5 font-mono text-sm font-semibold`,children:e.value})]},e.label))}),t.mutations>0&&(0,J.jsx)(Te,{lifetime:t}),(0,J.jsxs)(`div`,{className:k(`flex items-start gap-2 rounded-md border px-2.5 py-2 text-[10px]`,e.level===`churn`?`border-destructive/25 bg-destructive/[0.055]`:`border-border/70 bg-background/45`),children:[(0,J.jsx)(o,{className:k(`mt-0.5 h-3.5 w-3.5 shrink-0`,e.level===`churn`?`text-destructive`:`text-primary`)}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`font-semibold`,children:l(`activity:fileActivity.analysisTitle.${e.level}`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:l(`activity:fileActivity.analysisBody.${e.level}`,{mutations:e.mutationCount,actors:e.actorCount,sessions:e.sessionCount})})]})]}),s.length>0&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 text-[9px]`,children:[(0,J.jsxs)(`span`,{className:`text-muted-foreground`,children:[l(`activity:fileActivity.workLinks`),`:`]}),s.slice(0,4).map(e=>(0,J.jsx)(`span`,{className:`max-w-[180px] truncate rounded border border-primary/20 bg-primary/5 px-1.5 py-0.5 text-primary`,title:e,children:c(e)},e))]})]}),(0,J.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border/70 bg-background/35`,children:[(0,J.jsx)(`div`,{className:`border-b border-border/60 px-2.5 py-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:l(`activity:fileActivity.recentActivity`)}),(0,J.jsx)(`div`,{className:`divide-y divide-border/40`,children:n.length===0?(0,J.jsx)(je,{text:l(`activity:fileActivity.noEvidence`)}):n.slice(0,5).map(e=>(0,J.jsx)(Ae,{record:e},`${e.id}:${e.at}`))})]})]})}function Te({lifetime:e}){let{t}=r(),n=[{value:e.mutations,label:t(`activity:fileActivity.lifetimeChanges`)},{value:e.sessions,label:t(`activity:fileActivity.lifetimeSessions`)},{value:e.tasks,label:t(`activity:fileActivity.lifetimeTasks`)},{value:e.boards,label:t(`activity:fileActivity.lifetimeBoards`)}],i=e.firstAt?new Date(e.firstAt).toLocaleDateString():void 0;return(0,J.jsxs)(`div`,{className:`rounded-md border border-primary/15 bg-primary/[0.03] px-2.5 py-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[9px] font-semibold uppercase tracking-wider text-primary [&>svg]:h-3 [&>svg]:w-3`,children:[(0,J.jsx)(f,{}),t(`activity:fileActivity.lifetimeTitle`)]}),(0,J.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[9px] text-muted-foreground`,children:[n.map(e=>(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`b`,{className:`text-foreground`,children:e.value.toLocaleString()}),` `,e.label]},e.label)),i&&(0,J.jsx)(`span`,{children:t(`activity:fileActivity.lifetimeSince`,{date:i})})]}),e.tools.length>0&&(0,J.jsx)(`div`,{className:`mt-1 truncate font-mono text-[8px] text-muted-foreground`,title:e.tools.join(`, `),children:t(`activity:fileActivity.lifetimeTools`,{tools:e.tools.slice(0,6).join(`, `)})})]})}function Ee({sessions:e,agents:t,tasks:n,records:i,taskLabel:a,boardTitle:o}){let{t:s}=r();return(0,J.jsxs)(`div`,{className:`grid min-h-full grid-cols-1 divide-y divide-border/50 md:grid-cols-3 md:divide-x md:divide-y-0`,children:[(0,J.jsx)(De,{icon:(0,J.jsx)(S,{}),title:s(`activity:fileActivity.sessions`),empty:s(`activity:fileActivity.noSessions`),children:e.map(e=>(0,J.jsx)(Oe,{title:be(e),subtitle:`${i.filter(t=>t.sessionId===e).length} ${s(`activity:fileActivity.events`)}`,raw:e},e))}),(0,J.jsx)(De,{icon:(0,J.jsx)(b,{}),title:s(`activity:fileActivity.actors`),empty:s(`activity:fileActivity.noActors`),children:t.map(e=>(0,J.jsx)(Oe,{title:e,subtitle:`${i.filter(t=>t.actor===e).length} ${s(`activity:fileActivity.events`)}`},e))}),(0,J.jsx)(De,{icon:(0,J.jsx)(v,{}),title:s(`activity:fileActivity.workLinks`),empty:s(`activity:fileActivity.noWorkLinks`),children:n.map(e=>(0,J.jsx)(Oe,{title:a(e),subtitle:o??s(`activity:fileActivity.taskOrTodo`),raw:e},e))})]})}function De({icon:e,title:t,empty:n,children:r}){let i=Array.isArray(r)?r.length>0:!!r;return(0,J.jsxs)(`section`,{className:`min-w-0 p-2`,children:[(0,J.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground [&>svg]:h-3 [&>svg]:w-3`,children:[e,t]}),(0,J.jsx)(`div`,{className:`space-y-1`,children:i?r:(0,J.jsx)(je,{text:n})})]})}function Oe({title:e,subtitle:t,raw:n}){return(0,J.jsxs)(`div`,{className:`rounded-md border border-border/60 bg-background/45 px-2 py-1.5`,title:n,children:[(0,J.jsx)(`div`,{className:`truncate text-[10px] font-medium`,children:e}),(0,J.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[8px] text-muted-foreground`,children:t})]})}function ke({records:e,loading:t}){let{t:n}=r();return t&&e.length===0?(0,J.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-[10px] text-muted-foreground`,children:[(0,J.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}),n(`activity:fileActivity.loadingEvidence`)]}):e.length===0?(0,J.jsx)(je,{text:n(`activity:fileActivity.noEvidence`)}):(0,J.jsx)(`div`,{className:`divide-y divide-border/40`,children:e.map(e=>(0,J.jsx)(Ae,{record:e,raw:!0},`${e.id}:${e.at}`))})}function Ae({record:e,raw:t=!1}){let n=(0,J.jsxs)(`div`,{className:`grid grid-cols-[62px_74px_minmax(90px,.7fr)_minmax(160px,1.5fr)] items-center gap-2 text-[9px]`,children:[(0,J.jsx)(`span`,{className:`font-mono text-muted-foreground`,children:new Date(e.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,J.jsx)(`span`,{className:k(`w-fit rounded px-1.5 py-0.5 font-mono`,X.test(e.action)?`bg-warning/10 text-warning`:`bg-primary/10 text-primary`),children:e.action}),(0,J.jsx)(`span`,{className:`truncate`,title:e.agentId,children:e.actor}),(0,J.jsx)(`span`,{className:`truncate text-muted-foreground`,title:e.summary,children:e.summary})]});return t?(0,J.jsxs)(`details`,{className:`group cursor-pointer px-2.5 py-1.5`,children:[(0,J.jsx)(`summary`,{className:`list-none [&::-webkit-details-marker]:hidden`,children:n}),(0,J.jsx)(`pre`,{className:`mt-1.5 max-h-48 overflow-auto rounded border border-border/60 bg-background/60 p-2 font-mono text-[8px] leading-relaxed text-muted-foreground`,children:JSON.stringify(e.raw,null,2)})]}):(0,J.jsx)(`div`,{className:`px-2.5 py-1.5`,children:n})}function je({text:e}){return(0,J.jsx)(`div`,{className:`px-3 py-3 text-center text-[10px] text-muted-foreground`,children:e})}T.config({monaco:O});function Me(e){switch(e){case`method`:return E.CompletionItemKind.Method;case`function`:return E.CompletionItemKind.Function;case`constructor`:return E.CompletionItemKind.Constructor;case`field`:return E.CompletionItemKind.Field;case`variable`:return E.CompletionItemKind.Variable;case`class`:return E.CompletionItemKind.Class;case`interface`:return E.CompletionItemKind.Interface;case`module`:return E.CompletionItemKind.Module;case`property`:return E.CompletionItemKind.Property;case`unit`:return E.CompletionItemKind.Unit;case`value`:return E.CompletionItemKind.Value;case`enum`:return E.CompletionItemKind.Enum;case`keyword`:return E.CompletionItemKind.Keyword;case`snippet`:return E.CompletionItemKind.Snippet;case`file`:return E.CompletionItemKind.File;case`reference`:return E.CompletionItemKind.Reference;default:return E.CompletionItemKind.Text}}function Ne(){let e=j(e=>e.openFiles),t=j(e=>e.activeFilePath),n=j(e=>e.setActiveFile),r=j(e=>e.closeFile);return e.length===0?null:(0,J.jsx)(`div`,{className:`flex items-center border-b bg-muted/40 overflow-x-auto shrink-0`,children:e.map(e=>{let a=e.path===t,o=e.path.split(`/`).pop()??e.path;return(0,J.jsxs)(`button`,{type:`button`,onClick:()=>n(e.path),onMouseDown:t=>{t.button===1&&(t.preventDefault(),r(e.path))},className:k(`group flex items-center gap-1.5 px-3 py-1.5 text-[11px] border-r whitespace-nowrap min-w-0 max-w-[180px] transition-colors`,a?`bg-background border-t-2 border-t-primary text-foreground -mb-px`:`text-muted-foreground hover:bg-muted/60 hover:text-foreground`),title:e.path,children:[e.dirty&&(0,J.jsx)(i,{className:`h-2 w-2 fill-current text-primary shrink-0`}),(0,J.jsx)(`span`,{className:`truncate`,children:o}),(0,J.jsx)(p,{className:k(`h-3 w-3 shrink-0 rounded-sm hover:bg-muted-foreground/20 opacity-0 group-hover:opacity-100 transition-opacity`,a&&`opacity-100`),onClick:t=>{t.stopPropagation(),r(e.path)}})]},e.path)})})}function Pe(){let{t:e}=r(),t=j(e=>e.openFiles),n=j(e=>e.activeFilePath),i=j(e=>e.updateContent),{theme:a}=N(),o=(0,q.useRef)(null),s=(0,q.useRef)(n),c=(0,q.useRef)(new Map),l=(0,q.useMemo)(()=>t.find(e=>e.path===n)??null,[t,n]),d=n?H(n):`plaintext`,f=I(),[p,m]=(0,q.useState)(!1);(0,q.useEffect)(()=>{s.current=n},[n]),(0,q.useEffect)(()=>{let e=I();C.setTheme(e)},[a]),(0,q.useEffect)(()=>{let e=R.map(e=>E.registerCompletionItemProvider(e,{triggerCharacters:[`.`,`_`],provideCompletionItems:async(e,t,n,r)=>{let i=s.current;if(!i)return{suggestions:[]};let a=e.getOffsetAt(t),o=e.getValue(),l=o.slice(Math.max(0,a-z),a),u=o.slice(a,a+B),d=e.getLineContent(t.lineNumber).slice(0,Math.max(0,t.column-1)),f=U(d),p={triggerCharacter:n.triggerCharacter,triggerKind:n.triggerKind};if(!W(p,f))return{suggestions:[]};let m=`cmp_${Date.now()}_${Math.random().toString(36).slice(2)}`,h=e.getWordUntilPosition(t),g={startLineNumber:t.lineNumber,endLineNumber:t.lineNumber,startColumn:h.startColumn,endColumn:t.column},_=te(re.getState().wsUrl),v=e=>e.map((e,t)=>({label:e.label,kind:Me(e.kind),insertText:e.insertText,detail:e.detail??(e.source?`WrongStack ${e.source}`:void 0),documentation:e.documentation,sortText:e.sortText??`${String(t).padStart(3,`0`)}-${e.label}`,range:g,insertTextRules:e.kind===`snippet`?E.CompletionItemInsertTextRule.InsertAsSnippet:void 0})),y=K({filePath:i,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,versionId:e.getVersionId(),triggerCharacter:n.triggerCharacter,linePrefix:d,suffix:u}),b=c.current.get(y);return b&&b.expiresAt>Date.now()?{suggestions:v(b.items)}:await new Promise(a=>{let s=!1,d=()=>{},h=null,g,b=e=>{s||(s=!0,d(),g!==void 0&&window.clearTimeout(g),h?.dispose(),a({suggestions:e}))};d=_.on(`completion.result`,e=>{let t=e;t.payload.requestId===m&&(c.current.set(y,{expiresAt:Date.now()+V,items:t.payload.items}),b(v(t.payload.items)))}),g=window.setTimeout(()=>b([]),ce),h=r.onCancellationRequested(()=>b([])),_.requestCompletion({requestId:m,filePath:i,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,content:o.length<=5e5?o:void 0,prefix:l,suffix:u,triggerCharacter:n.triggerCharacter,triggerKind:n.triggerKind,allowLlm:G(p,f)})})}}));return()=>{e.forEach(e=>{e.dispose()})}},[]);let g=(0,q.useCallback)(()=>{let e=o.current;if(!e)return null;let t=e.getSelection();if(!t||t.isEmpty())return null;let n=e.getModel();if(!n)return null;let r=n.getValueInRange(t);return r.trim()?{content:r,startLine:t.startLineNumber,endLine:t.endLineNumber}:null},[]),_=(0,q.useCallback)(()=>{M(`chat`),requestAnimationFrame(()=>{document.querySelector(`[data-chat-textarea]`)?.focus()})},[]),v=(0,q.useCallback)(()=>{let e=s.current;if(!e)return;let t=g();t&&(A.getState().addRef({kind:`snippet`,path:e,startLine:t.startLine,endLine:t.endLine,content:t.content}),_())},[g,_]),y=(0,q.useCallback)(()=>{let e=s.current;e&&(A.getState().addRef({kind:`file`,path:e}),_())},[_]),b=(0,q.useCallback)(t=>{o.current=t,C.setTheme(I()),t.onDidChangeCursorSelection(()=>{let e=t.getSelection();m(!!e&&!e.isEmpty())}),t.addAction({id:`wrongstack-send-to-chat`,label:e(`activity:codeEditor.sendSelectionAction`),contextMenuGroupId:`wrongstack`,contextMenuOrder:0,precondition:void 0,keybindings:[w.CtrlCmd|w.Shift|D.KeyL],run:e=>{let t=e.getSelection();t&&!t.isEmpty()?v():y()}})},[v,y]),ee=(0,q.useCallback)(e=>{n&&e!==void 0&&i(n,e)},[n,i]);return(0,q.useEffect)(()=>{let e=e=>{let t=e.ctrlKey||e.metaKey,r=e.target?.tagName?.toLowerCase()===`textarea`||e.target?.closest(`.monaco-editor`)!==null;!t||!r||(e.key.toLowerCase()===`s`&&(e.preventDefault(),window.dispatchEvent(new CustomEvent(`wrongstack:save-file`,{detail:{filePath:n}}))),e.key.toLowerCase()===`w`&&(e.preventDefault(),n&&j.getState().closeFile(n)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),t.length===0?(0,J.jsx)(F,{title:e(`activity:codeEditor.noFilesOpen`),description:e(`activity:codeEditor.selectToEdit`)}):(0,J.jsxs)(`div`,{className:`flex h-full min-w-0 flex-col overflow-hidden`,children:[(0,J.jsx)(Ne,{}),(0,J.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(p||l)&&(0,J.jsx)(`div`,{className:`absolute top-2 right-2 z-10 flex items-center gap-1 rounded-lg border border-border bg-popover/95 backdrop-blur shadow-md p-1`,children:(0,J.jsxs)(`button`,{type:`button`,onClick:p?v:y,className:`inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-[11px] text-foreground hover:bg-accent transition-colors`,title:e(p?`activity:codeEditor.sendSelectedTitle`:`activity:codeEditor.mentionFileTitle`),children:[p?(0,J.jsx)(h,{className:`h-3 w-3`}):(0,J.jsx)(u,{className:`h-3 w-3`}),(0,J.jsx)(`span`,{children:e(p?`activity:codeEditor.sendToChat`:`activity:codeEditor.mentionFile`)})]})}),l?(0,J.jsx)(x,{language:d,value:l.content,onChange:ee,theme:f,onMount:b,loading:(0,J.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,J.jsx)(`span`,{className:`text-[11px] text-muted-foreground animate-pulse`,children:e(`activity:codeEditor.loadingEditor`)})}),options:{minimap:{enabled:!1},fontSize:13,fontFamily:`'IBM Plex Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace`,lineNumbers:`on`,renderWhitespace:`selection`,scrollBeyondLastLine:!1,wordWrap:`off`,tabSize:2,smoothScrolling:!0,cursorBlinking:`smooth`,cursorSmoothCaretAnimation:`on`,bracketPairColorization:{enabled:!0},"semanticHighlighting.enabled":!0,automaticLayout:!0,padding:{top:8}}},l.path):(0,J.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,J.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e(`activity:codeEditor.selectTab`)})})]}),l&&(0,J.jsx)(Se,{file:l})]})}export{Pe as CodeEditor};
|