@wrongstack/webui 1.0.6 → 1.0.7

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 (84) hide show
  1. package/dist/assets/{AgentRosterView-Cat9dDuY.js → AgentRosterView-C2PmzJWn.js} +4 -4
  2. package/dist/assets/AnalyticsDashboard-tA_UUQWD.js +1 -0
  3. package/dist/assets/AudienceMemoryPanel-DNopUX7m.js +3 -0
  4. package/dist/assets/{ChangesView-D0oqt9WQ.js → ChangesView-Cij-BSUX.js} +1 -1
  5. package/dist/assets/{ChimeraReviewsView-xYqbuZGK.js → ChimeraReviewsView-1TlYFUrk.js} +1 -1
  6. package/dist/assets/{ChronicleDashboard-BDaOO8qg.js → ChronicleDashboard-mZgdM2It.js} +1 -1
  7. package/dist/assets/{CodeEditor-BgJIgzjz.js → CodeEditor-CXf7lq5W.js} +2 -2
  8. package/dist/assets/{CodeMap-D47WG8ZE.js → CodeMap-CoQQ76zV.js} +1 -1
  9. package/dist/assets/{CronJobsPanel-oxmSB2ni.js → CronJobsPanel-CL4m2QgQ.js} +1 -1
  10. package/dist/assets/{DeadCodeScanPanel-DAOBcPPB.js → DeadCodeScanPanel-DxCRT8rV.js} +1 -1
  11. package/dist/assets/{DebugDashboard-P6-449d1.js → DebugDashboard-CMbbIq8d.js} +1 -1
  12. package/dist/assets/{DesignGalleryView-BUYdq9xj.js → DesignGalleryView-CcX5u8rA.js} +1 -1
  13. package/dist/assets/GoalView-CVjWpHkb.js +1 -0
  14. package/dist/assets/KanbanView-DQmHGtH3.js +3 -0
  15. package/dist/assets/{MailboxDetailView-CidOf8tE.js → MailboxDetailView-CfJjqySh.js} +1 -1
  16. package/dist/assets/{MemoryDrawer-D2iiRUm3.js → MemoryDrawer-C72rzAy0.js} +1 -1
  17. package/dist/assets/{MemoryManager-ajwrcppd.js → MemoryManager-DOZYeDYO.js} +1 -1
  18. package/dist/assets/{ProcessMonitor-D4q3YZ99.js → ProcessMonitor-C7h419Eb.js} +1 -1
  19. package/dist/assets/{PromptJournalView-BRTW81Ev.js → PromptJournalView-UkyefQGK.js} +1 -1
  20. package/dist/assets/ProviderTestView-B74V32hh.js +1 -0
  21. package/dist/assets/{QueuePanel--kMl1y82.js → QueuePanel-CW3iERCF.js} +1 -1
  22. package/dist/assets/RefreshDebugView-CDfO7Uid.js +1 -0
  23. package/dist/assets/RepositoryHistoryView-DnJ5jcgB.js +2 -0
  24. package/dist/assets/{RequirementIntakeView-DXimEE5N.js → RequirementIntakeView-CSTVrB4Y.js} +1 -1
  25. package/dist/assets/{SageTabs-DC4wv_Gu.js → SageTabs-DMFqP3JS.js} +2 -2
  26. package/dist/assets/{SddFlowGraph-BNd4F2pW.js → SddFlowGraph-hmWEIf45.js} +1 -1
  27. package/dist/assets/{SddHub-Dfsg4kpC.js → SddHub-BedY4SV-.js} +1 -1
  28. package/dist/assets/{SessionInspectView-CFKKgcpn.js → SessionInspectView-DA0kAM4e.js} +1 -1
  29. package/dist/assets/{SessionList-C_5GxI2E.js → SessionList-17tCMc4D.js} +1 -1
  30. package/dist/assets/{SessionsDashboard-yTvoFIQH.js → SessionsDashboard-CvrLsLGL.js} +1 -1
  31. package/dist/assets/SetupScreen-BHcAa0VI.js +1 -0
  32. package/dist/assets/{SkillDetailView-BZ-xB1C6.js → SkillDetailView-BODqDrPU.js} +1 -1
  33. package/dist/assets/{TechStackView-DPmmgBtE.js → TechStackView-DjP_PhtH.js} +2 -2
  34. package/dist/assets/TerminalPanel-perOinUJ.js +1 -0
  35. package/dist/assets/{activity-DBzijhvU.js → activity-BKJV5XjX.js} +1 -1
  36. package/dist/assets/{activity-D8QpThnB.js → activity-CHP09wRx.js} +1 -1
  37. package/dist/assets/{activity-DaNFfhdh.js → activity-DDfoWJrR.js} +1 -1
  38. package/dist/assets/{activity-BYWZhxvD.js → activity-DThW4oMo.js} +1 -1
  39. package/dist/assets/{activity-B6W4JEPC.js → activity-DZ2z6LSR.js} +1 -1
  40. package/dist/assets/{activity-C2ThLEx6.js → activity-EReqzYpW.js} +1 -1
  41. package/dist/assets/{activity-Co3aH0eV.js → activity-oY2h83Fp.js} +1 -1
  42. package/dist/assets/chat-store-BVz6zQLP.js +1 -0
  43. package/dist/assets/config-store-CZdk-vPj.js +22 -0
  44. package/dist/assets/i18n-BwptPW9U.js +3 -0
  45. package/dist/assets/index-BYBlSXtn.js +170 -0
  46. package/dist/assets/index-coebX2ug.css +1 -0
  47. package/dist/assets/{roster-ws-BviY2gOb.js → roster-ws-Cx9Bzoh0.js} +1 -1
  48. package/dist/assets/{stores-BOo4b1ZG.js → stores-Bt7wAdGA.js} +2 -2
  49. package/dist/assets/ui-store-CMdVzHOn.js +1 -0
  50. package/dist/assets/{view-navigation-Ca7VJMhX.js → view-navigation-BDsXeQ5i.js} +1 -1
  51. package/dist/components/ChatInput/slash-routing.d.ts +7 -0
  52. package/dist/components/ChatInput/subagent-models-button.d.ts +2 -0
  53. package/dist/components/ProviderTestView.d.ts +2 -0
  54. package/dist/components/QuickModelSwitcher.filter.d.ts +3 -1
  55. package/dist/components/SettingsPanel/ProviderSection.d.ts +1 -0
  56. package/dist/components/SettingsPanel/SubagentModelsSection.d.ts +14 -0
  57. package/dist/components/UserInputDialog.d.ts +2 -0
  58. package/dist/index.html +8 -8
  59. package/dist/index.js +14204 -12676
  60. package/dist/lib/clear-chat-context.d.ts +17 -0
  61. package/dist/lib/view-navigation.d.ts +1 -1
  62. package/dist/stores/index.d.ts +1 -0
  63. package/dist/stores/local-prefs.d.ts +29 -1
  64. package/dist/stores/ui-store-types.d.ts +1 -1
  65. package/dist/stores/user-input-store.d.ts +16 -0
  66. package/dist/types/client-message.d.ts +17 -2
  67. package/dist/types/runtime.d.ts +21 -0
  68. package/dist/types/server-message.d.ts +4 -4
  69. package/dist/types/system.d.ts +52 -0
  70. package/package.json +10 -9
  71. package/dist/assets/AnalyticsDashboard-BAC5fpQO.js +0 -1
  72. package/dist/assets/AudienceMemoryPanel-BOaFRWeR.js +0 -3
  73. package/dist/assets/GoalView-DfVrI8Br.js +0 -1
  74. package/dist/assets/KanbanView-DYzC0SvN.js +0 -3
  75. package/dist/assets/RefreshDebugView-Dty8h6nr.js +0 -1
  76. package/dist/assets/RepositoryHistoryView-DGlHg9K7.js +0 -2
  77. package/dist/assets/SetupScreen-BCgcO4L-.js +0 -1
  78. package/dist/assets/TerminalPanel-Cjineyx0.js +0 -1
  79. package/dist/assets/chat-store-Dl3XHXs8.js +0 -1
  80. package/dist/assets/config-store-Dq6MhrIA.js +0 -22
  81. package/dist/assets/i18n-CRIAwjnX.js +0 -3
  82. package/dist/assets/index-BI1MMjfc.js +0 -170
  83. package/dist/assets/index-DO49jK02.css +0 -1
  84. package/dist/assets/ui-store-D2CzZVyU.js +0 -1
@@ -0,0 +1,17 @@
1
+ interface ClearChatContextClient {
2
+ clearContext?: (() => void) | undefined;
3
+ sendAbort?: (() => void) | undefined;
4
+ }
5
+ interface ClearChatContextOptions {
6
+ /** Socket to tell about the clear. */
7
+ client: ClearChatContextClient | null | undefined;
8
+ /** Does the lane believe a run is in flight? */
9
+ isLoading: boolean;
10
+ clearMessages: () => void;
11
+ setLoading: (loading: boolean) => void;
12
+ /** Abort override — the chat composer passes its own bound sender. */
13
+ sendAbort?: (() => void) | undefined;
14
+ }
15
+ export declare function clearChatContext(options: ClearChatContextOptions): void;
16
+ export {};
17
+ //# sourceMappingURL=clear-chat-context.d.ts.map
@@ -8,7 +8,7 @@ export type PanelMainView = 'chat' | 'files' | 'skill' | 'changes' | 'mailbox' |
8
8
  * A standalone main view with its own activity-bar icon (or a slot in the "…"
9
9
  * utilities menu). Selecting one collapses the side panel.
10
10
  */
11
- export type MainView = 'goal' | 'kanban' | 'sddhub' | 'settings' | 'memory' | 'roster' | 'codemap' | 'techstack' | 'chronicle' | 'intake' | 'prompts' | 'chimera' | 'history';
11
+ export type MainView = 'goal' | 'kanban' | 'sddhub' | 'settings' | 'provider-test' | 'memory' | 'roster' | 'codemap' | 'techstack' | 'chronicle' | 'intake' | 'prompts' | 'chimera' | 'history';
12
12
  /**
13
13
  * A view with no bar affordance at all — reached from the command palette, a
14
14
  * deep link, or another view's action. Diagnostics and drill-downs live here.
@@ -53,6 +53,7 @@ export { bucketSuccessRatio, LEADER_AGENT_KEY, sessionInFlight, type ToolStatsBu
53
53
  export type { AgentTranscriptEntry, AgentTranscriptKind, BrainDecisionData, ChatMessage, ChatMessageAttachment, CouncilDecisionData, CouncilSeatVote, FleetTimelineEvent, SessionHistoryEntry, SessionInfo, SubagentEvent, SubagentView, ToolExecution, } from './types.js';
54
54
  export type { Activity, DockSection, InspectorTab, WorkDashboardTab } from './ui-store.js';
55
55
  export { coerceActivity, resetUiNavigationToHome, SIDEBAR_DEFAULT_WIDTH, SIDEBAR_MAX_WIDTH, SIDEBAR_MIN_WIDTH, useUIStore, } from './ui-store.js';
56
+ export { pendingUserInputForSession, useUserInputStore } from './user-input-store.js';
56
57
  export type { VizEdge, VizEvent, VizNode } from './viz-store.js';
57
58
  export { useVizStore } from './viz-store.js';
58
59
  export { useWorktreeStore } from './worktree-store.js';
@@ -50,8 +50,36 @@ export interface LocalPrefs {
50
50
  fallbackProfiles: Record<string, string[]>;
51
51
  /** User-curated model references prioritized by pickers and smart fallbacks. */
52
52
  favoriteModels: string[];
53
+ /** Provider-qualified models intentionally hidden from selection and fallback routing. */
54
+ disabledModels: string[];
53
55
  /** Restrict auto-derived fallback chains to favorite models. */
54
56
  favoriteModelsOnly: boolean;
57
+ /**
58
+ * Session-scoped subagent model lanes. Each live subagent holds one lane, so
59
+ * a fan-out runs on as many different provider/model pairs as there are
60
+ * pinned lanes. `lock` decides whether a lane outranks the provider/model the
61
+ * leader passed to `spawn_subagent` / `delegate`. Never written to
62
+ * config.json — the server journals it with the session.
63
+ */
64
+ subagentModelPlan: {
65
+ enabled: boolean;
66
+ lock: boolean;
67
+ /** Run every plain subagent on the session's own model; outranks the lanes. */
68
+ followSessionModel?: boolean;
69
+ slots: Array<{
70
+ provider?: string;
71
+ model?: string;
72
+ tier?: string;
73
+ fallbackProfile?: string;
74
+ label?: string;
75
+ }>;
76
+ roles?: Record<string, {
77
+ provider?: string;
78
+ model?: string;
79
+ tier?: string;
80
+ fallbackProfile?: string;
81
+ }>;
82
+ };
55
83
  /** Per-role/phase/default model routing matrix. */
