@wrongstack/webui 1.0.19 → 1.0.24

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.
Files changed (132) hide show
  1. package/dist/assets/{AgentRosterView-D4TuVXe8.js → AgentRosterView-Dq8Xa0WK.js} +4 -4
  2. package/dist/assets/{AnalyticsDashboard-DmQd0E0V.js → AnalyticsDashboard-DgqJODVI.js} +1 -1
  3. package/dist/assets/{AudienceMemoryPanel-DHJM4rf1.js → AudienceMemoryPanel-BVGdDVTT.js} +1 -1
  4. package/dist/assets/{ChangesView-CZ-nCe26.js → ChangesView-BVyLENBb.js} +1 -1
  5. package/dist/assets/ChimeraReviewsView-CTuxzgTC.js +1 -0
  6. package/dist/assets/ChronicleDashboard-BRP7D6RZ.js +1 -0
  7. package/dist/assets/{CodeEditor-CLscjkIR.js → CodeEditor-k3z3M0NG.js} +1 -1
  8. package/dist/assets/{CodeMap-CdVy9Q7V.js → CodeMap-CvHNQZEF.js} +1 -1
  9. package/dist/assets/{CronJobsPanel-TcZy_W2t.js → CronJobsPanel-GTK038V9.js} +1 -1
  10. package/dist/assets/{DeadCodeScanPanel-BOD2JEyf.js → DeadCodeScanPanel-DX4OEuyp.js} +1 -1
  11. package/dist/assets/{DebugDashboard-DFPNPzQ_.js → DebugDashboard-CKp3sa_k.js} +1 -1
  12. package/dist/assets/{DesignGalleryView-BXABwAji.js → DesignGalleryView-DVUTYaP6.js} +1 -1
  13. package/dist/assets/{GoalView-Cepqrg9l.js → GoalView-D8G8e8YG.js} +1 -1
  14. package/dist/assets/{KanbanView-FSePkLch.js → KanbanView-BMXGDqGo.js} +2 -2
  15. package/dist/assets/{MailboxDetailView-QyNmt1Gv.js → MailboxDetailView-CylnzTVc.js} +1 -1
  16. package/dist/assets/{MemoryDrawer-BZsyD1dh.js → MemoryDrawer-DJ0Y98Z8.js} +1 -1
  17. package/dist/assets/{MemoryManager-IHmhWn4P.js → MemoryManager-DfcsYPUB.js} +1 -1
  18. package/dist/assets/{ProcessMonitor-Bz0jZvHJ.js → ProcessMonitor-BnQ3vJtn.js} +1 -1
  19. package/dist/assets/{PromptJournalView-Ct8cLcGU.js → PromptJournalView-D7k8Yh5a.js} +1 -1
  20. package/dist/assets/{ProviderTestView-Dy3k2bVu.js → ProviderTestView-DSd6kkWT.js} +1 -1
  21. package/dist/assets/{QueuePanel-oVkTB68Q.js → QueuePanel-79KiyZWD.js} +1 -1
  22. package/dist/assets/{RefreshDebugView-_XPrBDq3.js → RefreshDebugView-s6MyGpPq.js} +1 -1
  23. package/dist/assets/{RepositoryHistoryView-Wlnvi5r1.js → RepositoryHistoryView-CWi_Zo3F.js} +1 -1
  24. package/dist/assets/{RequirementIntakeView-Cj5arGFF.js → RequirementIntakeView-D_Ea20fx.js} +1 -1
  25. package/dist/assets/{SageTabs-qrBn3VQr.js → SageTabs-D6eTg3ix.js} +2 -2
  26. package/dist/assets/SddFlowGraph-B-ptkFX6.js +1 -0
  27. package/dist/assets/SddHub-CSVfLGpr.js +2 -0
  28. package/dist/assets/{SessionInspectView-CuRk2DS0.js → SessionInspectView-NSpj5WEN.js} +1 -1
  29. package/dist/assets/{SessionList-BgRb1Mp4.js → SessionList-BYRCs1AK.js} +1 -1
  30. package/dist/assets/{SessionsDashboard-CSkm28Bx.js → SessionsDashboard-mF4PzdKY.js} +1 -1
  31. package/dist/assets/{SetupScreen-CNcJ_9O9.js → SetupScreen-BUZeJSZi.js} +1 -1
  32. package/dist/assets/SkillDetailView-B9BFyB1i.js +3 -0
  33. package/dist/assets/{TechStackView-BHiGCRBT.js → TechStackView-CXJilX0M.js} +2 -2
  34. package/dist/assets/{TerminalPanel-7VeXK8LB.js → TerminalPanel-CAXevSAa.js} +1 -1
  35. package/dist/assets/{activity-BVbAv0x7.js → activity-B3wutYIE.js} +4 -4
  36. package/dist/assets/activity-Be03cc7g.js +10 -0
  37. package/dist/assets/activity-CiYZ3y4e.js +10 -0
  38. package/dist/assets/activity-CmIA2MhR.js +10 -0
  39. package/dist/assets/activity-Cp5GhldB.js +10 -0
  40. package/dist/assets/activity-DFCf7l5d.js +10 -0
  41. package/dist/assets/{activity-Du_fOnvF.js → activity-EbNUY7Ci.js} +4 -4
  42. package/dist/assets/{chat-store-C-PKlsCR.js → chat-store-C7InoWAO.js} +1 -1
  43. package/dist/assets/common-Bjl7V12m.js +1 -0
  44. package/dist/assets/common-BtyQBZBN.js +1 -0
  45. package/dist/assets/common-D0QL7rwb.js +1 -0
  46. package/dist/assets/common-DJRPtYAt.js +1 -0
  47. package/dist/assets/common-DPPTV3yw.js +1 -0
  48. package/dist/assets/common-DvjdaRhB.js +1 -0
  49. package/dist/assets/common-opV6EoLd.js +1 -0
  50. package/dist/assets/config-store-BbL0WxLE.js +21 -0
  51. package/dist/assets/{i18n--QdD6NCn.js → i18n-Dv97urcO.js} +3 -3
  52. package/dist/assets/index-CON0Nbm4.css +1 -0
  53. package/dist/assets/index-DX6tHUzs.js +177 -0
  54. package/dist/assets/roster-ws-Cv_PHlEV.js +1 -0
  55. package/dist/assets/settings-BCvuzOJ6.js +1 -0
  56. package/dist/assets/settings-DMPKd-4K.js +1 -0
  57. package/dist/assets/settings-DxQ2452f.js +1 -0
  58. package/dist/assets/settings-Dz3StaVx.js +1 -0
  59. package/dist/assets/settings-EBW1mlXc.js +1 -0
  60. package/dist/assets/settings-Er2LHp9d.js +1 -0
  61. package/dist/assets/settings-EzznCDaX.js +1 -0
  62. package/dist/assets/stores-DXn5tdr7.js +7 -0
  63. package/dist/assets/ui-store-DxDwFHNK.js +1 -0
  64. package/dist/assets/{view-navigation-DTs4cSQ6.js → view-navigation-CpIPxhZp.js} +1 -1
  65. package/dist/components/ChatInput/skill-mention-picker.d.ts +10 -0
  66. package/dist/components/CustomRosterPanel.d.ts +0 -1
  67. package/dist/components/OfficeMapCanvas.d.ts +0 -7
  68. package/dist/components/SettingsPanel/BrainSection.d.ts +1 -1
  69. package/dist/components/SettingsPanel/JevSection.d.ts +4 -0
  70. package/dist/components/SettingsPanel/OAuthLoginSection.d.ts +2 -0
  71. package/dist/components/SettingsPanel/ProviderSection.d.ts +5 -5
  72. package/dist/components/SettingsPanel/brain-section-options.d.ts +1 -1
  73. package/dist/components/SettingsPanel/contracts.d.ts +1 -0
  74. package/dist/components/SettingsPanel/official-servers.d.ts +1 -0
  75. package/dist/components/SettingsPanel/use-brain-section.d.ts +28 -0
  76. package/dist/components/SkillDetailView.d.ts +1 -1
  77. package/dist/components/chronicle-event-detail.d.ts +51 -0
  78. package/dist/components/context-dashboard-sections.d.ts +79 -0
  79. package/dist/components/use-office-map-canvas.d.ts +42 -0
  80. package/dist/components/use-skill-detail.d.ts +177 -0
  81. package/dist/components/vector-memory-panel/model.d.ts +9 -0
  82. package/dist/hooks/useProviderModels.d.ts +2 -0
  83. package/dist/hooks/useWebSocket.d.ts +3 -3
  84. package/dist/hooks/ws-handlers/brain-handlers.d.ts +18 -0
  85. package/dist/hooks/ws-handlers/goal-handlers.d.ts +7 -0
  86. package/dist/hooks/ws-handlers/misc-handlers.d.ts +2 -21
  87. package/dist/index.html +9 -9
  88. package/dist/index.js +15497 -12864
  89. package/dist/lib/auth-operation.d.ts +5 -0
  90. package/dist/lib/sdd-theme.d.ts +2 -2
  91. package/dist/lib/ws-client-actions.d.ts +2 -0
  92. package/dist/lib/ws-client-domain-methods.d.ts +1 -1
  93. package/dist/lib/ws-client-session-methods.d.ts +1 -1
  94. package/dist/lib/ws-client.d.ts +0 -3
  95. package/dist/stores/council-log-store.d.ts +4 -0
  96. package/dist/stores/ui-store-types.d.ts +1 -1
  97. package/dist/types/client-message.d.ts +13 -0
  98. package/dist/types/jev.d.ts +62 -0
  99. package/dist/types/runtime.d.ts +5 -3
  100. package/dist/types/server-message-system.d.ts +4 -0
  101. package/dist/types/system.d.ts +2 -0
  102. package/package.json +10 -10
  103. package/dist/assets/ChimeraReviewsView-CNeRLesP.js +0 -1
  104. package/dist/assets/ChronicleDashboard-CYELq7EO.js +0 -1
  105. package/dist/assets/SddFlowGraph-DS8R2zEj.js +0 -1
  106. package/dist/assets/SddHub-C8pHQYSM.js +0 -2
  107. package/dist/assets/SkillDetailView-Bc9owpaX.js +0 -3
  108. package/dist/assets/activity-1wlPY6yi.js +0 -10
  109. package/dist/assets/activity-BmJTU8kX.js +0 -10
  110. package/dist/assets/activity-By_aWEsY.js +0 -10
  111. package/dist/assets/activity-Cps_29WN.js +0 -10
  112. package/dist/assets/activity-p_2o4eC6.js +0 -10
  113. package/dist/assets/common-BXosnbIt.js +0 -1
  114. package/dist/assets/common-CzfPgMjC.js +0 -1
  115. package/dist/assets/common-DDDPz7Dv.js +0 -1
  116. package/dist/assets/common-DYx9oSoC.js +0 -1
  117. package/dist/assets/common-DZ-05t4z.js +0 -1
  118. package/dist/assets/common-MjX8fcng.js +0 -1
  119. package/dist/assets/common-ipsuLC3n.js +0 -1
  120. package/dist/assets/config-store-xSv1mChc.js +0 -21
  121. package/dist/assets/index-DiX5j910.css +0 -1
  122. package/dist/assets/index-FWwLmwjx.js +0 -177
  123. package/dist/assets/roster-ws-CxKDc-ET.js +0 -1
  124. package/dist/assets/settings-B5Jy-ObI.js +0 -1
  125. package/dist/assets/settings-BXTJJ4n-.js +0 -1
  126. package/dist/assets/settings-BcXAVecM.js +0 -1
  127. package/dist/assets/settings-ByPfZHGm.js +0 -1
  128. package/dist/assets/settings-CCe4iHcn.js +0 -1
  129. package/dist/assets/settings-D2GLiaDO.js +0 -1
  130. package/dist/assets/settings-gB9nKL3f.js +0 -1
  131. package/dist/assets/stores-2kakt8j9.js +0 -7
  132. package/dist/assets/ui-store-DC3mkswy.js +0 -1
@@ -0,0 +1,5 @@
1
+ import type { WSClientMessage } from '@/types';
2
+ import type { WrongStackWebSocketClient } from './ws-client';
3
+ /** A matching server acknowledgment, never an unrelated operation result. */
4
+ export declare function requestAuthOperation(client: WrongStackWebSocketClient, message: WSClientMessage, signal: AbortSignal, onTimeout: () => void): Promise<boolean>;
5
+ //# sourceMappingURL=auth-operation.d.ts.map
@@ -8,8 +8,8 @@
8
8
  import { type LucideIcon } from 'lucide-react';
9
9
  type SddStatus = 'pending' | 'queued' | 'in_progress' | 'blocked' | 'review' | 'failed' | 'completed' | 'cancelled';
10
10
  interface SddStatusStyle {
11
- /** Short label, e.g. "Running". */
12
- label: string;
11
+ /** i18n key resolving to the short label, e.g. "Running". */
12
+ labelKey: string;
13
13
  /** Lucide icon for the status. */
14
14
  icon: LucideIcon;
15
15
  /** True for the running state (drives spin + glow). */
@@ -64,6 +64,7 @@ export interface WsClientActionMethods {
64
64
  allowedTools?: string[];
65
65
  url?: string;
66
66
  headers?: Record<string, string>;
67
+ bearerTokenEnv?: string;
67
68
  lazy?: boolean;
68
69
  }): void;
69
70
  removeMcpServer(name: string): void;
@@ -78,6 +79,7 @@ export interface WsClientActionMethods {
78
79
  allowedTools?: string[];
79
80
  url?: string;
80
81
  headers?: Record<string, string>;
82
+ bearerTokenEnv?: string;
81
83
  lazy?: boolean;
82
84
  }): void;
83
85
  wakeMcpServer(name: string): void;
