@pellux/goodvibes-agent 1.4.4 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +7 -7
  3. package/dist/package/main.js +7424 -12241
  4. package/docs/README.md +2 -2
  5. package/docs/channels-remote-and-api.md +1 -1
  6. package/docs/getting-started.md +2 -2
  7. package/docs/release-and-publishing.md +1 -1
  8. package/docs/tools-and-commands.md +5 -5
  9. package/package.json +4 -2
  10. package/release/performance-snapshot.json +2 -2
  11. package/release/release-notes.md +11 -7
  12. package/release/release-readiness.json +6 -6
  13. package/src/agent/behavior-discovery-summary.ts +4 -18
  14. package/src/agent/calendar-registry.ts +322 -0
  15. package/src/agent/competitive-feature-inventory.ts +268 -130
  16. package/src/agent/document-registry.ts +5 -1
  17. package/src/agent/email/email-service.ts +350 -0
  18. package/src/agent/email/imap-client.ts +596 -0
  19. package/src/agent/email/smtp-client.ts +453 -0
  20. package/src/agent/ics-calendar.ts +662 -0
  21. package/src/agent/ics-timezone.ts +172 -0
  22. package/src/agent/markdown-frontmatter.ts +31 -0
  23. package/src/agent/memory-safety.ts +1 -1
  24. package/src/agent/note-registry.ts +3 -9
  25. package/src/agent/persona-discovery.ts +3 -15
  26. package/src/agent/persona-registry.ts +1 -10
  27. package/src/agent/research-source-registry.ts +5 -1
  28. package/src/agent/routine-discovery.ts +3 -15
  29. package/src/agent/runtime-profile.ts +3 -0
  30. package/src/agent/skill-discovery.ts +3 -15
  31. package/src/agent/skill-draft-proposer.ts +203 -0
  32. package/src/agent/skill-draft-runner.ts +201 -0
  33. package/src/agent/skill-registry.ts +36 -1
  34. package/src/agent/skill-standard.ts +99 -0
  35. package/src/agent/vibe-file.ts +7 -22
  36. package/src/cli/completion.ts +1 -1
  37. package/src/cli/config-overrides.ts +10 -1
  38. package/src/cli/redaction.ts +17 -5
  39. package/src/config/provider-model.ts +2 -1
  40. package/src/config/secret-config.ts +13 -6
  41. package/src/core/activity-feed.ts +97 -0
  42. package/src/core/away-digest.ts +161 -0
  43. package/src/core/conversation-rendering.ts +7 -3
  44. package/src/core/conversation.ts +22 -15
  45. package/src/core/hardware-profile.ts +362 -0
  46. package/src/core/last-seen-store.ts +78 -0
  47. package/src/core/plain-language.ts +52 -0
  48. package/src/core/setup-incomplete-hint.ts +90 -0
  49. package/src/core/system-message-router.ts +38 -87
  50. package/src/input/agent-workspace-basic-command-editor-submission.ts +60 -220
  51. package/src/input/agent-workspace-basic-command-editors.ts +39 -141
  52. package/src/input/agent-workspace-categories.ts +40 -125
  53. package/src/input/agent-workspace-command-editor.ts +4 -0
  54. package/src/input/agent-workspace-host-category.ts +0 -5
  55. package/src/input/agent-workspace-local-editor-submission.ts +3 -1
  56. package/src/input/agent-workspace-navigation.ts +10 -3
  57. package/src/input/agent-workspace-onboarding-actions.ts +132 -0
  58. package/src/input/agent-workspace-onboarding-categories.ts +29 -26
  59. package/src/input/agent-workspace-onboarding-finish.ts +11 -4
  60. package/src/input/agent-workspace-onboarding-state.ts +111 -0
  61. package/src/input/agent-workspace-profile-editor-submission.ts +260 -0
  62. package/src/input/agent-workspace-profile-editors.ts +155 -0
  63. package/src/input/agent-workspace-subscription-editor.ts +7 -0
  64. package/src/input/agent-workspace-types.ts +5 -1
  65. package/src/input/agent-workspace.ts +65 -39
  66. package/src/input/command-registry.ts +18 -5
  67. package/src/input/commands/agent-runtime-profile-runtime.ts +2 -1
  68. package/src/input/commands/agent-skills-runtime.ts +60 -3
  69. package/src/input/commands/calendar-runtime.ts +209 -0
  70. package/src/input/commands/channels-runtime.ts +1 -0
  71. package/src/input/commands/command-error.ts +9 -0
  72. package/src/input/commands/compat-runtime.ts +1 -0
  73. package/src/input/commands/config.ts +1 -0
  74. package/src/input/commands/conversation-runtime.ts +1 -1
  75. package/src/input/commands/delegation-runtime.ts +5 -6
  76. package/src/input/commands/email-runtime.ts +387 -0
  77. package/src/input/commands/experience-runtime.ts +17 -4
  78. package/src/input/commands/guidance-runtime.ts +1 -1
  79. package/src/input/commands/health-runtime.ts +6 -1
  80. package/src/input/commands/knowledge-format.ts +73 -0
  81. package/src/input/commands/knowledge.ts +9 -74
  82. package/src/input/commands/local-provider-runtime.ts +2 -1
  83. package/src/input/commands/local-runtime.ts +10 -4
  84. package/src/input/commands/mcp-runtime.ts +7 -0
  85. package/src/input/commands/notify-runtime.ts +17 -1
  86. package/src/input/commands/onboarding-runtime.ts +1 -0
  87. package/src/input/commands/operator-actions-runtime.ts +1 -0
  88. package/src/input/commands/operator-runtime.ts +3 -0
  89. package/src/input/commands/personas-runtime.ts +1 -0
  90. package/src/input/commands/platform-access-runtime.ts +40 -17
  91. package/src/input/commands/product-runtime.ts +6 -1
  92. package/src/input/commands/provider-accounts-runtime.ts +3 -2
  93. package/src/input/commands/qrcode-runtime.ts +1 -0
  94. package/src/input/commands/routines-runtime.ts +1 -0
  95. package/src/input/commands/runtime-services.ts +0 -13
  96. package/src/input/commands/security-runtime.ts +1 -0
  97. package/src/input/commands/session-content.ts +1 -0
  98. package/src/input/commands/shell-core.ts +5 -2
  99. package/src/input/commands/subscription-runtime.ts +33 -9
  100. package/src/input/commands/support-bundle-runtime.ts +8 -1
  101. package/src/input/commands/tasks-runtime.ts +1 -0
  102. package/src/input/commands/tts-runtime.ts +1 -0
  103. package/src/input/commands/vibe-runtime.ts +1 -0
  104. package/src/input/commands.ts +4 -0
  105. package/src/input/feed-context-factory.ts +3 -12
  106. package/src/input/handler-command-route.ts +7 -60
  107. package/src/input/handler-feed-routes.ts +0 -194
  108. package/src/input/handler-feed.ts +2 -54
  109. package/src/input/handler-interactions.ts +0 -2
  110. package/src/input/handler-modal-stack.ts +0 -9
  111. package/src/input/handler-picker-routes.ts +24 -1
  112. package/src/input/handler-shortcuts.ts +11 -40
  113. package/src/input/handler-ui-state.ts +13 -0
  114. package/src/input/handler.ts +8 -35
  115. package/src/input/keybindings.ts +40 -17
  116. package/src/input/model-picker-local-fit.ts +130 -0
  117. package/src/input/submission-router.ts +0 -5
  118. package/src/main.ts +111 -89
  119. package/src/renderer/activity-sidebar.ts +186 -0
  120. package/src/renderer/agent-workspace-context-lines.ts +5 -48
  121. package/src/renderer/agent-workspace-style.ts +1 -1
  122. package/src/renderer/agent-workspace.ts +14 -2
  123. package/src/renderer/compositor.ts +37 -125
  124. package/src/renderer/conversation-overlays.ts +3 -3
  125. package/src/renderer/help-overlay.ts +7 -5
  126. package/src/renderer/model-workspace.ts +101 -86
  127. package/src/{panels → renderer}/polish.ts +3 -3
  128. package/src/renderer/shell-surface.ts +4 -5
  129. package/src/renderer/status-token.ts +31 -11
  130. package/src/renderer/tab-strip.ts +1 -1
  131. package/src/renderer/tool-call.ts +7 -8
  132. package/src/renderer/tool-labels.ts +92 -0
  133. package/src/renderer/ui-factory.ts +48 -96
  134. package/src/runtime/bootstrap-command-context.ts +0 -5
  135. package/src/runtime/bootstrap-command-parts.ts +6 -15
  136. package/src/runtime/bootstrap-core.ts +34 -13
  137. package/src/runtime/bootstrap-hook-bridge.ts +3 -1
  138. package/src/runtime/bootstrap-shell.ts +3 -50
  139. package/src/runtime/bootstrap.ts +3 -4
  140. package/src/runtime/context.ts +1 -1
  141. package/src/runtime/diagnostics/panels/index.ts +0 -1
  142. package/src/runtime/diagnostics/panels/policy.ts +1 -1
  143. package/src/runtime/execution-ledger.ts +16 -1
  144. package/src/runtime/index.ts +6 -1
  145. package/src/runtime/onboarding/index.ts +1 -0
  146. package/src/runtime/onboarding/onboarding-state.ts +200 -0
  147. package/src/{panels → runtime}/provider-account-snapshot.ts +5 -2
  148. package/src/runtime/services.ts +16 -4
  149. package/src/runtime/terminal-output-guard.ts +7 -0
  150. package/src/runtime/tool-permission-safety.ts +1 -1
  151. package/src/runtime/ui/model-picker/data-provider.ts +1 -1
  152. package/src/runtime/ui/model-picker/health-enrichment.ts +2 -2
  153. package/src/runtime/ui/model-picker/types.ts +2 -2
  154. package/src/runtime/ui/provider-health/data-provider.ts +3 -3
  155. package/src/runtime/ui/provider-health/types.ts +2 -2
  156. package/src/runtime/ui-services.ts +0 -2
  157. package/src/shell/agent-workspace-fullscreen.ts +0 -1
  158. package/src/shell/autonomy-surfacing.ts +272 -0
  159. package/src/shell/session-continuity-hints.ts +0 -6
  160. package/src/shell/startup-wiring.ts +221 -0
  161. package/src/shell/ui-openers.ts +18 -29
  162. package/src/tools/agent-context-policy.ts +1 -1
  163. package/src/tools/agent-harness-background-processes.ts +4 -4
  164. package/src/tools/agent-harness-browser-cockpit-route.ts +3 -3
  165. package/src/tools/agent-harness-command-runner.ts +6 -1
  166. package/src/tools/agent-harness-document-ops.ts +26 -53
  167. package/src/tools/agent-harness-execution-history.ts +1 -13
  168. package/src/tools/agent-harness-execution-posture.ts +0 -15
  169. package/src/tools/agent-harness-keybinding-metadata.ts +28 -29
  170. package/src/tools/agent-harness-local-model-cookbook.ts +24 -1
  171. package/src/tools/agent-harness-metadata.ts +16 -0
  172. package/src/tools/agent-harness-mode-catalog.ts +2 -9
  173. package/src/tools/agent-harness-provider-account-metadata.ts +2 -2
  174. package/src/tools/agent-harness-setup-posture-utils.ts +1 -1
  175. package/src/tools/agent-harness-tool-schema.ts +13 -14
  176. package/src/tools/agent-harness-tool.ts +27 -23
  177. package/src/tools/agent-harness-ui-surface-metadata.ts +10 -20
  178. package/src/tools/agent-harness-workspace-action-runner.ts +3 -4
  179. package/src/tools/agent-workspace-tool.ts +2 -33
  180. package/src/utils/terminal-width.ts +9 -3
  181. package/src/version.ts +1 -1
  182. package/src/input/agent-workspace-panel-route.ts +0 -44
  183. package/src/input/panel-integration-actions.ts +0 -26
  184. package/src/panels/approval-panel.ts +0 -149
  185. package/src/panels/automation-control-panel.ts +0 -212
  186. package/src/panels/base-panel.ts +0 -254
  187. package/src/panels/builtin/agent.ts +0 -58
  188. package/src/panels/builtin/knowledge.ts +0 -26
  189. package/src/panels/builtin/operations.ts +0 -121
  190. package/src/panels/builtin/session.ts +0 -138
  191. package/src/panels/builtin/shared.ts +0 -275
  192. package/src/panels/builtin/usage.ts +0 -21
  193. package/src/panels/builtin-panels.ts +0 -23
  194. package/src/panels/confirm-state.ts +0 -61
  195. package/src/panels/context-visualizer-panel.ts +0 -204
  196. package/src/panels/cost-tracker-panel.ts +0 -444
  197. package/src/panels/docs-panel.ts +0 -285
  198. package/src/panels/index.ts +0 -25
  199. package/src/panels/knowledge-panel.ts +0 -417
  200. package/src/panels/memory-panel.ts +0 -226
  201. package/src/panels/panel-list-panel.ts +0 -464
  202. package/src/panels/panel-manager.ts +0 -570
  203. package/src/panels/provider-accounts-panel.ts +0 -233
  204. package/src/panels/provider-health-domains.ts +0 -208
  205. package/src/panels/provider-health-panel.ts +0 -720
  206. package/src/panels/provider-health-tracker.ts +0 -115
  207. package/src/panels/provider-stats-panel.ts +0 -366
  208. package/src/panels/qr-panel.ts +0 -207
  209. package/src/panels/schedule-panel.ts +0 -321
  210. package/src/panels/scrollable-list-panel.ts +0 -491
  211. package/src/panels/search-focus.ts +0 -32
  212. package/src/panels/security-panel.ts +0 -295
  213. package/src/panels/session-browser-panel.ts +0 -395
  214. package/src/panels/session-maintenance.ts +0 -125
  215. package/src/panels/subscription-panel.ts +0 -263
  216. package/src/panels/system-messages-panel.ts +0 -230
  217. package/src/panels/tasks-panel.ts +0 -344
  218. package/src/panels/thinking-panel.ts +0 -304
  219. package/src/panels/token-budget-panel.ts +0 -475
  220. package/src/panels/tool-inspector-panel.ts +0 -436
  221. package/src/panels/types.ts +0 -54
  222. package/src/renderer/panel-composite.ts +0 -158
  223. package/src/renderer/panel-tab-bar.ts +0 -69
  224. package/src/renderer/panel-workspace-bar.ts +0 -42
  225. package/src/runtime/diagnostics/panels/panel-resources.ts +0 -118
  226. package/src/tools/agent-harness-panel-metadata.ts +0 -211
  227. /package/src/runtime/perf/{panel-health-monitor.ts → component-health.ts} +0 -0