56
84
  modelMatrix: Record<string, {
57
85
  provider?: string;
@@ -297,7 +325,7 @@ export interface LocalPrefs {
297
325
  * global shows tab 1's autonomy while tab 3 is on screen. Parity is enforced
298
326
  * by `tests/server/session-scoped-prefs-parity.test.ts`, not by memory.
299
327
  */
300
- export declare const SESSION_SCOPED_PREFS: readonly ["subagentsAllowed", "subagentsPolicyLocked", "autonomy", "autonomyDelayMs", "autoProceedMaxIterations", "yolo", "maxIterations", "contextStrategy", "contextMode", "contextAutoCompact", "tokenSavingTier", "systemPromptVariant", "reasoningMode", "reasoningEffort", "reasoningPreserve", "nextPrediction", "nextStepsTool"];
328
+ export declare const SESSION_SCOPED_PREFS: readonly ["subagentsAllowed", "subagentsPolicyLocked", "subagentModelPlan", "autonomy", "autonomyDelayMs", "autoProceedMaxIterations", "yolo", "maxIterations", "contextStrategy", "contextMode", "contextAutoCompact", "tokenSavingTier", "systemPromptVariant", "reasoningMode", "reasoningEffort", "reasoningPreserve", "nextPrediction", "nextStepsTool"];
301
329
  /**
302
330
  * The effective value of a session-scoped preference for ONE session.
303
331
  *
@@ -20,7 +20,7 @@ export declare function coerceActivity(value: unknown): Activity;
20
20
  * bucket, which makes that class of drift a compile error.
21
21
  * See docs/audit/webui-full-review-2026-09-03.md B-02.
22
22
  */
23
- export declare const VIEWS: readonly ['chat', 'settings', 'memory', 'roster', 'context', 'goal', 'kanban', 'sddhub', 'files', 'changes', 'history', 'sessions', 'session-inspect', 'setup', 'skill', 'mailbox', 'debug', 'design-gallery', 'refresh-debug', 'analytics', 'codemap', 'techstack', 'chronicle', 'intake', 'deadcode', 'prompts', 'chimera'];
23
+ export declare const VIEWS: readonly ['chat', 'settings', 'provider-test', 'memory', 'roster', 'context', 'goal', 'kanban', 'sddhub', 'files', 'changes', 'history', 'sessions', 'session-inspect', 'setup', 'skill', 'mailbox', 'debug', 'design-gallery', 'refresh-debug', 'analytics', 'codemap', 'techstack', 'chronicle', 'intake', 'deadcode', 'prompts', 'chimera'];
24
24
  export type View = (typeof VIEWS)[number];
25
25
  /** Coerce an arbitrary value onto the current view union. Used by migrate
26
26
  * when reading from localStorage so a stale value (e.g. 'context', a view
@@ -0,0 +1,16 @@
1
+ import type { UserInputRequest } from '@wrongstack/core/types';
2
+ export interface PendingUserInputEntry {
3
+ sessionId: string;
4
+ request: UserInputRequest;
5
+ }
6
+ interface UserInputState {
7
+ queues: Record<string, PendingUserInputEntry[]>;
8
+ enqueue: (entry: PendingUserInputEntry) => void;
9
+ resolve: (requestId: string) => void;
10
+ forgetSession: (sessionId: string) => void;
11
+ reset: () => void;
12
+ }
13
+ export declare const useUserInputStore: import("zustand").UseBoundStore<import("zustand").StoreApi<UserInputState>>;
14
+ export declare function pendingUserInputForSession(queues: UserInputState['queues'], sessionId: string | null): PendingUserInputEntry | null;
15
+ export {};
16
+ //# sourceMappingURL=user-input-store.d.ts.map
@@ -2,7 +2,7 @@ import type { BrainConfigPatchWire } from './brain.js';
2
2
  import type { ChronicleFacet, ChronicleMetricsView, ChronicleQuery } from './chronicle.js';
3
3
  import type { WSCollabAnnotate, WSCollabGrantControl, WSCollabInjectTool, WSCollabJoin, WSCollabLeave, WSCollabRequestPause, WSCollabResolve, WSCollabResume } from './collab.js';
4
4
  import type { SessionScopedPayload, WSUserMessage } from './protocol-core.js';
5
- import type { ContextEditorMessage, ContextEditorRemoval, WSModelSwitch, WSToolConfirmResult } from './runtime.js';
5
+ import type { ContextEditorMessage, ContextEditorRemoval, WSModelSwitch, WSToolConfirmResult, WSUserInputSubmit } from './runtime.js';
6
6
  import type { SageAnchor, SageScope, SageStatus, WSMemorySageForFileRequest } from './sage.js';
7
7
  import type { OAuthKind, WSCompletionRequest } from './system.js';
8
8
  /** Metadata persisted by the custom-provider model editor in provider add/update messages. */
@@ -70,7 +70,7 @@ export type WSClientMessageCore = WSUserMessage | {
70
70
  outcome?: string | undefined;
71
71
  reason?: string | undefined;
72
72
  };
73
- } | WSToolConfirmResult | {
73
+ } | WSToolConfirmResult | WSUserInputSubmit | {
74
74
  type: 'side_effects.list';
75
75
  payload?: SessionScopedPayload | undefined;
76
76
  } | {
@@ -530,6 +530,7 @@ export type WSClientMessageCore = WSUserMessage | {
530
530
  type: 'provider.models';
531
531
  payload: {
532
532
  providerId: string;
533
+ includeDisabled?: boolean | undefined;
533
534
  };
534
535
  } | {
535
536
  type: 'provider.models.search';
@@ -537,6 +538,20 @@ export type WSClientMessageCore = WSUserMessage | {
537
538
  query: string;
538
539
  limit?: number | undefined;
539
540
  };
541
+ } | {
542
+ type: 'provider.test.run';
543
+ payload: {
544
+ requestId: string;
545
+ providerId: string;
546
+ modelIds: string[];
547
+ timeoutMs?: number | undefined;
548
+ maxTokens?: number | undefined;
549
+ };
550
+ } | {
551
+ type: 'provider.test.cancel';
552
+ payload: {
553
+ requestId: string;
554
+ };
540
555
  } | {
541
556
  type: 'providers.saved';
542
557
  } | {
@@ -1,4 +1,25 @@
1
+ import type { UserInputRequest, UserInputResponse } from '@wrongstack/core/types';
1
2
  import type { SessionScopedPayload } from './protocol-core.js';
3
+ export interface WSUserInputRequested {
4
+ type: 'user.input_requested';
5
+ payload: SessionScopedPayload & {
6
+ request: UserInputRequest;
7
+ };
8
+ }
9
+ export interface WSUserInputResolved {
10
+ type: 'user.input_resolved';
11
+ payload: SessionScopedPayload & {
12
+ requestId: string;
13
+ response: UserInputResponse;
14
+ source: 'user' | 'abort';
15
+ };
16
+ }
17
+ export interface WSUserInputSubmit {
18
+ type: 'user.input_submit';
19
+ payload: SessionScopedPayload & {
20
+ response: UserInputResponse;
21
+ };
22
+ }
2
23
  export interface WSSessionStats {
3
24
  type: 'session.stats';
4
25
  payload: {
@@ -3,7 +3,7 @@ import type { WSCollabAnnotationAdded, WSCollabAnnotationResolved, WSCollabEvent
3
3
  import type { AutoHealStatusEvent, ConnectionsHealthReport, ServiceActionResult } from './connections.js';
4
4
  import type { WSAgentStatusChanged, WSAgentTimelineMessage, WSEternalIteration, WSGoalAssessResult, WSGoalLifecycle, WSGoalList, WSGoalProgress, WSGoalState, WSKanbanResult, WSKanbanTaskActivity, WSModesList, WSWorktreeCleanupResult, WSWorktreeDiffResult, WSWorktreeEvent, WSWorktreeMergeResult, WSWorktreeOrphans, WSWorktreeState } from './goal-kanban-worktree.js';
5
5
  import type { WSCodeMapToolExecuted, WSCodeMapToolStarted, WSIterationCompleted, WSIterationLimitReached, WSIterationStarted, WSProviderActiveBlocked, WSProviderAuditHistory, WSProviderError, WSProviderFallback, WSProviderFallbackPending, WSProviderQuota, WSProviderResponse, WSProviderRetry, WSProviderStatusChanged, WSProviderStatusSnapshot, WSProviderStreamError, WSRunResult, WSSessionEnd, WSSessionResumeProgress, WSSessionRunState, WSSessionStart, WSTextDelta, WSThinkingDelta, WSToolExecuted, WSToolProgress, WSToolUseStart } from './protocol-core.js';
6
- import type { WSCompactionFailed, WSContextCompacted, WSContextDebug, WSContextEditorApplied, WSContextEditorSnapshot, WSContextEditorValidation, WSContextMaxContext, WSContextModeChanged, WSContextModesList, WSContextPct, WSContextRepaired, WSDelegateCompleted, WSDelegateStarted, WSError, WSMemoryList, WSSessionStats, WSTokenCostEstimateUnavailable, WSTokenThreshold, WSToolConfirmNeeded, WSToolConfirmResolved, WSToolLoopDetected, WSToolsList, WSTopicAdviceResult, WSTrustPersisted } from './runtime.js';
6
+ import type { WSCompactionFailed, WSContextCompacted, WSContextDebug, WSContextEditorApplied, WSContextEditorSnapshot, WSContextEditorValidation, WSContextMaxContext, WSContextModeChanged, WSContextModesList, WSContextPct, WSContextRepaired, WSDelegateCompleted, WSDelegateStarted, WSError, WSMemoryList, WSSessionStats, WSTokenCostEstimateUnavailable, WSTokenThreshold, WSToolConfirmNeeded, WSToolConfirmResolved, WSToolLoopDetected, WSToolsList, WSTopicAdviceResult, WSTrustPersisted, WSUserInputRequested, WSUserInputResolved } from './runtime.js';
7
7
  import type { WSMemorySageBackfillRecoverable, WSMemorySageCandidateResolve, WSMemorySageDelete, WSMemorySageForFile, WSMemorySageGet, WSMemorySageGraph, WSMemorySageList, WSMemorySageListCandidates, WSMemorySageListPage, WSMemorySageRecover, WSMemorySageRemember, WSMemorySageSearchBreakdown, WSMemorySageUpdate } from './sage.js';
8
8
  import type { WSChimeraServerMessage } from './server-message-chimera.js';
9
9
  import type { WSFilesGitServerMessage } from './server-message-files.js';
@@ -11,8 +11,8 @@ import type { WSFleetServerMessage } from './server-message-fleet.js';
11
11
  import type { WSMcpServerMessage } from './server-message-mcp.js';
12
12
  import type { WSSystemMiscServerMessage } from './server-message-system.js';
13
13
  import type { WSDesignList, WSDesignMaterialize, WSDesignSet, WSDesignState, WSDesignSwap, WSDesignTune, WSDesignUse, WSDesignVerify, WSSkillContent, WSSkillsCreated, WSSkillsEdited, WSSkillsExported, WSSkillsInstalled, WSSkillsList, WSSkillsUninstalled, WSSkillsUpdated } from './skills-design.js';
14
- import type { WSAuthOAuthProviders, WSAuthOAuthStatus, WSCatalogModelSearchResult, WSCompletionResult, WSDiagGet, WSFilesList, WSKeyOperationResult, WSModelSwitchResult, WSProviderCatalog, WSProviderModels, WSProviderProbe, WSSavedProviders, WSSessionInspect, WSSessionsList, WSSideEffects, WSStatsGet, WSTodosCleared, WSTodosUpdated } from './system.js';
15
- export type WSServerMessage = WSSessionStart | WSSessionEnd | WSTextDelta | WSThinkingDelta | WSToolUseStart | WSToolProgress | WSToolExecuted | WSCodeMapToolStarted | WSCodeMapToolExecuted | WSIterationStarted | WSIterationCompleted | WSIterationLimitReached | WSProviderResponse | WSProviderRetry | WSProviderAuditHistory | WSProviderError | WSProviderFallback | WSProviderFallbackPending | WSProviderStatusChanged | WSProviderQuota | WSProviderStatusSnapshot | WSProviderActiveBlocked | WSProviderStreamError | WSRunResult | WSSessionRunState | WSSessionResumeProgress | WSSessionStats | WSError | WSToolConfirmNeeded | WSToolConfirmResolved | WSTrustPersisted | WSToolLoopDetected | WSDelegateStarted | WSDelegateCompleted | WSContextDebug | WSContextCompacted | WSCompactionFailed | WSContextRepaired | WSContextEditorSnapshot | WSContextEditorValidation | WSContextEditorApplied | WSContextPct | WSTopicAdviceResult | WSContextMaxContext | WSTokenThreshold | WSTokenCostEstimateUnavailable | WSContextModesList | WSContextModeChanged | WSToolsList | WSMemoryList | WSMemorySageList | WSMemorySageListPage | WSMemorySageListCandidates | WSMemorySageGet | WSMemorySageGraph | WSMemorySageSearchBreakdown | WSMemorySageUpdate | WSMemorySageRemember | WSMemorySageDelete | WSMemorySageRecover | WSMemorySageCandidateResolve | WSMemorySageBackfillRecoverable | WSMemorySageForFile | WSSkillsList | WSSkillContent | WSDesignList | WSDesignUse | WSDesignState | WSDesignSet | WSDesignTune | WSDesignSwap | WSDesignMaterialize | WSDesignVerify | WSSkillsInstalled | WSSkillsUninstalled | WSSkillsUpdated | WSSkillsCreated | WSSkillsEdited | WSSkillsExported | WSDiagGet | WSStatsGet | {
14
+ import type { WSAuthOAuthProviders, WSAuthOAuthStatus, WSCatalogModelSearchResult, WSCompletionResult, WSDiagGet, WSFilesList, WSKeyOperationResult, WSModelSwitchResult, WSProviderCatalog, WSProviderModels, WSProviderModelTestComplete, WSProviderModelTestResult, WSProviderModelTestStarted, WSProviderProbe, WSSavedProviders, WSSessionInspect, WSSessionsList, WSSideEffects, WSStatsGet, WSTodosCleared, WSTodosUpdated } from './system.js';
15
+ export type WSServerMessage = WSSessionStart | WSSessionEnd | WSTextDelta | WSThinkingDelta | WSToolUseStart | WSToolProgress | WSToolExecuted | WSCodeMapToolStarted | WSCodeMapToolExecuted | WSIterationStarted | WSIterationCompleted | WSIterationLimitReached | WSProviderResponse | WSProviderRetry | WSProviderAuditHistory | WSProviderError | WSProviderFallback | WSProviderFallbackPending | WSProviderStatusChanged | WSProviderQuota | WSProviderStatusSnapshot | WSProviderActiveBlocked | WSProviderStreamError | WSRunResult | WSSessionRunState | WSSessionResumeProgress | WSSessionStats | WSError | WSToolConfirmNeeded | WSToolConfirmResolved | WSUserInputRequested | WSUserInputResolved | WSTrustPersisted | WSToolLoopDetected | WSDelegateStarted | WSDelegateCompleted | WSContextDebug | WSContextCompacted | WSCompactionFailed | WSContextRepaired | WSContextEditorSnapshot | WSContextEditorValidation | WSContextEditorApplied | WSContextPct | WSTopicAdviceResult | WSContextMaxContext | WSTokenThreshold | WSTokenCostEstimateUnavailable | WSContextModesList | WSContextModeChanged | WSToolsList | WSMemoryList | WSMemorySageList | WSMemorySageListPage | WSMemorySageListCandidates | WSMemorySageGet | WSMemorySageGraph | WSMemorySageSearchBreakdown | WSMemorySageUpdate | WSMemorySageRemember | WSMemorySageDelete | WSMemorySageRecover | WSMemorySageCandidateResolve | WSMemorySageBackfillRecoverable | WSMemorySageForFile | WSSkillsList | WSSkillContent | WSDesignList | WSDesignUse | WSDesignState | WSDesignSet | WSDesignTune | WSDesignSwap | WSDesignMaterialize | WSDesignVerify | WSSkillsInstalled | WSSkillsUninstalled | WSSkillsUpdated | WSSkillsCreated | WSSkillsEdited | WSSkillsExported | WSDiagGet | WSStatsGet | {
16
16
  type: 'connections.health_result';
17
17
  payload: ConnectionsHealthReport;
18
18
  } | {
@@ -62,7 +62,7 @@ export type WSServerMessage = WSSessionStart | WSSessionEnd | WSTextDelta | WSTh
62
62
  payload: {
63
63
  message: string;
64
64
  };
65
- } | WSSessionsList | WSSessionInspect | WSProviderCatalog | WSCatalogModelSearchResult | WSProviderModels | WSSavedProviders | WSProviderProbe | WSKeyOperationResult | WSModelSwitchResult | WSAuthOAuthStatus | WSAuthOAuthProviders | WSFilesList | WSFilesGitServerMessage | WSCompletionResult | WSTodosUpdated | WSTodosCleared | WSModesList | WSGoalState | WSGoalProgress | WSGoalLifecycle | WSGoalList | WSGoalAssessResult | WSEternalIteration | WSAgentTimelineMessage | WSAgentStatusChanged | WSKanbanResult | WSKanbanTaskActivity | WSWorktreeState | WSWorktreeEvent | WSWorktreeOrphans | WSWorktreeCleanupResult | WSWorktreeMergeResult | WSWorktreeDiffResult | WSCollabState | WSCollabParticipantJoined | WSCollabParticipantLeft | WSCollabEvent | WSCollabAnnotationAdded | WSCollabAnnotationResolved | WSCollabPauseGranted | WSCollabPauseReleased | WSCollabInjectionGranted | WSSideEffects | WSMcpServerMessage | WSChimeraServerMessage | WSFleetServerMessage | WSSystemMiscServerMessage;
65
+ } | WSSessionsList | WSSessionInspect | WSProviderCatalog | WSCatalogModelSearchResult | WSProviderModels | WSProviderModelTestStarted | WSProviderModelTestResult | WSProviderModelTestComplete | WSSavedProviders | WSProviderProbe | WSKeyOperationResult | WSModelSwitchResult | WSAuthOAuthStatus | WSAuthOAuthProviders | WSFilesList | WSFilesGitServerMessage | WSCompletionResult | WSTodosUpdated | WSTodosCleared | WSModesList | WSGoalState | WSGoalProgress | WSGoalLifecycle | WSGoalList | WSGoalAssessResult | WSEternalIteration | WSAgentTimelineMessage | WSAgentStatusChanged | WSKanbanResult | WSKanbanTaskActivity | WSWorktreeState | WSWorktreeEvent | WSWorktreeOrphans | WSWorktreeCleanupResult | WSWorktreeMergeResult | WSWorktreeDiffResult | WSCollabState | WSCollabParticipantJoined | WSCollabParticipantLeft | WSCollabEvent | WSCollabAnnotationAdded | WSCollabAnnotationResolved | WSCollabPauseGranted | WSCollabPauseReleased | WSCollabInjectionGranted | WSSideEffects | WSMcpServerMessage | WSChimeraServerMessage | WSFleetServerMessage | WSSystemMiscServerMessage;
66
66
  export type { WSChimeraServerMessage } from './server-message-chimera.js';
67
67
  export type { WSFilesGitServerMessage } from './server-message-files.js';
68
68
  export type { WSFleetServerMessage } from './server-message-fleet.js';
@@ -184,6 +184,7 @@ export interface WSProviderModels {
184
184
  description?: string | undefined;
185
185
  releaseDate?: string | undefined;
186
186
  contextWindow?: number | undefined;
187
+ maxOutput?: number | undefined;
187
188
  inputCost?: number | undefined;
188
189
  outputCost?: number | undefined;
189
190
  provenance?: ModelProvenance | undefined;
@@ -196,6 +197,7 @@ export interface WSSavedProviders {
196
197
  payload: {
197
198
  providers: Array<{
198
199
  id: string;
200
+ type?: string | undefined;
199
201
  family?: string | undefined;
200
202
  baseUrl?: string | undefined;
201
203
  /** Saved model allowlist, in the order the user pinned them. */
@@ -230,6 +232,56 @@ export interface WSSavedProviders {
230
232
  }>;
231
233
  };
232
234
  }
235
+ export interface WSProviderModelTestStarted {
236
+ type: 'provider.test.started';
237
+ payload: {
238
+ requestId: string;
239
+ providerId: string;
240
+ modelIds: string[];
241
+ total: number;
242
+ timeoutMs: number;
243
+ maxTokens: number;
244
+ };
245
+ }
246
+ export interface WSProviderModelTestResult {
247
+ type: 'provider.test.result';
248
+ payload: {
249
+ requestId: string;
250
+ providerId: string;
251
+ modelId: string;
252
+ status: 'passed' | 'failed' | 'cancelled';
253
+ diagnosis: string;
254
+ latencyMs: number;
255
+ stopReason?: string | undefined;
256
+ usage?: {
257
+ input: number;
258
+ output: number;
259
+ cacheRead?: number;
260
+ cacheWrite?: number;
261
+ } | undefined;
262
+ error?: string | undefined;
263
+ errorKind?: string | undefined;
264
+ httpStatus?: number | undefined;
265
+ family?: string | undefined;
266
+ wire?: string | undefined;
267
+ maxContext?: number | undefined;
268
+ maxOutput?: number | undefined;
269
+ inputCost?: number | undefined;
270
+ outputCost?: number | undefined;
271
+ capabilities?: string[] | undefined;
272
+ };
273
+ }
274
+ export interface WSProviderModelTestComplete {
275
+ type: 'provider.test.complete';
276
+ payload: {
277
+ requestId: string;
278
+ providerId: string;
279
+ passed: number;
280
+ failed: number;
281
+ cancelled: number;
282
+ error?: string | undefined;
283
+ };
284
+ }
233
285
  /**
234
286
  * Health-probe result for a single provider, broadcast in reply to a
235
287
  * `provider.probe` client message. Mirrors the `ProbeResult` shape
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/webui",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
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": [
@@ -57,12 +57,12 @@
57
57
  "@radix-ui/react-tabs": "^1.1.21",
58
58
  "@tanstack/react-virtual": "^3.14.10",
59
59
  "@uiw/react-textarea-code-editor": "^3.1.1",
60
- "@wrongstack/core": "1.0.6",
61
- "@wrongstack/kanban": "1.0.6",
62
- "@wrongstack/plugins": "1.0.6",
63
- "@wrongstack/providers": "1.0.6",
64
- "@wrongstack/tools": "1.0.6",
65
- "@wrongstack/webui-protocol": "1.0.6",
60
+ "@wrongstack/core": "1.0.7",
61
+ "@wrongstack/kanban": "1.0.7",
62
+ "@wrongstack/plugins": "1.0.7",
63
+ "@wrongstack/providers": "1.0.7",
64
+ "@wrongstack/tools": "1.0.7",
65
+ "@wrongstack/webui-protocol": "1.0.7",
66
66
  "@xterm/addon-fit": "^0.11.0",
67
67
  "@xterm/xterm": "^6.0.0",
68
68
  "@xyflow/react": "^12.11.3",
@@ -98,8 +98,8 @@
98
98
  "@types/ws": "^8.18.1",
99
99
  "@vitejs/plugin-react": "^6.1.0",
100
100
  "@vitest/coverage-v8": "^4.1.11",
101
- "@wrongstack/sdd": "1.0.6",
102
- "@wrongstack/webui-server": "1.0.6",
101
+ "@wrongstack/sdd": "1.0.7",
102
+ "@wrongstack/webui-server": "1.0.7",
103
103
  "jsdom": "^30.0.1",
104
104
  "tailwindcss": "^4.3.3",
105
105
  "typescript": "^7.0.2",
@@ -111,6 +111,7 @@
111
111
  "build": "vite build && node ../../scripts/build-package.mjs",
112
112
  "typecheck": "tsc --noEmit",
113
113
  "test": "vitest run",
114
+ "test:user-input-browser": "node tests/user-input-browser-smoke.mjs",
114
115
  "test:watch": "vitest",
115
116
  "test:coverage": "node ../../scripts/coverage-lock.mjs node ../../scripts/run-vitest-coverage.mjs run --coverage"
116
117
  }
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{W as t,t as n}from"./config-store-Dq6MhrIA.js";import{i as r,t as i}from"./react-core-wiHys0m2.js";import{$i as a,Fn as o,Jn as s,La as c,_t as l,dt as u,ft as d,ja as f,mi as p,nt as m,ui as h}from"./vendor-Cvuk-OYN.js";import"./i18n-CRIAwjnX.js";import"./stores-BOo4b1ZG.js";import{C as g,S as _,v}from"./index-BI1MMjfc.js";var y=e(r(),1),b=i();function x(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m ${t%60}s`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d`}function S(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function C(e){return e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function w(e){return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function T(e){return e.includes(`error`)||e.includes(`fail`)?`text-destructive`:e.includes(`warn`)?`text-warning`:e.includes(`success`)||e.includes(`complete`)?`text-success`:`text-muted-foreground`}function E({icon:e,label:t,value:n,sub:r,color:i=`text-muted-foreground`}){return(0,b.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,b.jsx)(`div`,{className:`mt-0.5 ${i}`,children:e}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(`div`,{className:`text-2xl font-semibold tabular-nums text-foreground`,children:n}),(0,b.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:t}),r?(0,b.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground/70`,children:r}):null]})]})}function D(){let{t:e}=c(),[r,i]=(0,y.useState)(null),[D,O]=(0,y.useState)([]),[k,A]=(0,y.useState)([]),[j,M]=(0,y.useState)(null),[N,P]=(0,y.useState)(!0),[F,I]=(0,y.useState)(!1),L=(0,y.useRef)(null),R=(0,y.useCallback)(async()=>{try{let e=await fetch(`/api/analytics/summary`);if(e.ok){let t=await e.json();i(t)}}catch{}},[]),z=(0,y.useCallback)(async()=>{try{let e=await fetch(`/api/analytics?limit=50`);if(e.ok){let t=await e.json();O(t.events)}}catch{}},[]),B=(0,y.useCallback)(async()=>{try{let e=await fetch(`/api/sessions`);if(e.ok){let t=await e.json();A(t)}}catch{}},[]),V=(0,y.useCallback)(async()=>{if(F)return;I(!0);let e=null,r=null;try{let i=t(n.getState().wsUrl);L.current=i,r=i.on(`stats.get`,t=>{let n=t.payload;M(n),I(!1),r?.(),e!==null&&clearTimeout(e)}),i.getStats({echoToChat:!1}),e=setTimeout(()=>{r?.(),I(!1)},8e3)}catch{r?.(),e!==null&&clearTimeout(e),I(!1)}},[F]);(0,y.useEffect)(()=>{let e=()=>{Promise.all([R(),z(),B(),V()]).finally(()=>P(!1))};e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[R,z,B,V]);let{totalAgents:H,activeAgents:U,totalToolCalls:W,totalIterations:G}=(0,y.useMemo)(()=>{let e=0,t=0,n=0,r=0;for(let i of k)for(let a of i.agents)e++,a.status===`running`&&t++,n+=a.toolCalls,r+=a.iterations;return{totalAgents:e,activeAgents:t,totalToolCalls:n,totalIterations:r}},[k]),K=(0,y.useMemo)(()=>r?Object.entries(r.categoryBreakdown).sort((e,t)=>t[1]-e[1]).slice(0,8):[],[r]),q=(0,y.useMemo)(()=>r?Object.entries(r.eventBreakdown).sort((e,t)=>t[1]-e[1]).slice(0,10):[],[r]),J=(0,y.useMemo)(()=>{if(!r)return 0;let e=0;for(let[t,n]of Object.entries(r.eventBreakdown))t.toLowerCase().includes(`error`)&&(e+=n);return e},[r]),Y=(0,y.useMemo)(()=>{if(!r)return 0;let e=0;for(let[t,n]of Object.entries(r.eventBreakdown))t.toLowerCase().includes(`warn`)&&(e+=n);return e},[r]),X=(0,y.useMemo)(()=>[...D].reverse(),[D]),Z=g(X,20);return N?(0,b.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-[hsl(var(--surface-2)/0.45)] p-4`,children:(0,b.jsxs)(`div`,{className:`ws-surface flex items-center gap-2 rounded-xl px-4 py-3 text-sm text-muted-foreground`,children:[(0,b.jsx)(s,{className:`h-4 w-4 animate-spin text-primary`}),e(`activity:analytics.loading`)]})}):(0,b.jsx)(`div`,{ref:v(`analytics`),className:`h-full min-h-0 min-w-0 overflow-y-auto overscroll-contain bg-[hsl(var(--surface-2)/0.45)] p-4 sm:p-6`,children:(0,b.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col gap-5`,children:[(0,b.jsx)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:(0,b.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,b.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,b.jsx)(a,{className:`h-4 w-4 text-primary`}),(0,b.jsx)(`h1`,{className:`truncate text-base font-semibold`,children:e(`activity:analytics.heading`)})]}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`activity:analytics.autoRefresh`)})]})}),(0,b.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[(0,b.jsxs)(`div`,{className:`grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3`,children:[(0,b.jsx)(E,{icon:(0,b.jsx)(f,{className:`h-4 w-4`}),label:e(`activity:analytics.liveSessions`),value:k.length,color:`text-primary`}),(0,b.jsx)(E,{icon:(0,b.jsx)(m,{className:`h-4 w-4`}),label:e(`activity:analytics.agents`),value:`${U}/${H}`,sub:U>0?e(`activity:analytics.agentsActive`,{count:U}):void 0,color:`text-success`}),(0,b.jsx)(E,{icon:(0,b.jsx)(o,{className:`h-4 w-4`}),label:e(`activity:analytics.totalEvents`),value:r?.totalEvents??0,sub:e(`activity:analytics.categoriesSub`,{count:r?.uniqueCategories??0}),color:`text-warning`}),(0,b.jsx)(E,{icon:(0,b.jsx)(l,{className:`h-4 w-4`}),label:e(`activity:analytics.toolCalls`),value:W,sub:e(`activity:analytics.iterationsSub`,{count:G}),color:`text-success`}),(0,b.jsx)(E,{icon:(0,b.jsx)(h,{className:`h-4 w-4`}),label:e(`activity:analytics.sessionCost`),value:j?C(j.cost):`—`,sub:j?e(`activity:analytics.tokensSub`,{input:S(j.usage.input),output:S(j.usage.output)}):void 0,color:`text-primary`}),(0,b.jsx)(E,{icon:(0,b.jsx)(p,{className:`h-4 w-4`}),label:e(`activity:analytics.sessionDuration`),value:j?x(j.elapsedMs):`—`,sub:j?e(`activity:analytics.messagesSub`,{count:j.messages}):void 0,color:`text-muted-foreground`})]}),(0,b.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,b.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,b.jsxs)(`h3`,{className:`mb-3 flex items-center gap-2 text-xs font-semibold uppercase text-muted-foreground`,children:[(0,b.jsx)(d,{className:`h-3.5 w-3.5 text-primary`}),e(`activity:analytics.eventsByCategory`)]}),K.length===0?(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`activity:analytics.noEvents`)}):(0,b.jsx)(`div`,{className:`space-y-1.5`,children:K.map(([e,t])=>{let n=K[0]?.[1]??1,r=Math.round(t/n*100);return(0,b.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,7rem)_minmax(0,1fr)_2.5rem] items-center gap-2 text-xs`,children:[(0,b.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:e}),(0,b.jsx)(`div`,{className:`h-4 overflow-hidden rounded-full bg-muted`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full bg-primary/70 transition-all`,style:{width:`${Math.max(r,4)}%`}})}),(0,b.jsx)(`span`,{className:`text-right tabular-nums text-muted-foreground`,children:t})]},e)})})]}),(0,b.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,b.jsxs)(`h3`,{className:`mb-3 flex items-center gap-2 text-xs font-semibold uppercase text-muted-foreground`,children:[(0,b.jsx)(a,{className:`h-3.5 w-3.5 text-warning`}),e(`activity:analytics.topEvents`)]}),q.length===0?(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`activity:analytics.noEvents`)}):(0,b.jsx)(`div`,{className:`space-y-1.5`,children:q.map(([e,t])=>{let n=q[0]?.[1]??1,r=Math.round(t/n*100);return(0,b.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,9rem)_minmax(0,1fr)_2.5rem] items-center gap-2 text-xs`,children:[(0,b.jsx)(`span`,{className:`min-w-0 truncate ${T(e)}`,children:e}),(0,b.jsx)(`div`,{className:`h-4 overflow-hidden rounded-full bg-muted`,children:(0,b.jsx)(`div`,{className:`h-full rounded-full bg-warning/70 transition-all`,style:{width:`${Math.max(r,4)}%`}})}),(0,b.jsx)(`span`,{className:`text-right tabular-nums text-muted-foreground`,children:t})]},e)})})]})]}),(0,b.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,b.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,b.jsxs)(`h3`,{className:`mb-3 flex items-center gap-2 text-xs font-semibold uppercase text-muted-foreground`,children:[(0,b.jsx)(h,{className:`h-3.5 w-3.5 text-primary`}),e(`activity:analytics.activeSessionUsage`)]}),j?(0,b.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 text-xs`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-border/70 bg-background/50 px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:analytics.provider`)}),(0,b.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-foreground`,children:j.provider})]}),(0,b.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-border/70 bg-background/50 px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:analytics.model`)}),(0,b.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-foreground`,children:j.model})]}),(0,b.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/50 px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:analytics.inputTokens`)}),(0,b.jsx)(`p`,{className:`mt-0.5 tabular-nums text-foreground`,children:S(j.usage.input)})]}),(0,b.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/50 px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:analytics.outputTokens`)}),(0,b.jsx)(`p`,{className:`mt-0.5 tabular-nums text-foreground`,children:S(j.usage.output)})]}),(0,b.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/50 px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:analytics.cacheRatio`)}),(0,b.jsxs)(`p`,{className:`mt-0.5 tabular-nums text-foreground`,children:[(j.cache.hitRatio*100).toFixed(1),`%`]})]}),(0,b.jsxs)(`div`,{className:`rounded-lg border border-border/70 bg-background/50 px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:analytics.filesRead`)}),(0,b.jsx)(`p`,{className:`mt-0.5 tabular-nums text-foreground`,children:j.readFiles})]}),(j.cache.providers?.length??0)>0?(0,b.jsxs)(`div`,{className:`col-span-2 rounded-lg border border-border/70 bg-background/50 px-3 py-2`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:`Provider cache breakdown`}),(0,b.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:j.cache.providers?.map(e=>(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 font-mono`,children:[(0,b.jsx)(`span`,{className:`text-foreground`,children:e.provider}),(0,b.jsxs)(`span`,{className:`tabular-nums text-success`,children:[(e.hitRatio*100).toFixed(1),`% hit`]}),(0,b.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,children:[S(e.cacheRead),` read ·`,` `,S(e.cacheWrite),` write`]})]},e.provider))})]}):null]}):(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`activity:analytics.noSession`)})]}),(0,b.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,b.jsxs)(`h3`,{className:`mb-3 flex items-center gap-2 text-xs font-semibold uppercase text-muted-foreground`,children:[(0,b.jsx)(u,{className:`h-3.5 w-3.5 text-warning`}),e(`activity:analytics.healthErrors`)]}),(0,b.jsx)(`div`,{className:`space-y-2 text-xs`,children:r?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`flex justify-between`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:analytics.errorEvents`)}),(0,b.jsx)(`span`,{className:`tabular-nums text-destructive`,children:J})]}),(0,b.jsxs)(`div`,{className:`flex justify-between`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:analytics.warningEvents`)}),(0,b.jsx)(`span`,{className:`tabular-nums text-warning`,children:Y})]}),(0,b.jsxs)(`div`,{className:`flex justify-between`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:analytics.cacheHitRate`)}),(0,b.jsx)(`span`,{className:`tabular-nums text-success`,children:j?`${(j.cache.hitRatio*100).toFixed(1)}%`:`—`})]}),(0,b.jsxs)(`div`,{className:`flex justify-between`,children:[(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:e(`activity:analytics.totalCategories`)}),(0,b.jsx)(`span`,{className:`tabular-nums text-foreground`,children:r.uniqueCategories})]})]}):(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:e(`activity:analytics.waitingData`)})})]})]}),(0,b.jsxs)(`div`,{className:`rounded-xl border border-border/70 bg-card/75 p-4 shadow-sm`,children:[(0,b.jsxs)(`h3`,{className:`mb-3 flex items-center gap-2 text-xs font-semibold uppercase text-muted-foreground`,children:[(0,b.jsx)(f,{className:`h-3.5 w-3.5 text-primary`}),e(`activity:analytics.recentEvents`)]}),D.length===0?(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e(`activity:analytics.noRecentEvents`)}):(0,b.jsx)(`div`,{className:`max-h-64 space-y-1 overflow-y-auto`,children:Z.pageItems.map((e,t)=>(0,b.jsxs)(`div`,{className:`grid grid-cols-[4rem_minmax(0,7rem)_minmax(0,6rem)_minmax(0,1fr)] items-start gap-2 rounded px-2 py-1 text-xs hover:bg-muted/60`,children:[(0,b.jsx)(`span`,{className:`tabular-nums text-muted-foreground/70`,children:w(e.timestamp)}),(0,b.jsx)(`span`,{className:`min-w-0 truncate ${T(e.event)}`,children:e.event}),(0,b.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:e.category}),(0,b.jsx)(`span`,{className:`min-w-0 truncate text-foreground/80`,children:e.label??e.sessionId??``})]},`${e.timestamp}-${t}`))}),(0,b.jsx)(_,{page:Z.page,pageSize:Z.pageSize,totalItems:Z.totalItems,onPageChange:Z.setPage,compact:!0,itemLabel:`events`,className:`mt-3 rounded-lg border`})]})]})]})})}export{D as AnalyticsDashboard};
@@ -1,3 +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{J as r,La as i,Pt as a,Ut as o,ct as s,kr as c,li as l,ln as u,mt as d,rn as f,yt as p}from"./vendor-Cvuk-OYN.js";import"./i18n-CRIAwjnX.js";import{t as m}from"./utils-sO9lidp6.js";import{a as h,i as g,n as _,o as v,r as y,t as b}from"./dialog-DNsBc-EF.js";import{t as x}from"./button-CN_h6kNT.js";import{t as S}from"./input-BnTFqRjn.js";import{C,P as w,S as T}from"./index-BI1MMjfc.js";import{g as E,i as D,r as O,y as k}from"./shared-h0I65HLY.js";var A=e(t(),1),j=n();function M(e){if(!Array.isArray(e))return;let t=[...new Set(e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean))];return t.length>0?t:void 0}function N(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n={roles:M(t.roles),taskTypes:M(t.taskTypes),modes:M(t.modes)};return n.roles||n.taskTypes||n.modes?n:void 0}function P(e){let t=e.trim().replace(/^```(?:json)?\s*/i,``).replace(/\s*```$/,``),n=JSON.parse(t);if(!Array.isArray(n))throw Error(`Input must be a JSON array.`);let r=[],i=0;for(let e of n){if(!e||typeof e!=`object`||Array.isArray(e)){i++;continue}let t=e,n=typeof t.text==`string`?t.text.trim():``,a=N(t.audience);if(!n||!a){i++;continue}let o=typeof t.kind==`string`&&D.some(e=>e===t.kind)?t.kind:void 0,s=M(t.tags);r.push({text:n,audience:a,kind:o,tags:s,importance:typeof t.importance==`number`?t.importance:void 0,confidence:typeof t.confidence==`number`?t.confidence:void 0})}return{entries:r,skipped:i}}function F(e,t){if(!t)return!0;let n=e.audience;return[e.text,e.kind,e.status,...n?.roles??[],...n?.taskTypes??[],...n?.modes??[]].join(` `).toLocaleLowerCase().includes(t.toLocaleLowerCase())}function I(e,t){return[...new Set(e.flatMap(e=>e.audience?.[t]??[]).filter(e=>e.length>0))].sort((e,t)=>e.localeCompare(t))}function L(){let{t:e}=i(),t=w(),[n,a]=(0,A.useState)([]),[D,O]=(0,A.useState)(!0),[k,M]=(0,A.useState)(null),[N,L]=(0,A.useState)(``),[z,B]=(0,A.useState)(!1),[ae,V]=(0,A.useState)(!1),[H,U]=(0,A.useState)(null),[W,G]=(0,A.useState)(!1),[K,q]=(0,A.useState)(!1),J=(0,A.useRef)(null),Y=(0,A.useCallback)(()=>{O(!0),M(null),t.listSageMemories({echoToChat:!1})},[t.listSageMemories]);(0,A.useEffect)(()=>{let n=t.client,r=n.on(`memory.sage.list`,e=>{let t=e.payload;t.error?M({tone:`error`,text:t.error}):a(t.memories??[]),O(!1)}),i=n.on(`memory.sage.remember`,e=>{let t=e.payload;if(G(!1),t.error){M({tone:`error`,text:t.error});return}t.memory&&(a(e=>[t.memory,...e.filter(e=>e.id!==t.memory.id)]),B(!1))}),o=n.on(`memory.sage.update`,t=>{let n=t.payload;n.error?M({tone:`error`,text:n.error}):n.memory&&(a(e=>e.map(e=>e.id===n.memory.id?n.memory:e)),n.memory.audience||M({tone:`success`,text:e(`activity:audienceMem.scopeRemoved`)}))}),s=n.on(`memory.sage.delete`,t=>{let n=t.payload,r=J.current;n.success&&r?(a(e=>e.filter(e=>e.id!==r)),M({tone:`success`,text:e(`activity:audienceMem.deleted`)}),U(null),q(!1),J.current=null):n.success?Y():(M({tone:`error`,text:n.message??`Could not delete the memory.`}),q(!1),J.current=null)});return Y(),()=>{r(),i(),o(),s()}},[Y,t.client]);let X=(0,A.useMemo)(()=>n.filter(e=>{let t=e.audience;return!!(t&&(t.roles?.length||t.taskTypes?.length||t.modes?.length))}),[n]),Z=N.trim(),Q=(0,A.useMemo)(()=>X.filter(e=>F(e,Z)),[Z,X]),$=C(Q,16,Z),oe=(0,A.useMemo)(()=>I(X,`roles`),[X]),se=(0,A.useMemo)(()=>I(X,`taskTypes`),[X]),ce=(0,A.useMemo)(()=>I(X,`modes`),[X]),le=e=>{M(null),t.updateSage(e,{audience:void 0},{echoToChat:!1})},ue=()=>{H&&(J.current=H,q(!0),M(null),t.deleteSage(H,`Removed from the audience memory panel.`))},de=async()=>{let t=X.map(e=>({id:e.id,text:e.text,kind:e.kind,status:e.status,audience:e.audience,tags:e.tags,importance:e.importance,confidence:e.confidence}));try{if(!navigator.clipboard)throw Error(`Clipboard access is unavailable.`);await navigator.clipboard.writeText(JSON.stringify(t,null,2)),M({tone:`success`,text:e(`activity:audienceMem.copiedAsJson`,{count:t.length})})}catch(t){M({tone:`error`,text:t instanceof Error?t.message:e(`activity:audienceMem.copyFailed`)})}};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-card/20`,"aria-labelledby":`audience-memory-title`,children:[(0,j.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 p-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,j.jsx)(`div`,{className:`min-w-0`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md border border-primary/20 bg-primary/10 text-primary`,children:(0,j.jsx)(p,{className:`size-3.5`})}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`h2`,{id:`audience-memory-title`,className:`truncate text-sm font-semibold`,children:e(`activity:audienceMem.heading`)}),(0,j.jsx)(`p`,{className:`truncate text-[10px] text-muted-foreground`,children:e(`activity:audienceMem.subheading`)})]})]})}),(0,j.jsxs)(x,{variant:`default`,size:`sm`,className:`h-7 shrink-0 gap-1 px-2 text-xs`,onClick:()=>B(!0),children:[(0,j.jsx)(u,{className:`size-3`}),e(`common:action.add`)]})]}),(0,j.jsxs)(`div`,{className:`mt-3 grid grid-cols-4 gap-px overflow-hidden rounded-md border border-border/60 bg-border/60`,children:[(0,j.jsx)(R,{value:X.length,label:e(`activity:audienceMem.statMemories`)}),(0,j.jsx)(R,{value:oe.length,label:e(`activity:audienceMem.statRoles`)}),(0,j.jsx)(R,{value:se.length,label:e(`activity:audienceMem.statTasks`)}),(0,j.jsx)(R,{value:ce.length,label:e(`activity:audienceMem.statModes`)})]}),(0,j.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,j.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,j.jsx)(o,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,j.jsx)(S,{value:N,onChange:e=>L(e.target.value),placeholder:e(`activity:audienceMem.searchTextRoleTaskOrMode`),"aria-label":e(`activity:audienceMem.searchAudienceMemories`),className:`h-8 pl-8 pr-8 text-xs`}),N&&(0,j.jsx)(`button`,{type:`button`,className:`absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground hover:text-foreground`,onClick:()=>L(``),"aria-label":e(`activity:audienceMem.clearAudienceMemorySearch`),children:(0,j.jsx)(r,{className:`size-3`})})]}),(0,j.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0`,onClick:Y,"aria-label":e(`activity:audienceMem.refreshAudienceMemories`),title:e(`activity:audienceMem.refresh`),children:(0,j.jsx)(f,{className:m(`size-3.5`,D&&`animate-spin`)})}),(0,j.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0`,onClick:()=>V(!0),"aria-label":e(`activity:audienceMem.importAudienceMemories`),title:e(`activity:audienceMem.importJson`),children:(0,j.jsx)(s,{className:`size-3.5`})}),(0,j.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-8 shrink-0`,onClick:()=>void de(),"aria-label":e(`activity:audienceMem.copyAudienceMemoriesAsJson`),title:e(`activity:audienceMem.copyJson`),disabled:X.length===0,children:(0,j.jsx)(l,{className:`size-3.5`})})]})]}),k&&(0,j.jsxs)(`div`,{role:k.tone===`error`?`alert`:`status`,className:m(`mx-3 mt-3 flex shrink-0 items-start justify-between gap-2 rounded-md border px-2.5 py-2 text-[11px]`,k.tone===`error`?`border-destructive/30 bg-destructive/5 text-destructive`:`border-success/30 bg-success/5 text-success`),children:[(0,j.jsx)(`span`,{children:k.text}),(0,j.jsx)(`button`,{type:`button`,onClick:()=>M(null),className:`shrink-0 rounded-sm opacity-70 hover:opacity-100`,"aria-label":e(`activity:audienceMem.dismissMessage`),children:(0,j.jsx)(r,{className:`size-3`})})]}),(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[!D&&X.length>0&&(0,j.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between px-3 pb-1.5 pt-3 text-[10px] text-muted-foreground`,children:[(0,j.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,j.jsx)(c,{className:`size-3`}),Z?`${Q.length} of ${X.length}`:`${X.length} scoped`]}),Z&&(0,j.jsx)(`button`,{type:`button`,className:`hover:text-foreground`,onClick:()=>L(``),children:e(`activity:audienceMem.clearFilter`)})]}),(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3`,children:[D?(0,j.jsx)(te,{}):X.length===0?(0,j.jsx)(ne,{onAdd:()=>B(!0)}):Q.length===0?(0,j.jsxs)(`div`,{className:`flex h-full min-h-32 flex-col items-center justify-center px-4 text-center`,children:[(0,j.jsx)(o,{className:`mb-2 size-5 text-muted-foreground/60`}),(0,j.jsx)(`p`,{className:`text-xs font-medium`,children:e(`activity:audienceMem.noMatching`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[10px] text-muted-foreground`,children:e(`activity:audienceMem.noMatchingHint`)}),(0,j.jsx)(x,{variant:`ghost`,size:`sm`,className:`mt-2 h-7 text-xs`,onClick:()=>L(``),children:e(`activity:audienceMemoryPanel.clearSearch`)})]}):(0,j.jsx)(`ul`,{className:`space-y-2`,children:$.pageItems.map(e=>(0,j.jsx)(ee,{memory:e,onFilter:L,onClearScope:()=>le(e.id),onDelete:()=>U(e.id)},e.id))}),(0,j.jsx)(T,{page:$.page,pageSize:$.pageSize,totalItems:$.totalItems,onPageChange:$.setPage,compact:!0,itemLabel:`memories`})]})]})]}),(0,j.jsx)(re,{open:z,busy:W,onOpenChange:e=>{W||B(e)},onCreate:e=>{M(null),G(!0),t.rememberSage({text:e.text,kind:e.kind,audience:{roles:e.roles.length>0?e.roles:void 0,taskTypes:e.taskTypes.length>0?e.taskTypes:void 0,modes:e.modes.length>0?e.modes:void 0}},{echoToChat:!1})}}),(0,j.jsx)(ie,{open:ae,onOpenChange:V,onImport:n=>{try{let{entries:r,skipped:i}=P(n);if(r.length===0)return M({tone:`error`,text:e(`activity:audienceMem.noValidInJson`)}),!1;for(let e of r)t.rememberSage(e,{echoToChat:!1});return M({tone:`success`,text:e(`activity:audienceMem.queuedForImport`,{count:r.length})+(i?e(`activity:audienceMem.skippedSuffix`,{count:i}):`.`)}),V(!1),!0}catch(t){return M({tone:`error`,text:t instanceof Error?t.message:e(`activity:customRoster.invalidJson`)}),!1}}}),(0,j.jsx)(b,{open:!!H,onOpenChange:e=>{!e&&!K&&U(null)},children:(0,j.jsxs)(_,{className:`max-w-md`,children:[(0,j.jsxs)(h,{children:[(0,j.jsx)(v,{children:e(`activity:audienceMem.deleteTitle`)}),(0,j.jsx)(y,{children:e(`activity:audienceMem.deleteBody`)})]}),(0,j.jsx)(`div`,{className:`rounded-md border border-border/70 bg-background/45 p-3 text-xs text-muted-foreground`,children:E(n.find(e=>e.id===H)?.text??``,180)}),(0,j.jsxs)(g,{children:[(0,j.jsx)(x,{variant:`outline`,onClick:()=>U(null),disabled:K,children:`Cancel`}),(0,j.jsxs)(x,{variant:`destructive`,onClick:ue,disabled:K,children:[(0,j.jsx)(d,{className:`size-4`}),K?`Deleting…`:`Delete memory`]})]})]})})]})}function R({value:e,label:t}){return(0,j.jsxs)(`div`,{className:`bg-card/95 px-1.5 py-2 text-center`,children:[(0,j.jsx)(`p`,{className:`text-sm font-semibold tabular-nums`,children:e}),(0,j.jsx)(`p`,{className:`truncate text-[9px] uppercase tracking-wide text-muted-foreground`,children:t})]})}function ee({memory:e,onFilter:t,onClearScope:n,onDelete:r}){let{t:o}=i();return(0,j.jsxs)(`li`,{className:`group rounded-md border border-border/65 bg-card/55 p-2.5 transition-colors hover:border-border hover:bg-card/85`,children:[(0,j.jsx)(`p`,{className:`break-words text-xs leading-5`,children:e.text}),e.audience&&(0,j.jsx)(z,{audience:e.audience,onFilter:t}),(0,j.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 border-t border-border/45 pt-2`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[9px] uppercase tracking-wide text-muted-foreground`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:O[e.kind]??e.kind}),(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,j.jsx)(`span`,{children:e.status})]}),(0,j.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,j.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-6`,onClick:n,"aria-label":`Remove audience scope from ${E(e.text,42)}`,title:o(`activity:audienceMem.makeGeneralMemory`),children:(0,j.jsx)(a,{className:`size-3`})}),(0,j.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-6 text-destructive hover:text-destructive`,onClick:r,"aria-label":`Delete ${E(e.text,42)}`,title:o(`activity:audienceMem.delete`),children:(0,j.jsx)(d,{className:`size-3`})})]})]})]})}function z({audience:e,onFilter:t}){let n=[...(e.roles??[]).map(e=>({label:`role`,value:e})),...(e.taskTypes??[]).map(e=>({label:`task`,value:e})),...(e.modes??[]).map(e=>({label:`mode`,value:e}))];return(0,j.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:n.map(({label:e,value:n})=>(0,j.jsxs)(`button`,{type:`button`,className:`max-w-full truncate rounded border border-primary/15 bg-primary/7 px-1.5 py-0.5 font-mono text-[9px] text-primary/90 transition-colors hover:border-primary/35 hover:bg-primary/12`,onClick:()=>t(n),title:`Filter by ${e}: ${n}`,children:[e,`:`,n]},`${e}:${n}`))})}function te(){let{t:e}=i();return(0,j.jsx)(`div`,{className:`space-y-2 pt-3`,role:`status`,"aria-label":e(`activity:audienceMem.loadingAudienceMemories`),children:[0,1,2].map(e=>(0,j.jsxs)(`div`,{className:`animate-pulse rounded-md border border-border/50 p-3`,children:[(0,j.jsx)(`div`,{className:`h-2.5 w-full rounded bg-muted`}),(0,j.jsx)(`div`,{className:`mt-2 h-2.5 w-2/3 rounded bg-muted`}),(0,j.jsx)(`div`,{className:`mt-3 h-4 w-24 rounded bg-muted`})]},e))})}function ne({onAdd:e}){let{t}=i();return(0,j.jsxs)(`div`,{className:`flex h-full min-h-44 flex-col items-center justify-center px-5 text-center`,children:[(0,j.jsx)(`span`,{className:`mb-3 flex size-10 items-center justify-center rounded-full border border-dashed border-primary/35 bg-primary/5 text-primary`,children:(0,j.jsx)(p,{className:`size-4`})}),(0,j.jsx)(`p`,{className:`text-xs font-medium`,children:t(`activity:audienceMem.emptyTitle`)}),(0,j.jsx)(`p`,{className:`mt-1 max-w-52 text-[10px] leading-4 text-muted-foreground`,children:t(`activity:audienceMem.emptyBody`)}),(0,j.jsxs)(x,{variant:`outline`,size:`sm`,className:`mt-3 h-7 gap-1 text-xs`,onClick:e,children:[(0,j.jsx)(u,{className:`size-3`}),t(`activity:audienceMem.addScoped`)]})]})}function re({open:e,busy:t,onOpenChange:n,onCreate:r}){let{t:a}=i(),[o,s]=(0,A.useState)(``),[c,l]=(0,A.useState)(`workflow`),[u,d]=(0,A.useState)(``),[f,p]=(0,A.useState)(``),[m,S]=(0,A.useState)(``);(0,A.useEffect)(()=>{e||(s(``),l(`workflow`),d(``),p(``),S(``))},[e]);let C=k(u),w=k(f),T=k(m),E=o.trim().length>0&&(C.length>0||w.length>0||T.length>0);return(0,j.jsx)(b,{open:e,onOpenChange:n,children:(0,j.jsxs)(_,{className:`max-w-xl`,children:[(0,j.jsxs)(h,{children:[(0,j.jsx)(v,{children:a(`activity:audienceMem.createTitle`)}),(0,j.jsx)(y,{children:a(`activity:audienceMem.createBody`)})]}),(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:`audience-memory-text`,className:`mb-1.5 block text-xs font-medium`,children:a(`activity:audienceMem.fieldMemory`)}),(0,j.jsx)(`textarea`,{id:`audience-memory-text`,value:o,onChange:e=>s(e.target.value),placeholder:a(`activity:audienceMem.whatShouldMatchingAgentsRemember`),rows:4,autoFocus:!0,className:`w-full resize-y rounded-md border border-input bg-background px-3 py-2 text-sm outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring`})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:`audience-memory-kind`,className:`mb-1.5 block text-xs font-medium`,children:a(`activity:audienceMem.fieldKind`)}),(0,j.jsx)(`select`,{id:`audience-memory-kind`,value:c,onChange:e=>l(e.target.value),className:`h-9 w-full rounded-md border border-input bg-background px-3 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:D.map(e=>(0,j.jsx)(`option`,{value:e,children:O[e]??e},e))})]}),(0,j.jsxs)(`fieldset`,{className:`space-y-3 rounded-md border border-border/70 bg-background/35 p-3`,children:[(0,j.jsx)(`legend`,{className:`px-1 text-xs font-medium`,children:a(`activity:audienceMem.selectors`)}),(0,j.jsx)(B,{id:`audience-memory-roles`,label:a(`activity:audienceMem.statRoles`),value:u,onChange:d,placeholder:a(`activity:audienceMem.reviewerRefactorPlanner`)}),(0,j.jsx)(B,{id:`audience-memory-task-types`,label:a(`activity:audienceMem.fieldTaskTypes`),value:f,onChange:p,placeholder:a(`activity:audienceMem.reviewRefactorBugfix`)}),(0,j.jsx)(B,{id:`audience-memory-modes`,label:a(`activity:audienceMem.statModes`),value:m,onChange:S,placeholder:a(`activity:audienceMem.teachCodeReview`)}),(0,j.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:a(`activity:audienceMem.selectorsHint`)})]})]}),(0,j.jsxs)(g,{children:[(0,j.jsx)(x,{variant:`outline`,onClick:()=>n(!1),disabled:t,children:a(`common:action.cancel`)}),(0,j.jsx)(x,{onClick:()=>r({text:o.trim(),kind:c,roles:C,taskTypes:w,modes:T}),disabled:!E||t,children:t?`Remembering…`:`Remember`})]})]})})}function B({id:e,label:t,value:n,placeholder:r,onChange:i}){return(0,j.jsxs)(`div`,{className:`grid gap-1.5 sm:grid-cols-[6rem_1fr] sm:items-center`,children:[(0,j.jsx)(`label`,{htmlFor:e,className:`text-[11px] font-medium text-muted-foreground`,children:t}),(0,j.jsx)(S,{id:e,value:n,onChange:e=>i(e.target.value),placeholder:r,className:`h-8 font-mono text-xs`})]})}function ie({open:e,onOpenChange:t,onImport:n}){let{t:r}=i(),[a,o]=(0,A.useState)(``);return(0,A.useEffect)(()=>{e||o(``)},[e]),(0,j.jsx)(b,{open:e,onOpenChange:t,children:(0,j.jsxs)(_,{className:`max-w-xl`,children:[(0,j.jsxs)(h,{children:[(0,j.jsx)(v,{children:r(`activity:audienceMem.importTitle`)}),(0,j.jsxs)(y,{children:[r(`activity:audienceMem.importBodyBefore`),` `,(0,j.jsx)(`code`,{children:r(`activity:audienceMemoryPanel.memoryAudienceExport`)}),`.`,` `,r(`activity:audienceMem.importBodyAfter`)]})]}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`label`,{htmlFor:`audience-memory-import`,className:`mb-1.5 block text-xs font-medium`,children:r(`activity:audienceMem.jsonArray`)}),(0,j.jsx)(`textarea`,{id:`audience-memory-import`,value:a,onChange:e=>o(e.target.value),placeholder:`[
2
- { "text": "…", "audience": { "roles": ["reviewer"] } }
3
- ]`,rows:10,autoFocus:!0,spellCheck:!1,className:`w-full resize-y rounded-md border border-input bg-background p-3 font-mono text-xs outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring`})]}),(0,j.jsxs)(g,{children:[(0,j.jsx)(x,{variant:`outline`,onClick:()=>t(!1),children:r(`common:action.cancel`)}),(0,j.jsxs)(x,{onClick:()=>n(a),disabled:!a.trim(),children:[(0,j.jsx)(s,{className:`size-4`}),r(`activity:audienceMem.importAction`)]})]})]})})}export{L as AudienceMemoryPanel};
@@ -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{Ba as r,Ei as i,J as a,Jn as o,La as s,Mi as c,Qt as l,Vi as u,Yt as d,bi as f,en as p,hn as m,ji as h,ln as g,lt as _,or as v,ot as y,q as b,un as x,wt as S}from"./vendor-Cvuk-OYN.js";import"./i18n-CRIAwjnX.js";import{t as C}from"./utils-sO9lidp6.js";import{o as w}from"./view-navigation-Ca7VJMhX.js";import{t as T,v as E,y as D}from"./stores-BOo4b1ZG.js";import{t as O}from"./chat-store-Dl3XHXs8.js";import{t as k}from"./button-CN_h6kNT.js";import{P as A,j,n as M,r as ee,t as te}from"./index-BI1MMjfc.js";var N=e(t(),1),P=n(),F={pending:{icon:(0,P.jsx)(h,{className:`w-4 h-4`}),color:`text-muted-foreground`},in_progress:{icon:(0,P.jsx)(i,{className:`w-4 h-4 animate-spin`}),color:`text-primary`},blocked:{icon:(0,P.jsx)(m,{className:`w-4 h-4`}),color:`text-warning`},failed:{icon:(0,P.jsx)(c,{className:`w-4 h-4`}),color:`text-destructive`},review:{icon:(0,P.jsx)(l,{className:`w-4 h-4`}),color:`text-info`},completed:{icon:(0,P.jsx)(u,{className:`w-4 h-4`}),color:`text-success`}},I={critical:`bg-destructive/15 text-destructive`,high:`bg-warning/15 text-warning`,medium:`bg-info/15 text-info`,low:`bg-muted text-muted-foreground`},L={feature:`bg-success/15 text-success`,bugfix:`bg-destructive/15 text-destructive`,refactor:`bg-primary/15 text-primary`,docs:`bg-info/15 text-info`,test:`bg-primary/15 text-primary`,chore:`bg-muted text-muted-foreground`};function R(e){if(!e)return``;let t=Math.floor(e/6e4);if(t<60)return`${t}m`;let n=Math.floor(t/60),r=t%60;return r>0?`${n}h ${r}m`:`${n}h`}function z({task:e,onStatusChange:t,onRetry:n,agents:r,onAssign:a,compact:o,className:c}){let{t:u}=s(),d=F[e.status],[f,p]=(0,N.useState)(!1),m=e.status===`in_progress`;return(0,P.jsxs)(`div`,{className:C(`w-full text-left rounded-lg border p-3 transition-all hover:shadow-sm`,m?`border-primary/40 bg-primary/5`:e.status===`completed`?`border-success/35 bg-success/6`:e.status===`failed`?`border-destructive/40 bg-destructive/5`:`border-border bg-card`,c),children:[(0,P.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,P.jsx)(`span`,{className:C(`mt-0.5`,d.color),role:`img`,"aria-label":m?u(`common:status.inProgress`):void 0,children:d.icon}),(0,P.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium`,children:e.title}),(0,P.jsx)(`span`,{className:C(`px-1.5 py-0.5 rounded text-[10px] font-medium`,I[e.priority]),children:e.priority}),(0,P.jsx)(`span`,{className:C(`px-1.5 py-0.5 rounded text-[10px] font-medium`,L[e.type]),children:e.type})]}),e.description&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1 line-clamp-2`,children:e.description})]})]}),e.assignee&&(0,P.jsxs)(`div`,{className:C(`mt-2 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-medium`,m?`bg-primary/15 text-primary`:`bg-muted text-muted-foreground`),children:[m&&(0,P.jsx)(i,{className:`w-3 h-3 animate-spin`,"aria-label":u(`common:status.working`)}),(0,P.jsx)(`span`,{children:e.assignee})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 mt-2 text-xs text-muted-foreground`,children:[e.estimateHours?(0,P.jsxs)(`span`,{children:[`~`,e.estimateHours,`h`]}):null,e.actualHours?(0,P.jsxs)(`span`,{children:[`• `,e.actualHours,`h`]}):null,e.startedAt?(0,P.jsxs)(`span`,{children:[`• `,R(Date.now()-e.startedAt)]}):null]}),e.tags.length>0&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,children:e.tags.map(e=>(0,P.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px] bg-muted text-muted-foreground`,children:e},e))}),!o&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 mt-2`,children:[t&&e.status!==`in_progress`&&e.status!==`completed`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`in_progress`),className:`px-2 py-0.5 text-[10px] rounded bg-primary/15 text-primary hover:bg-primary/25 transition-colors`,children:u(`activity:task.start`)}),t&&e.status===`in_progress`&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>t(e.id,`completed`),className:`px-2 py-0.5 text-[10px] rounded bg-success/15 text-success hover:bg-success/25 transition-colors`,children:u(`activity:task.complete`)}),n&&(e.status===`failed`||e.status===`completed`)&&(0,P.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,children:[(0,P.jsx)(l,{className:`w-3 h-3`}),` `,u(`activity:task.retry`)]}),a&&r&&r.length>0&&(f?(0,P.jsxs)(`select`,{defaultValue:e.assignee??``,onChange:t=>{a(e.id,t.target.value),p(!1)},onBlur:()=>p(!1),className:`px-1 py-0.5 text-[10px] rounded border border-border bg-card`,children:[(0,P.jsx)(`option`,{value:``,children:u(`activity:task.unassigned`)}),r.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>p(!0),className:`px-2 py-0.5 text-[10px] rounded bg-muted text-muted-foreground hover:bg-muted/70 transition-colors inline-flex items-center gap-1`,title:u(`activity:task.assignTitle`),children:[(0,P.jsx)(y,{className:`w-3 h-3`}),` `,u(`activity:task.assign`)]}))]})]})}var B=[{key:`pending`,match:[`pending`,`blocked`]},{key:`in_progress`,match:[`in_progress`]},{key:`review`,match:[`review`]},{key:`failed`,match:[`failed`]},{key:`completed`,match:[`completed`]}],V={pending:`bg-muted text-muted-foreground`,ready:`bg-info/15 text-info`,running:`bg-primary/15 text-primary`,paused:`bg-warning/15 text-warning`,completed:`bg-success/15 text-success`,failed:`bg-destructive/15 text-destructive`,skipped:`bg-muted text-muted-foreground`};function ne(){let{client:e}=A(),{t}=s(),n=E(e=>e.phases),r=E(e=>e.multiBoard),[i,a]=(0,N.useState)(`phase`),[o,c]=(0,N.useState)(null),[l,u]=(0,N.useState)(null),[p,m]=(0,N.useState)(0),h=Math.min(p,Math.max(0,n.length-1)),g=r?n[h]:void 0,_=(0,N.useMemo)(()=>n.flatMap(e=>(e.tasks??[]).map(t=>({...t,phaseId:e.id}))),[n]),v=(0,N.useMemo)(()=>[...new Set(_.map(e=>e.assignee).filter(e=>!!e))],[_]),y=(0,N.useCallback)(t=>e?.send?.(t),[e]),b=(0,N.useCallback)((e,t)=>y({type:`goal.taskStatus`,payload:{taskId:e,status:t}}),[y]),x=(0,N.useCallback)(e=>y({type:`goal.retryTask`,payload:{taskId:e}}),[y]),S=(0,N.useCallback)((e,t)=>y({type:`goal.assignTask`,payload:{taskId:e,agentName:t||void 0}}),[y]),w=(0,N.useCallback)(e=>{j({title:t(`activity:board.newTaskTitle`),placeholder:t(`activity:board.newTaskPlaceholder`),confirmLabel:t(`activity:board.addTask`)}).then(t=>{t&&y({type:`goal.addTask`,payload:{phaseId:e,title:t}})})},[y]),T=(0,N.useCallback)(e=>{o&&y({type:`goal.moveTask`,payload:{taskId:o,toPhaseId:e}}),c(null),u(null)},[o,y]),D=(0,N.useCallback)(e=>{o&&y({type:`goal.taskStatus`,payload:{taskId:o,status:e}}),c(null),u(null)},[o,y]),O={onStatusChange:b,onRetry:x,agents:v,onAssign:S};function k(e){return{draggable:!0,onDragStart:t=>{c(e),t.dataTransfer.effectAllowed=`move`},onDragEnd:()=>{c(null),u(null)}}}function M(e,t){return{onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,l!==e&&u(e)},onDragLeave:()=>u(t=>t===e?null:t),onDrop:e=>{e.preventDefault(),t()},"data-hover":l===e||void 0}}return n.length===0?(0,P.jsx)(`div`,{className:`flex h-full min-h-0 min-w-0 items-center justify-center text-muted-foreground`,children:(0,P.jsx)(`p`,{className:`text-sm`,children:t(`activity:board.empty`)})}):(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2`,children:[(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t(`activity:board.summary`,{phases:n.length,tasks:_.length})}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>a(`phase`),className:C(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,i===`phase`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(f,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.phases`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>a(`status`),className:C(`inline-flex items-center gap-1 rounded px-2 py-1 text-xs transition-colors`,i===`status`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(d,{className:`h-3.5 w-3.5`}),` `,t(`activity:board.statusTab`)]})]})]}),r&&g?(0,P.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,P.jsx)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-b border-border px-3 py-1.5`,children:n.map((e,t)=>(0,P.jsxs)(`button`,{type:`button`,onClick:()=>m(t),className:C(`shrink-0 rounded-t px-3 py-1.5 text-xs font-medium transition-colors`,t===h?`border-primary/40 bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[(0,P.jsx)(`span`,{className:`truncate`,children:e.name}),(0,P.jsxs)(`span`,{className:`ml-1.5 text-[10px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount]})]},e.id))}),(0,P.jsx)(W,{phase:g,allTasks:_,layout:i,dragId:o,hoverKey:l,callbacks:O,draggable:k,dropZone:M,dropToPhase:T,dropToStatus:D,onAddTask:w})]}):(0,P.jsx)(U,{phases:n,allTasks:_,layout:i,dragId:o,hoverKey:l,callbacks:O,draggable:k,dropZone:M,dropToPhase:T,dropToStatus:D,onAddTask:w})]})}function H({phase:e,phaseTasks:t,callbacks:n,draggable:r,dropZone:i,dropToPhase:a,onAddTask:o,dragId:c,hoverKey:l}){let{t:u}=s();return(0,P.jsxs)(`div`,{...i(`phase:${e.id}`,()=>a(e.id)),className:C(`flex min-h-0 w-80 shrink-0 flex-col rounded-lg border bg-muted/30 transition-colors`,l===`phase:${e.id}`?`border-primary/60 bg-primary/5`:`border-border`),children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-2`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`truncate text-sm font-semibold`,children:e.name}),(0,P.jsx)(`span`,{className:C(`rounded px-1.5 py-0.5 text-[10px] font-medium capitalize`,V[e.status]),children:e.status})]}),(0,P.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[e.completedTasks,`/`,e.taskCount,` · `,e.progressPercent,`%`]})]}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>o(e.id),title:u(`activity:board.addTask`),className:`rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground`,children:(0,P.jsx)(g,{className:`h-4 w-4`})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain p-2`,children:t.length===0?(0,P.jsx)(`p`,{className:`px-1 py-4 text-center text-[11px] text-muted-foreground`,children:u(`activity:board.dropHere`)}):t.map(e=>(0,P.jsx)(`div`,{...r(e.id),className:C(c===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,...n})},e.id))})]})}function U({phases:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,dropToStatus:l,onAddTask:u}){return(0,P.jsx)(P.Fragment,{children:n===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:e.map(e=>{let n=t.filter(t=>t.phaseId===e.id);return(0,P.jsx)(H,{phase:e,phaseTasks:n,callbacks:a,draggable:o,dropZone:s,dropToPhase:c,onAddTask:u,dragId:r,hoverKey:i},e.id)})}):(0,P.jsx)(G,{phases:e,allTasks:t,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:s,dropToStatus:l})})}function W({phase:e,allTasks:t,layout:n,dragId:r,hoverKey:i,callbacks:a,draggable:o,dropZone:c,dropToPhase:l,dropToStatus:u,onAddTask:d}){let f=t.filter(t=>t.phaseId===e.id),{t:p}=s();return n===`phase`?(0,P.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 gap-3 overflow-x-auto p-3`,children:(0,P.jsx)(H,{phase:e,phaseTasks:f,callbacks:a,draggable:o,dropZone:c,dropToPhase:l,onAddTask:d,dragId:r,hoverKey:i})}):(0,P.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain p-3`,children:(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:p(`activity:board.status.${e.key}`)},e.key)),(0,P.jsxs)(K,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:C(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(t=>{let n=f.filter(e=>t.match.includes(e.status)),s=`cell:${e.id}:${t.key}`;return(0,P.jsx)(`div`,{...c(s,()=>u(t.key)),className:C(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,i===s?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:n.map(e=>(0,P.jsx)(`div`,{...o(e.id),className:C(r===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...a})},e.id))},t.key)})]},e.id)]})})}function G({phases:e,allTasks:t,dragId:n,hoverKey:r,callbacks:i,draggable:a,dropZone:o,dropToStatus:c}){let{t:l}=s();return(0,P.jsxs)(`div`,{className:`grid min-w-[900px] gap-2`,style:{gridTemplateColumns:`9rem repeat(${B.length}, minmax(0, 1fr))`},children:[(0,P.jsx)(`div`,{}),B.map(e=>(0,P.jsx)(`div`,{className:`px-2 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:l(`activity:board.status.${e.key}`)},e.key)),e.map(e=>(0,P.jsxs)(K,{children:[(0,P.jsx)(`div`,{className:`flex items-center pr-2`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,P.jsx)(`span`,{className:C(`mt-0.5 inline-block rounded px-1.5 py-0.5 text-[10px] capitalize`,V[e.status]),children:e.status})]})}),B.map(s=>{let l=t.filter(t=>t.phaseId===e.id&&s.match.includes(t.status)),u=`cell:${e.id}:${s.key}`;return(0,P.jsx)(`div`,{...o(u,()=>c(s.key)),className:C(`min-h-[4rem] space-y-2 rounded-md border p-1.5 transition-colors`,r===u?`border-primary/60 bg-primary/5`:`border-border bg-muted/20`),children:l.map(e=>(0,P.jsx)(`div`,{...a(e.id),className:C(n===e.id&&`opacity-50`),children:(0,P.jsx)(z,{task:e,compact:!0,...i})},e.id))},s.key)})]},e.id))]})}function K({children:e}){return(0,P.jsx)(P.Fragment,{children:e})}function q({onClose:e}){let{client:t}=A(),{t:n}=s(),i=E(e=>e.phases),c=E(e=>e.overallPercent),l=E(e=>e.autonomous),u=E(e=>e.title),d=E(e=>e.goal),f=E(e=>e.status),h=E(e=>e.lastError),y=E(e=>e.graphs);(0,N.useEffect)(()=>{t?.send?.({type:`goal.list`}),t?.send?.({type:`goal.state`})},[t]);let j=T(e=>e.worktrees),F=T(e=>e.baseBranch),[I,L]=(0,N.useState)(``),[R,z]=(0,N.useState)(null),[B,V]=(0,N.useState)(!1),[H,U]=(0,N.useState)(!0),[W,G]=(0,N.useState)(!1),[K,q]=(0,N.useState)(!1),[J,re]=(0,N.useState)(!1),Y=D(e=>e.result),X=D(e=>e.loading),Z=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(Z.current&&clearTimeout(Z.current),!I.trim()){D.getState().clear();return}return Z.current=setTimeout(()=>{D.getState().setLoading();let e=D.getState().nextSeq();t?.send?.({type:`goal.assess`,payload:{goal:I,seq:e}})},800),()=>{Z.current&&clearTimeout(Z.current)}},[I,t]),(0,N.useEffect)(()=>{!I.trim()&&!R&&D.getState().clear()},[I,R]);let Q=i.length>0,ie=R!=null&&!Q;(0,N.useEffect)(()=>{Q&&z(null)},[Q]);let ae=(0,N.useCallback)(()=>{let e=I.trim();if(!e||R!=null)return;let n=O.getState();n.addMessage({role:`user`,content:e}),n.addMessage({role:`assistant`,content:r.t(`activity:goalRun.planningAck`)}),z(e),L(``),t?.send?.({type:`goal.start`,payload:{title:e,autonomous:!0,worktrees:H,multiBoard:W,verifyTasks:K,chimeraReview:J}}),w(`chat`)},[I,R,t,H]),oe=(0,N.useCallback)(()=>{t?.send?.({type:`goal.stop`,payload:{}}),z(null)},[t]),se=(0,N.useCallback)(()=>{t?.send?.({type:`goal.toggleAutonomous`,payload:{}})},[t]),ce=(0,N.useCallback)(()=>{t?.send?.(f===`paused`?{type:`goal.resume`,payload:{}}:{type:`goal.pause`,payload:{}})},[t,f]),le=(0,N.useCallback)(()=>{t?.send?.({type:`goal.stop`,payload:{}})},[t]),ue=(0,N.useCallback)(()=>{t?.send?.({type:`goal.clear`,payload:{}}),E.getState().clear(),z(null),L(``)},[t]),[de,$]=(0,N.useState)(!1),fe=(0,N.useCallback)(()=>{t?.send?.({type:`goal.revert`,payload:{}}),$(!1)},[t]),pe=f===`running`||f===`paused`,me=f===`stopped`||f===`completed`||f===`failed`,he=(0,N.useCallback)(e=>{e&&t?.send?.({type:`goal.load`,payload:{graphId:e}})},[t]);return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col bg-background`,children:[(0,P.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-2 border-b bg-card px-4 py-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(v,{className:`h-5 w-5 text-muted-foreground`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold`,children:Q&&u||`Goal`}),Q&&(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`activity:goalRun.summary`,{count:i.length,pct:c})})]}),Q&&(0,P.jsx)(`span`,{className:C(`rounded border px-2 py-0.5 text-[11px] font-medium capitalize`,f===`failed`?`border-destructive/40 bg-destructive/10 text-destructive`:f===`paused`||f===`stopped`?`border-warning/40 bg-warning/10 text-warning`:f===`completed`?`border-success/40 bg-success/10 text-success`:`border-primary/30 bg-primary/10 text-primary`),title:h??void 0,children:f})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 sm:justify-end`,children:[y.length>0&&(0,P.jsxs)(`select`,{value:Q?y.find(e=>e.title===u)?.id??``:``,onChange:e=>he(e.target.value),title:n(`activity:goalRun.switchBoard`),className:`min-w-0 flex-1 rounded border border-border bg-card px-2 py-1 text-xs text-foreground sm:w-72 sm:flex-none`,children:[(0,P.jsx)(`option`,{value:``,disabled:!0,children:n(`activity:goalRun.boardsCount`,{count:y.length})}),y.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.title,` · `,e.status]},e.id))]}),Q&&(0,P.jsxs)(`button`,{type:`button`,onClick:se,title:n(`activity:goalRun.toggleAutonomousTitle`),className:C(`inline-flex items-center gap-1 rounded border px-2 py-1 text-xs transition-colors`,l?`border-primary/30 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:[(0,P.jsx)(b,{className:`h-3.5 w-3.5`}),` `,n(l?`activity:goalRun.autonomous`:`activity:goalRun.manual`)]}),pe&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:ce,title:n(f===`paused`?`activity:goalRun.resumeTitle`:`activity:goalRun.pauseTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[f===`paused`?(0,P.jsx)(x,{className:`h-3.5 w-3.5`}):(0,P.jsx)(m,{className:`h-3.5 w-3.5`}),n(f===`paused`?`activity:goalRun.resume`:`activity:goalRun.pause`)]}),(0,P.jsxs)(`button`,{type:`button`,onClick:le,title:n(`activity:goalRun.stopTitle`),className:`inline-flex items-center gap-1 rounded border border-destructive/40 bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/20`,children:[(0,P.jsx)(S,{className:`h-3.5 w-3.5 fill-current`}),` `,n(`activity:goalRun.stop`)]})]}),Q&&me&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,onClick:ue,title:n(`activity:goalRun.newTitle`),className:`inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary transition-colors hover:bg-primary/20`,children:[(0,P.jsx)(g,{className:`h-3.5 w-3.5`}),` `,n(`activity:goalRun.newLabel`)]}),de?(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 text-xs`,children:[(0,P.jsx)(`span`,{className:`text-warning`,children:n(`activity:goalRun.revertConfirm`)}),(0,P.jsx)(`button`,{type:`button`,onClick:fe,className:`rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-destructive hover:bg-destructive/25`,children:n(`common:action.yes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>$(!1),className:`rounded px-1.5 py-0.5 text-muted-foreground hover:text-foreground`,children:n(`common:action.no`)})]}):(0,P.jsxs)(`button`,{type:`button`,onClick:()=>$(!0),title:n(`activity:goalRun.revertTitle`),className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,P.jsx)(_,{className:`h-3.5 w-3.5`}),` `,n(`activity:goalRun.revert`)]})]}),(0,P.jsx)(k,{variant:`ghost`,size:`icon`,onClick:e,children:(0,P.jsx)(a,{className:`h-4 w-4`})})]})]}),Q&&d&&(0,P.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-muted/20 px-4 py-2.5`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(p,{className:`h-3 w-3`}),` `,n(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:d})]}),Q?(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,P.jsx)(ne,{})}):ie?(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-5 text-center`,children:[(0,P.jsx)(o,{className:`h-10 w-10 mx-auto animate-spin text-primary/70`}),(0,P.jsxs)(`div`,{className:`space-y-1`,children:[(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:n(`activity:goalRun.planning`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`activity:goalRun.planningBody`)})]}),(0,P.jsxs)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-left`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground`,children:[(0,P.jsx)(p,{className:`h-3 w-3`}),` `,n(`activity:goalRun.goal`)]}),(0,P.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-relaxed text-foreground/90`,children:R})]}),(0,P.jsxs)(k,{variant:`outline`,onClick:oe,className:`gap-2`,children:[(0,P.jsx)(S,{className:`h-4 w-4 fill-current`}),` `,n(`common:action.cancel`)]})]})}):(0,P.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,P.jsxs)(`div`,{className:`max-w-lg w-full space-y-6`,children:[(0,P.jsxs)(`div`,{className:`text-center space-y-2`,children:[(0,P.jsx)(p,{className:`h-10 w-10 mx-auto text-primary/60`}),(0,P.jsx)(`h2`,{className:`text-xl font-semibold`,children:n(`activity:goalRun.startHeading`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(`activity:goalRun.startBody`)})]}),(0,P.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:n(`activity:goalRun.startPlaceholder`),rows:5,className:`w-full rounded-lg border border-border bg-card px-4 py-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/30 placeholder:text-muted-foreground/70`,onKeyDown:e=>{e.key===`Enter`&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),ae())}}),X&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(o,{className:`h-3 w-3 animate-spin`}),n(`activity:goalRun.assess.analyzing`)]}),!X&&Y&&!Y.parseFailed&&(0,P.jsxs)(`div`,{className:C(`rounded-lg border px-3 py-2 text-xs space-y-1.5`,Y.realistic?`border-success/40 bg-success/10`:`border-warning/40 bg-warning/10`),children:[(0,P.jsx)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:Y.realistic?(0,P.jsx)(`span`,{className:`text-success`,children:n(`activity:goalRun.assess.realistic`)}):(0,P.jsx)(`span`,{className:`text-warning`,children:n(`activity:goalRun.assess.durationConcern`)})}),Y.durationClaimed&&(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:n(`activity:goalRun.assess.durationClaimed`,{duration:Y.durationClaimed})}),(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:Y.explanation}),Y.recommendedDuration&&(0,P.jsx)(`p`,{className:`text-muted-foreground`,children:n(`activity:goalRun.assess.recommendation`,{duration:Y.recommendedDuration})}),Y.concerns.length>0&&(0,P.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,P.jsx)(`p`,{className:`font-medium text-foreground/80`,children:n(`activity:goalRun.assess.concerns`)}),(0,P.jsx)(`ul`,{className:`list-disc pl-4 space-y-0.5 text-muted-foreground`,children:Y.concerns.map((e,t)=>(0,P.jsx)(`li`,{children:e},t))})]})]}),!X&&Y?.parseFailed&&(0,P.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-muted/20 px-3 py-2 text-xs text-muted-foreground`,children:n(`activity:goalRun.assess.analysisFailed`)}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:H,onChange:e=>U(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),n(`activity:goalRun.isolateLabel`)]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-3 text-xs text-muted-foreground`,children:[(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:W,onChange:e=>G(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),n(`activity:goalRun.multiBoardLabel`)]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:K,onChange:e=>q(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),n(`activity:goalRun.verifyTasksLabel`)]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:J,onChange:e=>re(e.target.checked),className:`h-3.5 w-3.5 accent-primary`}),n(`activity:goalRun.chimeraReviewLabel`)]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[!X&&Y&&!Y.realistic&&!Y.parseFailed&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>D.getState().clear(),className:`shrink-0 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,title:n(`activity:goalRun.assess.overrideTitle`),children:n(`activity:goalRun.assess.override`)}),(0,P.jsxs)(k,{onClick:ae,disabled:!I.trim()||R!=null||X||!X&&Y!=null&&!Y.parseFailed&&!Y.realistic,className:`flex-1 gap-2`,title:I.trim()&&!X&&Y&&!Y.parseFailed&&!Y.realistic?n(`activity:goalRun.assess.disableTitle`):``,children:[(0,P.jsx)(x,{className:`h-4 w-4`}),n(`activity:goalRun.startButton`)]})]}),(0,P.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center`,children:[n(`activity:goalRun.ctrlHint`),` ·`,` `,n(H?`activity:goalRun.isolateOn`:`activity:goalRun.isolateOff`)]})]})}),j.length>0&&(0,P.jsxs)(`div`,{className:`border-t bg-card/50 shrink-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-4 pt-2 text-xs`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!1),className:C(`rounded px-2 py-0.5 border transition-colors`,B?`border-border text-muted-foreground hover:text-foreground`:`bg-primary/10 border-primary/30 text-primary`),children:n(`activity:goalRun.lanes`)}),(0,P.jsx)(`button`,{type:`button`,onClick:()=>V(!0),className:C(`rounded px-2 py-0.5 border transition-colors`,B?`bg-primary/10 border-primary/30 text-primary`:`border-border text-muted-foreground hover:text-foreground`),children:n(`activity:goalRun.graph`)})]}),(0,P.jsxs)(`div`,{className:`space-y-2 px-4 pb-3`,children:[(0,P.jsx)(te,{}),B?(0,P.jsx)(ee,{worktrees:j,baseBranch:F}):(0,P.jsx)(M,{worktrees:j,baseBranch:F})]})]})]})}export{q as GoalView};