@@ -73,7 +73,7 @@ declare const domainMethods: {
73
73
  updateKey(this: WsClientDomainHost, providerId: string, label: string, apiKey: string): void;
74
74
  deleteKey(this: WsClientDomainHost, providerId: string, label: string): void;
75
75
  setActiveKey(this: WsClientDomainHost, providerId: string, label: string): void;
76
- addProvider(this: WsClientDomainHost, id: string, family: string, baseUrl?: string | undefined, apiKey?: string, models?: string[] | undefined, customModels?: Record<string, ProviderCustomModelWire> | undefined): void;
76
+ addProvider(this: WsClientDomainHost, id: string, family: string, baseUrl?: string | undefined, apiKey?: string, models?: string[] | undefined, customModels?: Record<string, ProviderCustomModelWire> | undefined, providerType?: string | undefined): void;
77
77
  removeProvider(this: WsClientDomainHost, providerId: string): void;
78
78
  listOAuthProviders(this: WsClientDomainHost): void;
79
79
  startOAuth(this: WsClientDomainHost, kind: string, providerId?: string): void;
@@ -41,7 +41,7 @@ export interface WsClientSessionMethods {
41
41
  sendAbort(sessionId?: string | undefined): void;
42
42
  subscribeSessions(sessionIds: string[]): void;
43
43
  clearSessionSubscription(): void;
44
- sendConfirm(id: string, decision: 'yes' | 'no' | 'always' | 'deny'): void;
44
+ sendConfirm(id: string, decision: 'yes' | 'no' | 'always' | 'always-exact' | 'always-command' | 'always-tool' | 'deny'): void;
45
45
  switchModel(provider: string, model: string, timeoutMs?: number): Promise<WSModelSwitchResult['payload']>;
46
46
  shutdownCodebaseIndexServer(timeoutMs?: number): Promise<Extract<WSServerMessage, {
47
47
  type: 'codebase.index.server.shutdown_result';
@@ -114,9 +114,6 @@ declare class WrongStackWebSocketClientBase {
114
114
  * B-04 (docs/audit/webui-full-review-2026-09-03.md).
115
115
  */
116
116
  private echoSuppression;
117
- private get suppressedChatEchoes();
118
- private get echoSweepTimer();
119
- private set echoSweepTimer(value);
120
117
  private protocolCapabilities;
121
118
  private protocolVersion;
122
119
  supportsCapability(capability: string): boolean;
@@ -6,6 +6,8 @@ export interface CouncilPanelEntry {
6
6
  startedAt: number;
7
7
  resolvedAt?: number | undefined;
8
8
  seats: CouncilSeatVote[];
9
+ /** Final ballots supersede the live stream, including later failed rounds. */
10
+ hasFinalVotes?: boolean | undefined;
9
11
  /** Folded in from the matching `brain.decision_*` event, when it arrives. */
10
12
  question?: string | undefined;
11
13
  status?: string | undefined;
@@ -33,6 +35,8 @@ export declare const MAX_COUNCIL_PANELS = 50;
33
35
  interface CouncilLogState {
34
36
  /** Newest first. */
35
37
  panels: CouncilPanelEntry[];
38
+ /** Bounded, session-local questions received before the first ballot. */
39
+ questions: Map<string, string>;
36
40
  recordVote: (payload: Record<string, unknown>) => void;
37
41
  recordResolution: (payload: Record<string, unknown>) => void;
38
42
  noteQuestion: (requestId: string, question: string) => void;
@@ -28,7 +28,7 @@ export type View = (typeof VIEWS)[number];
28
28
  export declare function coerceView(value: unknown): View;
29
29
  export declare const DOCK_SECTIONS: readonly ['goal', 'goal-state', 'fleet', 'work', 'worktrees', 'collab'];
30
30
  export declare function coerceDockSection(value: unknown): DockSection | null;
31
- export declare const SETTINGS_TABS: readonly ['general', 'fonts', 'provider', 'connection', 'agent', 'execution', 'fallbacks', 'routing', 'fleet', 'integrations', 'chimera', 'context', 'logs', 'security', 'display'];
31
+ export declare const SETTINGS_TABS: readonly ['general', 'fonts', 'provider', 'jev', 'connection', 'agent', 'execution', 'fallbacks', 'routing', 'fleet', 'integrations', 'chimera', 'context', 'logs', 'security', 'display'];
32
32
  export declare function coerceSettingsTab(value: unknown): string;
33
33
  /** Single source of truth for the secondary panel width bounds. */
34
34
  export declare const SIDEBAR_MIN_WIDTH = 240;
@@ -584,6 +584,7 @@ export type WSClientMessageCore = WSUserMessage | {
584
584
  type: 'provider.add';
585
585
  payload: {
586
586
  id: string;
587
+ type?: string | undefined;
587
588
  family: string;
588
589
  baseUrl?: string | undefined;
589
590
  apiKey?: string | undefined;
@@ -1175,7 +1176,19 @@ export type WSClientMessageCore = WSUserMessage | {
1175
1176
  type: 'brain.ask';
1176
1177
  payload: {
1177
1178
  question: string;
1179
+ requestId?: string;
1178
1180
  } & SessionScopedPayload;
1181
+ } | {
1182
+ type: 'jev.get' | 'jev.test' | 'jev.check';
1183
+ payload?: {
1184
+ requestId: string;
1185
+ };
1186
+ } | {
1187
+ type: 'jev.set';
1188
+ payload: {
1189
+ requestId: string;
1190
+ patch: Record<string, unknown>;
1191
+ };
1179
1192
  } | {
1180
1193
  type: 'brain.config.get';
1181
1194
  } | {
@@ -0,0 +1,62 @@
1
+ export interface JevSettings {
2
+ status: string;
3
+ reason?: string;
4
+ route: string;
5
+ endpoint: string;
6
+ model: string;
7
+ requestTimeoutMs: number;
8
+ keySource: string;
9
+ features: Record<string, boolean>;
10
+ contextStrategy?: 'hybrid' | 'intelligent' | 'selective';
11
+ recallTurnContext?: boolean;
12
+ readiness?: Record<string, {
13
+ state: 'disabled' | 'account-required' | 'blocked' | 'conditional';
14
+ reason: string;
15
+ }>;
16
+ }
17
+ export interface JevState {
18
+ requestId?: string;
19
+ settings?: JevSettings;
20
+ message?: string;
21
+ error?: string;
22
+ checks?: {
23
+ running: boolean;
24
+ report?: {
25
+ at: number;
26
+ route: string;
27
+ model: string;
28
+ passed: number;
29
+ total: number;
30
+ cases: Array<{
31
+ feature: string;
32
+ name: string;
33
+ expected: string;
34
+ actual: string;
35
+ ok: boolean;
36
+ ms: number;
37
+ note?: string;
38
+ }>;
39
+ };
40
+ };
41
+ activity?: {
42
+ scope: 'process';
43
+ path?: string;
44
+ writeError?: string;
45
+ entries: Array<{
46
+ id: string;
47
+ at: number;
48
+ feature: string;
49
+ purpose?: 'runtime' | 'self-test';
50
+ project: string;
51
+ route: string;
52
+ model: string;
53
+ durationMs: number;
54
+ outcome: 'answered' | 'incomplete' | 'fallback';
55
+ reason?: string;
56
+ inputTokens?: number;
57
+ outputTokens?: number;
58
+ answers?: Record<string, string | number>;
59
+ }>;
60
+ };
61
+ }
62
+ //# sourceMappingURL=jev.d.ts.map
@@ -56,7 +56,7 @@ export interface WSToolConfirmResolved {
56
56
  payload: SessionScopedPayload & {
57
57
  id: string;
58
58
  toolName: string;
59
- decision: 'yes' | 'no' | 'always' | 'deny' | 'abort';
59
+ decision: 'yes' | 'no' | 'always' | 'always-exact' | 'always-command' | 'always-tool' | 'deny' | 'abort';
60
60
  source: 'brain_timeout' | 'abort';
61
61
  rationale?: string | undefined;
62
62
  };
@@ -65,7 +65,7 @@ export interface WSToolConfirmResult {
65
65
  type: 'tool.confirm_result';
66
66
  payload: SessionScopedPayload & {
67
67
  id: string;
68
- decision: 'yes' | 'no' | 'always' | 'deny';
68
+ decision: 'yes' | 'no' | 'always' | 'always-exact' | 'always-command' | 'always-tool' | 'deny';
69
69
  };
70
70
  }
71
71
  export interface WSTrustPersisted {
@@ -73,6 +73,8 @@ export interface WSTrustPersisted {
73
73
  payload: SessionScopedPayload & {
74
74
  tool: string;
75
75
  pattern: string;
76
+ displayPattern?: string;
77
+ scope?: 'exact' | 'command' | 'tool';
76
78
  decision: 'always' | 'deny';
77
79
  };
78
80
  }
@@ -352,7 +354,7 @@ export interface WSTopicAdviceResult {
352
354
  confidence: number;
353
355
  reason: string;
354
356
  nextTopic?: string | undefined;
355
- source: 'explicit' | 'model' | 'cache' | 'local';
357
+ source: 'explicit' | 'model' | 'system-one' | 'cache' | 'local';
356
358
  };
357
359
  }
358
360
  export interface WSContextMaxContext {
@@ -218,6 +218,9 @@ export type WSSystemMiscServerMessage = {
218
218
  judgeIsVoter?: boolean | undefined;
219
219
  ledgerPath?: string | undefined;
220
220
  };
221
+ } | {
222
+ type: 'jev.state';
223
+ payload: import('./jev.js').JevState;
221
224
  } | {
222
225
  type: 'brain.config';
223
226
  payload: {
@@ -228,6 +231,7 @@ export type WSSystemMiscServerMessage = {
228
231
  } | {
229
232
  type: 'brain.answer';
230
233
  payload: SessionScopedPayload & {
234
+ requestId?: string;
231
235
  question: string;
232
236
  decision: {
233
237
  type: string;
@@ -306,6 +306,8 @@ export interface WSKeyOperationResult {
306
306
  payload: {
307
307
  success: boolean;
308
308
  message: string;
309
+ /** Correlates an acknowledged operation with its submitting form. */
310
+ requestId?: string | undefined;
309
311
  /**
310
312
  * The tab whose request this answers.
311
313
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/webui",
3
- "version": "1.0.19",
3
+ "version": "1.0.24",
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": [
@@ -87,12 +87,12 @@
87
87
  "@radix-ui/react-tabs": "^1.1.21",
88
88
  "@tanstack/react-virtual": "^3.14.12",
89
89
  "@uiw/react-textarea-code-editor": "^3.1.1",
90
- "@wrongstack/core": "1.0.19",
91
- "@wrongstack/kanban": "1.0.19",
92
- "@wrongstack/plugins": "1.0.19",
93
- "@wrongstack/providers": "1.0.19",
94
- "@wrongstack/tools": "1.0.19",
95
- "@wrongstack/webui-protocol": "1.0.19",
90
+ "@wrongstack/core": "1.0.24",
91
+ "@wrongstack/kanban": "1.0.24",
92
+ "@wrongstack/plugins": "1.0.24",
93
+ "@wrongstack/providers": "1.0.24",
94
+ "@wrongstack/tools": "1.0.24",
95
+ "@wrongstack/webui-protocol": "1.0.24",
96
96
  "@xterm/addon-fit": "^0.11.0",
97
97
  "@xterm/xterm": "^6.0.0",
98
98
  "@xyflow/react": "^12.11.6",
@@ -114,7 +114,7 @@
114
114
  "zustand": "^5.0.15"
115
115
  },
116
116
  "optionalDependencies": {
117
- "node-pty": "1.1.0"
117
+ "node-pty": "1.2.0-beta.15"
118
118
  },
119
119
  "devDependencies": {
120
120
  "@playwright/test": "^1.63.0",
@@ -128,8 +128,8 @@
128
128
  "@types/ws": "^8.18.1",
129
129
  "@vitejs/plugin-react": "^6.1.1",
130
130
  "@vitest/coverage-v8": "^5.0.0",
131
- "@wrongstack/sdd": "1.0.19",
132
- "@wrongstack/webui-server": "1.0.19",
131
+ "@wrongstack/sdd": "1.0.24",
132
+ "@wrongstack/webui-server": "1.0.24",
133
133
  "jsdom": "^30.0.1",
134
134
  "tailwindcss": "^4.3.3",
135
135
  "typescript": "^7.0.2",
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{K as t,kt as n}from"./config-store-xSv1mChc.js";import{i as r,t as i}from"./react-core-wiHys0m2.js";import{Da as a,Dn as o,En as s,Fn as c,Ii as l,Ln as u,Mr as d,Na as f,Pa as p,Ta as m,Vn as h,bn as g,ga as _,ja as v,qn as y,xo as b}from"./vendor-V3ydTHqN.js";import"./i18n--QdD6NCn.js";import{t as x}from"./utils-CKsqCaP8.js";import{i as S}from"./index-FWwLmwjx.js";import{t as C}from"./empty-state-pfuS5znr.js";var w=e(r(),1),T=i();function E(e){try{return new Date(e).toLocaleString()}catch{return e}}function D(e){try{let t=new Date(e),n=Date.now()-t.getTime();return n<6e4?`Just now`:n<36e5?`${Math.round(n/6e4)}m ago`:n<864e5?`${Math.round(n/36e5)}h ago`:n<6048e5?`${Math.round(n/864e5)}d ago`:t.toLocaleDateString()}catch{return e}}var O={open:{label:`Open`,cls:`border-primary/30 bg-primary/10 text-primary`,icon:a},actioned:{label:`Actioned`,cls:`border-warning/30 bg-warning/10 text-warning`,icon:c},completed:{label:`Completed`,cls:`border-success/30 bg-success/10 text-success`,icon:m},skipped:{label:`Skipped`,cls:`border-border bg-muted text-muted-foreground`,icon:_}},k={critical:{bg:`bg-destructive/10 border-destructive/30`,text:`text-destructive`,dot:`bg-destructive`},high:{bg:`bg-warning/15 border-warning/40`,text:`text-warning`,dot:`bg-warning`},medium:{bg:`bg-warning/10 border-warning/30`,text:`text-warning`,dot:`bg-warning`},low:{bg:`bg-muted border-border`,text:`text-muted-foreground`,dot:`bg-muted-foreground`}};function A(){let{t:e}=b(),{reports:r,selectedReportId:i,detail:a,loading:A,detailLoading:j,error:M,filterSessionId:N,filterLifecycle:P,searchQuery:F,fetchReports:I,selectReport:L,setFilterSessionId:R,setFilterLifecycle:z,setSearchQuery:B,transitionReport:V,addReportNote:H,transitionFinding:U}=S(),[W,G]=(0,w.useState)(``),[K,q]=(0,w.useState)(!1);(0,w.useEffect)(()=>{I()},[I]);let J=(0,w.useMemo)(()=>{let e=new Set;for(let t of r)t.sessionId&&e.add(t.sessionId);return Array.from(e)},[r]),Y=(0,w.useMemo)(()=>{let e=F.trim().toLowerCase();return r.filter(t=>{if(N&&t.sessionId!==N||P&&t.lifecycleStatus!==P)return!1;if(e){let n=t.reportId.toLowerCase().includes(e),r=t.sessionId.toLowerCase().includes(e),i=(t.reviewerModel??``).toLowerCase().includes(e);if(!n&&!r&&!i)return!1}return!0})},[r,N,P,F]);return(0,T.jsxs)(`div`,{className:`flex h-full w-full flex-col overflow-hidden bg-background text-foreground`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-border bg-card/40 px-4 py-3 sm:px-6`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{className:`text-xl`,"aria-hidden":!0,children:`🦂`}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-base font-semibold leading-none`,children:`Chimera Review Hub & Journal`}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:`Track agent code reviews, findings, session lineage, and audit event timeline`})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsxs)(`select`,{value:N,onChange:e=>R(e.target.value),className:`rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,"aria-label":`Filter by session`,children:[(0,T.jsxs)(`option`,{value:``,children:[`All Sessions (`,J.length,`)`]}),J.map(e=>(0,T.jsxs)(`option`,{value:e,children:[`Session: `,e.length>16?`${e.slice(0,16)}…`:e]},e))]}),(0,T.jsxs)(`select`,{value:P,onChange:e=>z(e.target.value),className:`rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,"aria-label":`Filter by status`,children:[(0,T.jsx)(`option`,{value:``,children:`All Statuses`}),(0,T.jsx)(`option`,{value:`open`,children:`Open`}),(0,T.jsx)(`option`,{value:`actioned`,children:`Actioned`}),(0,T.jsx)(`option`,{value:`completed`,children:`Completed`}),(0,T.jsx)(`option`,{value:`skipped`,children:`Skipped`})]}),(0,T.jsxs)(`div`,{className:`relative`,children:[(0,T.jsx)(o,{className:`absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground`}),(0,T.jsx)(`input`,{type:`text`,placeholder:`Search reports...`,value:F,onChange:e=>B(e.target.value),className:`rounded-lg border border-border bg-background pl-8 pr-3 py-1.5 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary w-40 sm:w-52`})]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>I(),disabled:A,className:`inline-flex items-center gap-1 rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs font-medium hover:bg-muted transition-colors disabled:opacity-50`,title:`Refresh reports`,children:[(0,T.jsx)(h,{className:x(`h-3.5 w-3.5`,A&&`animate-spin`)}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:`Refresh`})]})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex w-72 sm:w-80 flex-col border-r border-border bg-card/20 shrink-0 overflow-y-auto`,children:[(0,T.jsxs)(`div`,{className:`border-b border-border px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider flex items-center justify-between`,children:[(0,T.jsxs)(`span`,{children:[`Reports (`,Y.length,`)`]}),A&&(0,T.jsx)(d,{className:`h-3 w-3 animate-spin`})]}),Y.length===0?(0,T.jsx)(`div`,{className:`p-6 text-center text-xs text-muted-foreground`,children:A?`Loading review reports…`:`No review reports match your filter.`}):(0,T.jsx)(`div`,{className:`divide-y divide-border/60`,children:Y.map(e=>{let t=e.reportId===i,n=O[e.lifecycleStatus]??O.open,r=n.icon,a=e.totalFindings;return(0,T.jsxs)(`button`,{type:`button`,onClick:()=>L(e.reportId),className:x(`flex w-full flex-col gap-1.5 px-3.5 py-3 text-left transition-colors hover:bg-muted/60`,t&&`bg-primary/10 border-l-2 border-primary`),children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,T.jsxs)(`span`,{className:`text-xs font-semibold truncate font-mono text-foreground`,children:[e.reportId.slice(0,12),`…`]}),(0,T.jsxs)(`span`,{className:x(`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium leading-none`,n.cls),children:[(0,T.jsx)(r,{className:`h-2.5 w-2.5`}),n.label]})]}),(0,T.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,T.jsxs)(`span`,{className:`truncate`,children:[`Sess: `,e.sessionId.slice(0,10),`…`]}),(0,T.jsx)(`span`,{children:D(e.reviewedAt)})]}),(0,T.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:a===0?(0,T.jsx)(`span`,{className:`text-success font-medium`,children:`All clear ✓`}):`${a} finding(s)`}),e.counts&&a>0&&(0,T.jsxs)(`div`,{className:`flex items-center gap-1 font-mono text-[10px]`,children:[e.counts.critical>0&&(0,T.jsxs)(`span`,{className:`text-destructive font-semibold`,children:[e.counts.critical,` critical`]}),e.counts.high>0&&(0,T.jsxs)(`span`,{className:`text-warning`,children:[e.counts.high,` high`]}),e.counts.medium>0&&(0,T.jsxs)(`span`,{className:`text-warning`,children:[e.counts.medium,` med`]}),e.counts.low>0&&(0,T.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.counts.low,` low`]})]})]})]},e.reportId)})})]}),i&&a?.report?(0,T.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col lg:flex-row overflow-hidden`,children:[(0,T.jsxs)(`div`,{className:`flex flex-1 min-h-0 min-w-0 flex-col overflow-y-auto p-4 sm:p-6 space-y-6`,children:[(0,T.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-5 space-y-4 shadow-sm`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,T.jsxs)(`h2`,{className:`text-lg font-bold`,children:[`Review Report`,` `,(0,T.jsxs)(`span`,{className:`font-mono text-sm text-muted-foreground`,children:[`(`,a.report.id,`)`]})]})}),(0,T.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Session`,` `,(0,T.jsx)(`span`,{className:`font-mono font-medium text-foreground`,children:a.report.sessionId}),` `,`• Reviewed at `,E(a.report.reviewedAt)]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>V(a.report.id,`actioned`,`Manual action status`),disabled:a.report.lifecycle===`actioned`,className:`inline-flex items-center gap-1 rounded-lg border border-warning/30 bg-warning/10 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/20 disabled:opacity-40 transition-colors`,children:[(0,T.jsx)(c,{className:`h-3.5 w-3.5`}),`Mark Actioned`]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>V(a.report.id,`completed`,`Manual completion`),disabled:a.report.lifecycle===`completed`,className:`inline-flex items-center gap-1 rounded-lg border border-success/30 bg-success/10 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/20 disabled:opacity-40 transition-colors`,children:[(0,T.jsx)(p,{className:`h-3.5 w-3.5`}),`Mark Completed`]}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>V(a.report.id,`skipped`,`Manual skip`),disabled:a.report.lifecycle===`skipped`,className:`inline-flex items-center gap-1 rounded-lg border border-border bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted/80 disabled:opacity-40 transition-colors`,children:[(0,T.jsx)(_,{className:`h-3.5 w-3.5`}),`Skip`]})]})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 pt-2 border-t border-border/60 text-xs`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground block text-[11px]`,children:`Reviewer Model`}),(0,T.jsx)(`span`,{className:`font-mono font-medium text-foreground`,children:a.report.reviewerModel||`default`})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground block text-[11px]`,children:`Reviewed Files`}),(0,T.jsxs)(`span`,{className:`font-medium text-foreground`,children:[a.report.files.length,` file(s)`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground block text-[11px]`,children:`Total Findings`}),(0,T.jsx)(`span`,{className:`font-semibold text-foreground`,children:a.report.totalFindings})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`span`,{className:`text-muted-foreground block text-[11px]`,children:`Cascade Depth`}),(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:a.report.cascadeDepth??0})]})]}),a.report.evidenceStatus&&(0,T.jsxs)(`div`,{className:`rounded-lg bg-muted/40 p-3 border border-border/80 text-xs space-y-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[(0,T.jsx)(`span`,{children:`Machine Evidence Verification:`}),(0,T.jsx)(`span`,{className:x(`px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase border`,a.report.evidenceStatus===`verified`?`bg-success/10 text-success border-success/30`:a.report.evidenceStatus===`failed`?`bg-destructive/10 text-destructive border-destructive/30`:`bg-warning/10 text-warning border-warning/30`),children:a.report.evidenceStatus})]}),a.report.evidenceChecks&&a.report.evidenceChecks.length>0&&(0,T.jsx)(`div`,{className:`space-y-1 font-mono text-[11px] text-muted-foreground`,children:a.report.evidenceChecks.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`span`,{children:e.ok?`✓`:`✗`}),(0,T.jsxs)(`span`,{className:`font-semibold text-foreground`,children:[e.name,`:`]}),(0,T.jsx)(`span`,{className:`truncate`,children:e.command})]},t))})]}),(0,T.jsx)(`div`,{className:`pt-2`,children:(0,T.jsxs)(`button`,{type:`button`,onClick:()=>{if(!a?.report)return;let e=a.report,r=`Take a look at the tasks mentioned in Chimera report (${e.id}) for session ${e.sessionId} — review the ${e.totalFindings} finding(s) it flagged and address them.`,i=n(e.sessionId);i.addMessage({role:`user`,content:r}),i.patch({isLoading:!0}),t().sendMessage(r,void 0,!1,e.sessionId===`__unbound__`?void 0:e.sessionId),V(e.id,`actioned`,`Prompt dispatched to leader`)},className:`inline-flex items-center gap-2 rounded-lg bg-primary px-4 py-2 text-xs font-semibold text-primary-foreground hover:bg-primary/90 transition-colors shadow-sm`,children:[(0,T.jsx)(s,{className:`h-3.5 w-3.5`}),`Dispatch Follow-up Task to Session Leader`]})})]}),(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,T.jsxs)(`h3`,{className:`text-sm font-bold uppercase tracking-wider text-muted-foreground`,children:[`Findings (`,a.findings.length,`)`]})}),a.findings.length===0?(0,T.jsxs)(`div`,{className:`rounded-xl border border-border/80 bg-card/40 p-8 text-center text-xs text-muted-foreground`,children:[(0,T.jsx)(m,{className:`mx-auto h-8 w-8 text-success/60 mb-2`}),`No actionable findings were discovered in this review run.`]}):(0,T.jsx)(`div`,{className:`space-y-3`,children:a.findings.map(({finding:e})=>{let t=k[e.severity]??k.low;return(0,T.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4 space-y-3 shadow-sm transition-all hover:border-border/80`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsxs)(`span`,{className:x(`inline-flex items-center gap-1 rounded-md px-2 py-0.5 text-xs font-semibold uppercase border`,t.bg,t.text),children:[(0,T.jsx)(`span`,{className:x(`h-1.5 w-1.5 rounded-full`,t.dot)}),e.severity]}),e.category&&(0,T.jsx)(`span`,{className:`rounded-md bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground`,children:e.category}),e.location?.file&&(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-xs text-foreground bg-muted/60 px-2 py-0.5 rounded`,children:[(0,T.jsx)(l,{className:`h-3 w-3 text-muted-foreground`}),e.location.file,e.location.line?`:${e.location.line}`:``]})]}),(0,T.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,T.jsx)(`span`,{className:`font-semibold text-muted-foreground mr-1`,children:`Status:`}),(0,T.jsx)(`span`,{className:x(`px-2 py-0.5 rounded-full text-[11px] font-medium capitalize border`,e.status===`resolved`?`bg-success/10 text-success border-success/30`:e.status===`ignored`?`bg-muted text-muted-foreground border-border`:`bg-primary/10 text-primary border-primary/30`),children:e.status}),e.status!==`resolved`&&(0,T.jsx)(`button`,{type:`button`,onClick:()=>U(e.id,`resolved`,`fixed`,`Resolved by operator in WebUI`),className:`ml-2 rounded px-2 py-0.5 text-[11px] font-medium bg-success/10 text-success hover:bg-success/20 border border-success/30`,children:`Resolve (Fixed)`}),e.status!==`ignored`&&e.status!==`resolved`&&(0,T.jsx)(`button`,{type:`button`,onClick:()=>U(e.id,`ignored`,void 0,`Ignored by operator`),className:`rounded px-2 py-0.5 text-[11px] font-medium bg-muted text-muted-foreground hover:bg-muted/80 border border-border`,children:`Ignore`}),(e.status===`resolved`||e.status===`ignored`)&&(0,T.jsx)(`button`,{type:`button`,onClick:()=>U(e.id,`active`,void 0,`Reopened in WebUI`),className:`rounded px-2 py-0.5 text-[11px] font-medium bg-primary/10 text-primary hover:bg-primary/20 border border-primary/30`,children:`Reopen`})]})]}),(0,T.jsx)(`h4`,{className:`text-sm font-semibold text-foreground`,children:e.title}),(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground whitespace-pre-wrap`,children:e.description}),e.suggestedFix&&(0,T.jsxs)(`div`,{className:`rounded-lg bg-muted/40 border border-border/80 p-3 space-y-1 text-xs`,children:[(0,T.jsx)(`span`,{className:`font-semibold text-primary block`,children:`Suggested Fix:`}),(0,T.jsx)(`pre`,{className:`font-mono text-[11px] text-foreground overflow-x-auto whitespace-pre-wrap`,children:e.suggestedFix})]}),e.verification&&(0,T.jsxs)(`div`,{className:`text-[11px] text-muted-foreground flex items-center gap-2`,children:[(0,T.jsx)(`span`,{children:`Disk check:`}),(0,T.jsxs)(`span`,{className:x(`font-semibold`,e.verification.status===`verified`?`text-success`:e.verification.status===`failed`?`text-destructive`:`text-warning`),children:[e.verification.status,` (`,e.verification.reason,`)`]}),e.verification.evidence&&(0,T.jsxs)(`span`,{className:`font-mono text-muted-foreground truncate max-w-xs`,children:[`"`,e.verification.evidence,`"`]})]})]},e.id)})})]}),a.report.rawText&&(0,T.jsxs)(`div`,{className:`rounded-xl border border-border bg-card overflow-hidden`,children:[(0,T.jsxs)(`button`,{type:`button`,onClick:()=>q(e=>!e),className:`flex w-full items-center justify-between px-4 py-3 text-xs font-semibold text-muted-foreground hover:bg-muted/50 transition-colors`,children:[(0,T.jsx)(`span`,{children:`Raw Report Markdown`}),K?(0,T.jsx)(f,{className:`h-4 w-4`}):(0,T.jsx)(v,{className:`h-4 w-4`})]}),K&&(0,T.jsx)(`div`,{className:`border-t border-border p-4 bg-muted/20`,children:(0,T.jsx)(`pre`,{className:`text-xs font-mono whitespace-pre-wrap break-words text-muted-foreground`,children:a.report.rawText})})]})]}),(0,T.jsxs)(`div`,{className:`w-full lg:w-80 border-t lg:border-t-0 lg:border-l border-border bg-card/30 flex flex-col shrink-0 overflow-y-auto p-4 space-y-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border pb-3`,children:[(0,T.jsx)(u,{className:`h-4 w-4 text-primary`}),(0,T.jsx)(`h3`,{className:`text-sm font-bold`,children:`Activity Journal`})]}),(0,T.jsx)(`div`,{className:`space-y-3 flex-1 overflow-y-auto`,children:a.events.length===0?(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No journal events recorded yet.`}):(0,T.jsx)(`div`,{className:`relative pl-4 space-y-4 before:absolute before:left-1.5 before:top-2 before:bottom-2 before:w-0.5 before:bg-border`,children:a.events.map(e=>(0,T.jsxs)(`div`,{className:`relative space-y-1 text-xs`,children:[(0,T.jsx)(`div`,{className:`absolute -left-4 top-1 h-2 w-2 rounded-full bg-primary ring-4 ring-card`}),(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-1 text-[11px] text-muted-foreground`,children:[(0,T.jsx)(`span`,{className:`font-semibold text-foreground capitalize`,children:e.eventType.replace(`_`,` `)}),(0,T.jsx)(`span`,{children:D(e.timestamp)})]}),(0,T.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[`Actor: `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:e.actorId}),` (`,e.actorKind,`)`]}),e.fromLifecycle&&e.toLifecycle&&(0,T.jsxs)(`div`,{className:`text-[11px] text-muted-foreground`,children:[`Status:`,` `,(0,T.jsxs)(`span`,{className:`text-foreground`,children:[e.fromLifecycle,` ➔ `,e.toLifecycle]})]}),e.reason&&(0,T.jsxs)(`p`,{className:`rounded bg-muted/60 p-1.5 text-[11px] text-foreground/90 italic`,children:[`"`,e.reason,`"`]})]},e.id))})}),(0,T.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i&&W.trim()&&(H(i,W.trim()),G(``))},className:`pt-3 border-t border-border space-y-2`,children:[(0,T.jsx)(`label`,{className:`text-xs font-semibold text-muted-foreground block`,children:`Add Journal Note / Inote:`}),(0,T.jsx)(`textarea`,{rows:3,value:W,onChange:e=>G(e.target.value),placeholder:`Record an observation, fix PR link, or triage note...`,className:`w-full rounded-lg border border-border bg-background p-2 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),(0,T.jsxs)(`button`,{type:`submit`,disabled:!W.trim(),className:`inline-flex w-full items-center justify-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50`,children:[(0,T.jsx)(y,{className:`h-3.5 w-3.5`}),`Append to Journal`]})]})]})]}):(0,T.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8`,children:(0,T.jsx)(C,{icon:(0,T.jsx)(g,{className:`h-12 w-12 text-muted-foreground/40`}),title:`Select a Chimera Review Report`,description:`Choose a review report from the left pane to view structured findings, disk verification proofs, and the activity journal.`})})]})]})}export{A as ChimeraReviewsView};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{K as t}from"./config-store-xSv1mChc.js";import{i as n,t as r}from"./react-core-wiHys0m2.js";import{Dn as i,Ha as a,Ii as o,In as s,Ka as c,Mt as ee,Rr as te,Vn as ne,Yi as l,Yt as u,ci as d,da as re,ho as f,ja as p,ln as m,pi as ie,xo as h,yn as g}from"./vendor-V3ydTHqN.js";import"./i18n--QdD6NCn.js";import{t as _}from"./utils-CKsqCaP8.js";import{E as ae,T as oe}from"./index-FWwLmwjx.js";var v=e(n(),1),y=r();function b({status:e}){let{t}=h();return(0,y.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,y.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-primary`,children:t(`activity:chroniclePipelineStrip.chronicleOwnership`)}),(0,y.jsxs)(`span`,{children:[`collect `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.collection})]}),(0,y.jsxs)(`span`,{children:[`process `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.processing})]}),(0,y.jsxs)(`span`,{children:[`serve `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pipeline.serving})]}),(0,y.jsxs)(`span`,{children:[`PID `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.pid}),` · `,e.clients,` clients`]}),(0,y.jsxs)(`span`,{children:[`watcher`,` `,(0,y.jsx)(`b`,{className:_(e.watcher.active?`text-success`:`text-warning`),children:e.watcher.active?`active`:`inactive`}),` `,`· `,e.watcher.watchedFiles,` files`]}),(0,y.jsxs)(`span`,{children:[`store `,(0,y.jsx)(`b`,{className:`text-foreground`,children:x(e.pipeline.storage)})]}),e.mode===`inline`&&(0,y.jsx)(`span`,{className:`font-sans font-semibold text-warning`,children:t(`activity:chroniclePipelineStrip.inlineFallback`)})]})}function x(e){return e.replaceAll(`\\`,`/`).split(`/`).filter(Boolean).slice(-3).join(`/`)}var S=[`eventType`,`providerId`,`modelId`,`outcome`,`resourceKind`],C=864e5;function w(){return{limit:300,order:`desc`,from:new Date(Date.now()-C).toISOString()}}var se=[{id:`all`,labelKey:`activity:chronicle.signalAllSignals`,icon:(0,y.jsx)(f,{})},{id:`llm`,labelKey:`activity:chronicle.signalLlm`,icon:(0,y.jsx)(a,{})},{id:`agents`,labelKey:`activity:chronicle.signalAgents`,icon:(0,y.jsx)(c,{})},{id:`tools`,labelKey:`activity:chronicle.signalTools`,icon:(0,y.jsx)(m,{})},{id:`files`,labelKey:`activity:chronicle.signalFiles`,icon:(0,y.jsx)(o,{})},{id:`failures`,labelKey:`activity:chronicle.signalFailures`,icon:(0,y.jsx)(u,{})}];function T(){let{t:e}=h(),n=t(),[r,l]=(0,v.useState)([]),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)({}),[g,x]=(0,v.useState)(w()),[C,T]=(0,v.useState)({text:``,path:``,providerId:``,modelId:``,sessionId:``}),[E,k]=(0,v.useState)(`all`),[N,F]=(0,v.useState)({total:0,scannedEvents:0,sourceFiles:0,invalidLines:0}),[I,pe]=(0,v.useState)(D),[L,R]=(0,v.useState)(!0),[z,B]=(0,v.useState)(null),[me,V]=(0,v.useState)(null),[H,he]=(0,v.useState)([]),[U,ge]=(0,v.useState)([]),[W,_e]=(0,v.useState)(null),G=(0,v.useRef)(g);G.current=g;let K=(0,v.useCallback)(e=>{if(!n.supportsCapability(`chronicle.query`)){R(!1),B(`Restart the backend once to activate Chronicle protocol support.`);return}if(R(!0),B(null),x(e),p({}),n.send({type:`chronicle.query`,payload:{query:e}}),n.supportsCapability(`chronicle.facets`))n.send({type:`chronicle.facets`,payload:{fields:[...S],query:e,limit:12}});else for(let t of S)n.send({type:`chronicle.facet`,payload:{field:t,query:e,limit:12}})},[n]),q=(0,v.useCallback)(()=>{n.supportsCapability(`chronicle.metrics`)&&(n.send({type:`chronicle.metrics`,payload:{view:`providers`}}),n.send({type:`chronicle.metrics`,payload:{view:`tasks`,limit:200}}))},[n]),J=(0,v.useCallback)(()=>{n.supportsCapability(`chronicle.status`)&&n.send({type:`chronicle.status`})},[n]);(0,v.useEffect)(()=>{let e=n.on(`chronicle.query_result`,e=>{e.type===`chronicle.query_result`&&(l(e.payload.events),F(e.payload),pe(e.payload.summary??D),R(!1))}),t=n.on(`chronicle.facet_result`,e=>{e.type===`chronicle.facet_result`&&p(t=>({...t,[e.payload.field]:e.payload.values}))}),r=n.on(`chronicle.facets_result`,e=>{e.type===`chronicle.facets_result`&&p(e.payload.values)}),i=n.on(`chronicle.error`,e=>{e.type===`chronicle.error`&&(B(e.payload.message),R(!1))}),a=n.on(`chronicle.graph_result`,e=>{e.type===`chronicle.graph_result`&&V(e.payload)}),o=n.on(`chronicle.metrics_result`,e=>{e.type===`chronicle.metrics_result`&&(e.payload.view===`providers`?he(e.payload.data):e.payload.view===`tasks`&&ge(e.payload.data))}),s=n.on(`chronicle.status_result`,e=>{e.type===`chronicle.status_result`&&_e(e.payload)});return K(G.current),q(),J(),()=>{e(),t(),r(),i(),a(),o(),s()}},[n,K,q,J]);let Y=(0,v.useMemo)(()=>r.filter(e=>O(e,E)),[r,E]),X=ae(Y,25,E),Z=(0,v.useMemo)(()=>{let e=r.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`)}}},[r]),Q=(0,v.useMemo)(()=>{let e={};for(let t of U)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=[...U].sort((e,t)=>(t.endedAt??t.startedAt??``).localeCompare(e.endedAt??e.startedAt??``)).slice(0,8);return{counts:e,total:U.length,terminal:t,successRate:t>0?n/t*100:100,recent:r}},[U]),$=()=>K({...w(),...C.text?{text:C.text}:{},...C.path?{path:C.path}:{},...C.providerId?{providerId:C.providerId}:{},...C.modelId?{modelId:C.modelId}:{},...C.sessionId?{sessionId:C.sessionId}:{}}),ve=()=>{T({text:``,path:``,providerId:``,modelId:``,sessionId:``}),k(`all`),K(w())},ye=e=>{d(e),V(null),n.supportsCapability(`chronicle.graph`)&&n.send({type:`chronicle.graph`,payload:{seed:{eventId:e.eventId},hops:2,maxNodes:250}})};return(0,y.jsxs)(`div`,{className:`flex h-full min-h-0 bg-background`,"data-testid":`chronicle-dashboard`,children:[(0,y.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,y.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,y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(a,{className:`h-5 w-5 text-primary`}),(0,y.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:e(`activity:chronicle.codingIntelligence`)}),(0,y.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:e(`activity:chronicle.chronicle`)})]}),(0,y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e(`activity:chronicle.llmAgentToolAndFileEvidence`)})]}),(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:_(`h-2 w-2 rounded-full`,z?`bg-destructive`:L?`animate-pulse bg-warning`:`bg-success`)}),(0,y.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:L?`Reading journal`:z?`Unavailable`:`Live evidence`}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>{K(g),q(),J()},className:`ml-2 rounded-md border border-border bg-card p-2 hover:bg-muted`,title:e(`activity:chronicle.refreshEvidence`),children:(0,y.jsx)(ne,{className:_(`h-4 w-4`,L&&`animate-spin`)})})]})]})}),(0,y.jsxs)(`section`,{className:`grid grid-cols-2 border-b border-border/70 xl:grid-cols-6`,children:[(0,y.jsx)(M,{icon:(0,y.jsx)(a,{}),label:e(`activity:chronicle.llmRequests`),value:I.logicalRequests,detail:`${I.modelAttempts} attempts · ${I.providers} providers · ${I.models} models`}),(0,y.jsx)(M,{icon:(0,y.jsx)(c,{}),label:e(`activity:chronicle.agentWork`),value:I.agentEvents,detail:`${I.uniqueAgents} correlated agents · ${I.decisions} decisions`}),(0,y.jsx)(M,{icon:(0,y.jsx)(m,{}),label:e(`activity:chronicle.toolCalls`),value:I.toolCalls,detail:`${I.failedTools} failed · ${I.processes} processes`}),(0,y.jsx)(M,{icon:(0,y.jsx)(o,{}),label:e(`activity:chronicle.fileEvidence`),value:I.fileEvents,detail:`${I.uniqueFiles} unique paths`}),(0,y.jsx)(M,{icon:(0,y.jsx)(s,{}),label:e(`activity:chronicle.retries`),value:I.scheduledRetries,detail:`${I.failures} failures · ${I.fallbacks} fallbacks`,tone:I.failures?`danger`:`normal`}),(0,y.jsx)(M,{icon:(0,y.jsx)(re,{}),label:e(`activity:chronicle.providerP95`),value:A(I.providerP95DurationMs),detail:`${A(I.providerAvgDurationMs)} average · all matches`})]}),(0,y.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,y.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-primary`,children:e(`activity:chronicle.tokenEconomics`)}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.freshInput`),` `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.inputTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[`output `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.outputTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.cacheRead`),` `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.cacheReadTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[`cache write`,` `,(0,y.jsx)(`b`,{className:`text-foreground`,children:I.cacheWriteTokens.toLocaleString()})]}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.cacheHit`),` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[le(I).toFixed(1),`%`]})]}),(0,y.jsxs)(`span`,{children:[e(`activity:chronicle.estimatedCost`),` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[`$`,I.estimatedCostUsd.toFixed(4)]})]})]}),H.length>0&&(0,y.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,y.jsx)(`span`,{className:`shrink-0 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e(`activity:chronicle.modelReliability`)}),H.slice(0,6).map(e=>{let t=e.completed+e.failed,n=t>0?e.completed/t*100:100;return(0,y.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,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 rounded-full`,n>=99?`bg-success`:n>=90?`bg-warning`:`bg-destructive`)}),(0,y.jsxs)(`span`,{className:`max-w-[180px] truncate`,children:[e.providerId,`/`,e.modelId]}),(0,y.jsxs)(`b`,{className:`text-foreground`,children:[n.toFixed(0),`%`]}),(0,y.jsx)(`span`,{className:`text-muted-foreground`,children:e.day.slice(5)})]},`${e.day}-${e.providerId}-${e.modelId}`)})]}),Q.total>0&&(0,y.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,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,y.jsx)(te,{className:`h-3 w-3`}),e(`activity:chronicle.taskOutcomes`)]}),(0,y.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,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 rounded-full`,Q.successRate>=90?`bg-success`:Q.successRate>=60?`bg-warning`:`bg-destructive`)}),(0,y.jsxs)(`b`,{className:`text-foreground`,children:[Q.successRate.toFixed(0),`%`]}),(0,y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`success · `,Q.total,` tasks`]})]}),[`completed`,`merged`,`failed`,`conflict`,`started`].filter(e=>Q.counts[e]).map(e=>(0,y.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-muted-foreground`,children:[e,` `,(0,y.jsx)(`b`,{className:_(e===`failed`||e===`conflict`?`text-destructive`:`text-foreground`),children:Q.counts[e]})]},e)),(0,y.jsx)(`span`,{className:`mx-1 h-3 w-px shrink-0 bg-border`}),Q.recent.map(e=>(0,y.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,y.jsx)(`span`,{className:_(`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,y.jsx)(`span`,{className:`max-w-[84px] truncate`,children:e.taskId}),e.durationMs!==null&&(0,y.jsx)(`span`,{className:`text-muted-foreground`,children:A(e.durationMs)}),e.filesTouched>0&&(0,y.jsxs)(`span`,{className:`flex items-center gap-0.5 text-muted-foreground`,children:[(0,y.jsx)(o,{className:`h-2.5 w-2.5`}),e.filesTouched]})]},e.taskId))]}),(0,y.jsx)(`section`,{className:`border-b border-border/70 px-4 py-3`,children:(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 xl:grid-cols-[1.35fr_1fr_1fr_1fr_1fr_auto]`,children:[(0,y.jsx)(j,{icon:(0,y.jsx)(i,{}),placeholder:e(`activity:chronicle.searchEventEvidence`),value:C.text,onChange:e=>T(t=>({...t,text:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.fileOrDirectory`),value:C.path,onChange:e=>T(t=>({...t,path:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.provider`),value:C.providerId,onChange:e=>T(t=>({...t,providerId:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.model`),value:C.modelId,onChange:e=>T(t=>({...t,modelId:e})),onEnter:$}),(0,y.jsx)(j,{placeholder:e(`activity:chronicle.session`),value:C.sessionId,onChange:e=>T(t=>({...t,sessionId:e})),onEnter:$}),(0,y.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,y.jsxs)(`button`,{type:`button`,onClick:$,className:`rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground`,children:[(0,y.jsx)(ie,{className:`mr-1 inline h-3 w-3`}),e(`activity:chronicle.apply`)]}),(0,y.jsx)(`button`,{type:`button`,onClick:ve,className:`rounded-md border border-border px-2.5 text-xs hover:bg-muted`,children:e(`activity:chronicle.clear`)})]})]})}),(0,y.jsxs)(`section`,{className:`flex items-center gap-1 overflow-x-auto border-b border-border/70 px-4 py-2`,children:[se.map(t=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>k(t.id),className:_(`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===t.id?`bg-primary/10 font-medium text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[t.icon,e(t.labelKey),(0,y.jsx)(`span`,{className:`ml-1 rounded bg-background/70 px-1 font-mono text-[9px]`,children:ce(I,t.id,N.total)})]},t.id)),(0,y.jsxs)(`div`,{className:`ml-auto hidden items-center gap-3 pl-4 text-[9px] text-muted-foreground lg:flex`,children:[(0,y.jsxs)(`span`,{children:[N.total.toLocaleString(),` matched`]}),(0,y.jsxs)(`span`,{children:[N.sourceFiles,` journal files`]}),N.invalidLines>0&&(0,y.jsxs)(`span`,{className:`text-warning`,children:[N.invalidLines,` invalid lines`]})]})]}),W&&(0,y.jsx)(b,{status:W}),Z&&(0,y.jsx)(ue,{health:Z}),(0,y.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,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,y.jsx)(`span`,{className:`mr-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e.replace(`Id`,``)}),(f[e]??[]).slice(0,4).map(t=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>K({...g,[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,y.jsx)(`b`,{children:t.count})]},t.value))]},e))}),(0,y.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,y.jsx)(`span`,{children:e(`activity:chronicle.time`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.signal`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.outcome`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.modelAgent`)}),(0,y.jsx)(`span`,{children:e(`activity:chronicle.resource`)}),(0,y.jsx)(`span`,{})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:z?(0,y.jsx)(P,{text:z}):!L&&Y.length===0?(0,y.jsx)(P,{text:`No coding evidence matches these filters.`}):(0,y.jsx)(`div`,{className:`divide-y divide-border/40`,children:X.pageItems.map(e=>(0,y.jsx)(de,{event:e,active:u?.eventId===e.eventId,onClick:()=>ye(e)},e.eventId))})}),(0,y.jsx)(oe,{page:X.page,pageSize:X.pageSize,totalItems:X.totalItems,onPageChange:X.setPage,itemLabel:`events`})]}),u&&(0,y.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,y.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,y.jsxs)(`div`,{children:[(0,y.jsx)(`div`,{className:`text-xs font-semibold`,children:e(`activity:chronicle.evidenceLineage`)}),(0,y.jsxs)(`div`,{className:`mt-0.5 font-mono text-[9px] text-muted-foreground`,children:[`#`,u.sequence,` · `,u.eventId]})]}),(0,y.jsx)(`button`,{type:`button`,onClick:()=>d(null),className:`rounded p-1 hover:bg-muted`,children:(0,y.jsx)(ee,{className:`h-4 w-4`})})]}),(0,y.jsx)(fe,{event:u,graph:me})]})]})}var E={llm:0,agent:0,tool:0,file:0,memory:0,task:0,decision:0,runtime:0},D={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:{...E},failuresByFamily:{...E}};function ce(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 le(e){let t=e.inputTokens+e.cacheReadTokens;return t?e.cacheReadTokens/t*100:0}function O(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,y.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,y.jsx)(`span`,{className:`text-muted-foreground [&>svg]:h-3.5 [&>svg]:w-3.5`,children:i}),(0,y.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,y.jsxs)(`div`,{className:`min-w-0 border-r border-border/60 px-4 py-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`text-primary [&>svg]:h-3.5 [&>svg]:w-3.5`,children:e}),t]}),(0,y.jsx)(`div`,{className:_(`mt-1 text-xl font-semibold tabular-nums`,i===`danger`&&`text-destructive`),children:typeof n==`number`?n.toLocaleString():n}),(0,y.jsx)(`div`,{className:`mt-0.5 truncate text-[9px] text-muted-foreground`,children:r})]})}function ue({health:e}){let{t}=h();return(0,y.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,y.jsx)(`span`,{className:`font-sans font-semibold uppercase tracking-wider text-success`,children:t(`activity:chronicle.collectorHealthy`)}),(0,y.jsxs)(`span`,{children:[`ELU`,` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[((e.eventLoop?.utilization??0)*100).toFixed(1),`%`]})]}),(0,y.jsxs)(`span`,{children:[`p95 `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[(e.eventLoop?.delayP95Ms??0).toFixed(1),`ms`]})]}),(0,y.jsxs)(`span`,{children:[`heap`,` `,(0,y.jsxs)(`b`,{className:`text-foreground`,children:[((e.memory?.heapUsedBytes??0)/1048576).toFixed(0),`MB`]})]}),(0,y.jsxs)(`span`,{children:[`queue `,(0,y.jsx)(`b`,{className:`text-foreground`,children:e.chronicle?.pendingEvents??0})]}),(0,y.jsxs)(`span`,{children:[`dropped`,` `,(0,y.jsx)(`b`,{className:_((e.chronicle?.rejectedEvents??0)>0&&`text-destructive`),children:e.chronicle?.rejectedEvents??0})]})]})}function de({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,y.jsxs)(`button`,{type:`button`,onClick:n,className:_(`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,y.jsx)(`span`,{className:`font-mono text-[9px] text-muted-foreground`,children:new Date(r).toLocaleTimeString()}),(0,y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,y.jsx)(`span`,{className:_(`h-1.5 w-1.5 shrink-0 rounded-full`,e.outcome===`failure`?`bg-destructive`:e.outcome===`success`?`bg-success`:`bg-primary`)}),(0,y.jsx)(`span`,{className:`truncate font-mono text-[11px] font-medium`,children:e.eventType})]}),(0,y.jsx)(`span`,{className:_(`w-fit rounded px-1.5 py-0.5 text-[9px]`,F(e.outcome)),children:e.outcome??`unknown`}),(0,y.jsx)(`span`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:i}),(0,y.jsx)(`span`,{className:`truncate font-mono text-[9px] text-muted-foreground`,children:a}),(0,y.jsx)(p,{className:`h-3.5 w-3.5 text-muted-foreground`})]})}function fe({event:e,graph:t}){let{t:n}=h(),r=(0,v.useMemo)(()=>[[`Scope`,e.scope],[`Correlation`,e.correlation],[`Runtime`,e.runtime],[`Resource`,e.resource],[`Attributes`,e.attributes],[`Tags`,e.tags]],[e]);return(0,y.jsxs)(`div`,{className:`p-4`,children:[(0,y.jsxs)(`div`,{className:`mb-4 rounded-lg border border-border bg-background/60 p-3`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:_(`h-2 w-2 rounded-full`,e.outcome===`failure`?`bg-destructive`:e.outcome===`success`?`bg-success`:`bg-primary`)}),(0,y.jsx)(`span`,{className:`font-mono text-xs font-semibold`,children:e.eventType})]}),(0,y.jsxs)(`div`,{className:`mt-2 flex gap-4 text-[9px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{children:new Date(e.occurredAt??e.observedAt).toLocaleString()}),(0,y.jsx)(`span`,{children:k(Number(e.durationNs??0))})]})]}),(0,y.jsxs)(`div`,{className:`mb-4 grid grid-cols-2 gap-2`,children:[(0,y.jsx)(N,{icon:(0,y.jsx)(g,{}),label:n(`activity:chronicle.evidenceHash`),value:e.hash.slice(0,16)}),(0,y.jsx)(N,{icon:(0,y.jsx)(l,{}),label:n(`activity:chronicle.sequence`),value:String(e.sequence)})]}),t&&(0,y.jsxs)(`section`,{className:`mb-4`,children:[(0,y.jsxs)(`h3`,{className:`mb-1.5 flex items-center gap-1 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:[(0,y.jsx)(d,{className:`h-3 w-3`}),`Lineage · `,t.nodes.length,` nodes · `,t.edges.length,` edges`]}),(0,y.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,y.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-[9px]`,children:[(0,y.jsx)(`span`,{className:_(`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,y.jsx)(`span`,{className:`text-muted-foreground`,children:e.kind}),(0,y.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,y.jsx)(`p`,{className:`mt-1 text-[9px] text-warning`,children:n(`activity:chronicle.lineageTruncatedAtSafetyLimit`)})]}),r.map(([e,t])=>t&&(0,y.jsxs)(`section`,{className:`mb-4`,children:[(0,y.jsx)(`h3`,{className:`mb-1.5 text-[9px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e}),(0,y.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 N({icon:e,label:t,value:n}){return(0,y.jsxs)(`div`,{className:`rounded-md border border-border p-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-1 text-[8px] uppercase text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`[&>svg]:h-3 [&>svg]:w-3`,children:e}),t]}),(0,y.jsx)(`div`,{className:`mt-1 truncate font-mono text-[9px]`,children:n})]})}function P({text:e}){return(0,y.jsx)(`div`,{className:`flex h-48 items-center justify-center text-sm text-muted-foreground`,children:e})}function F(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{T as ChronicleDashboard};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{$a as r,In as i,Jn as a,Mr as o,Mt as s,Pa as c,Va as l,Wr as u,Yt as d,bn as f,ci as p,dn as m,ii as h,wa as g,xo as _}from"./vendor-V3ydTHqN.js";import"./i18n--QdD6NCn.js";import{a as v,c as y,h as b,n as x,o as S,p as C,r as w,t as T,u as E}from"./xyflow-BqDBClm9.js";import{t as D}from"./utils-CKsqCaP8.js";var O=e(t(),1),k=n();function A({pct:e}){let{t}=_(),n=(0,O.useId)(),r=2*Math.PI*26,i=r-Math.max(0,Math.min(100,e))/100*r;return(0,k.jsxs)(`div`,{className:`relative h-16 w-16 shrink-0`,children:[(0,k.jsxs)(`svg`,{viewBox:`0 0 64 64`,className:`h-16 w-16 -rotate-90`,role:`img`,"aria-label":t(`activity:progressring.progress`),children:[(0,k.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`hsl(var(--muted))`,strokeWidth:`6`}),(0,k.jsx)(`circle`,{cx:`32`,cy:`32`,r:26,fill:`none`,stroke:`url(#${n})`,strokeWidth:`6`,strokeLinecap:`round`,strokeDasharray:r,strokeDashoffset:i,style:{transition:`stroke-dashoffset 0.6s cubic-bezier(0.16,1,0.3,1)`}}),(0,k.jsx)(`defs`,{children:(0,k.jsxs)(`linearGradient`,{id:n,x1:`0`,y1:`0`,x2:`1`,y2:`1`,children:[(0,k.jsx)(`stop`,{offset:`0%`,stopColor:`hsl(var(--primary))`}),(0,k.jsx)(`stop`,{offset:`100%`,stopColor:`hsl(var(--info))`})]})})]}),(0,k.jsxs)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm font-bold text-foreground`,children:[Math.round(e),`%`]})]})}var j={pending:{label:`Pending`,icon:g,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`},queued:{label:`Ready`,icon:g,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--primary))`},in_progress:{label:`Running`,icon:o,spin:!0,text:`text-warning`,ring:`border-warning/45 bg-warning/10`,dot:`bg-warning`,hex:`hsl(var(--warning))`},blocked:{label:`Blocked`,icon:g,text:`text-destructive`,ring:`border-destructive/30 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},review:{label:`Review`,icon:g,text:`text-primary`,ring:`border-primary/35 bg-primary/10`,dot:`bg-primary`,hex:`hsl(var(--info))`},failed:{label:`Failed`,icon:s,text:`text-destructive`,ring:`border-destructive/45 bg-destructive/10`,dot:`bg-destructive`,hex:`hsl(var(--destructive))`},completed:{label:`Done`,icon:c,text:`text-success`,ring:`border-success/35 bg-success/10`,dot:`bg-success`,hex:`hsl(var(--success))`},cancelled:{label:`Cancelled`,icon:r,text:`text-muted-foreground`,ring:`border-border/70 bg-muted/45`,dot:`bg-muted-foreground`,hex:`hsl(var(--muted-foreground))`}};function M(e){return j[e]??j.pending}var N={critical:{text:`text-destructive`,chip:`bg-destructive/10 text-destructive`},high:{text:`text-warning`,chip:`bg-warning/12 text-warning`},medium:{text:`text-primary`,chip:`bg-primary/10 text-primary`},low:{text:`text-muted-foreground`,chip:`bg-muted text-muted-foreground`}};function P(e){return N[e]??N.medium}var F={running:`border-primary/35 bg-primary/10 text-primary`,paused:`border-warning/35 bg-warning/10 text-warning`,stopped:`border-border/70 bg-muted text-muted-foreground`,completed:`border-success/35 bg-success/10 text-success`,failed:`border-destructive/35 bg-destructive/10 text-destructive`,deadlocked:`border-destructive/35 bg-destructive/10 text-destructive`,idle:`border-border bg-muted text-muted-foreground`},I=[`bg-warning`,`bg-primary`,`bg-success`,`bg-destructive`,`bg-secondary`,`bg-muted-foreground`,`bg-accent`],L={started:{icon:a,color:`text-warning`},completed:{icon:c,color:`text-success`},failed:{icon:s,color:`text-destructive`},retrying:{icon:i,color:`text-warning`},wave:{icon:u,color:`text-primary`},deadlock:{icon:d,color:`text-destructive`},verification_failed:{icon:f,color:`text-destructive`},conflict:{icon:h,color:`text-warning`},split:{icon:m,color:`text-primary`},supervisor:{icon:l,color:`text-primary`}};function R(e){let t=e.trim().split(/\s+/);return((t[0]?.[0]??``)+(t[1]?.[0]??``)).toUpperCase()||`·`}function z(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?t%60?`${n}m ${t%60}s`:`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function B(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m`:`${Math.floor(r/60)}h`}var V=300,H=128,U=240,W={pending:{ring:`border-border/70`,chip:`bg-muted text-muted-foreground`,dot:`bg-muted-foreground`},queued:{ring:`border-primary/35`,chip:`bg-primary/10 text-primary`,dot:`bg-primary`},in_progress:{ring:`border-warning/45`,chip:`bg-warning/12 text-warning`,dot:`bg-warning`},blocked:{ring:`border-destructive/30`,chip:`bg-destructive/10 text-destructive`,dot:`bg-destructive`},review:{ring:`border-primary/35`,chip:`bg-primary/10 text-primary`,dot:`bg-primary`},failed:{ring:`border-destructive/45`,chip:`bg-destructive/10 text-destructive`,dot:`bg-destructive`},completed:{ring:`border-success/35`,chip:`bg-success/12 text-success`,dot:`bg-success`},cancelled:{ring:`border-border/70`,chip:`bg-muted text-muted-foreground`,dot:`bg-muted-foreground`}};function G({data:e}){let t=e.task,{t:n}=_(),r=W[t.displayStatus],a=t.displayStatus===`in_progress`,l=t.displayStatus===`completed`?c:t.displayStatus===`failed`?s:a?o:g;return(0,k.jsxs)(`div`,{className:D(`sdd-node-enter group relative rounded-lg border bg-card/95 px-2.5 py-2 text-left shadow-lg backdrop-blur`,r.ring,a&&`sdd-node-running`,t.displayStatus===`completed`&&`sdd-node-complete`,t.displayStatus===`failed`&&`sdd-node-failed`,e.onTaskClick&&`hover:brightness-125`),style:{width:U,animationDelay:`${Math.min(e.index*45,600)}ms`},children:[e.onTaskClick&&(0,k.jsx)(`button`,{type:`button`,"aria-label":n(`activity:sdd.openTask`,{title:t.title,defaultValue:`Open task: ${t.title}`}),className:`absolute inset-0 z-10 cursor-pointer rounded-lg`,onClick:()=>e.onTaskClick?.(t.id)}),(0,k.jsx)(v,{type:`target`,position:b.Left,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,k.jsx)(v,{type:`source`,position:b.Right,isConnectable:!1,className:`!h-1.5 !w-1.5 !border-0 !bg-border`}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,k.jsx)(l,{className:D(`h-3.5 w-3.5`,a&&`animate-spin`,r.chip.split(` `).find(e=>e.startsWith(`text`)))}),(0,k.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:t.shortId}),(0,k.jsx)(`span`,{className:D(`font-mono text-[10px] font-bold uppercase`,P(t.priority).text),children:t.priority[0]}),(0,k.jsx)(`span`,{className:D(`ml-auto rounded px-1.5 py-px text-[9px] font-medium`,r.chip),children:n(`activity:sdd.status.${t.displayStatus}`)})]}),(0,k.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:t.title}),(t.agentName||t.worktreeBranch)&&(0,k.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[t.agentName&&(0,k.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,k.jsx)(`span`,{className:D(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,a?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:R(t.agentName)}),(0,k.jsx)(`span`,{className:`max-w-[88px] truncate text-[10px] text-muted-foreground`,children:t.agentName})]}),t.retries?(0,k.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,k.jsx)(i,{className:`h-2.5 w-2.5`}),t.retries]}):null,t.worktreeBranch&&(0,k.jsxs)(`span`,{className:`ml-auto flex items-center gap-0.5 text-[9px] text-muted-foreground`,title:t.worktreeBranch,children:[(0,k.jsx)(p,{className:`h-2.5 w-2.5`}),(0,k.jsx)(`span`,{className:`max-w-[70px] truncate`,children:t.worktreeBranch.replace(/^.*\//,``)})]})]})]})}function K({data:e}){return(0,k.jsx)(`div`,{className:`whitespace-nowrap text-[11px] font-bold uppercase text-muted-foreground`,children:e.label})}var q={task:G,colLabel:K};function J(e,t,n){let r=new Map(e.map(e=>[e.shortId,e])),i=[],a=0;t.forEach((e,t)=>{i.push({id:`__col_${t}`,position:{x:t*V,y:-52},data:{label:e.label},draggable:!1,selectable:!1,type:`colLabel`,style:{pointerEvents:`none`}}),e.taskIds.forEach((e,o)=>{let s=r.get(e);s&&i.push({id:s.id,position:{x:t*V,y:o*H},data:{task:s,index:a++,onTaskClick:n},type:`task`,draggable:!0})})});let o=[];for(let t of e)for(let e of t.deps){let n=r.get(e);if(!n)continue;let i=n.displayStatus===`completed`&&(t.displayStatus===`in_progress`||t.displayStatus===`queued`);o.push({id:`${n.id}->${t.id}`,source:n.id,target:t.id,animated:i,className:i?`sdd-edge-flow`:void 0,style:{stroke:M(t.displayStatus).hex,strokeWidth:i?2.2:1.4,opacity:t.displayStatus===`pending`?.4:.85}})}return{nodes:i,edges:o}}function Y({tasks:e,columns:t,onTaskClick:n}){let{fitView:r}=C(),{nodes:i,edges:a}=(0,O.useMemo)(()=>J(e,t,n),[e,t,n]),o=e.length;return(0,O.useEffect)(()=>{let e=setTimeout(()=>r({padding:.18,duration:400}),60);return()=>clearTimeout(e)},[o,r]),(0,k.jsxs)(E,{nodes:i,edges:a,nodeTypes:q,fitView:!0,fitViewOptions:{padding:.18},minZoom:.2,maxZoom:1.6,proOptions:{hideAttribution:!0},nodesConnectable:!1,elementsSelectable:!!n,children:[(0,k.jsx)(T,{variant:x.Dots,gap:22,size:1,color:`hsl(var(--border))`}),(0,k.jsx)(w,{showInteractive:!1,className:`!bottom-2 !left-2`}),(0,k.jsx)(S,{pannable:!0,zoomable:!0,nodeStrokeWidth:2,maskColor:`hsl(var(--background) / 0.65)`,nodeColor:e=>{let t=e.data?.task?.displayStatus;return t?M(t).hex:`hsl(var(--muted-foreground))`},className:`!bottom-2 !right-2 !h-24 !w-40 overflow-hidden rounded-md border border-border/70 bg-card`})]})}function X({tasks:e,columns:t,onTaskClick:n}){return(0,k.jsx)(y,{children:(0,k.jsx)(Y,{tasks:e,columns:t,onTaskClick:n})})}export{R as a,P as c,F as i,M as l,I as n,B as o,L as r,z as s,X as t,A as u};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-core-wiHys0m2.js";import{$a as r,$n as i,Br as a,En as o,Fa as s,Hr as c,Ht as l,In as u,Jn as d,Ka as f,Mr as p,Mt as m,Na as h,Pa as g,Qi as _,Qt as v,Rn as y,Ta as b,Ti as x,Ui as S,Wt as ee,Yt as te,ci as C,cn as ne,dn as w,ea as T,fn as E,ga as D,gr as re,ha as O,ho as k,ja as A,jr as j,jt as M,nn as ie,pn as N,qt as ae,so as P,tn as F,ua as oe,ur as se,wo as I,wr as ce,xo as L}from"./vendor-V3ydTHqN.js";import"./i18n--QdD6NCn.js";import{t as R}from"./utils-CKsqCaP8.js";import{o as z,r as B}from"./view-navigation-DTs4cSQ6.js";import{i as V}from"./mailbox-store-ZQO_Rv6E.js";import{n as le}from"./ui-store-DC3mkswy.js";import{a as H,m as U,r as W}from"./stores-2kakt8j9.js";import{a as G,i as K,n as q,o as J,r as ue,t as de}from"./dialog-b-Ai37sa.js";import{t as Y}from"./button-BbeB5Qm8.js";import{L as fe,g as pe,h as me,v as he,y as ge}from"./index-FWwLmwjx.js";import{a as _e,c as ve,i as ye,l as be,n as xe,o as Se,r as Ce,s as we,t as Te,u as Ee}from"./SddFlowGraph-DS8R2zEj.js";import{RequirementIntakeView as De}from"./RequirementIntakeView-Cj5arGFF.js";var X=e(t(),1),Z=n();function Oe({feed:e,now:t}){let{t:n}=L();return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-border px-3 py-2 text-xs font-semibold text-foreground`,children:[(0,Z.jsx)(k,{className:`h-3.5 w-3.5 text-warning`}),n(`activity:sdd.activityHeading`)]}),(0,Z.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 space-y-1 overflow-auto overscroll-contain p-2`,children:e.length===0?(0,Z.jsx)(`p`,{className:`px-1 pt-4 text-center text-[11px] text-muted-foreground`,children:n(`activity:sdd.feedEmpty`)}):e.map((e,n)=>{let r=Ce[e.kind]??Ce.started,i=r.icon;return(0,Z.jsxs)(`div`,{className:R(`sdd-rise flex items-start gap-2 rounded-md px-2 py-1.5 text-[11px]`,n===0?`bg-muted`:`hover:bg-muted`),children:[(0,Z.jsx)(i,{className:R(`mt-0.5 h-3.5 w-3.5 shrink-0`,r.color)}),(0,Z.jsx)(`span`,{className:`flex-1 leading-snug text-foreground`,children:e.text}),(0,Z.jsx)(`span`,{className:`shrink-0 tabular-nums text-[10px] text-muted-foreground`,children:Se(e.ts,t)})]},`${e.ts}-${n}`)})})]})}function ke({open:e,onOpenChange:t,snapshot:n,busy:r,onConfirm:i}){let{t:a}=L(),o=n?.mergedCommits?.length??0,s=n?.baseBranch,[c,l]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&l(!1)},[e]);let u=n?.status===`running`||n?.status===`paused`,d=(0,X.useMemo)(()=>{let e=new Set;for(let t of n?.tasks??[])t.worktreeBranch&&e.add(t.worktreeBranch);return e.size},[n?.tasks]),f=(0,X.useMemo)(()=>{let e=new Set;for(let t of n?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.add(t.agentName);return e.size},[n?.tasks]);return(0,Z.jsx)(de,{open:e,onOpenChange:e=>!r&&t(e),children:(0,Z.jsxs)(q,{className:`sm:max-w-lg border-destructive/50`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsxs)(J,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(v,{className:`h-5 w-5 text-destructive`}),a(`activity:sdd.destroyTitle`)]}),(0,Z.jsx)(ue,{children:a(`activity:sdd.destroyDesc`)})]}),(0,Z.jsxs)(`ul`,{className:`space-y-1.5 py-1 text-sm`,children:[u&&(0,Z.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Z.jsx)(`span`,{children:f>0?a(`activity:sdd.stopRunAgents`,{count:f}):a(`activity:sdd.stopRun`)})]}),(0,Z.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Z.jsx)(`span`,{children:d>0?a(`activity:sdd.removeWorktreesCount`,{count:d}):a(`activity:sdd.removeWorktreesAll`)})]}),(0,Z.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 text-destructive`,children:`■`}),(0,Z.jsx)(`span`,{children:a(`activity:sdd.deleteArtifacts`)})]})]}),o>0&&(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md border border-warning/30 bg-warning/5 p-2.5 text-sm`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:c,onChange:e=>l(e.target.checked),className:`mt-0.5 h-4 w-4 accent-warning`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:a(`activity:sdd.revertMerged`,{count:o})}),` `,`on`,` `,(0,Z.jsx)(`code`,{className:`text-xs`,children:s??a(`activity:sdd.baseBranchFallback`)}),(0,Z.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:a(`activity:sdd.revertHint`)})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-muted/50 p-2 text-xs text-muted-foreground`,children:[(0,Z.jsx)(te,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),a(o>0&&!c?`activity:sdd.noteLeaveMerged`:`activity:sdd.noteAbandon`)]}),(0,Z.jsxs)(K,{className:`gap-2 sm:gap-2`,children:[(0,Z.jsx)(Y,{variant:`outline`,size:`sm`,disabled:r,onClick:()=>t(!1),children:a(`common:action.cancel`)}),(0,Z.jsx)(Y,{size:`sm`,disabled:r,onClick:()=>i(c),className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(p,{className:`mr-1 h-3.5 w-3.5 animate-spin`}),` `,a(`activity:sdd.destroying`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v,{className:`mr-1 h-3.5 w-3.5`}),` `,a(`activity:sdd.destroyAll`)]})})]})]})})}var Ae=[{key:`pending`,labelKey:`kanbanBacklog`,accent:`border-border/70`,head:`text-muted-foreground`},{key:`queued`,labelKey:`kanbanReady`,accent:`border-primary/35`,head:`text-primary`},{key:`in_progress`,labelKey:`kanbanRunning`,accent:`border-warning/45`,head:`text-warning`},{key:`review`,labelKey:`kanbanReview`,accent:`border-primary/35`,head:`text-primary`},{key:`failed`,labelKey:`kanbanFailed`,accent:`border-destructive/35`,head:`text-destructive`},{key:`completed`,labelKey:`kanbanDone`,accent:`border-success/35`,head:`text-success`}];function je({tasks:e,selectedId:t,onTaskClick:n}){let{t:r}=L(),i=(0,X.useMemo)(()=>{let t=new Map;for(let e of Ae)t.set(e.key,[]);for(let n of e){let e=n.displayStatus===`blocked`?`pending`:n.displayStatus===`cancelled`?`failed`:n.displayStatus;(t.get(e)??t.get(`pending`))?.push(n)}return t},[e]);return(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 gap-3 overflow-x-auto p-4`,children:Ae.map(e=>{let a=i.get(e.key)??[];return(0,Z.jsxs)(`div`,{className:`flex min-h-0 w-64 shrink-0 flex-col`,children:[(0,Z.jsxs)(`div`,{className:R(`mb-2 flex items-center gap-2 border-b-2 pb-1.5`,e.accent),children:[(0,Z.jsx)(`span`,{className:R(`text-xs font-bold uppercase tracking-wide`,e.head),children:r(`activity:sdd.${e.labelKey}`)}),(0,Z.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground`,children:a.length})]}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1`,children:[a.map(e=>(0,Z.jsx)(Q,{task:e,selected:e.id===t,onClick:()=>n(e.id)},e.id)),a.length===0&&(0,Z.jsx)(`div`,{className:`rounded-md border border-dashed border-border py-6 text-center text-[10px] text-muted-foreground`,children:r(`activity:sdd.kanbanEmpty`)})]})]},e.key)})})}function Q({task:e,selected:t,onClick:n}){let r=e.displayStatus===`in_progress`;return(0,Z.jsxs)(`button`,{type:`button`,onClick:n,className:R(`sdd-node-enter w-full rounded-lg border bg-card/85 p-2 text-left shadow-sm transition hover:border-primary/35 hover:bg-accent/35`,t?`border-primary/55 ring-1 ring-primary/35`:`border-border/70`,r&&`sdd-node-running`,e.displayStatus===`completed`&&`sdd-node-complete`,e.displayStatus===`failed`&&`sdd-node-failed`),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[r&&(0,Z.jsx)(p,{className:`h-3 w-3 animate-spin text-warning`}),e.displayStatus===`completed`&&(0,Z.jsx)(g,{className:`h-3 w-3 text-success`}),e.displayStatus===`failed`&&(0,Z.jsx)(m,{className:`h-3 w-3 text-destructive`}),(0,Z.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,children:e.shortId}),(0,Z.jsx)(`span`,{className:R(`ml-auto rounded px-1.5 text-[9px] font-bold uppercase`,ve(e.priority).chip),children:e.priority})]}),(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[11px] leading-snug text-foreground`,children:e.title}),(e.agentName||e.worktreeBranch||e.retries)&&(0,Z.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5`,children:[e.agentName&&(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`span`,{className:R(`flex h-4 w-4 items-center justify-center rounded-full text-[8px] font-bold text-white`,r?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:_e(e.agentName)}),(0,Z.jsx)(`span`,{className:`max-w-[80px] truncate text-[10px] text-muted-foreground`,children:e.agentName})]}),e.retries?(0,Z.jsxs)(`span`,{className:`flex items-center gap-0.5 text-[9px] text-destructive`,children:[(0,Z.jsx)(u,{className:`h-2.5 w-2.5`}),e.retries]}):null,e.worktreeBranch&&(0,Z.jsx)(C,{className:`ml-auto h-2.5 w-2.5 text-muted-foreground`})]})]})}function Me({task:e,allTasks:t,feed:n,now:r,expanded:i,modelCandidates:a,defaultModel:o,onClose:s,onToggleExpanded:c,onRetry:l,onReassign:d,onSetModel:f,onSetVerification:p,onCancel:h,onDelete:_,onSplit:y,onSelectTask:b}){let{t:x}=L(),S=be(e.displayStatus),te=S.icon,T=e.displayStatus===`in_progress`,E=e.displayStatus===`pending`||e.displayStatus===`blocked`||e.displayStatus===`queued`,[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(``),[j,M]=(0,X.useState)(null),[ie,N]=(0,X.useState)(!1),[ae,F]=(0,X.useState)(``),[se,I]=(0,X.useState)(!1),[z,B]=(0,X.useState)(e.verificationCommand??``),V=()=>{k.trim()&&(d(e.id,k.trim()),O(!1),A(``))},le=()=>{let t=ae.split(`
2
- `).map(e=>e.trim()).filter(Boolean).map(e=>{let[t,...n]=e.split(`::`),r=(t??``).trim();return{title:r,description:n.join(`::`).trim()||r}}).filter(e=>e.title);t.length&&(y(e.id,t),N(!1),F(``))},H=(0,X.useMemo)(()=>new Map(t.map(e=>[e.shortId,e])),[t]),U=(0,X.useMemo)(()=>t.filter(t=>t.deps.includes(e.shortId)),[t,e.shortId]),W=(0,X.useMemo)(()=>n.filter(t=>t.taskId===e.id||t.taskShortId===e.shortId),[n,e.id,e.shortId]),G=e.startedAt&&!e.completedAt?we(r-e.startedAt):e.startedAt&&e.completedAt?we(e.completedAt-e.startedAt):null;return(0,Z.jsxs)(`div`,{className:`sdd-rise flex h-full min-h-0 min-w-0 flex-col`,children:[(0,Z.jsxs)(`div`,{className:R(`flex items-center gap-2 border-b border-border/70 bg-card/70 px-3 py-2`,i&&`px-5 py-3`),children:[(0,Z.jsx)(`button`,{type:`button`,onClick:s,className:`text-muted-foreground hover:text-foreground`,title:x(`activity:sddTask.backTitle`),children:(0,Z.jsx)(P,{className:`h-4 w-4`})}),(0,Z.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),c&&(0,Z.jsx)(`button`,{type:`button`,onClick:c,className:`ml-1 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground`,title:x(i?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-label":x(i?`activity:sddTask.collapseTitle`:`activity:sddTask.expandTitle`),"aria-pressed":i,children:i?(0,Z.jsx)(re,{className:`h-4 w-4`}):(0,Z.jsx)(ce,{className:`h-4 w-4`})}),(0,Z.jsxs)(`span`,{className:R(`ml-auto flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px]`,S.ring,S.text),children:[(0,Z.jsx)(te,{className:R(`h-3 w-3`,T&&`animate-spin`)}),S.label]})]}),(0,Z.jsxs)(`div`,{className:R(`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain`,i?`grid grid-cols-2 content-start gap-4 p-5`:`space-y-3 p-3`),children:[(0,Z.jsx)(`h3`,{className:R(`text-sm font-semibold leading-snug text-foreground`,i&&`col-span-2 text-lg`),children:e.title}),e.agentName&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/70 bg-muted/45 p-2`,children:[(0,Z.jsx)(`span`,{className:R(`flex h-7 w-7 items-center justify-center rounded-full text-[10px] font-bold text-white`,T?`bg-warning sdd-agent-live`:`bg-muted-foreground`),children:_e(e.agentName)}),(0,Z.jsxs)(`div`,{className:`leading-tight`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:e.agentName}),(0,Z.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:x(T?`activity:sddTask.workingOn`:`activity:sddTask.assigned`)})]})]}),(0,Z.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5 text-[11px]`,children:[(0,Z.jsx)($,{label:x(`activity:sddTask.metaPriority`),children:(0,Z.jsx)(`span`,{className:R(`font-medium uppercase`,ve(e.priority).text),children:e.priority})}),(0,Z.jsx)($,{label:x(`activity:sddTask.metaType`),children:e.type}),G&&(0,Z.jsx)($,{label:e.completedAt?x(`activity:sddTask.metaDuration`):x(`activity:sddTask.metaElapsed`),children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(oe,{className:`h-3 w-3 text-muted-foreground`}),G]})}),e.retries?(0,Z.jsx)($,{label:x(`activity:sddTask.metaRetries`),children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-destructive`,children:[(0,Z.jsx)(u,{className:`h-3 w-3`}),e.retries]})}):null,e.worktreeBranch&&(0,Z.jsx)($,{label:x(`activity:sddTask.metaWorktree`),full:!0,children:(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 font-mono text-foreground`,title:e.worktreeBranch,children:[(0,Z.jsx)(C,{className:`h-3 w-3 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.worktreeBranch})]})})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[x(`activity:sddTask.workerModel`),!e.model&&o&&(0,Z.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,x(`activity:sddTask.runDefault`,{model:o})]})]}),(0,Z.jsx)(pe,{value:e.model,provider:e.provider,candidates:a,placeholder:o?x(`activity:sddTask.runDefaultPlaceholderModel`,{model:o}):x(`activity:sddTask.runDefaultPlaceholder`),onPick:(t,n)=>f(e.id,t,n),onReset:e.model?()=>f(e.id,void 0,void 0):void 0}),e.fallbackModels&&e.fallbackModels.length>0&&(0,Z.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:e.fallbackModels.map(e=>(0,Z.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`↳ `,e]},e))})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[x(`activity:sddTask.verificationCmd`),(0,Z.jsxs)(`span`,{className:`font-normal normal-case text-muted-foreground`,children:[`· `,x(`activity:sddTask.gatesCompletion`)]})]}),se?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`input`,{value:z,onChange:e=>B(e.target.value),onKeyDown:t=>{t.key===`Enter`?(p(e.id,z.trim()||void 0),I(!1)):t.key===`Escape`&&(B(e.verificationCommand??``),I(!1))},placeholder:x(`activity:sddTask.verifyPlaceholder`),className:`w-full rounded border border-border bg-background px-2 py-1 font-mono text-[11px] text-foreground`}),(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{p(e.id,z.trim()||void 0),I(!1)},className:`rounded bg-primary px-2 py-0.5 text-[10px] text-primary-foreground hover:opacity-90`,children:x(`common:action.save`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{B(e.verificationCommand??``),I(!1)},className:`rounded bg-muted px-2 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:x(`common:action.cancel`)})]})]}):e.verificationCommand?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.verificationState&&(0,Z.jsx)(`span`,{title:e.verificationDetail,className:e.verificationState===`passed`?`rounded bg-success/10 px-1.5 py-0.5 text-[10px] text-success`:`rounded bg-destructive/10 px-1.5 py-0.5 text-[10px] text-destructive`,children:e.verificationState===`passed`?`✓ verified`:`✗ failed`}),(0,Z.jsx)(`code`,{className:`flex-1 truncate rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-foreground`,children:e.verificationCommand}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>I(!0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:x(`common:action.edit`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>p(e.id,void 0),className:`rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground hover:bg-muted/80`,children:x(`common:action.clear`)})]}):(0,Z.jsx)(`button`,{type:`button`,onClick:()=>I(!0),className:`rounded border border-dashed border-border px-2 py-1 text-[10px] text-muted-foreground hover:bg-muted`,children:x(`activity:sddTask.addVerify`)})]}),e.description&&(0,Z.jsxs)(`div`,{className:R(i&&`col-span-2`),children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:x(`activity:sddTask.description`)}),(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap rounded-md bg-muted p-2 text-[11px] leading-relaxed text-foreground`,children:e.description})]}),(0,Z.jsx)(Ne,{events:W,expanded:i}),e.deps.length>0&&(0,Z.jsx)(Pe,{title:x(`activity:sddTask.dependsOn`),shortIds:e.deps,byShort:H,onSelectTask:b}),U.length>0&&(0,Z.jsx)(Pe,{title:x(`activity:sddTask.blocks`),shortIds:U.map(e=>e.shortId),byShort:H,onSelectTask:b})]}),(0,Z.jsxs)(`div`,{className:R(`border-t border-border p-2`,i&&`px-5 py-3`),children:[D?(0,Z.jsxs)(`div`,{className:`sdd-rise flex items-center gap-1.5`,children:[(0,Z.jsx)(`input`,{value:k,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&V(),e.key===`Escape`&&O(!1)},placeholder:x(`activity:sddTask.newWorkerPlaceholder`),className:`min-w-0 flex-1 rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs outline-none focus:border-primary/60`}),(0,Z.jsx)(`button`,{type:`button`,onClick:V,disabled:!k.trim(),className:`rounded-md bg-primary/10 px-2 py-1.5 text-xs font-medium text-primary hover:bg-primary/15 disabled:opacity-40`,children:(0,Z.jsx)(g,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>O(!1),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Z.jsx)(m,{className:`h-3.5 w-3.5`})})]}):j?(0,Z.jsxs)(`div`,{className:`sdd-rise flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`flex-1 text-xs text-foreground`,children:x(j===`stop`?`activity:sddTask.confirmStop`:`activity:sddTask.confirmDelete`)}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>{j===`stop`?h(e.id):_(e.id),M(null)},className:`inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Z.jsx)(g,{className:`h-3.5 w-3.5`}),` `,x(j===`stop`?`common:action.stop`:`common:action.delete`)]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>M(null),className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Z.jsx)(m,{className:`h-3.5 w-3.5`})})]}):(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>l(e.id),title:x(`activity:sddTask.retryTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-warning/12 py-1.5 text-xs font-medium text-warning hover:bg-warning/18`,children:[(0,Z.jsx)(u,{className:`h-3.5 w-3.5`}),` `,x(`common:action.retry`)]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>O(!0),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,Z.jsx)(ee,{className:`h-3.5 w-3.5`}),` `,x(`activity:sddTask.reassign`)]}),T&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>M(`stop`),title:x(`activity:sddTask.stopTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Z.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,x(`common:action.stop`)]}),!T&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>N(!0),title:x(`activity:sddTask.splitTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,Z.jsx)(w,{className:`h-3.5 w-3.5`}),` `,x(`activity:sddTask.split`)]}),E&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>M(`delete`),title:x(`activity:sddTask.deleteTitle`),className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-destructive/10 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/15`,children:[(0,Z.jsx)(v,{className:`h-3.5 w-3.5`}),` `,x(`common:action.delete`)]})]}),ie&&(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,Z.jsx)(`label`,{className:`text-[11px] text-muted-foreground`,htmlFor:`sdd-split-input`,children:x(`activity:sddTask.splitHint`)}),(0,Z.jsx)(`textarea`,{id:`sdd-split-input`,rows:3,value:ae,onChange:e=>F(e.target.value),placeholder:x(`activity:sddTask.splitPlaceholder`),className:`w-full resize-y rounded-md border border-border/70 bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring`}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:le,className:`inline-flex flex-1 items-center justify-center gap-1 rounded-md bg-primary/10 py-1.5 text-xs font-medium text-primary hover:bg-primary/15`,children:[(0,Z.jsx)(w,{className:`h-3.5 w-3.5`}),` `,x(`activity:sddTask.splitInto`)]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{N(!1),F(``)},className:`rounded-md bg-muted px-2 py-1.5 text-xs text-muted-foreground hover:bg-muted`,children:(0,Z.jsx)(m,{className:`h-3.5 w-3.5`})})]})]})]})]})}function Ne({events:e,expanded:t}){let{t:n}=L();return(0,Z.jsxs)(`section`,{className:R(`rounded-lg border border-border/70 bg-background/45`,t&&`col-span-2`),children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 px-3 py-2.5`,children:[(0,Z.jsx)(k,{className:`h-4 w-4 text-primary`}),(0,Z.jsx)(`h4`,{className:`text-xs font-semibold text-foreground`,children:n(`activity:sddTask.eventLog`)}),(0,Z.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,children:e.length}),(0,Z.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:n(`activity:sddTask.newestFirst`)})]}),e.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-5 text-center text-[11px] text-muted-foreground`,children:n(`activity:sddTask.noEvents`)}):(0,Z.jsx)(`div`,{className:R(`divide-y divide-border/45 overflow-auto`,t?`max-h-[32rem]`:`max-h-72`),children:e.map((e,t)=>{let n=e.kind===`file`,r=e.kind===`tool`,i=e.ok===!1||e.kind===`failed`||e.kind===`verification_failed`,a=n?x:r?F:k;return(0,Z.jsxs)(`div`,{className:R(`grid grid-cols-[4.75rem_1rem_minmax(0,1fr)] gap-2 px-3 py-2.5 text-[11px]`,i&&`bg-destructive/[0.035]`),children:[(0,Z.jsx)(`time`,{dateTime:new Date(e.ts).toISOString(),className:`font-mono text-[10px] text-muted-foreground`,title:new Date(e.ts).toLocaleString(),children:new Date(e.ts).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Z.jsx)(a,{className:R(`mt-0.5 h-3.5 w-3.5`,i?`text-destructive`:n?`text-info`:r?`text-warning`:`text-primary`)}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[e.action&&(0,Z.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] font-medium text-foreground`,children:e.action}),e.agentName&&(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.agentName}),e.durationMs!==void 0&&(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.durationMs<1e3?`${Math.round(e.durationMs)}ms`:`${(e.durationMs/1e3).toFixed(1)}s`})]}),e.filePath?(0,Z.jsx)(`code`,{className:`mt-1 block break-all font-mono text-[10px] leading-relaxed text-foreground`,children:e.filePath}):e.detail?(0,Z.jsx)(`code`,{className:`mt-1 block break-words font-mono text-[10px] leading-relaxed text-muted-foreground`,children:e.detail}):(0,Z.jsx)(`p`,{className:`mt-1 break-words leading-relaxed text-foreground`,children:e.text})]})]},`${e.ts}-${e.kind}-${t}`)})})]})}function $({label:e,children:t,full:n}){return(0,Z.jsxs)(`div`,{className:R(`rounded-md border border-border bg-muted/50 px-2 py-1`,n&&`col-span-2`),children:[(0,Z.jsx)(`div`,{className:`text-[9px] uppercase tracking-wide text-muted-foreground`,children:e}),(0,Z.jsx)(`div`,{className:`text-foreground`,children:t})]})}function Pe({title:e,shortIds:t,byShort:n,onSelectTask:r}){return(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:t.map(e=>{let t=n.get(e);return(0,Z.jsxs)(`button`,{type:`button`,disabled:!t,onClick:()=>t&&r(t.id),className:`flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-foreground hover:bg-muted disabled:opacity-50`,title:t?.title,children:[(0,Z.jsx)(`span`,{className:R(`h-1.5 w-1.5 rounded-full`,be(t?.displayStatus??`pending`).dot)}),(0,Z.jsx)(`span`,{className:`font-mono`,children:e})]},e)})})]})}function Fe({onClose:e}){let{t}=L(),{client:n}=fe(),r=H(e=>e.snapshot),a=H(e=>e.lifecycleResult),o=H(e=>e.destroying),s=H(e=>e.setDestroying),c=H(e=>e.setLifecycleResult),[l,f]=(0,X.useState)(()=>Date.now()),[p,h]=(0,X.useState)(null),[g,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(`graph`),[ee,C]=(0,X.useState)(!1);(0,X.useEffect)(()=>{n?.send?.({type:`sdd.board.get`})},[n]);let w=r&&(r.status===`running`||r.status===`paused`);(0,X.useEffect)(()=>{if(!w)return;let e=setInterval(()=>f(Date.now()),1e3);return f(Date.now()),()=>clearInterval(e)},[w]);let T=(0,X.useCallback)(e=>n?.send?.(e),[n]),E=(0,X.useRef)(null),D=(0,X.useCallback)(e=>{E.current=null,T({type:`sdd.board.destroy`,payload:{revertMerged:e}})},[T]),re=(0,X.useCallback)(e=>{C(!1),c(null),s(!0),w?(T({type:`sdd.board.stop`,payload:{}}),E.current={revertMerged:e,deadline:Date.now()+5e3}):D(e)},[w,T,D,s,c]);(0,X.useEffect)(()=>{let e=E.current;if(!e)return;if(!w||Date.now()>=e.deadline){D(e.revertMerged);return}let t=setTimeout(()=>{let e=E.current;e&&D(e.revertMerged)},Math.max(0,e.deadline-Date.now()));return()=>clearTimeout(t)},[w,r,D]);let O=(0,X.useCallback)(()=>{c(null),T({type:`sdd.board.cleanup_worktrees`,payload:{}})},[T,c]),A=(0,X.useCallback)(()=>{c(null),T({type:`sdd.board.rollback`,payload:{}})},[T,c]),j=(0,X.useMemo)(()=>(r?.tasks??[]).map(e=>({id:e.id,shortId:e.shortId,title:e.title,displayStatus:e.displayStatus,priority:e.priority,deps:e.deps,agentName:e.agentName,worktreeBranch:e.worktreeBranch})),[r?.tasks]),ie=(0,X.useMemo)(()=>{let e=new Map;for(let t of r?.tasks??[])t.displayStatus===`in_progress`&&t.agentName&&e.set(t.agentName,{name:t.agentName,task:t.title});return[...e.values()]},[r?.tasks]),N=(0,X.useCallback)(e=>h(e),[]),P=(0,X.useCallback)(()=>{h(null),y(!1)},[]),F=(0,X.useCallback)(e=>T({type:`sdd.board.retry`,payload:{taskId:e}}),[T]),oe=(0,X.useCallback)(()=>T({type:`sdd.board.retry_all_failed`,payload:{}}),[T]),se=(0,X.useCallback)((e,t)=>{let n=t.trim();n&&T({type:`sdd.board.reassign`,payload:{taskId:e,agentName:n}})},[T]),I=(0,X.useCallback)((e,t,n)=>T({type:`sdd.board.set_task_model`,payload:{taskId:e,model:t,provider:n}}),[T]),ce=(0,X.useCallback)((e,t)=>T({type:`sdd.board.set_task_verification`,payload:{taskId:e,verificationCommand:t}}),[T]),z=(0,X.useCallback)(e=>T({type:`sdd.board.cancel_task`,payload:{taskId:e}}),[T]),B=(0,X.useCallback)(e=>{T({type:`sdd.board.delete_task`,payload:{taskId:e}}),h(null),y(!1)},[T]),V=(0,X.useCallback)((e,t)=>{T({type:`sdd.board.split_task`,payload:{taskId:e,subtasks:t}}),h(null),y(!1)},[T]),W=he(p!==null),G=(0,X.useMemo)(()=>r?.tasks.find(e=>e.id===p)??null,[r?.tasks,p]),K=r?.progress,q=r?.diagnostics?.deadlockChains??[];return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Z.jsxs)(`header`,{className:`sdd-sheen shrink-0 border-b border-border px-4 pb-3 pt-2.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(k,{className:`h-5 w-5 text-warning`}),(0,Z.jsx)(`h1`,{className:`text-lg font-semibold text-foreground`,children:r?.title??t(`activity:sddBoard.titleFallback`)}),r&&(0,Z.jsx)(`span`,{className:R(`rounded-full border px-2 py-0.5 text-[11px] font-medium capitalize`,ye[r.status]??ye.idle),children:r.status}),r?.defaultModel&&(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-muted-foreground`,title:t(`activity:sddBoard.defaultModelTitle`),children:[(0,Z.jsx)(_,{className:`h-3 w-3 text-primary`}),r.defaultModel]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r&&(0,Z.jsxs)(`button`,{type:`button`,title:t(`activity:sddBoardView.openTheMirroredKanbanBoardSForThisRunOnePerDependencyWave`),onClick:()=>{let e=`run:${r.runId}`,t=U.getState().boards.filter(t=>t.tags?.includes(e)),i=t.find(e=>e.tags?.includes(`phase:wave-0`))??t[0];i&&(U.getState().setActiveBoardId(i.id),n?.send?.({type:`kanban.get`,payload:{boardId:i.id}})),le.getState().setCurrentView(`kanban`)},className:`inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,Z.jsx)(k,{className:`h-3.5 w-3.5`}),` Kanban`]}),r&&(0,Z.jsx)(`div`,{className:`flex items-center rounded-md border border-border bg-muted p-0.5 text-[11px]`,children:[`graph`,`kanban`].map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:()=>x(e),className:R(`rounded px-2 py-0.5 capitalize transition`,b===e?`bg-primary/12 text-primary`:`text-muted-foreground hover:text-foreground`),children:t(e===`graph`?`activity:sddBoard.graphLabel`:`activity:sddBoard.kanbanLabel`)},e))}),w&&(K?.failed??0)>0&&(0,Z.jsxs)(`button`,{type:`button`,onClick:oe,title:t(`activity:sddBoard.retryAllTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,Z.jsx)(u,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.retryFailed`,{count:K?.failed??0})]}),w&&(0,Z.jsxs)(Z.Fragment,{children:[r?.status===`paused`?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>T({type:`sdd.board.resume`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/25`,children:[(0,Z.jsx)(d,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.resume`)]}):(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>T({type:`sdd.board.pause`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,Z.jsx)(i,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.pause`)]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>T({type:`sdd.board.stop`,payload:{}}),className:`inline-flex items-center gap-1 rounded-md bg-destructive/15 px-2.5 py-1 text-xs font-medium text-destructive hover:bg-destructive/25`,children:[(0,Z.jsx)(ne,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.stop`)]})]}),r&&!w&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:O,title:t(`activity:sddBoard.cleanTitle`),className:`inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground hover:bg-muted/80`,children:[(0,Z.jsx)(S,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.cleanWorktrees`)]}),(r.mergedCommits?.length??0)>0&&(0,Z.jsxs)(`button`,{type:`button`,onClick:A,title:t(`activity:sddBoard.rollbackTitle`,{count:r.mergedCommits?.length??0,base:r.baseBranch??t(`activity:sdd.baseBranchFallback`)}),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning hover:bg-warning/25`,children:[(0,Z.jsx)(ae,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.rollback`,{count:r.mergedCommits?.length??0})]})]}),r&&(o?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-destructive/15 px-2.5 py-1 text-xs font-medium text-destructive`,children:[(0,Z.jsx)(u,{className:`h-3.5 w-3.5 animate-spin`}),` `,t(w?`activity:sddBoard.stopping`:`activity:sddBoard.destroying`)]}):(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>C(!0),title:t(`activity:sddBoard.destroyTitle`),className:`inline-flex items-center gap-1 rounded-md bg-destructive px-2.5 py-1 text-xs font-medium text-destructive-foreground hover:bg-destructive/90`,children:[(0,Z.jsx)(v,{className:`h-3.5 w-3.5`}),` `,t(`activity:sddBoard.destroy`)]})),(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Z.jsx)(m,{className:`h-4 w-4`})})]})]}),r&&K&&(0,Z.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-5`,children:[(0,Z.jsx)(Ee,{pct:K.percentComplete}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 text-xs`,children:[(0,Z.jsx)(Re,{label:t(`activity:sddBoard.statDone`),value:`${K.completed}/${K.total}`,color:`text-success`}),K.inProgress>0&&(0,Z.jsx)(Re,{label:t(`activity:sddBoard.statRunning`),value:K.inProgress,color:`text-warning`}),K.failed>0&&(0,Z.jsx)(Re,{label:t(`activity:sddBoard.statFailed`),value:K.failed,color:`text-destructive`}),(0,Z.jsx)(Re,{label:t(`activity:sddBoard.statWave`),value:r.wave+1,color:`text-primary`}),w&&r.startedAt>0&&(0,Z.jsx)(Re,{label:t(`activity:sddBoard.statElapsed`),value:we(l-r.startedAt),color:`text-foreground`})]}),(0,Z.jsx)(`div`,{className:`flex min-h-[24px] items-center gap-1.5`,children:ie.length===0?(0,Z.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`activity:sddBoard.noActiveWorkers`)}):ie.map((e,t)=>(0,Z.jsxs)(`span`,{title:`${e.name} → ${e.task}`,className:`flex items-center gap-1 rounded-full bg-muted py-0.5 pl-0.5 pr-2`,children:[(0,Z.jsx)(`span`,{className:R(`sdd-agent-live flex h-5 w-5 items-center justify-center rounded-full text-[9px] font-bold text-white`,xe[t%xe.length]),children:_e(e.name)}),(0,Z.jsx)(`span`,{className:`max-w-[90px] truncate text-[11px] text-foreground`,children:e.name})]},e.name))})]})]})]}),a&&(0,Z.jsx)(Le,{result:a,onDismiss:()=>c(null)}),q.length>0&&(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-destructive/30 bg-destructive/5 px-4 py-2 text-xs text-destructive`,children:[(0,Z.jsx)(te,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`font-semibold`,children:t(`activity:sddBoard.deadlock`)}),q.map(e=>(0,Z.jsxs)(`div`,{className:`font-mono`,children:[e.blocked,` ← `,e.blockedBy.join(`, `)]},e.blocked))]})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`relative min-h-0 min-w-0 flex-1 overflow-hidden`,children:r?b===`graph`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{tasks:j,columns:r.columns,onTaskClick:N}),(0,Z.jsx)(`div`,{className:`pointer-events-none absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-black/40 px-2 py-0.5 text-[10px] text-muted-foreground backdrop-blur`,children:t(`activity:sddBoard.clickTaskHint`)})]}):(0,Z.jsx)(je,{tasks:r.tasks,selectedId:p,onTaskClick:N}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[(0,Z.jsx)(M,{className:`h-10 w-10 text-primary/40`}),(0,Z.jsx)(`p`,{className:`text-foreground`,children:t(`activity:sddBoard.noRunTitle`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-center text-xs text-muted-foreground`,children:t(`activity:sddBoard.noRunBody`)})]})}),r&&(0,Z.jsx)(`aside`,{"data-testid":`sdd-task-panel`,"data-expanded":g&&G?`true`:`false`,className:R(`shrink-0 border-l border-border bg-card transition-[width] duration-200 ease-out`,g&&G?`w-[min(72rem,72vw)]`:`w-80`),children:G?(0,Z.jsx)(Me,{task:G,allTasks:r.tasks,feed:r.taskEvents?.[G.id]??r.feed??[],now:l,expanded:g,modelCandidates:W,defaultModel:r.defaultModel,onClose:P,onToggleExpanded:()=>y(e=>!e),onRetry:F,onReassign:se,onSetModel:I,onSetVerification:ce,onCancel:z,onDelete:B,onSplit:V,onSelectTask:h},G.id):(0,Z.jsx)(Oe,{feed:r.feed??[],now:l})})]}),(0,Z.jsx)(ke,{open:ee,onOpenChange:C,snapshot:r,busy:o,onConfirm:re})]})}function Ie(e){let t=e.op===`cleanup_worktrees`?`lcClean`:e.op===`rollback`?`lcRollback`:`lcDestroy`,n=I.t(`activity:sddBoard.${t}`);if(!e.ok)return I.t(`activity:sddBoard.lcFailed`,{op:n,reason:e.reason??I.t(`activity:sddBoard.lcUnknownError`)});let r=[];typeof e.removed==`number`&&r.push(I.t(`activity:sddBoard.lcWorktrees`,{count:e.removed})),typeof e.reverted==`number`&&e.reverted>0&&r.push(I.t(`activity:sddBoard.lcCommits`,{count:e.reverted})),e.deleted?.length&&r.push(I.t(`activity:sddBoard.lcDeleted`,{items:e.deleted.join(`, `)}));let i=r.length?r.join(` · `):I.t(`activity:sddBoard.lcNothing`);return e.reason?I.t(`activity:sddBoard.lcNote`,{op:n,body:i,reason:e.reason}):I.t(`activity:sddBoard.lcOk`,{op:n,body:i})}function Le({result:e,onDismiss:t}){let n=!e.ok||!!e.reason;return(0,Z.jsxs)(`div`,{className:R(`flex items-start gap-2 border-b px-4 py-2 text-xs`,n?`border-warning/30 bg-warning/5 text-warning`:`border-success/30 bg-success/5 text-success`),children:[n?(0,Z.jsx)(D,{className:`mt-0.5 h-4 w-4 shrink-0`}):(0,Z.jsx)(b,{className:`mt-0.5 h-4 w-4 shrink-0`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:Ie(e)}),(0,Z.jsx)(`button`,{type:`button`,onClick:t,className:`shrink-0 opacity-60 hover:opacity-100`,children:(0,Z.jsx)(m,{className:`h-3.5 w-3.5`})})]})}function Re({label:e,value:t,color:n}){return(0,Z.jsxs)(`span`,{className:`flex items-baseline gap-1`,children:[(0,Z.jsx)(`span`,{className:R(`font-semibold tabular-nums`,n),children:t}),(0,Z.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground`,children:e})]})}var ze={idle:`phaseStart`,questioning:`phaseInterview`,spec_review:`phaseSpecReview`,implementation:`phasePlanning`,task_review:`phaseTaskReview`,executing:`phaseRunning`,done:`phaseDone`},Be=[`questioning`,`spec_review`,`implementation`,`task_review`,`executing`];function Ve({onClose:e,onRunStarted:t}){let{t:n}=L(),{client:r}=fe(),i=V(e=>e.snapshot),s=V(e=>e.agentText),c=V(e=>e.error),l=V(e=>e.startedRunId),d=V(e=>e.setStartedRunId),f=V(e=>e.prefilledGoal),_=V(e=>e.setPrefilledGoal),[v,b]=(0,X.useState)(``);(0,X.useEffect)(()=>{f&&(b(f),_(``))},[f,_]);let[x,S]=(0,X.useState)(``),[ee,te]=(0,X.useState)(!1),[C,ne]=(0,X.useState)(!0),[w,T]=(0,X.useState)(!0),[D,re]=(0,X.useState)(!1),[O,k]=(0,X.useState)(void 0),[j,ae]=(0,X.useState)(void 0),[P,F]=(0,X.useState)([]),[oe,I]=(0,X.useState)(4),[ce,z]=(0,X.useState)(!0),[B,le]=(0,X.useState)(!1),H=he(D),U=(0,X.useCallback)(e=>r?.send?.(e),[r]),W=(0,X.useRef)(null);(0,X.useEffect)(()=>{U({type:`sdd.spec.get`})},[U]);let G=i?.answers.length??0;(0,X.useEffect)(()=>{W.current?.scrollIntoView({behavior:`smooth`,block:`end`})},[G,s]),(0,X.useEffect)(()=>{l&&(d(null),t?.())},[t,d,l]);let K=i?.busy??!1,q=i?.phase??`idle`,J=!!i?.sessionId,ue=!!i?.resumed,de=i?.lastRunId;(0,X.useEffect)(()=>{J&&te(!1)},[J]);let _e=i?.answers[i.answers.length-1]?.question??``,ye=!!i&&(i.taskCount>0||!!i.graphId||q===`task_review`||q===`executing`),be=()=>{let e=v.trim();!e||K||ee||(te(!0),U({type:`sdd.spec.start`,payload:{goal:e}}))},xe=()=>{let e=x.trim();e&&!K&&(U({type:`sdd.spec.message`,payload:{text:e}}),S(``))},Se=e=>{!K&&e.trim()&&(U({type:`sdd.spec.message`,payload:{text:e.trim()}}),S(``))},Ce=()=>!K&&U({type:`sdd.spec.approve`,payload:{}}),we=e=>!K&&U({type:`sdd.spec.rewind`,payload:e?{targetPhase:e}:{}}),Ee=()=>{U({type:`sdd.run.start`,payload:{parallelSlots:oe,worktrees:ce,planDecompose:B,...O?{model:O,provider:j}:{},...P.length?{fallbackModels:P}:{}}}),re(!1)},De=()=>{K||U({type:`sdd.spec.discard`,payload:{}})},Oe=(0,X.useMemo)(()=>(i?.board?.tasks??[]).map(e=>({id:e.id,shortId:e.shortId,title:e.title,displayStatus:e.displayStatus,priority:e.priority,deps:e.deps,agentName:e.agentName,worktreeBranch:e.worktreeBranch,retries:e.retries})),[i?.board]),ke=Oe.length>0,Ae=s&&q===`questioning`?s:_e??``,je=(0,X.useMemo)(()=>Ue(Ae),[Ae]),Q=i?.answers.length??0,Me=i?.minQuestions??2,Ne=i?.maxQuestions??5,$=Q>=Me,Pe=Math.min(100,Math.round(Q/Math.max(1,Ne)*100));return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Z.jsxs)(`header`,{className:`sdd-sheen flex shrink-0 items-center justify-between border-b border-border px-4 py-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(E,{className:`h-5 w-5 text-primary`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold`,children:i?.title||n(`activity:sddWizard.titleFallback`)}),J&&(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[n(`activity:sddWizard.${ze[q]??`phaseStart`}`),q===`questioning`&&` · ${n(`activity:sddWizard.questionsSuffix`,{cur:i?.questionCount??0,max:i?.maxQuestions??0})}`,i&&i.taskCount>0?` · ${n(`activity:sddWizard.tasksSuffix`,{count:i.taskCount})}`:``]})]}),K&&(0,Z.jsx)(p,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[de&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t?.(),className:`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-muted`,children:[(0,Z.jsx)(y,{className:`h-3.5 w-3.5`}),` `,n(`activity:sddWizard.openLiveBoard`)]}),J&&(0,Z.jsx)(`button`,{type:`button`,onClick:De,disabled:K,title:n(`activity:sddWizard.discardTitle`),className:`inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-destructive/10 hover:text-destructive disabled:opacity-50`,children:n(`activity:sddWizard.discardInterview`)}),ye&&(0,Z.jsxs)(`div`,{className:`relative flex items-center gap-1.5`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>re(e=>!e),title:n(`activity:sddWizard.runCfgTitle`),className:R(`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium`,O||P.length||B?`border-primary/40 bg-primary/10 text-primary`:`border-border bg-muted text-muted-foreground hover:text-foreground`),children:[(0,Z.jsx)(N,{className:`h-3.5 w-3.5`}),O||n(`activity:sddWizard.modelsLabel`)]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:Ee,className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success hover:bg-success/25`,children:[(0,Z.jsx)(y,{className:`h-3.5 w-3.5`}),` `,n(`activity:sddWizard.startRun`)]}),D&&(0,Z.jsxs)(`div`,{className:`sdd-rise absolute right-0 top-9 z-50 w-72 rounded-lg border border-border bg-popover p-3 shadow-xl`,children:[(0,Z.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:n(`activity:sddWizard.defaultWorkerModel`)}),(0,Z.jsx)(pe,{value:O,provider:j,candidates:H,placeholder:n(`activity:sddWizard.leaderDefaultPlaceholder`),resetLabel:n(`activity:sddWizard.useSessionDefault`),onPick:(e,t)=>{k(e),ae(t)},onReset:O?()=>{k(void 0),ae(void 0)}:void 0}),(0,Z.jsx)(`div`,{className:`mb-1 mt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:n(`activity:sddWizard.fallbackChain`)}),(0,Z.jsx)(me,{value:P,candidates:H,onChange:F}),(0,Z.jsx)(`p`,{className:`mt-2 text-[10px] text-muted-foreground`,children:n(`activity:sddWizard.appliesToAll`)}),(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`sdd-slots`,className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:n(`activity:sddWizard.parallelAgents`)}),(0,Z.jsx)(`input`,{id:`sdd-slots`,type:`number`,min:1,max:16,value:oe,onChange:e=>{let t=Number.parseInt(e.target.value,10);I(Number.isFinite(t)?Math.min(16,Math.max(1,t)):1)},className:`w-16 rounded-md border border-border bg-background px-2 py-1 text-right text-xs outline-none focus:border-primary`})]}),(0,Z.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:n(`activity:sddWizard.isolateWorktrees`)}),(0,Z.jsx)(`input`,{type:`checkbox`,checked:ce,onChange:e=>z(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:n(ce?`activity:sddWizard.worktreeOn`:`activity:sddWizard.worktreeOff`)}),(0,Z.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center justify-between gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:n(`activity:sddWizard.planDecompose`)}),(0,Z.jsx)(`input`,{type:`checkbox`,checked:B,onChange:e=>le(e.target.checked),className:`h-3.5 w-3.5 accent-primary`})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:n(B?`activity:sddWizard.planDecomposeOn`:`activity:sddWizard.planDecomposeOff`)})]})]}),(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Z.jsx)(m,{className:`h-4 w-4`})})]})]}),J&&(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-1 border-b bg-card/50 px-4 py-1.5 text-[11px]`,children:Be.map((e,t)=>{let r=e===q,i=Be.indexOf(q)>t;return(0,Z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[i&&!K&&q!==`executing`&&q!==`done`?(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>we(e),title:n(`activity:sddWizard.rewindToPhaseTitle`,`Return to this phase to revise`),className:`inline-flex items-center rounded-full px-2 py-0.5 text-success transition hover:bg-success/10 hover:underline`,children:[(0,Z.jsx)(g,{className:`mr-0.5 inline h-3 w-3`}),n(`activity:sddWizard.${ze[e]}`)]}):(0,Z.jsxs)(`span`,{className:R(`rounded-full px-2 py-0.5`,r?`bg-primary/15 text-primary font-medium`:i?`text-success`:`text-muted-foreground`),children:[i&&(0,Z.jsx)(g,{className:`mr-0.5 inline h-3 w-3`}),n(`activity:sddWizard.${ze[e]}`)]}),t<Be.length-1&&(0,Z.jsx)(`span`,{className:`text-muted-foreground/65`,children:`→`})]},e)})}),(0,Z.jsxs)(`div`,{ref:ge(`sdd-wizard`),className:`min-h-0 flex-1 overflow-auto overscroll-contain p-4`,children:[c&&(0,Z.jsx)(`div`,{className:`mb-3 rounded-md border border-destructive/40 bg-destructive/5 p-2 text-xs text-destructive`,children:c}),ue&&J&&(0,Z.jsx)(`div`,{className:`mb-3 rounded-md border border-primary/30 bg-primary/5 px-3 py-2 text-xs text-primary`,children:n(`activity:sddWizard.resumeBanner`)}),J?(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[q===`questioning`&&(0,Z.jsxs)(`div`,{className:`rounded-md border border-border/80 bg-card/60 p-2.5 shadow-sm`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between text-xs`,children:[(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium text-foreground`,children:[(0,Z.jsx)(E,{className:`h-3.5 w-3.5 text-primary`}),n(`activity:sddWizard.interviewProgress`,`Interview Progress`)]}),(0,Z.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[n(`activity:sddWizard.questionOf`,{current:Q+1,max:Ne}),` · `,$?(0,Z.jsx)(`span`,{className:`font-medium text-success`,children:n(`activity:sddWizard.minRequiredMet`,`Min met ✓`)}):(0,Z.jsx)(`span`,{children:n(`activity:sddWizard.minRequiredRemaining`,{count:Me-Q})})]})]}),(0,Z.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,Z.jsx)(`div`,{className:R(`h-full transition-all duration-500`,$?`bg-success`:`bg-primary`),style:{width:`${Math.max(12,Pe)}%`}})})]}),ke&&(0,Z.jsxs)(`div`,{className:`sdd-rise overflow-hidden rounded-lg border border-primary/20 bg-[hsl(var(--surface-2)/0.85)]`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>ne(e=>!e),className:`flex w-full items-center gap-1.5 border-b border-border/60 px-3 py-1.5 text-[11px] font-medium text-primary hover:bg-muted/40`,children:[C?(0,Z.jsx)(h,{className:`h-3.5 w-3.5`}):(0,Z.jsx)(A,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(se,{className:`h-3.5 w-3.5`}),n(`activity:sddWizard.taskGraphSummary`,{count:i?.taskCount??0}),(0,Z.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:n(C?`activity:sddWizard.dragToExplore`:`activity:sddWizard.show`)})]}),C&&(0,Z.jsx)(`div`,{className:`h-[32dvh] min-h-[200px]`,children:(0,Z.jsx)(Te,{tasks:Oe,columns:i?.board?.columns??[]})})]}),i?.goal&&(0,Z.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 px-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,Z.jsx)(ie,{className:`h-3 w-3`}),` `,n(`activity:sddWizard.goalLabel`)]}),(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:i.goal})]}),i?.answers.length||s&&q===`questioning`||K?(0,Z.jsxs)(`div`,{className:`space-y-2.5`,children:[i?.answers.map((e,t)=>(0,Z.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,Z.jsx)(Ge,{speaker:`assistant`,text:e.question,questionIndex:t+1}),(0,Z.jsx)(Ge,{speaker:`user`,text:e.answer})]},`${t}-${e.question.slice(0,32)}`)),s&&q===`questioning`&&s!==_e&&(0,Z.jsx)(Ge,{speaker:`assistant`,text:s,live:!0,questionIndex:Q+1}),K&&(0,Z.jsx)(Ge,{speaker:`assistant`,text:``,thinking:!0})]}):null,i?.spec&&(0,Z.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card p-3`,children:[(0,Z.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-sm font-semibold`,children:[(0,Z.jsx)(E,{className:`h-3.5 w-3.5 text-primary`}),i.spec.title]}),(0,Z.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:i.spec.overview}),(0,Z.jsx)(`ul`,{className:`space-y-0.5 text-xs`,children:i.spec.requirements.map((e,t)=>(0,Z.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,Z.jsx)(`span`,{className:R(`shrink-0 font-mono uppercase`,ve(e.priority).text),children:e.priority[0]}),(0,Z.jsx)(`span`,{children:e.description})]},`${e.priority}-${t}-${e.description.slice(0,24)}`))})]}),s&&(q===`implementation`||q===`task_review`)&&(0,Z.jsxs)(`div`,{className:`sdd-rise rounded-md border border-border bg-card`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>T(e=>!e),className:`flex w-full items-center gap-1.5 border-b border-border/60 px-3 py-2 text-sm font-semibold hover:bg-muted/40`,children:[w?(0,Z.jsx)(h,{className:`h-3.5 w-3.5`}):(0,Z.jsx)(A,{className:`h-3.5 w-3.5`}),(0,Z.jsx)(E,{className:`h-3.5 w-3.5 text-primary`}),` `,n(`activity:sddWizard.implementationPlan`)]}),w&&(0,Z.jsx)(`div`,{className:`max-h-[40dvh] overflow-auto px-3 py-2`,children:(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:He(s)})})]}),s&&q!==`questioning`&&q!==`implementation`&&q!==`task_review`&&!i?.spec&&(0,Z.jsx)(Ge,{speaker:`assistant`,text:s}),(q===`spec_review`||q===`implementation`||q===`task_review`)&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[q===`task_review`?(0,Z.jsxs)(Y,{className:`bg-success/15 text-success hover:bg-success/25`,onClick:Ee,disabled:K,children:[(0,Z.jsx)(y,{className:`mr-1.5 h-4 w-4`}),n(`activity:sddWizard.startRun`,`Start Run`)]}):(0,Z.jsxs)(Y,{variant:`secondary`,onClick:Ce,disabled:K,children:[(0,Z.jsx)(g,{className:`mr-1.5 h-4 w-4`}),n(q===`spec_review`?`activity:sddWizard.approveSpec`:`activity:sddWizard.approvePlan`)]}),(0,Z.jsxs)(Y,{variant:`outline`,onClick:()=>we(),disabled:K,className:`text-xs text-muted-foreground hover:text-foreground`,title:q===`spec_review`?n(`activity:sddWizard.backToQuestionsTitle`,`Reject spec and return to questioning`):n(`activity:sddWizard.backToSpecTitle`,`Reject plan and return to spec review`),children:[(0,Z.jsx)(u,{className:`mr-1.5 h-3.5 w-3.5`}),q===`spec_review`?n(`activity:sddWizard.backToQuestions`,`Back to Questions`):n(`activity:sddWizard.backToSpec`,`Back to Spec`)]})]}),(0,Z.jsx)(`div`,{ref:W})]}):(0,Z.jsxs)(`div`,{className:`mx-auto mt-8 max-w-xl`,children:[(0,Z.jsx)(`label`,{className:`mb-2 block text-sm font-medium`,htmlFor:`sdd-goal`,children:n(`activity:sddWizard.goalPrompt`)}),(0,Z.jsx)(`textarea`,{id:`sdd-goal`,value:v,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&be()},rows:4,placeholder:n(`activity:sddWizard.goalPlaceholder`),className:`w-full resize-none rounded-md border border-border bg-card px-3 py-2 text-sm outline-none focus:border-primary`}),(0,Z.jsx)(Y,{className:`mt-3`,onClick:be,disabled:!v.trim()||ee,children:ee?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(p,{className:`mr-1.5 h-4 w-4 animate-spin`}),` `,n(`activity:sddWizard.startingInterview`)]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(E,{className:`mr-1.5 h-4 w-4`}),` `,n(`activity:sddWizard.startInterview`)]})}),(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:n(`activity:sddWizard.introBody`)})]})]}),J&&q!==`executing`&&q!==`done`&&(0,Z.jsxs)(`div`,{className:`border-t bg-card`,children:[q===`questioning`&&!K&&(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-4 pt-2`,children:[je.map(e=>(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>S(e),className:`inline-flex items-center rounded-full border border-primary/25 bg-primary/5 px-2.5 py-1 text-xs text-primary transition hover:bg-primary/15 hover:border-primary/40 active:scale-95`,children:[(0,Z.jsx)(`span`,{className:`mr-1 opacity-70`,children:`👉`}),e]},e)),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>Se(n(`activity:sddWizard.quickBestPracticeDirective`,`Use standard industry best practices for this.`)),className:`inline-flex items-center rounded-full border border-warning/30 bg-warning/10 px-2.5 py-1 text-xs text-warning transition hover:bg-warning/20 active:scale-95`,title:`Answer using standard industry best practice`,children:[(0,Z.jsx)(a,{className:`mr-1 h-3 w-3`}),n(`activity:sddWizard.quickBestPractice`,`Use Best Practice`)]}),$&&(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>Se(`We have covered the necessary requirements. Please generate the complete specification JSON now.`),className:`inline-flex items-center rounded-full border border-success/30 bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition hover:bg-success/25 active:scale-95`,title:n(`activity:sddWizard.generateSpecNowTitle`,`Generate the specification now with gathered requirements`),children:[(0,Z.jsx)(M,{className:`mr-1 h-3 w-3`}),n(`activity:sddWizard.generateSpecNow`,`Generate Spec Now`)]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-end gap-2 px-4 py-2`,children:[(0,Z.jsx)(`textarea`,{value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),xe())},rows:1,placeholder:n(q===`questioning`?`activity:sddWizard.answerPlaceholder`:`activity:sddWizard.changePlaceholder`),disabled:K,className:`max-h-32 flex-1 resize-none rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary disabled:opacity-50`}),(0,Z.jsx)(Y,{size:`icon`,onClick:xe,disabled:K||!x.trim(),children:(0,Z.jsx)(o,{className:`h-4 w-4`})})]})]})]})}function He(e){let t=e.replace(/```json[\s\S]*?```/gi,``).trim();return t.length>0?t:e.trim()}function Ue(e){if(!e)return[];let t=[],n=e.matchAll(/(?:^|\n)\s*(?:[0-9]+[.)]|[A-D][.)]|[-*]\s+\*\*|[-*]\s+\[)\s*([^:\n\r]+)/gi);for(let e of n){let n=(e[1]??``).trim().replace(/^[`"']|[`"']$/g,``);n&&n.length>2&&n.length<50&&!t.includes(n)&&t.push(n)}if(t.length===0){let n=e.match(/(?:Options|Choices|Öneriler|Seçenekler):\s*([^\n\r]+)/i);if(n?.[1]){let e=n[1].split(/[,|/]/).map(e=>e.trim()).filter(e=>e.length>2&&e.length<45);t.push(...e.slice(0,4))}}return t.slice(0,4)}function We(e){let t=e.toLowerCase();return/security|auth|jwt|oauth|token|permission|role|rbac|şifre|güvenlik/i.test(t)?{label:`Security & Auth`,color:`bg-destructive/10 text-destructive border-destructive/20`}:/database|sql|postgres|sqlite|redis|mongodb|schema|tablo|veritabanı/i.test(t)?{label:`Data & Storage`,color:`bg-info/10 text-info border-info/20`}:/api|endpoint|rest|graphql|grpc|route|http/i.test(t)?{label:`API & Routing`,color:`bg-success/10 text-success border-success/20`}:/test|vitest|jest|e2e|playwright|coverage|mock/i.test(t)?{label:`Testing & QA`,color:`bg-warning/10 text-warning border-warning/20`}:/ui|css|component|frontend|react|tailwind|button|view|görsel|arayüz/i.test(t)?{label:`UI & Layout`,color:`bg-primary/10 text-primary border-primary/20`}:/architecture|microservice|queue|worker|scale|mimari/i.test(t)?{label:`Architecture`,color:`bg-accent/30 text-accent-foreground border-border`}:null}function Ge({speaker:e,text:t,live:n,thinking:r,questionIndex:i}){let a=e===`user`,[o,c]=(0,X.useState)(!1),u=!a&&t?We(t):null;return(0,Z.jsxs)(`div`,{className:R(`group sdd-rise flex items-start gap-2`,a&&`flex-row-reverse`),children:[(0,Z.jsx)(`span`,{className:R(`mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs`,a?`bg-info/15 text-info`:`bg-primary/15 text-primary`,(n||r)&&`sdd-agent-live`),children:a?(0,Z.jsx)(l,{className:`h-3.5 w-3.5`}):(0,Z.jsx)(f,{className:`h-3.5 w-3.5`})}),(0,Z.jsxs)(`div`,{className:R(`relative max-w-[85%] rounded-2xl px-3.5 py-2.5 text-sm leading-relaxed text-foreground shadow-sm transition-all`,a?`rounded-tr-sm bg-info/10 border border-info/20`:`rounded-tl-sm bg-muted/80 border border-border/70`),children:[!a&&!r&&(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-[10px]`,children:[i!==void 0&&(0,Z.jsxs)(`span`,{className:`rounded bg-primary/15 px-1.5 py-0.2 font-mono font-semibold text-primary`,children:[`Q`,i]}),u&&(0,Z.jsx)(`span`,{className:R(`rounded border px-1.5 py-0.2 font-medium`,u.color),children:u.label})]}),r?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 py-1`,children:[(0,Z.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-200ms]`}),(0,Z.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground [animation-delay:-100ms]`}),(0,Z.jsx)(`span`,{className:`h-1.5 w-1.5 animate-bounce rounded-full bg-muted-foreground`})]}):(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap`,children:t}),!r&&t&&(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{t&&(navigator.clipboard.writeText(t),c(!0),setTimeout(()=>c(!1),1500))},title:o?`Copied`:`Copy`,className:`absolute -bottom-2 right-2 hidden rounded bg-background/90 p-1 text-[10px] text-muted-foreground shadow border group-hover:flex items-center gap-1 hover:text-foreground`,children:o?(0,Z.jsx)(s,{className:`h-3 w-3 text-success`}):(0,Z.jsx)(T,{className:`h-3 w-3`})})]})]})}var Ke={completed:{icon:(0,Z.jsx)(b,{className:`h-3.5 w-3.5`}),text:`text-success`,ring:`border-success/35`},in_progress:{icon:(0,Z.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}),text:`text-primary`,ring:`border-primary/45`},queued:{icon:(0,Z.jsx)(oe,{className:`h-3.5 w-3.5`}),text:`text-warning`,ring:`border-warning/35`},blocked:{icon:(0,Z.jsx)(j,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/30`},pending:{icon:(0,Z.jsx)(O,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`},review:{icon:(0,Z.jsx)(u,{className:`h-3.5 w-3.5`}),text:`text-primary`,ring:`border-primary/35`},failed:{icon:(0,Z.jsx)(D,{className:`h-3.5 w-3.5`}),text:`text-destructive`,ring:`border-destructive/45`},cancelled:{icon:(0,Z.jsx)(r,{className:`h-3.5 w-3.5`}),text:`text-muted-foreground`,ring:`border-border/70`}},qe=[`completed`,`in_progress`,`queued`,`blocked`,`pending`,`failed`],Je={critical:{labelKey:`activity:depGraph.prioCrit`,cls:`bg-destructive/10 text-destructive`},high:{labelKey:`activity:depGraph.prioHigh`,cls:`bg-destructive/10 text-destructive`},medium:{labelKey:`activity:depGraph.prioMed`,cls:`bg-warning/12 text-warning`},low:{labelKey:`activity:depGraph.prioLow`,cls:`bg-success/12 text-success`}};function Ye({columns:e,onTaskClick:t}){let{t:n}=L();return e.length===0?(0,Z.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:n(`activity:board.emptySpec`)}):(0,Z.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,Z.jsx)(`h3`,{className:`mb-3 text-sm font-semibold text-foreground`,children:n(`activity:board.depGraphHeading`)}),(0,Z.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs`,children:qe.map(e=>(0,Z.jsxs)(`span`,{className:R(`inline-flex items-center gap-1.5`,Ke[e].text),children:[Ke[e].icon,(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:n(`activity:board.status.${e}`)})]},e))}),(0,Z.jsx)(`div`,{className:`flex gap-3 overflow-x-auto pb-2`,children:e.map((n,r)=>(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Z.jsxs)(`div`,{className:`w-60 shrink-0`,children:[(0,Z.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-1 text-center text-xs font-medium uppercase text-muted-foreground`,children:n.label}),(0,Z.jsx)(`div`,{className:`space-y-2`,children:n.tasks.map(e=>(0,Z.jsx)(Xe,{task:e,onClick:t},e.id))})]}),r<e.length-1&&(0,Z.jsx)(`div`,{className:`flex h-full items-center pt-8 text-muted-foreground/75`,children:(0,Z.jsx)(A,{className:`h-5 w-5`})})]},n.label))})]})}function Xe({task:e,onClick:t}){let n=Ke[e.displayStatus],r=Je[e.priority],{t:i}=L();return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>t?.(e.id),className:R(`w-full rounded-lg border bg-background/55 p-2.5 text-left shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/35`,n.ring),children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(`span`,{className:R(`inline-flex items-center gap-1.5 text-xs font-medium`,n.text),children:[n.icon,(0,Z.jsx)(`span`,{className:`font-mono text-foreground`,children:e.shortId})]}),(0,Z.jsx)(`span`,{className:R(`rounded px-1.5 py-0.5 text-[10px] font-medium`,r.cls),children:i(r.labelKey)})]}),(0,Z.jsx)(`p`,{className:`mt-1.5 text-xs text-foreground`,children:e.title}),e.deps.length>0&&(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:[`← `,e.deps.join(`, `)]}),e.agentName&&(0,Z.jsxs)(`div`,{className:R(`mt-1.5 inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px]`,e.displayStatus===`in_progress`?`bg-primary/10 text-primary`:`bg-muted text-muted-foreground`),title:e.worktreeBranch?i(`activity:board.worktreePrefix`,{branch:e.worktreeBranch}):void 0,children:[e.displayStatus===`in_progress`&&(0,Z.jsx)(p,{className:`h-3 w-3 animate-spin`}),(0,Z.jsx)(`span`,{children:e.agentName})]})]})}function Ze(e){return e.columns.map(e=>({name:e.label,description:``,priority:`medium`,estimateHours:e.tasks.length,parallelizable:!1,taskTemplates:e.tasks.map(e=>({title:e.title,description:e.description,type:e.type,priority:e.priority,estimateHours:1}))}))}function Qe({onClose:e,onRunStarted:t}){let{client:n}=fe(),{t:r}=L(),i=W(e=>e.specs),a=W(e=>e.detail),o=W(e=>e.expandedSpecId),s=W(e=>e.setExpanded),[l,u]=(0,X.useState)(`graph`),f=(0,X.useCallback)(e=>{a&&a.specId===e.id&&(n?.send?.({type:`goal.start`,payload:{title:e.title,phases:Ze(a),autonomous:!0}}),B(`goal`))},[a,n]),p=(0,X.useCallback)(e=>{let r=e.graphId??(a?.specId===e.id?a.graphId:void 0);r?n?.send?.({type:`sdd.run.from_graph`,payload:{graphId:r,worktrees:!0}}):n?.send?.({type:`sdd.run.from_spec`,payload:{specId:e.id,worktrees:!0}}),t?.(),B(`sddhub`)},[a,n,t]);(0,X.useEffect)(()=>{n?.send?.({type:`specs.list`})},[n]);let g=(0,X.useCallback)(e=>{o===e.id?s(null):(s(e.id),n?.send?.({type:`specs.get`,payload:{specId:e.id}}))},[o,s,n]),_=a?.columns.flatMap(e=>e.tasks)??[],v={done:_.filter(e=>e.status===`completed`).length,running:_.filter(e=>e.status===`in_progress`).length,pending:_.filter(e=>e.status===`pending`||e.displayStatus===`queued`).length};return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b bg-card px-4 py-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(x,{className:`h-5 w-5 text-warning`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold`,children:r(`activity:specs.heading`)}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`activity:specs.subtitle`)})]})]}),(0,Z.jsx)(Y,{variant:`ghost`,size:`icon`,onClick:e,children:(0,Z.jsx)(m,{className:`h-4 w-4`})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4`,children:i.length===0?(0,Z.jsx)(`div`,{className:`flex h-40 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:specs.empty`,{command:`/sdd`})}):(0,Z.jsx)(`div`,{className:`space-y-3`,children:i.map(e=>{let t=o===e.id,n=e.total>0?Math.round(e.completed/e.total*100):0;return(0,Z.jsxs)(`div`,{className:`rounded-lg border border-border bg-card/60`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>g(e),className:`flex w-full items-start gap-3 p-4 text-left`,children:[(0,Z.jsx)(`span`,{className:`mt-1 text-muted-foreground`,children:t?(0,Z.jsx)(h,{className:`h-4 w-4`}):(0,Z.jsx)(A,{className:`h-4 w-4`})}),(0,Z.jsx)(x,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.displayId}),(0,Z.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 text-[10px] capitalize text-muted-foreground`,children:e.status})]}),(0,Z.jsx)(`h2`,{className:`mt-1 text-base font-semibold`,children:e.title}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,Z.jsx)(`div`,{className:`h-2 flex-1 overflow-hidden rounded-full bg-muted`,children:(0,Z.jsx)(`div`,{className:`h-full rounded-full bg-success transition-all`,style:{width:`${n}%`}})}),(0,Z.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[e.completed,`/`,e.total]})]})]})]}),t&&(0,Z.jsxs)(`div`,{className:`border-t border-border p-4`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`text-sm font-medium`,children:[r(`activity:specs.tasks`,{count:a?.total??e.total}),a&&(0,Z.jsxs)(`span`,{className:`ml-3 text-xs font-normal text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`text-success`,children:r(`activity:specs.doneCount`,{count:v.done})}),` `,(0,Z.jsx)(`span`,{className:`text-primary`,children:r(`activity:specs.runningCount`,{count:v.running})}),` `,(0,Z.jsx)(`span`,{children:r(`activity:specs.pendingCount`,{count:v.pending})})]})]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>p(e),title:r(`activity:specs.runAsSddTitle`),className:`inline-flex items-center gap-1 rounded-md bg-success/15 px-2.5 py-1 text-xs font-medium text-success transition-colors hover:bg-success/25`,children:[(0,Z.jsx)(d,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.runAsSdd`)]}),(0,Z.jsxs)(`button`,{type:`button`,disabled:!a||a.specId!==e.id,onClick:()=>f(e),title:r(`activity:specs.runAsGoalTitle`),className:`inline-flex items-center gap-1 rounded-md bg-warning/15 px-2.5 py-1 text-xs font-medium text-warning transition-colors hover:bg-warning/25 disabled:opacity-40`,children:[(0,Z.jsx)(d,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.runAsGoal`)]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>u(`list`),className:R(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,l===`list`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,Z.jsx)(c,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.list`)]}),(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>u(`graph`),className:R(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs`,l===`graph`?`bg-primary/15 text-primary`:`text-muted-foreground`),children:[(0,Z.jsx)(se,{className:`h-3.5 w-3.5`}),` `,r(`activity:specs.graph`)]})]})]})]}),!a||a.specId!==e.id?(0,Z.jsx)(`div`,{className:`flex h-24 items-center justify-center text-sm text-muted-foreground`,children:r(`activity:specs.loadingTasks`)}):l===`graph`?(0,Z.jsx)(Ye,{columns:a.columns}):(0,Z.jsx)(`div`,{className:`space-y-1.5`,children:_.map(e=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2`,children:[(0,Z.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.shortId}),(0,Z.jsx)(`span`,{className:`flex-1 text-sm`,children:e.title}),(0,Z.jsx)(`span`,{className:`text-xs capitalize text-muted-foreground`,children:e.displayStatus.replace(`_`,` `)})]},e.id))})]})]},e.id)})})})]})}var $e=[{id:`requirements`,labelKey:`activity:sddhub.tabRequirements`},{id:`project`,labelKey:`activity:sddhub.tabProject`},{id:`board`,labelKey:`activity:sddhub.tabBoard`},{id:`specs`,labelKey:`activity:sddhub.tabSpecs`}];function et(){let{t:e}=L(),t=V(e=>e.activeHubTab),n=V(e=>e.setActiveHubTab),r=V(e=>e.setPrefilledGoal),i=V(e=>e.startedRunId),a=V(e=>e.setStartedRunId),o=()=>z(`chat`),s=(0,X.useCallback)(()=>n(`board`),[n]);(0,X.useEffect)(()=>{i&&(n(`board`),a(null))},[i,a]);let c=(e,t)=>{let r;if(e.key===`ArrowLeft`&&(r=(t-1+$e.length)%$e.length),e.key===`ArrowRight`&&(r=(t+1)%$e.length),e.key===`Home`&&(r=0),e.key===`End`&&(r=$e.length-1),r===void 0)return;e.preventDefault();let i=$e[r];i&&(n(i.id),e.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)[r]?.focus())};return(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,Z.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,className:`flex shrink-0 items-end border-b border-border/70 bg-card px-4`,children:$e.map((r,i)=>{let a=t===r.id;return(0,Z.jsxs)(`button`,{id:`sdd-hub-tab-${r.id}`,type:`button`,role:`tab`,"aria-selected":a,"aria-controls":`sdd-hub-panel-${r.id}`,tabIndex:a?0:-1,onClick:()=>n(r.id),onKeyDown:e=>c(e,i),className:R(`relative px-4 py-2.5 text-sm font-medium transition-colors`,a?`text-foreground`:`text-muted-foreground hover:text-foreground`),children:[e(r.labelKey),a&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-0 left-0 right-0 h-0.5 bg-primary`})]},r.id)})}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:[(0,Z.jsx)(`div`,{id:`sdd-hub-panel-requirements`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-requirements`,hidden:t!==`requirements`,className:`h-full overflow-hidden`,children:(0,Z.jsx)(De,{onStartSdd:async e=>{try{let t=await fetch(`/api/requirement-intakes/${encodeURIComponent(e.id)}`);if(t.ok){let n=await t.json();r(n.record?.originalRequest||e.title)}else r(e.title)}catch{r(e.title)}n(`project`)}})}),(0,Z.jsx)(`div`,{id:`sdd-hub-panel-project`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-project`,hidden:t!==`project`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(Ve,{onClose:o,onRunStarted:s})}),(0,Z.jsx)(`div`,{id:`sdd-hub-panel-board`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-board`,hidden:t!==`board`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(Fe,{onClose:o})}),(0,Z.jsx)(`div`,{id:`sdd-hub-panel-specs`,role:`tabpanel`,"aria-labelledby":`sdd-hub-tab-specs`,hidden:t!==`specs`,className:`h-full overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(Qe,{onClose:o,onRunStarted:s})})]})]})}export{et as SddHub};