@wrongstack/webui 0.298.3 → 0.299.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentRosterView-RvxaV08Y.js → AgentRosterView-BqojERFR.js} +4 -4
- package/dist/assets/{AnalyticsDashboard-irejsLMt.js → AnalyticsDashboard-D58kSekC.js} +1 -1
- package/dist/assets/{AudienceMemoryPanel-DDW_WPjf.js → AudienceMemoryPanel-Cc1UkbDl.js} +1 -1
- package/dist/assets/ChangesView-BKU80ANq.js +1 -0
- package/dist/assets/ChronicleDashboard-CvCS1Dj1.js +1 -0
- package/dist/assets/CodeEditor-BHZQhx_8.js +1 -0
- package/dist/assets/CodeMap-qllGEFLB.js +1 -0
- package/dist/assets/{CronJobsPanel-BXujnpGC.js → CronJobsPanel-DD5mhZ4Q.js} +1 -1
- package/dist/assets/{DeadCodeScanPanel-HTbGUTMl.js → DeadCodeScanPanel-PB-c8et_.js} +1 -1
- package/dist/assets/{DebugDashboard-B5kJBUv0.js → DebugDashboard-Q8QiVflQ.js} +1 -1
- package/dist/assets/{DesignGalleryView-BQ0CZpQm.js → DesignGalleryView-CGOtWO7s.js} +1 -1
- package/dist/assets/{GoalView-DvaSR6CO.js → GoalView-Dlk42vW7.js} +1 -1
- package/dist/assets/KanbanView-DIP6kKmU.js +3 -0
- package/dist/assets/{MailboxDetailView-Dh8ekyMw.js → MailboxDetailView-ZcKcOEAe.js} +1 -1
- package/dist/assets/MemoryManager-B7620q_K.js +1 -0
- package/dist/assets/{ModelPicker-BxYMTEEN.js → ModelPicker-DvNLZzkm.js} +1 -1
- package/dist/assets/OfficeMapPanel-DKJNTtOZ.js +4 -0
- package/dist/assets/{ProcessMonitor-DVUCtVHZ.js → ProcessMonitor-2nSk6sXA.js} +1 -1
- package/dist/assets/{QueuePanel-n9lScdWu.js → QueuePanel-4KBBWFxj.js} +1 -1
- package/dist/assets/{RefreshDebugView-eZQ3wdxU.js → RefreshDebugView-D3XnE53y.js} +1 -1
- package/dist/assets/RequirementIntakeView-BMxlf8bt.js +1 -0
- package/dist/assets/{SageTabs-B-eQ--Sb.js → SageTabs-g1hO2hJ0.js} +2 -2
- package/dist/assets/SddHub-Kv_TbTgT.js +2 -0
- package/dist/assets/SessionInspectView-PnKTvyvP.js +1 -0
- package/dist/assets/SessionList-BeinIC-h.js +1 -0
- package/dist/assets/SessionsDashboard-DEG_BylE.js +1 -0
- package/dist/assets/SetupScreen-DxJwZ1OZ.js +1 -0
- package/dist/assets/SkillDetailView-D7EQ2XtV.js +3 -0
- package/dist/assets/{SpecsView-BYiJr__T.js → SpecsView-Fm7pYYcj.js} +1 -1
- package/dist/assets/TechStackView-Bo_UenRF.js +1 -0
- package/dist/assets/{TerminalPanel-BgMsGfGa.js → TerminalPanel-BL9ZPGJt.js} +1 -1
- package/dist/assets/{Toaster-EXqX2jqp.js → Toaster-CJI70aa-.js} +1 -1
- package/dist/assets/{activity-DReNmuta.js → activity-BCgOEWgR.js} +2 -2
- package/dist/assets/{activity-Dyh19u3P.js → activity-BQ0zqkw2.js} +2 -2
- package/dist/assets/{activity-BJijwuIr.js → activity-CAovbq3e.js} +2 -2
- package/dist/assets/{activity-BBPMHCAJ.js → activity-CFQyCvgu.js} +2 -2
- package/dist/assets/{activity-GR8KiHvf.js → activity-CdQf7zRK.js} +2 -2
- package/dist/assets/{activity-iuGHFz2B.js → activity-DACvyn2-.js} +2 -2
- package/dist/assets/{activity-DeEOo2zu.js → activity-DOwYydU-.js} +2 -2
- package/dist/assets/{button-DwmC7ENW.js → button-Dcy288Mc.js} +1 -1
- package/dist/assets/{chat-store-LHzJqRCp.js → chat-store-CtOyUCdF.js} +2 -2
- package/dist/assets/{codemap-activity-store-B6n7KiS8.js → codemap-activity-store-DQfjo7-j.js} +1 -1
- package/dist/assets/codemap-index-store-COStDU-8.js +1 -0
- package/dist/assets/{dialog-DsCmc6eL.js → dialog-ftgTihmF.js} +1 -1
- package/dist/assets/{empty-state-02bIS4x7.js → empty-state-RRSqQaCk.js} +1 -1
- package/dist/assets/{i18n-DxnYsmc-.js → i18n-B0hsnanh.js} +2 -2
- package/dist/assets/index-DHdO0CRE.js +132 -0
- package/dist/assets/index-DKrFQ76m.css +1 -0
- package/dist/assets/{input-UhWgodVi.js → input-fo9-BPBC.js} +1 -1
- package/dist/assets/{mailbox-store-xh2Ux-Xs.js → mailbox-store-D8TvJsuk.js} +1 -1
- package/dist/assets/{progress-ring-C0O73ZjR.js → progress-ring-61A-xUEl.js} +1 -1
- package/dist/assets/{roster-ws-DlQQL7Eh.js → roster-ws-Dfg_187V.js} +1 -1
- package/dist/assets/{session-store-BE_S1f5v.js → session-store-b2KGFwkX.js} +1 -1
- package/dist/assets/{shared-bBntASiy.js → shared-KAzksK0C.js} +1 -1
- package/dist/assets/stores-BptlyD_v.js +7 -0
- package/dist/assets/ui-store-BsBnjO3w.js +1 -0
- package/dist/assets/useWebSocket-Bc4S0N4r.js +29 -0
- package/dist/assets/{utils-_s0GyctV.js → utils-B-9lSDIn.js} +1 -1
- package/dist/assets/{vendor-CxV3l5PQ.js → vendor-BuarzSSb.js} +30 -30
- package/dist/assets/{view-navigation-DLdE7qHU.js → view-navigation-DxfiZrXS.js} +1 -1
- package/dist/assets/ws-client-DqFoX4jJ.js +1 -0
- package/dist/components/CouncilLogTimeline.d.ts +2 -0
- package/dist/components/QuickModelSwitcher.filter.d.ts +9 -4
- package/dist/components/RequirementIntakeView.d.ts +2 -0
- package/dist/components/SessionInspectView.d.ts +2 -0
- package/dist/components/SettingsPanel/ModelCatalogPicker.d.ts +1 -2
- package/dist/components/SettingsPanel/brain-section-options.d.ts +16 -0
- package/dist/components/ViewRouter.d.ts +1 -1
- package/dist/hooks/useWebSocket.d.ts +1 -0
- package/dist/index.html +21 -21
- package/dist/index.js +10761 -9484
- package/dist/lib/view-navigation.d.ts +2 -2
- package/dist/lib/ws-client-actions.d.ts +1 -0
- package/dist/stores/council-log-store.d.ts +67 -0
- package/dist/stores/index.d.ts +3 -1
- package/dist/stores/session-inspect-store.d.ts +51 -0
- package/dist/stores/ui-store.d.ts +19 -7
- package/dist/stores/viz-store.d.ts +1 -1
- package/dist/types/brain.d.ts +15 -0
- package/dist/types/client-message.d.ts +5 -0
- package/dist/types/server-message.d.ts +2 -2
- package/dist/types/system.d.ts +35 -0
- package/package.json +8 -8
- package/dist/assets/ChangesView-Bnd167hf.js +0 -1
- package/dist/assets/ChronicleDashboard-DC62FDEt.js +0 -1
- package/dist/assets/CodeEditor-DCWcCQPO.js +0 -1
- package/dist/assets/CodeMap-DSqqgBuD.js +0 -1
- package/dist/assets/KanbanView-DpWs_i8T.js +0 -3
- package/dist/assets/MemoryManager-CUAbNwsz.js +0 -1
- package/dist/assets/OfficeMapPanel-HgERknuN.js +0 -4
- package/dist/assets/SddHub-D81poT6w.js +0 -2
- package/dist/assets/SessionsDashboard-CR3NZeHw.js +0 -1
- package/dist/assets/SetupScreen-t6wrhv6l.js +0 -1
- package/dist/assets/SkillDetailView-D6TOvMQU.js +0 -3
- package/dist/assets/TechStackView-HEMM3PkG.js +0 -1
- package/dist/assets/codemap-index-store-oapPwtvI.js +0 -1
- package/dist/assets/index-Bf75VrDE.js +0 -132
- package/dist/assets/index-NFp5CXyK.css +0 -1
- package/dist/assets/stores-BS-Bdi-5.js +0 -7
- package/dist/assets/ui-store-C4Ybfoon.js +0 -1
- package/dist/assets/useWebSocket-x8PMoTq8.js +0 -28
- package/dist/assets/ws-client-Cy3oRAmZ.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Activity } from '@/stores/ui-store';
|
|
2
2
|
export type PanelMainView = 'chat' | 'files' | 'skill' | 'officemap' | 'changes' | 'mailbox' | 'design-gallery';
|
|
3
|
-
export type MainView = 'goal' | 'kanban' | 'sddhub' | 'settings' | 'memory' | 'roster' | 'codemap' | 'techstack' | 'chronicle';
|
|
4
|
-
export type AppView = PanelMainView | MainView | 'sessions' | 'setup' | 'debug' | 'refresh-debug' | 'analytics';
|
|
3
|
+
export type MainView = 'goal' | 'kanban' | 'sddhub' | 'settings' | 'memory' | 'roster' | 'codemap' | 'techstack' | 'chronicle' | 'intake';
|
|
4
|
+
export type AppView = PanelMainView | MainView | 'sessions' | 'session-inspect' | 'setup' | 'debug' | 'refresh-debug' | 'analytics';
|
|
5
5
|
export declare const PANEL_VIEW_BY_ACTIVITY: Record<Activity, PanelMainView>;
|
|
6
6
|
export declare const VIEW_ACTIVITY: Partial<Record<AppView, Activity>>;
|
|
7
7
|
export declare const ACTIVITY_SHORTCUT_BY_KEY: Readonly<Record<string, Activity>>;
|
|
@@ -104,6 +104,7 @@ export interface WsClientActionMethods {
|
|
|
104
104
|
listSessions(limit?: number): void;
|
|
105
105
|
deleteSession(id: string): void;
|
|
106
106
|
renameSession(id: string, name: string): void;
|
|
107
|
+
inspectSession(id: string): void;
|
|
107
108
|
setWorkingDir(path: string): void;
|
|
108
109
|
resumeSession(sessionId: string): void;
|
|
109
110
|
ping(): void;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export type CouncilVoteStatus = 'valid' | 'invalid' | 'failed' | 'cancelled';
|
|
2
|
+
/** One seat's observable vote. No hidden chain-of-thought is retained. */
|
|
3
|
+
export interface CouncilSeatVote {
|
|
4
|
+
seatId: string;
|
|
5
|
+
persona: string;
|
|
6
|
+
status: CouncilVoteStatus | string;
|
|
7
|
+
/** The option this seat voted for, on an option-bearing question. */
|
|
8
|
+
optionId?: string | undefined;
|
|
9
|
+
/** Free-text stance / rationale — only present when trace content is 'full'. */
|
|
10
|
+
stance?: string | undefined;
|
|
11
|
+
rationale?: string | undefined;
|
|
12
|
+
providerId?: string | undefined;
|
|
13
|
+
model?: string | undefined;
|
|
14
|
+
veto?: boolean | undefined;
|
|
15
|
+
weight?: number | undefined;
|
|
16
|
+
durationMs?: number | undefined;
|
|
17
|
+
error?: string | undefined;
|
|
18
|
+
at: number;
|
|
19
|
+
}
|
|
20
|
+
export interface CouncilPanelEntry {
|
|
21
|
+
requestId: string;
|
|
22
|
+
/** `voting` until the resolution lands; a failed council can stay here. */
|
|
23
|
+
phase: 'voting' | 'resolved';
|
|
24
|
+
startedAt: number;
|
|
25
|
+
resolvedAt?: number | undefined;
|
|
26
|
+
seats: CouncilSeatVote[];
|
|
27
|
+
/** Folded in from the matching `brain.decision_*` event, when it arrives. */
|
|
28
|
+
question?: string | undefined;
|
|
29
|
+
status?: string | undefined;
|
|
30
|
+
resolution?: string | undefined;
|
|
31
|
+
optionId?: string | undefined;
|
|
32
|
+
reason?: string | undefined;
|
|
33
|
+
configuredSeatCount?: number | undefined;
|
|
34
|
+
validVoteCount?: number | undefined;
|
|
35
|
+
/** Distinct provider/model targets that served the valid votes. */
|
|
36
|
+
distinctTargetCount?: number | undefined;
|
|
37
|
+
judgeUsed?: boolean | undefined;
|
|
38
|
+
totalTokens?: number | undefined;
|
|
39
|
+
durationMs?: number | undefined;
|
|
40
|
+
/** Structural warnings — most importantly a CORRELATED (non-diverse) panel. */
|
|
41
|
+
warnings?: string[] | undefined;
|
|
42
|
+
}
|
|
43
|
+
/** Newest-first ring buffer bound. */
|
|
44
|
+
export declare const MAX_COUNCIL_PANELS = 50;
|
|
45
|
+
interface CouncilLogState {
|
|
46
|
+
/** Newest first. */
|
|
47
|
+
panels: CouncilPanelEntry[];
|
|
48
|
+
recordVote: (payload: Record<string, unknown>) => void;
|
|
49
|
+
recordResolution: (payload: Record<string, unknown>) => void;
|
|
50
|
+
noteQuestion: (requestId: string, question: string) => void;
|
|
51
|
+
clear: () => void;
|
|
52
|
+
}
|
|
53
|
+
export declare function toCouncilSeatVote(payload: Record<string, unknown>, now: number): CouncilSeatVote;
|
|
54
|
+
/**
|
|
55
|
+
* One-line panel summary.
|
|
56
|
+
*
|
|
57
|
+
* `distinctTargetCount` sits next to the seat count deliberately: a panel whose
|
|
58
|
+
* seats all resolved to the SAME model produces a perfectly normal-looking
|
|
59
|
+
* unanimous verdict while adding cost without adding independence, and nothing
|
|
60
|
+
* else on the row reveals it.
|
|
61
|
+
*/
|
|
62
|
+
export declare function summarizeCouncilPanel(entry: CouncilPanelEntry): string;
|
|
63
|
+
/** True when the panel resolved to a refusal, denial or non-verdict. */
|
|
64
|
+
export declare function isCouncilPanelAdverse(entry: CouncilPanelEntry): boolean;
|
|
65
|
+
export declare const useCouncilLogStore: import("zustand").UseBoundStore<import("zustand").StoreApi<CouncilLogState>>;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=council-log-store.d.ts.map
|
package/dist/stores/index.d.ts
CHANGED
|
@@ -36,8 +36,10 @@ export { type SideEffectEntry, useSideEffectStore } from './side-effect-store.js
|
|
|
36
36
|
export { type BoardTaskItem, type BoardTaskStatus, type SpecColumn, type SpecDetail, type SpecListItem, useSpecsStore, } from './specs-store.js';
|
|
37
37
|
export { type TechStackCoverage, type TechStackDependency, type TechStackEvidence, type TechStackFinding, type TechStackFindingAction, type TechStackFindingSeverity, type TechStackFindingType, type TechStackJobKind, type TechStackJobStatus, type TechStackJobView, type TechStackProgress, type TechStackSnapshot, type TechStackWorkspace, useTechStackStore, } from './techstack-store.js';
|
|
38
38
|
export type { AgentTranscriptEntry, AgentTranscriptKind, ChatMessage, FleetTimelineEvent, MessageContent, SessionHistoryEntry, SessionInfo, SubagentEvent, SubagentView, ToolExecution, } from './types.js';
|
|
39
|
-
export type { Activity, DockSection, WorkDashboardTab } from './ui-store.js';
|
|
39
|
+
export type { Activity, DockSection, InspectorTab, WorkDashboardTab } from './ui-store.js';
|
|
40
40
|
export { coerceActivity, resetUiNavigationToHome, SIDEBAR_DEFAULT_WIDTH, SIDEBAR_MAX_WIDTH, SIDEBAR_MIN_WIDTH, useUIStore, } from './ui-store.js';
|
|
41
|
+
export type { CouncilPanelEntry, CouncilSeatVote } from './council-log-store.js';
|
|
42
|
+
export { isCouncilPanelAdverse, MAX_COUNCIL_PANELS, summarizeCouncilPanel, toCouncilSeatVote, useCouncilLogStore, } from './council-log-store.js';
|
|
41
43
|
export type { VizEdge, VizEvent, VizNode } from './viz-store.js';
|
|
42
44
|
export { useVizStore } from './viz-store.js';
|
|
43
45
|
export { useWorktreeStore } from './worktree-store.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
interface InspectEvent {
|
|
2
|
+
ts: string;
|
|
3
|
+
type: string;
|
|
4
|
+
label: string;
|
|
5
|
+
detail: string;
|
|
6
|
+
}
|
|
7
|
+
interface InspectFileEntry {
|
|
8
|
+
operation: string;
|
|
9
|
+
filePath: string;
|
|
10
|
+
toolName: string;
|
|
11
|
+
ts: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SessionInspectData {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
name?: string | undefined;
|
|
17
|
+
model: string;
|
|
18
|
+
provider: string;
|
|
19
|
+
startedAt: string;
|
|
20
|
+
endedAt?: string | undefined;
|
|
21
|
+
tokenTotal: number;
|
|
22
|
+
outcome?: 'completed' | 'error' | 'timeout' | 'aborted' | undefined;
|
|
23
|
+
messageCount: number;
|
|
24
|
+
iterationCount: number;
|
|
25
|
+
toolCallCount: number;
|
|
26
|
+
toolErrorCount: number;
|
|
27
|
+
fileChangeCount: number;
|
|
28
|
+
compactionCount: number;
|
|
29
|
+
toolBreakdown: Record<string, number>;
|
|
30
|
+
events: InspectEvent[];
|
|
31
|
+
fileEvents: InspectFileEntry[];
|
|
32
|
+
lastUserMessage?: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
interface SessionInspectState {
|
|
35
|
+
payload: SessionInspectData | null;
|
|
36
|
+
loading: boolean;
|
|
37
|
+
error: string | null;
|
|
38
|
+
setPayload: (payload: SessionInspectData) => void;
|
|
39
|
+
setError: (error: string) => void;
|
|
40
|
+
setLoading: (loading: boolean) => void;
|
|
41
|
+
clear: () => void;
|
|
42
|
+
}
|
|
43
|
+
export declare const useSessionInspectStore: import("zustand").UseBoundStore<import("zustand").StoreApi<SessionInspectState>>;
|
|
44
|
+
/**
|
|
45
|
+
* Idempotently registers a WS handler for `session.inspect` responses.
|
|
46
|
+
* Safe to call multiple times — only the first call installs the handler.
|
|
47
|
+
* The handler updates the Zustand store with the response payload.
|
|
48
|
+
*/
|
|
49
|
+
export declare function ensureInspectHandlerInstalled(): void;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=session-inspect-store.d.ts.map
|
|
@@ -4,7 +4,7 @@ export type Activity = 'chat' | 'agents' | 'files' | 'changes' | 'mailbox' | 'sk
|
|
|
4
4
|
/** Map any persisted (possibly legacy) activity value onto the current set. */
|
|
5
5
|
export declare function coerceActivity(value: unknown): Activity;
|
|
6
6
|
/** All valid currentView values. Kept in sync with the union on UIState. */
|
|
7
|
-
declare const VIEWS: readonly ['chat', 'settings', 'memory', 'roster', 'context', 'goal', 'kanban', 'sddhub', 'files', 'changes', 'sessions', 'setup', 'skill', 'officemap', 'mailbox', 'debug', 'design-gallery', 'refresh-debug', 'analytics', 'codemap', 'techstack', 'chronicle', 'deadcode'];
|
|
7
|
+
declare const VIEWS: readonly ['chat', 'settings', 'memory', 'roster', 'context', 'goal', 'kanban', 'sddhub', 'files', 'changes', 'sessions', 'session-inspect', 'setup', 'skill', 'officemap', 'mailbox', 'debug', 'design-gallery', 'refresh-debug', 'analytics', 'codemap', 'techstack', 'chronicle', 'intake', 'deadcode'];
|
|
8
8
|
type View = (typeof VIEWS)[number];
|
|
9
9
|
/** Coerce an arbitrary value onto the current view union. Used by migrate
|
|
10
10
|
* when reading from localStorage so a stale value (e.g. 'context', a view
|
|
@@ -17,6 +17,14 @@ export declare const SIDEBAR_DEFAULT_WIDTH = 304;
|
|
|
17
17
|
/** Sections of the WorkspaceDock strip above the chat transcript. */
|
|
18
18
|
export type DockSection = 'goal' | 'goal-state' | 'fleet' | 'work' | 'worktrees' | 'collab';
|
|
19
19
|
export type WorkDashboardTab = 'todos' | 'tasks' | 'plan';
|
|
20
|
+
/**
|
|
21
|
+
* Tabs of the global right inspector drawer.
|
|
22
|
+
*
|
|
23
|
+
* `council` is the live Brain council panel log — the most expensive Brain
|
|
24
|
+
* tier (one provider call per seat) and, until it got a tab, the only one with
|
|
25
|
+
* no observable surface at all.
|
|
26
|
+
*/
|
|
27
|
+
export type InspectorTab = 'fleet' | 'agents' | 'sideEffects' | 'council';
|
|
20
28
|
interface UIState {
|
|
21
29
|
sidebarOpen: boolean;
|
|
22
30
|
/** Which activity icon is selected in the ActivityBar — controls secondary panel content. */
|
|
@@ -74,7 +82,7 @@ interface UIState {
|
|
|
74
82
|
/** Global right inspector drawer open (non-modal overlay on desktop). */
|
|
75
83
|
inspectorOpen: boolean;
|
|
76
84
|
/** Active tab inside the global right inspector drawer. */
|
|
77
|
-
inspectorTab:
|
|
85
|
+
inspectorTab: InspectorTab;
|
|
78
86
|
/** Agent ID to focus when opening the inspector on the agents tab. Cleared on read. */
|
|
79
87
|
inspectorFocusedAgentId: string | null;
|
|
80
88
|
/** Process Monitor overlay — triggered by /kill slash command. */
|
|
@@ -83,6 +91,8 @@ interface UIState {
|
|
|
83
91
|
queuePanelOpen: boolean;
|
|
84
92
|
/** Cron Jobs overlay — triggered by /cron slash command. */
|
|
85
93
|
cronJobsOpen: boolean;
|
|
94
|
+
/** Session ID currently being inspected (session-inspect view). */
|
|
95
|
+
inspectSessionId: string | null;
|
|
86
96
|
/** Integrated terminal bottom-dock — toggled by Ctrl+` or /terminal. */
|
|
87
97
|
terminalOpen: boolean;
|
|
88
98
|
/** Monotonic signal consumed by TerminalPanel to create another PTY tab. */
|
|
@@ -98,6 +108,8 @@ interface UIState {
|
|
|
98
108
|
setProcessMonitorOpen: (open: boolean) => void;
|
|
99
109
|
setQueuePanelOpen: (open: boolean) => void;
|
|
100
110
|
setCronJobsOpen: (open: boolean) => void;
|
|
111
|
+
setInspectSession: (id: string) => void;
|
|
112
|
+
clearInspectSession: () => void;
|
|
101
113
|
setTerminalOpen: (open: boolean) => void;
|
|
102
114
|
toggleTerminal: () => void;
|
|
103
115
|
requestTerminalCreate: () => void;
|
|
@@ -224,7 +236,7 @@ interface UIState {
|
|
|
224
236
|
setFleetMonitorOpen: (open: boolean) => void;
|
|
225
237
|
setAgentsMonitorOpen: (open: boolean) => void;
|
|
226
238
|
setInspectorOpen: (open: boolean) => void;
|
|
227
|
-
setInspectorTab: (tab:
|
|
239
|
+
setInspectorTab: (tab: InspectorTab) => void;
|
|
228
240
|
setInspectorFocusedAgentId: (id: string | null) => void;
|
|
229
241
|
toggleInspector: () => void;
|
|
230
242
|
}
|
|
@@ -246,7 +258,7 @@ export declare const useUIStore: import("zustand").UseBoundStore<Omit<import("zu
|
|
|
246
258
|
hiddenChips: DockSection[];
|
|
247
259
|
workDashboardTab: WorkDashboardTab;
|
|
248
260
|
inspectorOpen: boolean;
|
|
249
|
-
inspectorTab:
|
|
261
|
+
inspectorTab: InspectorTab;
|
|
250
262
|
skillsState: {
|
|
251
263
|
/** The skill currently shown in the detail pane. */
|
|
252
264
|
selectedSkill: {
|
|
@@ -281,7 +293,7 @@ export declare const useUIStore: import("zustand").UseBoundStore<Omit<import("zu
|
|
|
281
293
|
/** Number of installed skills with a newer ref available than knownRefs. */
|
|
282
294
|
updateAvailableCount: number;
|
|
283
295
|
};
|
|
284
|
-
currentView: "analytics" | "changes" | "chat" | "chronicle" | "codemap" | "context" | "deadcode" | "debug" | "design-gallery" | "files" | "goal" | "kanban" | "mailbox" | "memory" | "officemap" | "refresh-debug" | "roster" | "sddhub" | "sessions" | "settings" | "setup" | "skill" | "techstack";
|
|
296
|
+
currentView: "analytics" | "changes" | "chat" | "chronicle" | "codemap" | "context" | "deadcode" | "debug" | "design-gallery" | "files" | "goal" | "intake" | "kanban" | "mailbox" | "memory" | "officemap" | "refresh-debug" | "roster" | "sddhub" | "session-inspect" | "sessions" | "settings" | "setup" | "skill" | "techstack";
|
|
285
297
|
dockSection: DockSection | null;
|
|
286
298
|
settingsActiveTab: string;
|
|
287
299
|
scrollPositions: Record<string, number>;
|
|
@@ -306,7 +318,7 @@ export declare const useUIStore: import("zustand").UseBoundStore<Omit<import("zu
|
|
|
306
318
|
hiddenChips: DockSection[];
|
|
307
319
|
workDashboardTab: WorkDashboardTab;
|
|
308
320
|
inspectorOpen: boolean;
|
|
309
|
-
inspectorTab:
|
|
321
|
+
inspectorTab: InspectorTab;
|
|
310
322
|
skillsState: {
|
|
311
323
|
/** The skill currently shown in the detail pane. */
|
|
312
324
|
selectedSkill: {
|
|
@@ -341,7 +353,7 @@ export declare const useUIStore: import("zustand").UseBoundStore<Omit<import("zu
|
|
|
341
353
|
/** Number of installed skills with a newer ref available than knownRefs. */
|
|
342
354
|
updateAvailableCount: number;
|
|
343
355
|
};
|
|
344
|
-
currentView: "analytics" | "changes" | "chat" | "chronicle" | "codemap" | "context" | "deadcode" | "debug" | "design-gallery" | "files" | "goal" | "kanban" | "mailbox" | "memory" | "officemap" | "refresh-debug" | "roster" | "sddhub" | "sessions" | "settings" | "setup" | "skill" | "techstack";
|
|
356
|
+
currentView: "analytics" | "changes" | "chat" | "chronicle" | "codemap" | "context" | "deadcode" | "debug" | "design-gallery" | "files" | "goal" | "intake" | "kanban" | "mailbox" | "memory" | "officemap" | "refresh-debug" | "roster" | "sddhub" | "session-inspect" | "sessions" | "settings" | "setup" | "skill" | "techstack";
|
|
345
357
|
dockSection: DockSection | null;
|
|
346
358
|
settingsActiveTab: string;
|
|
347
359
|
scrollPositions: Record<string, number>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Every event is typed with a `vizKind` for the renderer to pattern-match on.
|
|
7
7
|
*/
|
|
8
8
|
/** Categories the cinematic renderer understands. */
|
|
9
|
-
export type VizEventKind = 'provider:call' | 'provider:delta' | 'provider:response' | 'agent:spawned' | 'agent:tool' | 'agent:status' | 'agent:ctx' | 'agent:text' | 'tool:started' | 'tool:executed' | 'tool:progress' | 'mailbox:send' | 'mailbox:deliver' | 'collab:event' | 'memory:event' | 'session:start' | 'session:end' | 'iteration:start' | 'iteration:end' | 'eternal:iteration' | 'error' | 'context:compacted' | 'context:repaired' | 'budget:warning' | 'budget:extended' | 'cost:update' | 'fleet:snapshot';
|
|
9
|
+
export type VizEventKind = 'provider:call' | 'provider:delta' | 'provider:response' | 'agent:spawned' | 'agent:tool' | 'agent:status' | 'agent:ctx' | 'agent:text' | 'tool:started' | 'tool:executed' | 'tool:progress' | 'mailbox:send' | 'mailbox:deliver' | 'collab:event' | 'memory:event' | 'brain:council_vote' | 'session:start' | 'session:end' | 'iteration:start' | 'iteration:end' | 'eternal:iteration' | 'error' | 'context:compacted' | 'context:repaired' | 'budget:warning' | 'budget:extended' | 'cost:update' | 'fleet:snapshot';
|
|
10
10
|
export interface VizEvent {
|
|
11
11
|
id: string;
|
|
12
12
|
kind: VizEventKind;
|
package/dist/types/brain.d.ts
CHANGED
|
@@ -134,6 +134,14 @@ export interface BrainCouncilSeatWire {
|
|
|
134
134
|
persona: string;
|
|
135
135
|
veto?: boolean | undefined;
|
|
136
136
|
}
|
|
137
|
+
/** One selectable Council decision lens, published from the server's registry. */
|
|
138
|
+
export interface BrainCouncilPersonaWire {
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
description: string;
|
|
142
|
+
/** Seats using this lens get veto power unless the seat overrides it. */
|
|
143
|
+
defaultVeto?: boolean | undefined;
|
|
144
|
+
}
|
|
137
145
|
/** Headless escalation variant. */
|
|
138
146
|
export type BrainTerminalPolicyWire = 'conservative' | 'deny-all' | 'continue-on-recommended';
|
|
139
147
|
/** JSON-safe snapshot of the live Brain config (mirrors core's BrainConfigSnapshot). */
|
|
@@ -159,6 +167,13 @@ export interface BrainConfigWire {
|
|
|
159
167
|
judgeMaxTokens?: number | undefined;
|
|
160
168
|
seats: BrainCouncilSeatWire[];
|
|
161
169
|
};
|
|
170
|
+
/**
|
|
171
|
+
* Decision lenses the server's Council persona registry offers. Optional so
|
|
172
|
+
* an older server still renders: the section then falls back to the three
|
|
173
|
+
* lenses it used to hard-code, which is what hid `security`, `maintainer`
|
|
174
|
+
* and `user-advocate` from every surface.
|
|
175
|
+
*/
|
|
176
|
+
personaCatalog?: BrainCouncilPersonaWire[] | undefined;
|
|
162
177
|
ledger: {
|
|
163
178
|
enabled: boolean;
|
|
164
179
|
autoDenyAfterFailures?: number | undefined;
|
|
@@ -332,6 +332,11 @@ export type WSClientMessageCore = WSUserMessage | WSToolConfirmResult | {
|
|
|
332
332
|
payload: {
|
|
333
333
|
id: string;
|
|
334
334
|
} & SessionScopedPayload;
|
|
335
|
+
} | {
|
|
336
|
+
type: 'session.inspect';
|
|
337
|
+
payload: {
|
|
338
|
+
id: string;
|
|
339
|
+
};
|
|
335
340
|
} | {
|
|
336
341
|
type: 'session.new';
|
|
337
342
|
payload?: SessionScopedPayload;
|
|
@@ -7,7 +7,7 @@ import type { SessionScopedPayload, WSCodeMapToolExecuted, WSCodeMapToolStarted,
|
|
|
7
7
|
import type { WSCompactionFailed, WSContextCompacted, WSContextDebug, WSContextEditorApplied, WSContextEditorSnapshot, WSContextEditorValidation, WSContextMaxContext, WSContextModeChanged, WSContextModesList, WSContextPct, WSContextRepaired, WSDelegateCompleted, WSDelegateStarted, WSError, WSMemoryList, WSSessionStats, WSTokenCostEstimateUnavailable, WSTokenThreshold, WSToolConfirmNeeded, WSToolLoopDetected, WSToolsList, WSTrustPersisted } from './runtime.js';
|
|
8
8
|
import type { WSMemorySageBackfillRecoverable, WSMemorySageCandidateResolve, WSMemorySageDelete, WSMemorySageForFile, WSMemorySageGet, WSMemorySageGraph, WSMemorySageList, WSMemorySageListPage, WSMemorySageRecover, WSMemorySageRemember, WSMemorySageUpdate } from './sage.js';
|
|
9
9
|
import type { WSDesignList, WSDesignMaterialize, WSDesignSet, WSDesignState, WSDesignSwap, WSDesignTune, WSDesignUse, WSDesignVerify, WSSkillContent, WSSkillsCreated, WSSkillsEdited, WSSkillsExported, WSSkillsInstalled, WSSkillsList, WSSkillsUninstalled, WSSkillsUpdated } from './skills-design.js';
|
|
10
|
-
import type { WSAuthOAuthStatus, WSCatalogModelSearchResult, WSCompletionResult, WSDiagGet, WSFilesList, WSKeyOperationResult, WSModelSwitchResult, WSProviderCatalog, WSProviderModels, WSProviderProbe, WSSavedProviders, WSSessionsList, WSSideEffects, WSStatsGet, WSTodosCleared, WSTodosUpdated } from './system.js';
|
|
10
|
+
import type { WSAuthOAuthStatus, WSCatalogModelSearchResult, WSCompletionResult, WSDiagGet, WSFilesList, WSKeyOperationResult, WSModelSwitchResult, WSProviderCatalog, WSProviderModels, WSProviderProbe, WSSavedProviders, WSSessionsList, WSSessionInspect, WSSideEffects, WSStatsGet, WSTodosCleared, WSTodosUpdated } from './system.js';
|
|
11
11
|
export type WSServerMessage = WSSessionStart | WSSessionEnd | WSTextDelta | WSThinkingDelta | WSToolUseStart | WSToolProgress | WSToolExecuted | WSCodeMapToolStarted | WSCodeMapToolExecuted | WSIterationStarted | WSIterationCompleted | WSIterationLimitReached | WSProviderResponse | WSProviderRetry | WSProviderError | WSProviderFallback | WSProviderStatusChanged | WSProviderStatusSnapshot | WSProviderActiveBlocked | WSProviderStreamError | WSRunResult | WSSessionStats | WSError | WSToolConfirmNeeded | WSTrustPersisted | WSToolLoopDetected | WSDelegateStarted | WSDelegateCompleted | WSContextDebug | WSContextCompacted | WSCompactionFailed | WSContextRepaired | WSContextEditorSnapshot | WSContextEditorValidation | WSContextEditorApplied | WSContextPct | WSContextMaxContext | WSTokenThreshold | WSTokenCostEstimateUnavailable | WSContextModesList | WSContextModeChanged | WSToolsList | WSMemoryList | WSMemorySageList | WSMemorySageListPage | WSMemorySageGet | WSMemorySageGraph | WSMemorySageUpdate | WSMemorySageRemember | WSMemorySageDelete | WSMemorySageRecover | WSMemorySageCandidateResolve | WSMemorySageBackfillRecoverable | WSMemorySageForFile | WSSkillsList | WSSkillContent | WSDesignList | WSDesignUse | WSDesignState | WSDesignSet | WSDesignTune | WSDesignSwap | WSDesignMaterialize | WSDesignVerify | WSSkillsInstalled | WSSkillsUninstalled | WSSkillsUpdated | WSSkillsCreated | WSSkillsEdited | WSSkillsExported | WSDiagGet | WSStatsGet | {
|
|
12
12
|
type: 'connections.health_result';
|
|
13
13
|
payload: ConnectionsHealthReport;
|
|
@@ -55,7 +55,7 @@ export type WSServerMessage = WSSessionStart | WSSessionEnd | WSTextDelta | WSTh
|
|
|
55
55
|
payload: {
|
|
56
56
|
message: string;
|
|
57
57
|
};
|
|
58
|
-
} | WSSessionsList | WSProviderCatalog | WSCatalogModelSearchResult | WSProviderModels | WSSavedProviders | {
|
|
58
|
+
} | WSSessionsList | WSSessionInspect | WSProviderCatalog | WSCatalogModelSearchResult | WSProviderModels | WSSavedProviders | {
|
|
59
59
|
type: 'codebase.index.server.shutdown_result';
|
|
60
60
|
payload: {
|
|
61
61
|
requestId?: string | undefined;
|
package/dist/types/system.d.ts
CHANGED
|
@@ -91,6 +91,41 @@ export interface WSSessionsList {
|
|
|
91
91
|
error?: string | undefined;
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
+
export interface WSSessionInspect {
|
|
95
|
+
type: 'session.inspect';
|
|
96
|
+
payload: {
|
|
97
|
+
id: string;
|
|
98
|
+
title?: string | undefined;
|
|
99
|
+
name?: string | undefined;
|
|
100
|
+
model?: string | undefined;
|
|
101
|
+
provider?: string | undefined;
|
|
102
|
+
startedAt?: string | undefined;
|
|
103
|
+
endedAt?: string | undefined;
|
|
104
|
+
tokenTotal?: number | undefined;
|
|
105
|
+
outcome?: 'completed' | 'error' | 'timeout' | 'aborted' | undefined;
|
|
106
|
+
messageCount?: number | undefined;
|
|
107
|
+
iterationCount?: number | undefined;
|
|
108
|
+
toolCallCount?: number | undefined;
|
|
109
|
+
toolErrorCount?: number | undefined;
|
|
110
|
+
fileChangeCount?: number | undefined;
|
|
111
|
+
compactionCount?: number | undefined;
|
|
112
|
+
toolBreakdown?: Record<string, number> | undefined;
|
|
113
|
+
events?: Array<{
|
|
114
|
+
ts: string;
|
|
115
|
+
type: string;
|
|
116
|
+
label: string;
|
|
117
|
+
detail: string;
|
|
118
|
+
}> | undefined;
|
|
119
|
+
fileEvents?: Array<{
|
|
120
|
+
operation: string;
|
|
121
|
+
filePath: string;
|
|
122
|
+
toolName: string;
|
|
123
|
+
ts: string;
|
|
124
|
+
}> | undefined;
|
|
125
|
+
lastUserMessage?: string | undefined;
|
|
126
|
+
error?: string | undefined;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
94
129
|
export interface WSProviderCatalog {
|
|
95
130
|
type: 'provider.catalog';
|
|
96
131
|
payload: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/webui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.299.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Browser-based WebUI for WrongStack — React + Vite frontend. The WebSocket backend lives in the separate @wrongstack/webui-server package (extracted in PR #018b to remove the CLI -> @wrongstack/webui/server cross-package edge).",
|
|
6
6
|
"keywords": [
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
"tailwind-merge": "^3.6.0",
|
|
77
77
|
"virtua": "^0.49.3",
|
|
78
78
|
"zustand": "^5.0.14",
|
|
79
|
-
"@wrongstack/
|
|
80
|
-
"@wrongstack/
|
|
81
|
-
"@wrongstack/
|
|
82
|
-
"@wrongstack/
|
|
83
|
-
"@wrongstack/
|
|
84
|
-
"@wrongstack/
|
|
79
|
+
"@wrongstack/core": "0.299.0",
|
|
80
|
+
"@wrongstack/providers": "0.299.0",
|
|
81
|
+
"@wrongstack/plugins": "0.299.0",
|
|
82
|
+
"@wrongstack/webui-server": "0.299.0",
|
|
83
|
+
"@wrongstack/kanban": "0.299.0",
|
|
84
|
+
"@wrongstack/tools": "0.299.0"
|
|
85
85
|
},
|
|
86
86
|
"optionalDependencies": {
|
|
87
87
|
"node-pty": "1.2.0-beta.14"
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"typescript": "^7.0.2",
|
|
104
104
|
"vite": "^8.1.5",
|
|
105
105
|
"vitest": "^4.1.10",
|
|
106
|
-
"@wrongstack/sdd": "0.
|
|
106
|
+
"@wrongstack/sdd": "0.299.0"
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|
|
109
109
|
"dev": "vite",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Ci as t,Ia as n,Xi as r,b as i,cn as a,ei as o,gn as s,ja as c,ln as l,lt as u,nr as d}from"./vendor-CxV3l5PQ.js";import"./i18n-DxnYsmc-.js";import{a as f,n as p,t as m}from"./monaco-BLUV5g0U.js";import{t as h}from"./ws-client-Cy3oRAmZ.js";import{t as g}from"./utils-_s0GyctV.js";import{M as _,g as v}from"./stores-BS-Bdi-5.js";import{b as y}from"./index-Bf75VrDE.js";import{t as b}from"./empty-state-02bIS4x7.js";import{t as x}from"./monaco-theme-DSeCDzQy.js";var S=e(n(),1),C=u();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}=c(),s=(0,S.useRef)(null),[l,u]=(0,S.useState)(!1),[p,m]=(0,S.useState)(!1),[g,v]=(0,S.useState)(null);(0,S.useEffect)(()=>{u(!1),m(!1),v(null)},[]);let y=(0,S.useCallback)(e=>{s.current=e,f.setTheme(x()),e.getModifiedEditor().onDidChangeModelContent(()=>u(!0))},[]),b=(0,S.useCallback)(()=>{let t=s.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&&(u(!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)(d,{className:`h-3.5 w-3.5 animate-spin`}):g&&!l?(0,C.jsx)(r,{className:`h-3.5 w-3.5 text-success`}):(0,C.jsx)(a,{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)(i,{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:n}=c(),r=v(e=>e.selectedPath),i=v(e=>e.diff),a=v(e=>e.loadingDiff),[u,f]=(0,S.useState)(`unified`),[p,m]=(0,S.useState)(!1),x=!!r&&(a||!i);(0,S.useEffect)(()=>{if(m(!1),!x)return;let e=setTimeout(()=>m(!0),D);return()=>clearTimeout(e)},[x,r]);let w=()=>{r&&(m(!1),v.getState().setDiffLoading(!0),h(_.getState().wsUrl).getGitDiff?.(r))};if(!r)return(0,C.jsx)(b,{icon:(0,C.jsx)(o,{className:`h-6 w-6`}),title:`Source changes`,description:n(`activity:changes.selectPrompt`),className:e});let T=i&&!i.error&&!i.binary&&!i.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:`Source control`}),(0,C.jsx)(`div`,{className:`truncate font-mono text-xs text-foreground`,title:r,children:r})]}),T&&(0,C.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>f(`unified`),title:n(`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)(l,{className:`h-3.5 w-3.5`}),` `,n(`activity:changes.unified`)]}),(0,C.jsxs)(`button`,{type:`button`,onClick:()=>f(`edit`),title:n(`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)(t,{className:`h-3.5 w-3.5`}),` `,n(`activity:changes.edit`)]})]})]}),(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:a||!i?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:n(`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)(s,{className:`h-3.5 w-3.5`}),` `,n(`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)(d,{className:`h-4 w-4 animate-spin`}),` `,n(`activity:changes.loadingDiff`)]}):i.error?(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-destructive`,children:i.error}):i.binary?(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:changes.binary`)}):i.tooLarge?(0,C.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:changes.tooLarge`)}):u===`edit`?(0,C.jsx)(E,{path:i.path,oldText:i.oldText??``,newText:i.newText??``},i.path):(0,C.jsx)(y,{oldText:i.oldText,newText:i.newText,caption:i.path,fill:!0})})]})})}export{O as ChangesView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Fr as t,Ia as n,Oi as r,Ot as i,Ta as a,Vt as o,Zt as s,an as c,cr as l,dt as u,fn as ee,gn as te,hi as d,jr as f,lt as p,oa as m,qi as h,ra as g,ri as _}from"./vendor-CxV3l5PQ.js";import{t as ne}from"./ws-client-Cy3oRAmZ.js";import{t as v}from"./utils-_s0GyctV.js";import{C as y,S as re}from"./index-Bf75VrDE.js";var b=e(n(),1),x=p();function ie({status:e}){return(0,x.jsxs)(`section`,{className:`flex flex-wrap gap-x-5 gap-y-1 border-b border-border/60 bg-primary/[0.025] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,title:e.chronicleDirectory,children:[(0,x.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-primary`,children:`Chronicle ownership`}),(0,x.jsxs)(`span`,{children:[`collect `,(0,x.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.collection})]}),(0,x.jsxs)(`span`,{children:[`process `,(0,x.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.processing})]}),(0,x.jsxs)(`span`,{children:[`serve `,(0,x.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.serving})]}),(0,x.jsxs)(`span`,{children:[`PID `,(0,x.jsx)(`b`,{className:`text-foreground`,children:e.pid}),` · `,e.clients,` clients`]}),(0,x.jsxs)(`span`,{children:[`watcher`,` `,(0,x.jsx)(`b`,{className:v(e.watcher.active?`text-success`:`text-warning`),children:e.watcher.active?`active`:`inactive`}),` `,`· `,e.watcher.watchedFiles,` files`]}),(0,x.jsxs)(`span`,{children:[`store `,(0,x.jsx)(`b`,{className:`text-foreground`,children:S(e.pipeline.storage)})]}),e.mode===`inline`&&(0,x.jsx)(`span`,{className:`font-sans font-semibold text-warning`,children:`INLINE FALLBACK`})]})}function S(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).slice(-3).join(`/`)}var C=[`eventType`,`providerId`,`modelId`,`outcome`,`resourceKind`],w=1440*60*1e3;function T(){return{limit:300,order:`desc`,from:new Date(Date.now()-w).toISOString()}}var ae=[{id:`all`,label:`All signals`,icon:(0,x.jsx)(a,{})},{id:`llm`,label:`LLM`,icon:(0,x.jsx)(g,{})},{id:`agents`,label:`Agents`,icon:(0,x.jsx)(m,{})},{id:`tools`,label:`Tools`,icon:(0,x.jsx)(o,{})},{id:`files`,label:`Files`,icon:(0,x.jsx)(_,{})},{id:`failures`,label:`Failures`,icon:(0,x.jsx)(i,{})}];function E(){let e=ne(),[n,i]=(0,b.useState)([]),[a,s]=(0,b.useState)(null),[d,f]=(0,b.useState)({}),[p,h]=(0,b.useState)(T()),[S,w]=(0,b.useState)({text:``,path:``,providerId:``,modelId:``,sessionId:``}),[E,D]=(0,b.useState)(`all`),[k,P]=(0,b.useState)({total:0,scannedEvents:0,sourceFiles:0,invalidLines:0}),[I,de]=(0,b.useState)(O),[L,R]=(0,b.useState)(!0),[z,B]=(0,b.useState)(null),[V,H]=(0,b.useState)(null),[U,fe]=(0,b.useState)([]),[W,pe]=(0,b.useState)([]),[G,me]=(0,b.useState)(null),K=(0,b.useCallback)(t=>{if(!e.supportsCapability(`chronicle.query`)){R(!1),B(`Restart the backend once to activate Chronicle protocol support.`);return}if(R(!0),B(null),h(t),f({}),e.send({type:`chronicle.query`,payload:{query:t}}),e.supportsCapability(`chronicle.facets`))e.send({type:`chronicle.facets`,payload:{fields:[...C],query:t,limit:12}});else for(let n of C)e.send({type:`chronicle.facet`,payload:{field:n,query:t,limit:12}})},[e]),q=(0,b.useCallback)(()=>{e.supportsCapability(`chronicle.metrics`)&&(e.send({type:`chronicle.metrics`,payload:{view:`providers`}}),e.send({type:`chronicle.metrics`,payload:{view:`tasks`,limit:200}}))},[e]),J=(0,b.useCallback)(()=>{e.supportsCapability(`chronicle.status`)&&e.send({type:`chronicle.status`})},[e]);(0,b.useEffect)(()=>{let t=e.on(`chronicle.query_result`,e=>{e.type===`chronicle.query_result`&&(i(e.payload.events),P(e.payload),de(e.payload.summary??O),R(!1))}),n=e.on(`chronicle.facet_result`,e=>{e.type===`chronicle.facet_result`&&f(t=>({...t,[e.payload.field]:e.payload.values}))}),r=e.on(`chronicle.facets_result`,e=>{e.type===`chronicle.facets_result`&&f(e.payload.values)}),a=e.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(B(e.payload.message),R(!1))}),o=e.on(`chronicle.graph_result`,e=>{e.type===`chronicle.graph_result`&&H(e.payload)}),s=e.on(`chronicle.metrics_result`,e=>{e.type===`chronicle.metrics_result`&&(e.payload.view===`providers`?fe(e.payload.data):e.payload.view===`tasks`&&pe(e.payload.data))}),c=e.on(`chronicle.status_result`,e=>{e.type===`chronicle.status_result`&&me(e.payload)});return K(T()),q(),J(),()=>{t(),n(),r(),a(),o(),s(),c()}},[e,K,q,J]);let Y=(0,b.useMemo)(()=>n.filter(e=>ce(e,E)),[n,E]),X=y(Y,25,E),Z=(0,b.useMemo)(()=>{let e=n.find(e=>e.eventType===`metrics.rollup`&&e.attributes?.signal===`runtime.health`)?.attributes?.stats;if(!e)return;let t=t=>e[t]?.last;return{eventLoop:{utilization:t(`eventLoop.utilization`),delayP95Ms:t(`eventLoop.delayP95Ms`)},memory:{heapUsedBytes:t(`memory.heapUsedBytes`)},chronicle:{pendingEvents:t(`chronicle.pendingEvents`),rejectedEvents:t(`chronicle.rejectedEvents`)}}},[n]),Q=(0,b.useMemo)(()=>{let e={};for(let t of W)e[t.status]=(e[t.status]??0)+1;let t=(e.completed??0)+(e.merged??0)+(e.failed??0)+(e.conflict??0),n=(e.completed??0)+(e.merged??0),r=[...W].sort((e,t)=>(t.endedAt??t.startedAt??``).localeCompare(e.endedAt??e.startedAt??``)).slice(0,8);return{counts:e,total:W.length,terminal:t,successRate:t>0?n/t*100:100,recent:r}},[W]),$=()=>K({...T(),...S.text?{text:S.text}:{},...S.path?{path:S.path}:{},...S.providerId?{providerId:S.providerId}:{},...S.modelId?{modelId:S.modelId}:{},...S.sessionId?{sessionId:S.sessionId}:{}}),he=()=>{w({text:``,path:``,providerId:``,modelId:``,sessionId:``}),D(`all`),K(T())},ge=t=>{s(t),H(null),e.supportsCapability(`chronicle.graph`)&&e.send({type:`chronicle.graph`,payload:{seed:{eventId:t.eventId},hops:2,maxNodes:250}})};return(0,x.jsxs)(`div`,{className:`flex h-full min-h-0 bg-background`,"data-testid":`chronicle-dashboard`,children:[(0,x.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,x.jsx)(`header`,{className:`border-b border-border/70 bg-gradient-to-r from-primary/[0.045] via-background to-background px-5 py-4`,children:(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(g,{className:`h-5 w-5 text-primary`}),(0,x.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Coding Intelligence`}),(0,x.jsx)(`span`,{className:`rounded-full border border-primary/20 bg-primary/10 px-2 py-0.5 text-[9px] font-semibold tracking-wider text-primary`,children:`CHRONICLE`})]}),(0,x.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`LLM, agent, tool and file evidence — connected from decision to code change.`})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:v(`h-2 w-2 rounded-full`,z?`bg-destructive`:L?`animate-pulse bg-warning`:`bg-success`)}),(0,x.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:L?`Reading journal`:z?`Unavailable`:`Live evidence`}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>{K(p),q(),J()},className:`ml-2 rounded-md border border-border bg-card p-2 hover:bg-muted`,title:`Refresh evidence`,children:(0,x.jsx)(te,{className:v(`h-4 w-4`,L&&`animate-spin`)})})]})]})}),(0,x.jsxs)(`section`,{className:`grid grid-cols-2 border-b border-border/70 xl:grid-cols-6`,children:[(0,x.jsx)(M,{icon:(0,x.jsx)(g,{}),label:`LLM requests`,value:I.logicalRequests,detail:`${I.modelAttempts} attempts · ${I.providers} providers · ${I.models} models`}),(0,x.jsx)(M,{icon:(0,x.jsx)(m,{}),label:`Agent work`,value:I.agentEvents,detail:`${I.uniqueAgents} correlated agents · ${I.decisions} decisions`}),(0,x.jsx)(M,{icon:(0,x.jsx)(o,{}),label:`Tool calls`,value:I.toolCalls,detail:`${I.failedTools} failed · ${I.processes} processes`}),(0,x.jsx)(M,{icon:(0,x.jsx)(_,{}),label:`File evidence`,value:I.fileEvents,detail:`${I.uniqueFiles} unique paths`}),(0,x.jsx)(M,{icon:(0,x.jsx)(ee,{}),label:`Retries`,value:I.scheduledRetries,detail:`${I.failures} failures · ${I.fallbacks} fallbacks`,tone:I.failures?`danger`:`normal`}),(0,x.jsx)(M,{icon:(0,x.jsx)(r,{}),label:`Provider p95`,value:A(I.providerP95DurationMs),detail:`${A(I.providerAvgDurationMs)} average · all matches`})]}),(0,x.jsxs)(`section`,{className:`flex flex-wrap gap-x-6 gap-y-1 border-b border-border/60 bg-primary/[0.018] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-primary`,children:`Token economics`}),(0,x.jsxs)(`span`,{children:[`fresh input `,(0,x.jsx)(`b`,{className:`text-foreground`,children:I.inputTokens.toLocaleString()})]}),(0,x.jsxs)(`span`,{children:[`output `,(0,x.jsx)(`b`,{className:`text-foreground`,children:I.outputTokens.toLocaleString()})]}),(0,x.jsxs)(`span`,{children:[`cache read `,(0,x.jsx)(`b`,{className:`text-foreground`,children:I.cacheReadTokens.toLocaleString()})]}),(0,x.jsxs)(`span`,{children:[`cache write`,` `,(0,x.jsx)(`b`,{className:`text-foreground`,children:I.cacheWriteTokens.toLocaleString()})]}),(0,x.jsxs)(`span`,{children:[`cache hit `,(0,x.jsxs)(`b`,{className:`text-foreground`,children:[se(I).toFixed(1),`%`]})]}),(0,x.jsxs)(`span`,{children:[`estimated cost `,(0,x.jsxs)(`b`,{className:`text-foreground`,children:[`$`,I.estimatedCostUsd.toFixed(4)]})]})]}),U.length>0&&(0,x.jsxs)(`section`,{className:`flex items-center gap-3 overflow-x-auto border-b border-border/60 bg-muted/[0.14] px-4 py-1.5`,children:[(0,x.jsx)(`span`,{className:`shrink-0 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Model reliability`}),U.slice(0,6).map(e=>{let t=e.completed+e.failed,n=t>0?e.completed/t*100:100;return(0,x.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 rounded-full border border-border bg-card px-2.5 py-0.5 font-mono text-[9px]`,title:`${e.day} · ${e.attempts} attempts · avg ${A(e.avgDurationMs)} · ${e.inputTokens.toLocaleString()} in / ${e.outputTokens.toLocaleString()} out`,children:[(0,x.jsx)(`span`,{className:v(`h-1.5 w-1.5 rounded-full`,n>=99?`bg-success`:n>=90?`bg-warning`:`bg-destructive`)}),(0,x.jsxs)(`span`,{className:`max-w-[180px] truncate`,children:[e.providerId,`/`,e.modelId]}),(0,x.jsxs)(`b`,{className:`text-foreground`,children:[n.toFixed(0),`%`]}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:e.day.slice(5)})]},`${e.day}-${e.providerId}-${e.modelId}`)})]}),Q.total>0&&(0,x.jsxs)(`section`,{className:`flex items-center gap-3 overflow-x-auto border-b border-border/60 bg-muted/[0.10] px-4 py-1.5`,children:[(0,x.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,x.jsx)(l,{className:`h-3 w-3`}),`Task outcomes`]}),(0,x.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 rounded-full border border-border bg-card px-2.5 py-0.5 font-mono text-[9px]`,title:`${Q.total} tasks tracked · ${Q.terminal} finished`,children:[(0,x.jsx)(`span`,{className:v(`h-1.5 w-1.5 rounded-full`,Q.successRate>=90?`bg-success`:Q.successRate>=60?`bg-warning`:`bg-destructive`)}),(0,x.jsxs)(`b`,{className:`text-foreground`,children:[Q.successRate.toFixed(0),`%`]}),(0,x.jsxs)(`span`,{className:`text-muted-foreground`,children:[`success · `,Q.total,` tasks`]})]}),[`completed`,`merged`,`failed`,`conflict`,`started`].filter(e=>Q.counts[e]).map(e=>(0,x.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-muted-foreground`,children:[e,` `,(0,x.jsx)(`b`,{className:v(e===`failed`||e===`conflict`?`text-destructive`:`text-foreground`),children:Q.counts[e]})]},e)),(0,x.jsx)(`span`,{className:`mx-1 h-3 w-px shrink-0 bg-border`}),Q.recent.map(e=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>K({limit:300,order:`desc`,taskId:e.taskId}),className:`flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-card px-2 py-0.5 font-mono text-[9px] hover:border-primary/50`,title:`${e.taskId}${e.boardId?` · board ${e.boardId}`:``}${e.sessionId?` · ${e.sessionId}`:``} · ${e.filesTouched} files${e.retries?` · ${e.retries} retries`:``}${e.verificationFailures?` · ${e.verificationFailures} verify-fails`:``}`,children:[(0,x.jsx)(`span`,{className:v(`h-1.5 w-1.5 rounded-full`,e.status===`completed`||e.status===`merged`?`bg-success`:e.status===`failed`||e.status===`conflict`?`bg-destructive`:`bg-primary`)}),(0,x.jsx)(`span`,{className:`max-w-[84px] truncate`,children:e.taskId}),e.durationMs!==null&&(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:A(e.durationMs)}),e.filesTouched>0&&(0,x.jsxs)(`span`,{className:`flex items-center gap-0.5 text-muted-foreground`,children:[(0,x.jsx)(_,{className:`h-2.5 w-2.5`}),e.filesTouched]})]},e.taskId))]}),(0,x.jsx)(`section`,{className:`border-b border-border/70 px-4 py-3`,children:(0,x.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 xl:grid-cols-[1.35fr_1fr_1fr_1fr_1fr_auto]`,children:[(0,x.jsx)(j,{icon:(0,x.jsx)(c,{}),placeholder:`Search event evidence`,value:S.text,onChange:e=>w(t=>({...t,text:e})),onEnter:$}),(0,x.jsx)(j,{placeholder:`File or directory`,value:S.path,onChange:e=>w(t=>({...t,path:e})),onEnter:$}),(0,x.jsx)(j,{placeholder:`Provider`,value:S.providerId,onChange:e=>w(t=>({...t,providerId:e})),onEnter:$}),(0,x.jsx)(j,{placeholder:`Model`,value:S.modelId,onChange:e=>w(t=>({...t,modelId:e})),onEnter:$}),(0,x.jsx)(j,{placeholder:`Session`,value:S.sessionId,onChange:e=>w(t=>({...t,sessionId:e})),onEnter:$}),(0,x.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,x.jsxs)(`button`,{type:`button`,onClick:$,className:`rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground`,children:[(0,x.jsx)(t,{className:`mr-1 inline h-3 w-3`}),`Apply`]}),(0,x.jsx)(`button`,{type:`button`,onClick:he,className:`rounded-md border border-border px-2.5 text-xs hover:bg-muted`,children:`Clear`})]})]})}),(0,x.jsxs)(`section`,{className:`flex items-center gap-1 overflow-x-auto border-b border-border/70 px-4 py-2`,children:[ae.map(e=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>D(e.id),className:v(`flex shrink-0 items-center gap-1.5 rounded-md px-2.5 py-1.5 text-[11px] transition-colors [&>svg]:h-3.5 [&>svg]:w-3.5`,E===e.id?`bg-primary/10 font-medium text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[e.icon,e.label,(0,x.jsx)(`span`,{className:`ml-1 rounded bg-background/70 px-1 font-mono text-[9px]`,children:oe(I,e.id,k.total)})]},e.id)),(0,x.jsxs)(`div`,{className:`ml-auto hidden items-center gap-3 pl-4 text-[9px] text-muted-foreground lg:flex`,children:[(0,x.jsxs)(`span`,{children:[k.total.toLocaleString(),` matched`]}),(0,x.jsxs)(`span`,{children:[k.sourceFiles,` journal files`]}),k.invalidLines>0&&(0,x.jsxs)(`span`,{className:`text-warning`,children:[k.invalidLines,` invalid lines`]})]})]}),G&&(0,x.jsx)(ie,{status:G}),Z&&(0,x.jsx)(le,{health:Z}),(0,x.jsx)(`section`,{className:`flex gap-4 overflow-x-auto border-b border-border/60 bg-muted/[0.18] px-4 py-2`,children:[`providerId`,`modelId`,`outcome`].map(e=>(0,x.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,x.jsx)(`span`,{className:`mr-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e.replace(`Id`,``)}),(d[e]??[]).slice(0,4).map(t=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>K({...p,[e]:t.value}),className:`rounded-full border border-border bg-card px-2 py-0.5 text-[9px] hover:border-primary/50`,children:[t.value,` `,(0,x.jsx)(`b`,{children:t.count})]},t.value))]},e))}),(0,x.jsxs)(`div`,{className:`grid grid-cols-[92px_minmax(190px,1.25fr)_110px_minmax(180px,1fr)_minmax(140px,.8fr)_24px] gap-3 border-b border-border/60 bg-muted/20 px-4 py-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:`Time`}),(0,x.jsx)(`span`,{children:`Signal`}),(0,x.jsx)(`span`,{children:`Outcome`}),(0,x.jsx)(`span`,{children:`Model / agent`}),(0,x.jsx)(`span`,{children:`Resource`}),(0,x.jsx)(`span`,{})]}),(0,x.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:z?(0,x.jsx)(F,{text:z}):!L&&Y.length===0?(0,x.jsx)(F,{text:`No coding evidence matches these filters.`}):(0,x.jsx)(`div`,{className:`divide-y divide-border/40`,children:X.pageItems.map(e=>(0,x.jsx)(N,{event:e,active:a?.eventId===e.eventId,onClick:()=>ge(e)},e.eventId))})}),(0,x.jsx)(re,{page:X.page,pageSize:X.pageSize,totalItems:X.totalItems,onPageChange:X.setPage,itemLabel:`events`})]}),a&&(0,x.jsxs)(`aside`,{className:`w-[440px] max-w-[48vw] shrink-0 overflow-auto border-l border-border bg-card/60 shadow-[-12px_0_32px_hsl(var(--background)/.35)]`,children:[(0,x.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center justify-between border-b border-border bg-card/95 px-4 py-3 backdrop-blur`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`div`,{className:`text-xs font-semibold`,children:`Evidence & lineage`}),(0,x.jsxs)(`div`,{className:`mt-0.5 font-mono text-[9px] text-muted-foreground`,children:[`#`,a.sequence,` · `,a.eventId]})]}),(0,x.jsx)(`button`,{type:`button`,onClick:()=>s(null),className:`rounded p-1 hover:bg-muted`,children:(0,x.jsx)(u,{className:`h-4 w-4`})})]}),(0,x.jsx)(ue,{event:a,graph:V})]})]})}var D={llm:0,agent:0,tool:0,file:0,memory:0,task:0,decision:0,runtime:0},O={logicalRequests:0,modelAttempts:0,completedAttempts:0,failedAttempts:0,scheduledRetries:0,fallbacks:0,providers:0,models:0,inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0,estimatedCostUsd:0,providerAvgDurationMs:0,providerP95DurationMs:0,toolCalls:0,completedTools:0,failedTools:0,toolAvgDurationMs:0,processes:0,failedProcesses:0,fileEvents:0,uniqueFiles:0,agentEvents:0,uniqueAgents:0,decisions:0,escalations:0,failures:0,cancellations:0,families:{...D},failuresByFamily:{...D}};function oe(e,t,n){return t===`all`?n:t===`llm`?e.families.llm:t===`agents`?e.families.agent:t===`tools`?e.families.tool:t===`files`?e.families.file:e.failures}function se(e){let t=e.inputTokens+e.cacheReadTokens;return t?e.cacheReadTokens/t*100:0}function ce(e,t){return t===`all`?!0:t===`llm`?/^(provider|token|context|compaction)\./.test(e.eventType):t===`agents`?/^(agent|subagent|delegate|fleet|sdd)\./.test(e.eventType):t===`tools`?/^(tool|process|mcp|network)\./.test(e.eventType):t===`files`?e.resource?.kind===`file`||/^(file|worktree|storage)\./.test(e.eventType):e.outcome===`failure`||/(?:failed|error|retry|fallback|blocked|conflict)/i.test(e.eventType)}function k(e){if(!e)return`—`;let t=e/1e6;return t<1?`${(e/1e3).toFixed(0)}µs`:t<1e3?`${t.toFixed(1)}ms`:`${(t/1e3).toFixed(1)}s`}function A(e){return e?e<1?`${(e*1e3).toFixed(0)}µs`:e<1e3?`${e.toFixed(1)}ms`:`${(e/1e3).toFixed(1)}s`:`—`}function j({placeholder:e,value:t,onChange:n,onEnter:r,icon:i}){return(0,x.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-2 focus-within:border-primary/60`,children:[i&&(0,x.jsx)(`span`,{className:`text-muted-foreground [&>svg]:h-3.5 [&>svg]:w-3.5`,children:i}),(0,x.jsx)(`input`,{className:`w-full bg-transparent text-xs outline-none placeholder:text-muted-foreground/70`,placeholder:e,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r()}})]})}function M({icon:e,label:t,value:n,detail:r,tone:i=`normal`}){return(0,x.jsxs)(`div`,{className:`min-w-0 border-r border-border/60 px-4 py-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`text-primary [&>svg]:h-3.5 [&>svg]:w-3.5`,children:e}),t]}),(0,x.jsx)(`div`,{className:v(`mt-1 text-xl font-semibold tabular-nums`,i===`danger`&&`text-destructive`),children:typeof n==`number`?n.toLocaleString():n}),(0,x.jsx)(`div`,{className:`mt-0.5 truncate text-[9px] text-muted-foreground`,children:r})]})}function le({health:e}){return(0,x.jsxs)(`section`,{className:`flex flex-wrap gap-x-5 gap-y-1 border-b border-border/60 bg-success/[0.025] px-4 py-1.5 font-mono text-[9px] text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-success`,children:`Collector healthy`}),(0,x.jsxs)(`span`,{children:[`ELU`,` `,(0,x.jsxs)(`b`,{className:`text-foreground`,children:[((e.eventLoop?.utilization??0)*100).toFixed(1),`%`]})]}),(0,x.jsxs)(`span`,{children:[`p95 `,(0,x.jsxs)(`b`,{className:`text-foreground`,children:[(e.eventLoop?.delayP95Ms??0).toFixed(1),`ms`]})]}),(0,x.jsxs)(`span`,{children:[`heap`,` `,(0,x.jsxs)(`b`,{className:`text-foreground`,children:[((e.memory?.heapUsedBytes??0)/1048576).toFixed(0),`MB`]})]}),(0,x.jsxs)(`span`,{children:[`queue `,(0,x.jsx)(`b`,{className:`text-foreground`,children:e.chronicle?.pendingEvents??0})]}),(0,x.jsxs)(`span`,{children:[`dropped`,` `,(0,x.jsx)(`b`,{className:v((e.chronicle?.rejectedEvents??0)>0&&`text-destructive`),children:e.chronicle?.rejectedEvents??0})]})]})}function N({event:e,active:t,onClick:n}){let r=e.occurredAt??e.observedAt,i=e.runtime?.modelId??e.scope.agentId??e.runtime?.providerId??`—`,a=e.resource?.path??e.resource?.id??e.correlation.toolCallId??`—`;return(0,x.jsxs)(`button`,{type:`button`,onClick:n,className:v(`grid w-full grid-cols-[92px_minmax(190px,1.25fr)_110px_minmax(180px,1fr)_minmax(140px,.8fr)_24px] items-center gap-3 px-4 py-2.5 text-left hover:bg-muted/45`,t&&`bg-primary/[0.07]`),children:[(0,x.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(r).toLocaleTimeString()}),(0,x.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,x.jsx)(`span`,{className:v(`h-1.5 w-1.5 shrink-0 rounded-full`,e.outcome===`failure`?`bg-destructive`:e.outcome===`success`?`bg-success`:`bg-primary`)}),(0,x.jsx)(`span`,{className:`truncate font-mono text-[11px] font-medium`,children:e.eventType})]}),(0,x.jsx)(`span`,{className:v(`w-fit rounded px-1.5 py-0.5 text-[9px]`,I(e.outcome)),children:e.outcome??`unknown`}),(0,x.jsx)(`span`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:i}),(0,x.jsx)(`span`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:a}),(0,x.jsx)(h,{className:`h-3.5 w-3.5 text-muted-foreground`})]})}function ue({event:e,graph:t}){let n=(0,b.useMemo)(()=>[[`Scope`,e.scope],[`Correlation`,e.correlation],[`Runtime`,e.runtime],[`Resource`,e.resource],[`Attributes`,e.attributes],[`Tags`,e.tags]],[e]);return(0,x.jsxs)(`div`,{className:`p-4`,children:[(0,x.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/60 p-3`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(`span`,{className:v(`h-2 w-2 rounded-full`,e.outcome===`failure`?`bg-destructive`:e.outcome===`success`?`bg-success`:`bg-primary`)}),(0,x.jsx)(`span`,{className:`font-mono text-xs font-semibold`,children:e.eventType})]}),(0,x.jsxs)(`div`,{className:`mt-2 flex gap-4 text-[9px] text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:new Date(e.occurredAt??e.observedAt).toLocaleString()}),(0,x.jsx)(`span`,{children:k(Number(e.durationNs??0))})]})]}),(0,x.jsxs)(`div`,{className:`mb-4 grid grid-cols-2 gap-2`,children:[(0,x.jsx)(P,{icon:(0,x.jsx)(s,{}),label:`Evidence hash`,value:e.hash.slice(0,16)}),(0,x.jsx)(P,{icon:(0,x.jsx)(d,{}),label:`Sequence`,value:String(e.sequence)})]}),t&&(0,x.jsxs)(`section`,{className:`mb-4`,children:[(0,x.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,x.jsx)(f,{className:`h-3 w-3`}),`Lineage · `,t.nodes.length,` nodes · `,t.edges.length,` edges`]}),(0,x.jsx)(`div`,{className:`space-y-1 rounded-md border border-border bg-background/70 p-2`,children:t.edges.slice(0,40).map((e,n)=>(0,x.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[9px]`,children:[(0,x.jsx)(`span`,{className:v(`rounded px-1`,e.confidence===`explicit`?`bg-success/10 text-success`:e.confidence===`inferred`?`bg-warning/10 text-warning`:`bg-primary/10 text-primary`),children:e.confidence}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:e.kind}),(0,x.jsxs)(`span`,{className:`truncate`,children:[t.nodes.find(t=>t.eventId===e.from)?.eventType,` →`,` `,t.nodes.find(t=>t.eventId===e.to)?.eventType]})]},`${e.from}-${e.to}-${e.kind}-${n}`))}),t.truncated&&(0,x.jsx)(`p`,{className:`mt-1 text-[9px] text-warning`,children:`Lineage truncated at safety limit.`})]}),n.map(([e,t])=>t&&(0,x.jsxs)(`section`,{className:`mb-4`,children:[(0,x.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e}),(0,x.jsx)(`pre`,{className:`overflow-auto rounded-md border border-border bg-background/70 p-3 font-mono text-[9px] leading-relaxed`,children:JSON.stringify(t,null,2)})]},e))]})}function P({icon:e,label:t,value:n}){return(0,x.jsxs)(`div`,{className:`rounded-md border border-border p-2`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1 text-[8px] uppercase text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:`[&>svg]:h-3 [&>svg]:w-3`,children:e}),t]}),(0,x.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px]`,children:n})]})}function F({text:e}){return(0,x.jsx)(`div`,{className:`flex h-48 items-center justify-center text-sm text-muted-foreground`,children:e})}function I(e){return e===`failure`?`bg-destructive/10 text-destructive`:e===`success`?`bg-success/10 text-success`:e===`started`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`}export{E as ChronicleDashboard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{Bi as t,Ia as n,Ki as r,Mi as i,Qt as a,Ta as o,Vt as s,Yi as c,dt as l,ei as u,gn as d,ii as f,in as p,ja as m,jr as h,lt as g,nr as _,oa as v,qr as y,rr as b,y as x,yt as S}from"./vendor-CxV3l5PQ.js";import"./i18n-DxnYsmc-.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 ee}from"./ws-client-Cy3oRAmZ.js";import{t as k}from"./utils-_s0GyctV.js";import{i as te}from"./codemap-activity-store-B6n7KiS8.js";import{D as A,M as ne,k as j,o as re,u as ie}from"./stores-BS-Bdi-5.js";import{o as M}from"./view-navigation-DLdE7qHU.js";import{A as N,b as ae,x as P}from"./index-Bf75VrDE.js";import{t as F}from"./empty-state-02bIS4x7.js";import{t as I}from"./monaco-theme-DSeCDzQy.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,oe=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=g();function se(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,ce=224,le=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 ue(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 de(e){let t=Date.parse(e.occurredAt??e.observedAt);return Number.isFinite(t)?t:Date.now()}function fe(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:de(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 pe(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 me(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 he(e){return e?e.split(/\r?\n/).length:0}function ge(e){return new TextEncoder().encode(e).length}function _e(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ve(e){return e.length>18?`${e.slice(0,8)}…${e.slice(-6)}`:e}function ye(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 be({file:e}){let{t:n}=m(),[i,a]=(0,q.useState)(!0),[l,p]=(0,q.useState)(ce),[g,_]=(0,q.useState)(`overview`),[v,y]=(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=ne(e=>e.wsUrl),M=te(e=>e.history),N=te(e=>e.activeOperations),P=ie(e=>e.activeBoard),F=re(e=>e.snapshot),I=(0,q.useMemo)(()=>ee(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)(()=>{y([]),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||(y(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));p(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)(()=>me([...R.map(pe),...v.map(fe)]),[v,R]),B=(0,q.useMemo)(()=>ue(z),[z]),oe=(0,q.useMemo)(()=>se(x),[x]),V=D?.text??e.savedContent,H=(0,q.useMemo)(()=>ye(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||a(!0),A.current={startY:e.clientY,startHeight:i?l:Y},document.body.style.cursor=`ns-resize`,document.body.style.userSelect=`none`},Z=[{id:`overview`,label:n(`activity:fileActivity.overview`),icon:(0,J.jsx)(o,{})},{id:`changes`,label:n(`activity:fileActivity.changes`),icon:(0,J.jsx)(u,{})},{id:`context`,label:n(`activity:fileActivity.context`),icon:(0,J.jsx)(b,{})},{id:`logs`,label:n(`activity:fileActivity.logs`),icon:(0,J.jsx)(s,{})}];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?l:le},"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:()=>{a(!0),p(ce)},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:()=>a(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)(c,{className:`h-3 w-3`}):(0,J.jsx)(r,{className:`h-3 w-3`})]}),(0,J.jsx)(`span`,{className:`hidden h-3 w-px bg-border sm:block`}),(0,J.jsx)(xe,{label:`${he(e.content)} ${n(`activity:fileActivity.lines`)}`}),(0,J.jsx)(xe,{label:_e(ge(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)(t,{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)(d,{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:()=>_(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`,g===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:[g===`overview`&&(0,J.jsx)(Se,{analysis:B,lifetime:oe,records:z,sessions:U,agents:W,tasks:G,taskLabel:K}),g===`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)(h,{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)(ae,{oldText:V,newText:e.content,caption:e.path,fill:!0})})]}),g===`context`&&(0,J.jsx)(we,{sessions:U,agents:W,tasks:G,records:z,taskLabel:K,boardTitle:P?.title??F?.title}),g===`logs`&&(0,J.jsx)(De,{records:z,loading:C})]})]})]})}function xe({label:e}){return(0,J.jsx)(`span`,{className:`hidden whitespace-nowrap font-mono text-[9px] text-muted-foreground sm:inline`,children:e})}function Se({analysis:e,lifetime:t,records:n,sessions:r,agents:i,tasks:o,taskLabel:s}){let{t:c}=m();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:c(`activity:fileActivity.mutations30m`),value:e.mutationCount,icon:(0,J.jsx)(u,{})},{label:c(`activity:fileActivity.sessions`),value:r.length,icon:(0,J.jsx)(S,{})},{label:c(`activity:fileActivity.actors`),value:i.length,icon:(0,J.jsx)(v,{})},{label:c(`activity:fileActivity.linkedWork`),value:o.length,icon:(0,J.jsx)(b,{})}].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)(Ce,{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)(a,{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:c(`activity:fileActivity.analysisTitle.${e.level}`)}),(0,J.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:c(`activity:fileActivity.analysisBody.${e.level}`,{mutations:e.mutationCount,actors:e.actorCount,sessions:e.sessionCount})})]})]}),o.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:[c(`activity:fileActivity.workLinks`),`:`]}),o.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:s(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:c(`activity:fileActivity.recentActivity`)}),(0,J.jsx)(`div`,{className:`divide-y divide-border/40`,children:n.length===0?(0,J.jsx)(ke,{text:c(`activity:fileActivity.noEvidence`)}):n.slice(0,5).map(e=>(0,J.jsx)(Oe,{record:e},`${e.id}:${e.at}`))})]})]})}function Ce({lifetime:e}){let{t}=m(),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`)}],r=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)),r&&(0,J.jsx)(`span`,{children:t(`activity:fileActivity.lifetimeSince`,{date:r})})]}),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 we({sessions:e,agents:t,tasks:n,records:r,taskLabel:i,boardTitle:a}){let{t:o}=m();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)(Te,{icon:(0,J.jsx)(S,{}),title:o(`activity:fileActivity.sessions`),empty:o(`activity:fileActivity.noSessions`),children:e.map(e=>(0,J.jsx)(Ee,{title:ve(e),subtitle:`${r.filter(t=>t.sessionId===e).length} ${o(`activity:fileActivity.events`)}`,raw:e},e))}),(0,J.jsx)(Te,{icon:(0,J.jsx)(v,{}),title:o(`activity:fileActivity.actors`),empty:o(`activity:fileActivity.noActors`),children:t.map(e=>(0,J.jsx)(Ee,{title:e,subtitle:`${r.filter(t=>t.actor===e).length} ${o(`activity:fileActivity.events`)}`},e))}),(0,J.jsx)(Te,{icon:(0,J.jsx)(b,{}),title:o(`activity:fileActivity.workLinks`),empty:o(`activity:fileActivity.noWorkLinks`),children:n.map(e=>(0,J.jsx)(Ee,{title:i(e),subtitle:a??o(`activity:fileActivity.taskOrTodo`),raw:e},e))})]})}function Te({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)(ke,{text:n})})]})}function Ee({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 De({records:e,loading:t}){let{t:n}=m();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)(_,{className:`h-3.5 w-3.5 animate-spin`}),n(`activity:fileActivity.loadingEvidence`)]}):e.length===0?(0,J.jsx)(ke,{text:n(`activity:fileActivity.noEvidence`)}):(0,J.jsx)(`div`,{className:`divide-y divide-border/40`,children:e.map(e=>(0,J.jsx)(Oe,{record:e,raw:!0},`${e.id}:${e.at}`))})}function Oe({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 ke({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 Ae(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 je(){let e=A(e=>e.openFiles),t=A(e=>e.activeFilePath),n=A(e=>e.setActiveFile),r=A(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)(l,{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 Me(){let{t:e}=m(),t=A(e=>e.openFiles),n=A(e=>e.activeFilePath),r=A(e=>e.updateContent),{theme:i}=N(),a=(0,q.useRef)(null),o=(0,q.useRef)(n),s=(0,q.useRef)(new Map),c=(0,q.useMemo)(()=>t.find(e=>e.path===n)??null,[t,n]),l=n?H(n):`plaintext`,u=I(),[d,f]=(0,q.useState)(!1);(0,q.useEffect)(()=>{o.current=n},[n]),(0,q.useEffect)(()=>{let e=I();C.setTheme(e)},[i]),(0,q.useEffect)(()=>{let e=R.map(e=>E.registerCompletionItemProvider(e,{triggerCharacters:[`.`,`_`],provideCompletionItems:async(e,t,n,r)=>{let i=o.current;if(!i)return{suggestions:[]};let a=e.getOffsetAt(t),c=e.getValue(),l=c.slice(Math.max(0,a-z),a),u=c.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},_=ee(ne.getState().wsUrl),v=e=>e.map((e,t)=>({label:e.label,kind:Ae(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=s.current.get(y);return b&&b.expiresAt>Date.now()?{suggestions:v(b.items)}:await new Promise(a=>{let o=!1,d=()=>{},h=null,g,b=e=>{o||(o=!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&&(s.current.set(y,{expiresAt:Date.now()+V,items:t.payload.items}),b(v(t.payload.items)))}),g=window.setTimeout(()=>b([]),oe),h=r.onCancellationRequested(()=>b([])),_.requestCompletion({requestId:m,filePath:i,language:e.getLanguageId(),lineNumber:t.lineNumber,column:t.column,content:c.length<=5e5?c:void 0,prefix:l,suffix:u,triggerCharacter:n.triggerCharacter,triggerKind:n.triggerKind,allowLlm:G(p,f)})})}}));return()=>{e.forEach(e=>{e.dispose()})}},[]);let h=(0,q.useCallback)(()=>{let e=a.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},[]),g=(0,q.useCallback)(()=>{M(`chat`),requestAnimationFrame(()=>{document.querySelector(`[data-chat-textarea]`)?.focus()})},[]),_=(0,q.useCallback)(()=>{let e=o.current;if(!e)return;let t=h();t&&(j.getState().addRef({kind:`snippet`,path:e,startLine:t.startLine,endLine:t.endLine,content:t.content}),g())},[h,g]),v=(0,q.useCallback)(()=>{let e=o.current;e&&(j.getState().addRef({kind:`file`,path:e}),g())},[g]),b=(0,q.useCallback)(t=>{a.current=t,C.setTheme(I()),t.onDidChangeCursorSelection(()=>{let e=t.getSelection();f(!!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()}})},[_,v]),S=(0,q.useCallback)(e=>{n&&e!==void 0&&r(n,e)},[n,r]);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&&A.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)(je,{}),(0,J.jsxs)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(d||c)&&(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:d?_:v,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(d?`activity:codeEditor.sendSelectedTitle`:`activity:codeEditor.mentionFileTitle`),children:[d?(0,J.jsx)(p,{className:`h-3 w-3`}):(0,J.jsx)(y,{className:`h-3 w-3`}),(0,J.jsx)(`span`,{children:e(d?`activity:codeEditor.sendToChat`:`activity:codeEditor.mentionFile`)})]})}),c?(0,J.jsx)(x,{language:l,value:c.content,onChange:S,theme:u,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}}},c.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`)})})]}),c&&(0,J.jsx)(be,{file:c})]})}export{Me as CodeEditor};
|