@@ -1,275 +0,0 @@
1
- import type { ConfigManager } from '@pellux/goodvibes-sdk/platform/config';
2
- import type { ServiceRegistry } from '@pellux/goodvibes-sdk/platform/config';
3
- import type { ToolRegistry } from '@pellux/goodvibes-sdk/platform/tools';
4
- import type { ProviderRegistry } from '@pellux/goodvibes-sdk/platform/providers';
5
- import type { Orchestrator } from '../../core/orchestrator';
6
- import type { MemoryRegistry } from '@pellux/goodvibes-sdk/platform/state';
7
- import type { ApprovalBroker, SharedSessionBroker } from '@pellux/goodvibes-sdk/platform/control-plane';
8
- import type { AutomationManager } from '@pellux/goodvibes-sdk/platform/automation';
9
- import type { ControlPlaneRecentEvent } from '@pellux/goodvibes-sdk/platform/control-plane';
10
- import type { UiRuntimeServices } from '../../runtime/ui-services.ts';
11
- import type { PluginManagerObserver } from '@pellux/goodvibes-sdk/platform/plugins';
12
- import type { HookWorkbench } from '@pellux/goodvibes-sdk/platform/hooks';
13
- import type { HookDispatcher } from '@pellux/goodvibes-sdk/platform/hooks';
14
- import type { HookActivityTracker } from '@pellux/goodvibes-sdk/platform/hooks';
15
- import type { McpRegistry } from '@pellux/goodvibes-sdk/platform/mcp';
16
- import type { PolicyRuntimeState } from '@/runtime/index.ts';
17
- import type { SessionManager } from '@pellux/goodvibes-sdk/platform/sessions';
18
- import type { SubscriptionManager } from '@pellux/goodvibes-sdk/platform/config';
19
- import type { UserAuthManager } from '@pellux/goodvibes-sdk/platform/security';
20
- import type { SessionMemoryStore } from '@pellux/goodvibes-sdk/platform/core';
21
- import type { ExecutionPlanManager } from '@pellux/goodvibes-sdk/platform/core';
22
- import type { AdaptivePlanner } from '@pellux/goodvibes-sdk/platform/core';
23
- import type { ProjectPlanningService } from '@pellux/goodvibes-sdk/platform/knowledge';
24
- import type { KnowledgeService } from '@pellux/goodvibes-sdk/platform/knowledge';
25
- import type { ApiTokenAuditor } from '@pellux/goodvibes-sdk/platform/security';
26
- import type { ComponentHealthMonitor } from '../../runtime/perf/panel-health-monitor.ts';
27
- import type { WorktreeRegistry } from '@/runtime/index.ts';
28
- import type { SandboxSessionRegistry } from '@/runtime/index.ts';
29
-
30
- export interface BuiltinPanelDeps {
31
- /** Config manager for settings-sync and other config-backed panels. */
32
- configManager?: ConfigManager;
33
- /** Getter returning the main orchestrator's cumulative token usage. */
34
- getOrchestratorUsage?: () => { input: number; output: number; cacheRead: number; cacheWrite: number; model?: string };
35
- /** Optional cost budget alert threshold in USD (0 = disabled). */
36
- budgetThreshold?: number;
37
- /** Tool registry for Docs panel. */
38
- toolRegistry?: ToolRegistry;
39
- /** Provider registry for Docs panel model list. */
40
- providerRegistry: ProviderRegistry;
41
- /** Local auth manager for panels that inspect shared auth state. */
42
- localUserAuthManager?: UserAuthManager;
43
- /** Session manager for panels that inspect shared session state. */
44
- sessionManager?: SessionManager;
45
- /** Subscription manager for panels that inspect shared provider subscription state. */
46
- subscriptionManager?: SubscriptionManager;
47
- /** Shared service registry for services-backed panels. */
48
- serviceRegistry?: ServiceRegistry;
49
- /** Context window size in tokens (for ContextVisualizerPanel). */
50
- contextWindow?: number;
51
- /** Main Orchestrator instance for TokenBudgetPanel.wire(). */
52
- orchestrator?: Orchestrator;
53
- /** Callback returning the current model context window size (for TokenBudgetPanel). */
54
- getCtxWindow?: () => number;
55
- /** Resume a saved session directly through the session controller path. */
56
- resumeSession?: (sessionId: string) => void;
57
- /** Request a shell repaint directly rather than routing through a retired event path. */
58
- requestRender?: () => void;
59
- /** Submit a Planning panel answer through the normal Agent chat/planning coordinator path. */
60
- submitPlanningAnswer?: (answer: string) => void;
61
- /** Pause the Agent-owned planning loop and return focus to normal prompt input. */
62
- dismissPlanning?: () => void;
63
- /** ForensicsRegistry for the Forensics panel. */
64
- forensicsRegistry?: import('@/runtime/index.ts').ForensicsRegistry;
65
- /** MemoryRegistry for the Memory panel. */
66
- memoryRegistry?: MemoryRegistry;
67
- /** Isolated Agent Knowledge service for the Agent Knowledge panel. */
68
- agentKnowledgeService?: Pick<KnowledgeService, 'getStatus'>;
69
- /** Shared policy runtime state for governance/policy diagnostics. */
70
- policyRuntimeState?: import('@/runtime/index.ts').PolicyRuntimeState;
71
- /** Approval broker for control-plane/operator panels. */
72
- approvalBroker?: ApprovalBroker;
73
- /** Shared session broker for control-plane/operator panels. */
74
- sessionBroker?: SharedSessionBroker;
75
- /** Automation manager for schedule/operator panels. */
76
- automationManager?: AutomationManager;
77
- /** Recent control-plane events provider for control-plane/operator panels. */
78
- getControlPlaneRecentEvents?: (limit: number) => readonly ControlPlaneRecentEvent[];
79
- /** Token auditor for the security control-room panel. */
80
- tokenAuditor: ApiTokenAuditor;
81
- /** Shared component-health monitor for rate-limited panels and diagnostics. */
82
- componentHealthMonitor: ComponentHealthMonitor;
83
- /** Inert shell dependency in Agent; build worktree UX belongs to GoodVibes TUI delegation. */
84
- worktreeRegistry: WorktreeRegistry;
85
- /** Isolation session registry used by MCP internals; Agent does not expose local execution-isolation command UX. */
86
- sandboxSessionRegistry: SandboxSessionRegistry;
87
- /**
88
- * Resolved connected-host token directory (e.g. `~/.goodvibes/daemon`) — owned by the
89
- * composition root and passed explicitly so panel factories do not discover cwd/home implicitly.
90
- */
91
- connectedHostTokenDir?: string;
92
- /** Session memory store for context and token budget panels. */
93
- sessionMemoryStore?: SessionMemoryStore;
94
- /** Execution plan manager for plan dashboard panels. */
95
- planManager?: ExecutionPlanManager;
96
- /** Adaptive planner for ops strategy panels. */
97
- adaptivePlanner?: AdaptivePlanner;
98
- /** Passive project planning artifact service. */
99
- projectPlanningService?: ProjectPlanningService;
100
- /** Stable workspace project id for project:<projectId> planning namespaces. */
101
- projectPlanningProjectId?: string;
102
- /** Agent-owned persistent work plan store. */
103
- workPlanStore?: import('../../work-plans/work-plan-store.ts').WorkPlanStore;
104
- /** Shared system-messages panel instance attached from boot so low-priority chatter stays out of conversation. */
105
- systemMessagesPanel?: import('../system-messages-panel.ts').SystemMessagesPanel;
106
- /** Explicit UI-facing runtime services for operator panels and modals. */
107
- uiServices?: UiRuntimeServices;
108
- /** Shared plugin manager observer for plugin and security panels. */
109
- pluginManager?: PluginManagerObserver;
110
- /** Shared hook dispatcher for the hooks control-room panel. */
111
- hookDispatcher?: Pick<HookDispatcher, 'listHooks' | 'getChains'>;
112
- /** Shared hook workbench for the hooks control-room panel. */
113
- hookWorkbench?: HookWorkbench;
114
- /** Shared hook activity tracker for the hooks control-room panel. */
115
- hookActivityTracker?: Pick<HookActivityTracker, 'listRecent'>;
116
- /** Shared MCP registry for security panels and MCP workspace commands. */
117
- mcpRegistry?: McpRegistry;
118
- }
119
-
120
- export type ResolvedBuiltinPanelDeps = Omit<
121
- BuiltinPanelDeps,
122
- | 'configManager'
123
- | 'localUserAuthManager'
124
- | 'sessionManager'
125
- | 'subscriptionManager'
126
- | 'serviceRegistry'
127
- | 'sessionMemoryStore'
128
- | 'planManager'
129
- | 'adaptivePlanner'
130
- | 'projectPlanningService'
131
- | 'projectPlanningProjectId'
132
- | 'workPlanStore'
133
- | 'policyRuntimeState'
134
- | 'systemMessagesPanel'
135
- > & {
136
- readonly configManager: ConfigManager;
137
- readonly localUserAuthManager: UserAuthManager;
138
- readonly sessionManager: SessionManager;
139
- readonly subscriptionManager: SubscriptionManager;
140
- readonly serviceRegistry: ServiceRegistry;
141
- readonly sessionMemoryStore: SessionMemoryStore;
142
- readonly planManager: ExecutionPlanManager;
143
- readonly adaptivePlanner: AdaptivePlanner;
144
- readonly projectPlanningService: ProjectPlanningService;
145
- readonly projectPlanningProjectId: string;
146
- readonly workPlanStore: import('../../work-plans/work-plan-store.ts').WorkPlanStore;
147
- readonly policyRuntimeState: PolicyRuntimeState;
148
- readonly systemMessagesPanel: import('../system-messages-panel.ts').SystemMessagesPanel;
149
- };
150
-
151
- export interface ControlPlanePanelFactoryDeps {
152
- readonly approvalBroker: ApprovalBroker;
153
- readonly sessionBroker: SharedSessionBroker;
154
- readonly getControlPlaneRecentEvents: (limit: number) => readonly ControlPlaneRecentEvent[];
155
- }
156
-
157
- function requireBuiltinPanelDep<TValue>(value: TValue | undefined, message: string): TValue {
158
- if (value === undefined) {
159
- throw new Error(message);
160
- }
161
- return value;
162
- }
163
-
164
- export function resolveBuiltinPanelDeps(deps: BuiltinPanelDeps): ResolvedBuiltinPanelDeps {
165
- const uiServices = requireUiServices(deps);
166
- return {
167
- ...deps,
168
- configManager: requireBuiltinPanelDep(
169
- uiServices.platform.configManager,
170
- 'Config manager must be wired at bootstrap for builtin panels.',
171
- ),
172
- localUserAuthManager: requireBuiltinPanelDep(
173
- uiServices.platform.localUserAuthManager,
174
- 'Local auth manager must be wired at bootstrap for builtin panels.',
175
- ),
176
- sessionManager: requireBuiltinPanelDep(
177
- uiServices.sessions.sessionManager,
178
- 'Session manager must be wired at bootstrap for builtin panels.',
179
- ),
180
- subscriptionManager: requireBuiltinPanelDep(
181
- uiServices.platform.subscriptionManager,
182
- 'Subscription manager must be wired at bootstrap for builtin panels.',
183
- ),
184
- serviceRegistry: requireBuiltinPanelDep(
185
- uiServices.platform.serviceRegistry,
186
- 'Service registry must be wired at bootstrap for builtin panels.',
187
- ),
188
- sessionMemoryStore: requireBuiltinPanelDep(
189
- uiServices.sessions.sessionMemoryStore,
190
- 'Session memory store must be wired at bootstrap for builtin panels.',
191
- ),
192
- planManager: requireBuiltinPanelDep(
193
- uiServices.planning.planManager,
194
- 'Execution plan manager must be wired at bootstrap for builtin panels.',
195
- ),
196
- adaptivePlanner: requireBuiltinPanelDep(
197
- uiServices.planning.adaptivePlanner,
198
- 'Adaptive planner must be wired at bootstrap for builtin panels.',
199
- ),
200
- projectPlanningService: requireBuiltinPanelDep(
201
- uiServices.planning.projectPlanningService,
202
- 'Project planning service must be wired at bootstrap for builtin panels.',
203
- ),
204
- projectPlanningProjectId: requireBuiltinPanelDep(
205
- uiServices.planning.projectPlanningProjectId,
206
- 'Project planning project id must be wired at bootstrap for builtin panels.',
207
- ),
208
- workPlanStore: requireBuiltinPanelDep(
209
- uiServices.planning.workPlanStore,
210
- 'Work plan store must be wired at bootstrap for builtin panels.',
211
- ),
212
- policyRuntimeState: requireBuiltinPanelDep(
213
- uiServices.platform.policyRuntimeState,
214
- 'Policy runtime state must be wired at bootstrap for builtin panels.',
215
- ),
216
- systemMessagesPanel: requireBuiltinPanelDep(
217
- deps.systemMessagesPanel,
218
- 'System messages panel must be wired at bootstrap for builtin panels.',
219
- ),
220
- };
221
- }
222
-
223
- export function requireControlPlanePanelDeps(deps: BuiltinPanelDeps): ControlPlanePanelFactoryDeps {
224
- if (!deps.approvalBroker || !deps.sessionBroker || !deps.getControlPlaneRecentEvents) {
225
- throw new Error('ControlPlanePanel requires approval/session brokers and recent-event access to be wired at bootstrap.');
226
- }
227
- return {
228
- approvalBroker: deps.approvalBroker,
229
- sessionBroker: deps.sessionBroker,
230
- getControlPlaneRecentEvents: deps.getControlPlaneRecentEvents,
231
- };
232
- }
233
-
234
- export function requireAutomationManager(deps: BuiltinPanelDeps): AutomationManager {
235
- if (!deps.automationManager) {
236
- throw new Error('SchedulePanel requires an automation manager to be wired at bootstrap.');
237
- }
238
- return deps.automationManager;
239
- }
240
-
241
- export function requireUiServices(deps: BuiltinPanelDeps): UiRuntimeServices {
242
- if (!deps.uiServices) {
243
- throw new Error('UI runtime services must be wired at bootstrap for operator panels.');
244
- }
245
- return deps.uiServices;
246
- }
247
-
248
- export function requirePluginManager(deps: BuiltinPanelDeps): PluginManagerObserver {
249
- if (!deps.pluginManager) {
250
- throw new Error('Plugin manager must be wired at bootstrap for plugin and security panels.');
251
- }
252
- return deps.pluginManager;
253
- }
254
-
255
- export function requireHookPanelDeps(deps: BuiltinPanelDeps): {
256
- readonly hookDispatcher: Pick<HookDispatcher, 'listHooks' | 'getChains'>;
257
- readonly hookWorkbench: HookWorkbench;
258
- readonly hookActivityTracker: Pick<HookActivityTracker, 'listRecent'>;
259
- } {
260
- if (!deps.hookDispatcher || !deps.hookWorkbench || !deps.hookActivityTracker) {
261
- throw new Error('Hook dispatcher, hook activity tracker, and hook workbench must be wired at bootstrap for the hooks panel.');
262
- }
263
- return {
264
- hookDispatcher: deps.hookDispatcher,
265
- hookWorkbench: deps.hookWorkbench,
266
- hookActivityTracker: deps.hookActivityTracker,
267
- };
268
- }
269
-
270
- export function requireMcpRegistry(deps: BuiltinPanelDeps): McpRegistry {
271
- if (!deps.mcpRegistry) {
272
- throw new Error('MCP registry must be wired at bootstrap for security panels and MCP workspace commands.');
273
- }
274
- return deps.mcpRegistry;
275
- }
@@ -1,21 +0,0 @@
1
- import type { PanelManager } from '../panel-manager.ts';
2
- import { CostTrackerPanel } from '../cost-tracker-panel.ts';
3
- import type { ResolvedBuiltinPanelDeps } from './shared.ts';
4
- import { requireUiServices } from './shared.ts';
5
-
6
- export function registerUsagePanels(manager: PanelManager, deps: ResolvedBuiltinPanelDeps): void {
7
- if (!deps.getOrchestratorUsage) return;
8
-
9
- const { getOrchestratorUsage, budgetThreshold } = deps;
10
- manager.registerType({
11
- id: 'cost',
12
- name: 'Cost',
13
- icon: '$',
14
- category: 'monitoring',
15
- description: 'Estimated assistant usage costs for this session and explicit delegated work, with budget alerts',
16
- factory: () => {
17
- const ui = requireUiServices(deps);
18
- return new CostTrackerPanel(ui.events.turns, ui.events.agents, getOrchestratorUsage, { budgetThreshold });
19
- },
20
- });
21
- }
@@ -1,23 +0,0 @@
1
- import type { PanelManager } from './panel-manager.ts';
2
- import { resolveBuiltinPanelDeps, type BuiltinPanelDeps } from './builtin/shared.ts';
3
- import { registerUsagePanels } from './builtin/usage.ts';
4
- import { registerOperationsPanels } from './builtin/operations.ts';
5
- import { registerAgentPanels } from './builtin/agent.ts';
6
- import { registerSessionPanels } from './builtin/session.ts';
7
- import { registerKnowledgePanels } from './builtin/knowledge.ts';
8
-
9
- /**
10
- * Register all built-in panel types with the given PanelManager.
11
- *
12
- * Call this once during application startup, before opening any panels.
13
- */
14
- export function registerBuiltinPanels(manager: PanelManager, deps: BuiltinPanelDeps): void {
15
- const resolved = resolveBuiltinPanelDeps(deps);
16
- registerUsagePanels(manager, resolved);
17
- registerOperationsPanels(manager, resolved);
18
- registerAgentPanels(manager, resolved);
19
- registerSessionPanels(manager, resolved);
20
- registerKnowledgePanels(manager, resolved);
21
- }
22
-
23
- export type { BuiltinPanelDeps } from './builtin/shared.ts';
@@ -1,61 +0,0 @@
1
- // ---------------------------------------------------------------------------
2
- // useConfirmState<T> — reusable inline y/n confirmation helper
3
- //
4
- // Pattern (chosen over ConfirmableListPanel base class):
5
- // - Composable: each panel holds a ConfirmState field, not a new base class
6
- // - Identical y/n UX everywhere: y confirms, n/Esc cancels, any other key
7
- // is absorbed (does nothing) while confirm is active
8
- // - Render: caller calls renderConfirmLines(width, state) to get the two
9
- // lines that replace the normal content area when confirming
10
- // ---------------------------------------------------------------------------
11
-
12
- import type { Line } from '../types/grid.ts';
13
- import { buildPanelLine } from './polish.ts';
14
- import { DEFAULT_PANEL_PALETTE } from './polish.ts';
15
-
16
- export interface ConfirmState<T = string> {
17
- /** The subject of the confirmation (e.g. item name or id). */
18
- readonly subject: T;
19
- /** Human-readable label for the item being destroyed. */
20
- readonly label: string;
21
- }
22
-
23
- /**
24
- * Call this from a panel's handleInput() BEFORE any other key handling.
25
- *
26
- * Returns:
27
- * - `'confirmed'` — user pressed y; caller must execute the action and
28
- * clear state (set confirm to null)
29
- * - `'cancelled'` — user pressed n or Esc; caller must clear state
30
- * - `'absorbed'` — any other key while confirm is active; caller returns true
31
- * - `'inactive'` — no confirm pending; caller continues normal dispatch
32
- */
33
- export function handleConfirmInput<T = string>(
34
- confirm: ConfirmState<T> | null,
35
- key: string,
36
- ): 'confirmed' | 'cancelled' | 'absorbed' | 'inactive' {
37
- if (!confirm) return 'inactive';
38
- if (key === 'y') return 'confirmed';
39
- if (key === 'n' || key === 'escape') return 'cancelled';
40
- return 'absorbed';
41
- }
42
-
43
- /**
44
- * Build the two confirmation lines to show in place of the normal list body.
45
- * Callers embed these lines in a workspace section titled 'Confirmation'.
46
- */
47
- export function renderConfirmLines<T = string>(width: number, state: ConfirmState<T>): Line[] {
48
- const palette = DEFAULT_PANEL_PALETTE;
49
- return [
50
- buildPanelLine(width, [[
51
- ` Delete "${state.label}"?`,
52
- palette.warn,
53
- ]]),
54
- buildPanelLine(width, [
55
- [' y', palette.info],
56
- [' confirm delete', palette.dim],
57
- [' n / Esc', palette.info],
58
- [' cancel', palette.dim],
59
- ]),
60
- ];
61
- }
@@ -1,204 +0,0 @@
1
- // ---------------------------------------------------------------------------
2
- // ContextVisualizerPanel — stacked bar showing context window composition.
3
- // ---------------------------------------------------------------------------
4
-
5
- import type { ConfigManager } from '@pellux/goodvibes-sdk/platform/config';
6
- import type { Line } from '../types/grid.ts';
7
- import { BasePanel } from './base-panel.ts';
8
- import { evaluateSessionMaintenance } from '@/runtime/index.ts';
9
- import type { TurnEvent } from '@/runtime/index.ts';
10
- import type { UiEventFeed } from '../runtime/ui-events.ts';
11
- import type { UiReadModel, UiSessionSnapshot } from '../runtime/ui-read-models.ts';
12
- import type { SessionMemoryQuery } from '../runtime/ui-service-queries.ts';
13
- import {
14
- buildEmptyState,
15
- buildGuidanceLine,
16
- buildMeterLine,
17
- buildPanelLine,
18
- buildStyledPanelLine,
19
- buildPanelWorkspace,
20
- DEFAULT_PANEL_PALETTE,
21
- } from './polish.ts';
22
-
23
- const C = {
24
- convFg: '#cc99ff',
25
- overFg: '#ff6666',
26
- barEmpty: '#333344',
27
- labelFg: '#8888bb',
28
- } as const;
29
-
30
-
31
-
32
- interface ContextSnapshot {
33
- input: number;
34
- limit: number;
35
- }
36
-
37
- function formatK(n: number): string {
38
- if (n >= 1000) return `${(n / 1000).toFixed(1)}k`;
39
- return String(n);
40
- }
41
-
42
- export class ContextVisualizerPanel extends BasePanel {
43
- private snapshot: ContextSnapshot = { input: 0, limit: 0 };
44
- private unsubs: Array<() => void> = [];
45
- private readonly sessionMemoryStore: SessionMemoryQuery;
46
-
47
- constructor(
48
- private readonly turnEvents: UiEventFeed<TurnEvent>,
49
- sessionMemoryStore: SessionMemoryQuery,
50
- private readonly configManager: Pick<ConfigManager, 'get'>,
51
- private getUsage?: () => { input: number; output: number; cacheRead: number; cacheWrite: number; model?: string },
52
- private contextLimit?: number,
53
- private sessionReadModel?: UiReadModel<UiSessionSnapshot>,
54
- ) {
55
- super('context', 'Context', 'C', 'ai');
56
- this.sessionMemoryStore = sessionMemoryStore;
57
- this._attachBus();
58
- this._refresh();
59
- }
60
-
61
- override onActivate(): void {
62
- this.needsRender = true;
63
- this._refresh();
64
- }
65
-
66
- override onDeactivate(): void {
67
- super.onDeactivate();
68
- }
69
-
70
- override onDestroy(): void {
71
- this._detachBus();
72
- }
73
-
74
- render(width: number, height: number): Line[] {
75
- return this.trackedRender(() => {
76
- if (height <= 0 || width <= 0) return [];
77
-
78
- const input = this.snapshot.input;
79
- const limit = this.snapshot.limit;
80
- const pct = limit > 0 ? Math.min(100, Math.round((input / limit) * 100)) : 0;
81
- const barWidth = Math.max(1, width - 2);
82
- const overLimit = limit > 0 && input > limit;
83
- const fg = overLimit ? C.overFg : C.convFg;
84
- if (limit <= 0) {
85
- return buildPanelWorkspace(width, height, {
86
- title: ' Context Usage',
87
- intro: 'Visualize current input-token pressure against the active model context window.',
88
- sections: [
89
- {
90
- lines: buildEmptyState(
91
- width,
92
- ' Context limit unavailable',
93
- 'Select a model with a known context window and submit or complete a turn to populate live context usage.',
94
- [],
95
- DEFAULT_PANEL_PALETTE,
96
- ),
97
- },
98
- ],
99
- palette: DEFAULT_PANEL_PALETTE,
100
- });
101
- }
102
-
103
- return buildPanelWorkspace(width, height, {
104
- title: ' Context Usage',
105
- intro: 'Visualize current input-token pressure against the active model context window.',
106
- sections: [
107
- {
108
- title: 'Summary',
109
- lines: [
110
- buildPanelLine(width, [
111
- [' Input ', DEFAULT_PANEL_PALETTE.label],
112
- [formatK(input), DEFAULT_PANEL_PALETTE.value],
113
- [' Limit ', DEFAULT_PANEL_PALETTE.label],
114
- [formatK(limit), DEFAULT_PANEL_PALETTE.info],
115
- [' Fill ', DEFAULT_PANEL_PALETTE.label],
116
- [`${pct}%`, overLimit ? DEFAULT_PANEL_PALETTE.bad : DEFAULT_PANEL_PALETTE.good],
117
- ]),
118
- ],
119
- },
120
- {
121
- title: 'Usage',
122
- lines: [
123
- this._renderBar(width, barWidth, input, limit),
124
- this._renderSegLine(width, 'Input tokens', input, pct, fg),
125
- buildPanelLine(width, [[` ${formatK(input)} / ${formatK(limit)} tokens (${pct}%) Refreshes each LLM call`, DEFAULT_PANEL_PALETTE.dim]]),
126
- ],
127
- },
128
- {
129
- title: 'Maintenance',
130
- lines: this._renderMaintenance(width),
131
- },
132
- ],
133
- palette: DEFAULT_PANEL_PALETTE,
134
- });
135
- });
136
- }
137
-
138
- private _renderBar(width: number, barWidth: number, input: number, limit: number): Line {
139
- const filled = limit > 0 ? Math.min(barWidth, Math.round((input / limit) * barWidth)) : 0;
140
- const overLimit = limit > 0 && input > limit;
141
- const barFg = overLimit ? C.overFg : C.convFg;
142
- return buildMeterLine(width, filled, barWidth, {
143
- filled: barFg,
144
- empty: C.barEmpty,
145
- label: DEFAULT_PANEL_PALETTE.dim,
146
- });
147
- }
148
-
149
- private _renderSegLine(width: number, label: string, val: number, pct: number, fg: string): Line {
150
- const labelPadded = ` ${label}`.padEnd(22);
151
- const valStr = formatK(val).padStart(7);
152
- const pctStr = `${pct}%`.padStart(5);
153
- return buildStyledPanelLine(width, [
154
- { text: labelPadded, fg: C.labelFg },
155
- { text: valStr, fg },
156
- { text: ' ', fg: DEFAULT_PANEL_PALETTE.dim },
157
- { text: pctStr, fg },
158
- ]);
159
- }
160
-
161
- private _refresh(): void {
162
- const usage = this.getUsage?.();
163
- if (usage) {
164
- this.snapshot.input = usage.input;
165
- this.snapshot.limit = this.contextLimit ?? 0;
166
- }
167
- this.markDirty();
168
- }
169
-
170
- private _renderMaintenance(width: number): Line[] {
171
- const status = evaluateSessionMaintenance({
172
- configManager: this.configManager,
173
- currentTokens: this.snapshot.input,
174
- contextWindow: this.snapshot.limit,
175
- sessionMemoryCount: this.sessionMemoryStore.list().length,
176
- session: this.sessionReadModel?.getSnapshot().session,
177
- });
178
- const lines: Line[] = [
179
- buildPanelLine(width, [[` ${status.summary}`, DEFAULT_PANEL_PALETTE.label]]),
180
- ];
181
- if (status.reasons[0]) {
182
- lines.push(buildPanelLine(width, [[` ${status.reasons[0]}`, DEFAULT_PANEL_PALETTE.dim]]));
183
- }
184
- if (status.guidanceMode !== 'off' && status.nextSteps[0]) {
185
- lines.push(buildGuidanceLine(width, status.nextSteps[0], 'open the suggested maintenance action', DEFAULT_PANEL_PALETTE));
186
- }
187
- return lines;
188
- }
189
-
190
- private _attachBus(): void {
191
- if (this.unsubs.length > 0) return;
192
- this.unsubs.push(this.turnEvents.on('TURN_COMPLETED', () => {
193
- this._refresh();
194
- }));
195
- this.unsubs.push(this.turnEvents.on('TURN_SUBMITTED', () => {
196
- this._refresh();
197
- }));
198
- }
199
-
200
- private _detachBus(): void {
201
- for (const unsub of this.unsubs) unsub();
202
- this.unsubs = [];
203
- }
204
- }