@pellux/goodvibes-tui 1.1.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -21
- package/README.md +20 -11
- package/docs/foundation-artifacts/operator-contract.json +1 -1
- package/package.json +2 -2
- package/src/core/alert-gating.ts +67 -0
- package/src/core/approval-alert.ts +72 -0
- package/src/core/budget-breach-notifier.ts +106 -0
- package/src/core/conversation-rendering.ts +19 -0
- package/src/core/conversation.ts +18 -0
- package/src/core/focus-tracker.ts +41 -0
- package/src/core/long-task-notifier.ts +33 -6
- package/src/core/system-message-router.ts +37 -51
- package/src/core/turn-cancellation.ts +20 -0
- package/src/core/turn-event-wiring.ts +64 -3
- package/src/export/cost-utils.ts +36 -0
- package/src/input/command-registry.ts +38 -1
- package/src/input/commands/checkpoint-runtime.ts +280 -0
- package/src/input/commands/codebase-runtime.ts +192 -0
- package/src/input/commands/eval.ts +1 -1
- package/src/input/commands/health-runtime.ts +1 -1
- package/src/input/commands/image-runtime.ts +112 -0
- package/src/input/commands/intelligence-runtime.ts +11 -1
- package/src/input/commands/local-auth-runtime.ts +4 -1
- package/src/input/commands/local-runtime.ts +9 -3
- package/src/input/commands/marketplace-runtime.ts +2 -2
- package/src/input/commands/memory.ts +6 -1
- package/src/input/commands/operator-panel-runtime.ts +40 -24
- package/src/input/commands/planning-runtime.ts +26 -3
- package/src/input/commands/platform-sandbox-runtime.ts +1 -6
- package/src/input/commands/plugin-runtime.ts +2 -2
- package/src/input/commands/policy-dispatch.ts +21 -0
- package/src/input/commands/provider-accounts-runtime.ts +1 -1
- package/src/input/commands/qrcode-runtime.ts +3 -3
- package/src/input/commands/recall-review.ts +35 -0
- package/src/input/commands/remote-runtime.ts +3 -3
- package/src/input/commands/runtime-services.ts +54 -13
- package/src/input/commands/services-runtime.ts +1 -1
- package/src/input/commands/session-workflow.ts +16 -1
- package/src/input/commands/settings-sync-runtime.ts +1 -1
- package/src/input/commands/shell-core.ts +15 -7
- package/src/input/commands/skills-runtime.ts +2 -8
- package/src/input/commands/subscription-runtime.ts +2 -2
- package/src/input/commands/test-runtime.ts +277 -0
- package/src/input/commands/websearch-runtime.ts +101 -0
- package/src/input/commands/work-plan-runtime.ts +36 -10
- package/src/input/commands/workstream-runtime.ts +338 -0
- package/src/input/commands.ts +12 -0
- package/src/input/config-modal-types.ts +161 -0
- package/src/input/config-modal.ts +377 -0
- package/src/input/feed-context-factory.ts +7 -8
- package/src/input/handler-command-route.ts +27 -17
- package/src/input/handler-feed-routes.ts +61 -23
- package/src/input/handler-feed.ts +47 -23
- package/src/input/handler-interactions.ts +1 -3
- package/src/input/handler-modal-routes.ts +65 -0
- package/src/input/handler-modal-stack.ts +3 -5
- package/src/input/handler-modal-token-routes.ts +16 -49
- package/src/input/handler-picker-routes.ts +11 -94
- package/src/input/handler-shortcuts.ts +24 -14
- package/src/input/handler-types.ts +2 -6
- package/src/input/handler-ui-state.ts +10 -22
- package/src/input/handler.ts +6 -28
- package/src/input/keybindings.ts +22 -8
- package/src/input/model-picker-types.ts +24 -6
- package/src/input/model-picker.ts +58 -0
- package/src/input/panel-integration-actions.ts +9 -170
- package/src/input/settings-modal-data.ts +95 -0
- package/src/input/settings-modal-mutations.ts +6 -4
- package/src/main.ts +24 -27
- package/src/panels/agent-inspector-shared.ts +2 -1
- package/src/panels/base-panel.ts +22 -1
- package/src/panels/builtin/agent.ts +21 -107
- package/src/panels/builtin/development.ts +15 -61
- package/src/panels/builtin/knowledge.ts +8 -32
- package/src/panels/builtin/operations.ts +84 -428
- package/src/panels/builtin/session.ts +21 -112
- package/src/panels/builtin/shared.ts +9 -43
- package/src/panels/builtin-modals.ts +218 -0
- package/src/panels/builtin-panels.ts +5 -0
- package/src/panels/cost-tracker-panel.ts +36 -10
- package/src/panels/diff-panel.ts +12 -43
- package/src/panels/eval-registry.ts +60 -0
- package/src/panels/fleet-panel.ts +800 -0
- package/src/panels/fleet-read-model.ts +477 -0
- package/src/panels/fleet-steer.ts +92 -0
- package/src/panels/fleet-stop.ts +125 -0
- package/src/panels/fleet-tabs.ts +230 -0
- package/src/panels/fleet-transcript.ts +356 -0
- package/src/panels/index.ts +7 -31
- package/src/panels/modals/hooks-modal.ts +187 -0
- package/src/panels/modals/keybindings-modal.ts +151 -0
- package/src/panels/modals/knowledge-modal.ts +158 -0
- package/src/panels/modals/local-auth-modal.ts +132 -0
- package/src/panels/modals/marketplace-modal.ts +218 -0
- package/src/panels/modals/memory-modal.ts +180 -0
- package/src/panels/modals/modal-surface-helpers.ts +54 -0
- package/src/panels/modals/modal-theme.ts +36 -0
- package/src/panels/modals/pairing-modal.ts +144 -0
- package/src/panels/modals/planning-modal.ts +282 -0
- package/src/panels/modals/plugins-modal.ts +174 -0
- package/src/panels/modals/policy-modal.ts +256 -0
- package/src/panels/modals/provider-health-modal.ts +136 -0
- package/src/panels/modals/remote-modal.ts +115 -0
- package/src/panels/modals/sandbox-modal.ts +150 -0
- package/src/panels/modals/security-modal.ts +217 -0
- package/src/panels/modals/services-modal.ts +179 -0
- package/src/panels/modals/settings-sync-modal.ts +142 -0
- package/src/panels/modals/skills-modal.ts +189 -0
- package/src/panels/modals/subscription-modal.ts +172 -0
- package/src/panels/modals/work-plan-modal.ts +149 -0
- package/src/panels/panel-confirm-overlay.ts +72 -0
- package/src/panels/panel-manager.ts +108 -5
- package/src/panels/project-planning-answer-actions.ts +4 -2
- package/src/panels/skills-panel.ts +7 -51
- package/src/panels/types.ts +13 -0
- package/src/permissions/hunk-selection.ts +179 -0
- package/src/permissions/prompt.ts +60 -4
- package/src/renderer/compaction-history-modal.ts +19 -3
- package/src/renderer/compaction-preview.ts +13 -2
- package/src/renderer/compaction-quality.ts +100 -0
- package/src/renderer/config-modal.ts +81 -0
- package/src/renderer/conversation-overlays.ts +10 -17
- package/src/renderer/fleet-tab-strip.ts +56 -0
- package/src/renderer/footer-tips.ts +10 -2
- package/src/renderer/git-status.ts +40 -0
- package/src/renderer/help-overlay.ts +2 -2
- package/src/renderer/model-workspace.ts +44 -1
- package/src/renderer/panel-workspace-bar.ts +8 -2
- package/src/renderer/turn-injection.ts +114 -0
- package/src/runtime/bootstrap-command-context.ts +21 -1
- package/src/runtime/bootstrap-command-parts.ts +34 -7
- package/src/runtime/bootstrap-core.ts +14 -4
- package/src/runtime/bootstrap-shell.ts +29 -16
- package/src/runtime/bootstrap.ts +11 -17
- package/src/runtime/code-index-services.ts +112 -0
- package/src/runtime/orchestrator-core-services.ts +49 -0
- package/src/runtime/process-lifecycle.ts +3 -1
- package/src/runtime/services.ts +91 -43
- package/src/runtime/ui-services.ts +8 -0
- package/src/runtime/workstream-services.ts +195 -0
- package/src/shell/blocking-input.ts +22 -1
- package/src/shell/ui-openers.ts +129 -17
- package/src/utils/format-duration.ts +8 -18
- package/src/utils/splash-lines.ts +1 -1
- package/src/version.ts +1 -1
- package/src/panels/agent-inspector-panel.ts +0 -786
- package/src/panels/approval-panel.ts +0 -252
- package/src/panels/automation-control-panel.ts +0 -479
- package/src/panels/cockpit-panel.ts +0 -481
- package/src/panels/cockpit-read-model.ts +0 -238
- package/src/panels/communication-panel.ts +0 -256
- package/src/panels/control-plane-panel.ts +0 -470
- package/src/panels/debug-panel.ts +0 -615
- package/src/panels/docs-panel.ts +0 -384
- package/src/panels/eval-panel.ts +0 -627
- package/src/panels/file-explorer-panel.ts +0 -673
- package/src/panels/file-preview-panel.ts +0 -517
- package/src/panels/hooks-panel.ts +0 -401
- package/src/panels/incident-review-panel.ts +0 -406
- package/src/panels/intelligence-panel.ts +0 -383
- package/src/panels/knowledge-graph-panel.ts +0 -515
- package/src/panels/marketplace-panel.ts +0 -399
- package/src/panels/memory-panel.ts +0 -558
- package/src/panels/ops-control-panel.ts +0 -329
- package/src/panels/ops-strategy-panel.ts +0 -321
- package/src/panels/orchestration-panel.ts +0 -465
- package/src/panels/panel-list-panel.ts +0 -566
- package/src/panels/plan-dashboard-panel.ts +0 -707
- package/src/panels/policy-panel.ts +0 -517
- package/src/panels/project-planning-panel.ts +0 -731
- package/src/panels/provider-health-panel.ts +0 -678
- package/src/panels/provider-health-tracker.ts +0 -310
- package/src/panels/provider-health-views.ts +0 -567
- package/src/panels/qr-panel.ts +0 -280
- package/src/panels/remote-panel.ts +0 -534
- package/src/panels/routes-panel.ts +0 -241
- package/src/panels/sandbox-panel.ts +0 -456
- package/src/panels/security-panel.ts +0 -447
- package/src/panels/services-panel.ts +0 -329
- package/src/panels/session-browser-panel.ts +0 -496
- package/src/panels/settings-sync-panel.ts +0 -398
- package/src/panels/subscription-panel.ts +0 -342
- package/src/panels/symbol-outline-panel.ts +0 -619
- package/src/panels/system-messages-panel.ts +0 -364
- package/src/panels/tasks-panel.ts +0 -608
- package/src/panels/thinking-panel.ts +0 -333
- package/src/panels/tool-inspector-panel.ts +0 -537
- package/src/panels/work-plan-panel.ts +0 -540
- package/src/panels/worktree-panel.ts +0 -360
- package/src/panels/wrfc-panel.ts +0 -790
- package/src/renderer/agent-detail-modal.ts +0 -466
- package/src/renderer/live-tail-modal.ts +0 -156
- package/src/renderer/process-modal.ts +0 -671
- package/src/renderer/qr-renderer.ts +0 -120
|
@@ -1,398 +0,0 @@
|
|
|
1
|
-
import { logger } from '@pellux/goodvibes-sdk/platform/utils';
|
|
2
|
-
import type { Line } from '../types/grid.ts';
|
|
3
|
-
import { createEmptyLine } from '../types/grid.ts';
|
|
4
|
-
import { fitDisplay, truncateDisplay } from '../utils/terminal-width.ts';
|
|
5
|
-
import { ScrollableListPanel } from './scrollable-list-panel.ts';
|
|
6
|
-
import {
|
|
7
|
-
buildDetailBlock,
|
|
8
|
-
buildKeyboardHints,
|
|
9
|
-
buildPanelListRow,
|
|
10
|
-
buildPanelLine,
|
|
11
|
-
buildPanelWorkspace,
|
|
12
|
-
buildStatusPill,
|
|
13
|
-
buildSummaryBlock,
|
|
14
|
-
DEFAULT_PANEL_PALETTE,
|
|
15
|
-
resolveScrollablePanelSection,
|
|
16
|
-
type PanelPalette,
|
|
17
|
-
type PanelWorkspaceSection,
|
|
18
|
-
} from './polish.ts';
|
|
19
|
-
import { getSettingsControlPlaneSnapshot } from '@/runtime/index.ts';
|
|
20
|
-
import type { ConfigManager } from '../config/index.ts';
|
|
21
|
-
import type { PanelIntegrationContext } from './types.ts';
|
|
22
|
-
|
|
23
|
-
// Base chrome only — state colors and text tokens come straight from
|
|
24
|
-
// DEFAULT_PANEL_PALETTE (WO-002).
|
|
25
|
-
const C = DEFAULT_PANEL_PALETTE;
|
|
26
|
-
|
|
27
|
-
type SettingsSnapshot = ReturnType<typeof getSettingsControlPlaneSnapshot>;
|
|
28
|
-
type ResolvedEntry = SettingsSnapshot['resolvedEntries'][number];
|
|
29
|
-
|
|
30
|
-
// Tab-toggled browse modes (RemotePanel pattern): 'keys' is the primary
|
|
31
|
-
// selectable list (kept at its own scroll viewport); the rest were
|
|
32
|
-
// previously dumped unconditionally into the header, squeezing the key
|
|
33
|
-
// list out of view.
|
|
34
|
-
const BROWSE_MODES = ['keys', 'events', 'locks', 'failures', 'conflicts', 'rollback'] as const;
|
|
35
|
-
type BrowseMode = typeof BROWSE_MODES[number];
|
|
36
|
-
|
|
37
|
-
interface BrowseModeContent {
|
|
38
|
-
readonly title: string;
|
|
39
|
-
readonly rows: Line[];
|
|
40
|
-
readonly emptyMessage: string;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export class SettingsSyncPanel extends ScrollableListPanel<ResolvedEntry> {
|
|
44
|
-
private browseMode: BrowseMode = 'keys';
|
|
45
|
-
private browseIndex = 0;
|
|
46
|
-
private browseScrollOffset = 0;
|
|
47
|
-
|
|
48
|
-
// Inline local/synced picker for a conflicted entry (Enter on the keys
|
|
49
|
-
// list). Resolved via handlePanelIntegrationAction, the only place
|
|
50
|
-
// executeCommand is available.
|
|
51
|
-
private _resolvePrompt: { readonly key: string } | null = null;
|
|
52
|
-
private _pendingResolve: { readonly key: string; readonly choice: 'local' | 'synced' } | null = null;
|
|
53
|
-
private _pendingManagedReview = false;
|
|
54
|
-
|
|
55
|
-
public constructor(private readonly configManager: ConfigManager) {
|
|
56
|
-
super('settings-sync', 'Settings Sync', '▱', 'security-policy');
|
|
57
|
-
this.showSelectionGutter = true; // I5: non-color selection affordance
|
|
58
|
-
this.filterEnabled = true;
|
|
59
|
-
this.filterLabel = 'Filter settings';
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
protected override filterMatches(entry: ResolvedEntry, q: string): boolean {
|
|
63
|
-
return entry.key.toLowerCase().includes(q)
|
|
64
|
-
|| String(entry.effectiveSource).toLowerCase().includes(q)
|
|
65
|
-
|| String(entry.effectiveValue).toLowerCase().includes(q);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
protected override getPalette(): PanelPalette {
|
|
69
|
-
return C;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
protected getItems(): readonly ResolvedEntry[] {
|
|
73
|
-
return getSettingsControlPlaneSnapshot(this.configManager).resolvedEntries;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
protected renderItem(entry: ResolvedEntry, _index: number, selected: boolean, width: number): Line {
|
|
77
|
-
return buildPanelListRow(width, [
|
|
78
|
-
{ text: fitDisplay(entry.key, 32).padEnd(32), fg: C.value },
|
|
79
|
-
{ text: ` ${entry.effectiveSource}`.padEnd(11), fg: entry.effectiveSource === 'managed' ? C.warn : entry.effectiveSource === 'synced' ? C.good : entry.effectiveSource === 'local' ? C.info : C.dim },
|
|
80
|
-
{ text: truncateDisplay(`${String(entry.effectiveValue)}`, Math.max(0, width - 47)), fg: entry.conflict ? C.bad : entry.locked ? C.warn : C.dim },
|
|
81
|
-
], C, { selected });
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
protected override getEmptyStateMessage(): string {
|
|
85
|
-
return ' No resolved settings entries.';
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/** Enter on a conflicted entry opens the inline local/synced picker. */
|
|
89
|
-
protected override onSelect(entry: ResolvedEntry): void {
|
|
90
|
-
if (!entry.conflict) return;
|
|
91
|
-
this._resolvePrompt = { key: entry.key };
|
|
92
|
-
this.needsRender = true;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
public override handleInput(key: string): boolean {
|
|
96
|
-
if (this.lastError !== null) this.clearError();
|
|
97
|
-
|
|
98
|
-
if (this._resolvePrompt) {
|
|
99
|
-
if (key === 'l') {
|
|
100
|
-
this._pendingResolve = { key: this._resolvePrompt.key, choice: 'local' };
|
|
101
|
-
this._resolvePrompt = null;
|
|
102
|
-
this.needsRender = true;
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
if (key === 's') {
|
|
106
|
-
this._pendingResolve = { key: this._resolvePrompt.key, choice: 'synced' };
|
|
107
|
-
this._resolvePrompt = null;
|
|
108
|
-
this.needsRender = true;
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
if (key === 'escape' || key === 'n') {
|
|
112
|
-
this._resolvePrompt = null;
|
|
113
|
-
this.needsRender = true;
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
return true; // absorbed — keep the picker pending
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// The inline `/`-filter capture must win over browse-mode/managed-review
|
|
120
|
-
// keys while it is actively collecting a query (e.g. typing "m").
|
|
121
|
-
if (this.filterActive) {
|
|
122
|
-
return super.handleInput(key);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (key === 'tab') {
|
|
126
|
-
const idx = BROWSE_MODES.indexOf(this.browseMode);
|
|
127
|
-
this.browseMode = BROWSE_MODES[(idx + 1) % BROWSE_MODES.length]!;
|
|
128
|
-
this.browseIndex = 0;
|
|
129
|
-
this.browseScrollOffset = 0;
|
|
130
|
-
this.needsRender = true;
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (key === 'm') {
|
|
135
|
-
const snapshot = getSettingsControlPlaneSnapshot(this.configManager);
|
|
136
|
-
if (snapshot.stagedManagedBundle) {
|
|
137
|
-
this._pendingManagedReview = true;
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (this.browseMode !== 'keys') {
|
|
144
|
-
return this._handleBrowseInput(key);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return super.handleInput(key);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
public handlePanelIntegrationAction(_key: string, ctx: PanelIntegrationContext): boolean {
|
|
151
|
-
if (this._pendingResolve) {
|
|
152
|
-
const { key, choice } = this._pendingResolve;
|
|
153
|
-
this._pendingResolve = null;
|
|
154
|
-
void ctx.executeCommand?.('settings-sync', ['resolve', key, choice]).catch((err) => {
|
|
155
|
-
logger.debug('settings-sync resolve dispatch failed', { err });
|
|
156
|
-
});
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
if (this._pendingManagedReview) {
|
|
160
|
-
this._pendingManagedReview = false;
|
|
161
|
-
void ctx.executeCommand?.('managed', ['review']).catch((err) => {
|
|
162
|
-
logger.debug('managed review dispatch failed', { err });
|
|
163
|
-
});
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
private _browseItemCount(): number {
|
|
170
|
-
const snapshot = getSettingsControlPlaneSnapshot(this.configManager);
|
|
171
|
-
switch (this.browseMode) {
|
|
172
|
-
case 'events': return snapshot.recentEvents.length;
|
|
173
|
-
case 'locks': return snapshot.managedLocks.length;
|
|
174
|
-
case 'failures': return snapshot.recentFailures.length;
|
|
175
|
-
case 'conflicts': return snapshot.conflicts.length;
|
|
176
|
-
case 'rollback': return snapshot.rollbackHistory.length;
|
|
177
|
-
default: return 0;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
private _handleBrowseInput(key: string): boolean {
|
|
182
|
-
const count = this._browseItemCount();
|
|
183
|
-
if (count === 0) return false;
|
|
184
|
-
switch (key) {
|
|
185
|
-
case 'up':
|
|
186
|
-
case 'k':
|
|
187
|
-
this.browseIndex = Math.max(0, this.browseIndex - 1);
|
|
188
|
-
this.needsRender = true;
|
|
189
|
-
return true;
|
|
190
|
-
case 'down':
|
|
191
|
-
case 'j':
|
|
192
|
-
this.browseIndex = Math.min(count - 1, this.browseIndex + 1);
|
|
193
|
-
this.needsRender = true;
|
|
194
|
-
return true;
|
|
195
|
-
case 'pageup':
|
|
196
|
-
this.browseIndex = Math.max(0, this.browseIndex - this.getPageSize());
|
|
197
|
-
this.needsRender = true;
|
|
198
|
-
return true;
|
|
199
|
-
case 'pagedown':
|
|
200
|
-
this.browseIndex = Math.min(count - 1, this.browseIndex + this.getPageSize());
|
|
201
|
-
this.needsRender = true;
|
|
202
|
-
return true;
|
|
203
|
-
case 'home':
|
|
204
|
-
case 'g':
|
|
205
|
-
this.browseIndex = 0;
|
|
206
|
-
this.needsRender = true;
|
|
207
|
-
return true;
|
|
208
|
-
case 'end':
|
|
209
|
-
case 'G':
|
|
210
|
-
this.browseIndex = count - 1;
|
|
211
|
-
this.needsRender = true;
|
|
212
|
-
return true;
|
|
213
|
-
default:
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/** ≤5 fixed rows total (1 summary title + 4 rows), shared by every mode. */
|
|
219
|
-
private _buildPostureHeader(width: number, snapshot: SettingsSnapshot): Line[] {
|
|
220
|
-
const rows: Line[] = [
|
|
221
|
-
buildPanelLine(width, [
|
|
222
|
-
[' resolved keys ', C.label], [String(snapshot.resolvedEntries.length), C.value],
|
|
223
|
-
[' conflicts ', C.label], ...buildStatusPill(snapshot.conflicts.length > 0 ? 'bad' : 'good', String(snapshot.conflicts.length)),
|
|
224
|
-
[' failures ', C.label], ...buildStatusPill(snapshot.recentFailures.length > 0 ? 'warn' : 'good', String(snapshot.recentFailures.length)),
|
|
225
|
-
]),
|
|
226
|
-
buildPanelLine(width, [
|
|
227
|
-
[' managed locks ', C.label], [String(snapshot.managedLockCount), snapshot.managedLockCount > 0 ? C.warn : C.dim],
|
|
228
|
-
[' staged bundle ', C.label], [snapshot.stagedManagedBundle ? snapshot.stagedManagedBundle.profileName : 'none', snapshot.stagedManagedBundle ? C.info : C.dim],
|
|
229
|
-
]),
|
|
230
|
-
buildPanelLine(width, [
|
|
231
|
-
[' effective local ', C.label], [String(snapshot.resolvedCounts.local), C.info],
|
|
232
|
-
[' synced ', C.label], [String(snapshot.resolvedCounts.synced), snapshot.resolvedCounts.synced > 0 ? C.good : C.dim],
|
|
233
|
-
[' managed ', C.label], [String(snapshot.resolvedCounts.managed), snapshot.resolvedCounts.managed > 0 ? C.warn : C.dim],
|
|
234
|
-
]),
|
|
235
|
-
buildPanelLine(width, [
|
|
236
|
-
[' last sync ', C.label], [snapshot.lastSync ? `${snapshot.lastSync.surface}/${snapshot.lastSync.direction}` : 'none', snapshot.lastSync ? C.good : C.dim],
|
|
237
|
-
[' mode ', C.label], [this.browseMode, C.info],
|
|
238
|
-
]),
|
|
239
|
-
];
|
|
240
|
-
return buildSummaryBlock(width, 'Settings posture', rows, C);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
private _buildResolvePromptLines(width: number, key: string): Line[] {
|
|
244
|
-
return [
|
|
245
|
-
buildPanelLine(width, [[` Resolve conflict for "${key}"?`, C.warn]]),
|
|
246
|
-
buildPanelLine(width, [
|
|
247
|
-
[' l', C.info], [' keep local', C.dim],
|
|
248
|
-
[' s', C.info], [' use synced', C.dim],
|
|
249
|
-
[' Esc', C.info], [' cancel', C.dim],
|
|
250
|
-
]),
|
|
251
|
-
];
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
private _buildBrowseModeContent(width: number, snapshot: SettingsSnapshot): BrowseModeContent {
|
|
255
|
-
switch (this.browseMode) {
|
|
256
|
-
case 'events':
|
|
257
|
-
return {
|
|
258
|
-
title: 'Recent Sync & Managed-Setting Events',
|
|
259
|
-
rows: snapshot.recentEvents.map((event, index) => buildPanelListRow(width, [
|
|
260
|
-
{ text: fitDisplay(` ${event.surface}/${event.direction}`, 18).padEnd(18), fg: C.info },
|
|
261
|
-
{ text: truncateDisplay(` ${event.detail}`, Math.max(0, width - 20)), fg: C.dim },
|
|
262
|
-
], C, { selected: index === this.browseIndex })),
|
|
263
|
-
emptyMessage: ' No sync or managed-setting events recorded yet.',
|
|
264
|
-
};
|
|
265
|
-
case 'locks':
|
|
266
|
-
return {
|
|
267
|
-
title: 'Managed Locks',
|
|
268
|
-
rows: snapshot.managedLocks.map((lock, index) => buildPanelListRow(width, [
|
|
269
|
-
{ text: fitDisplay(` ${lock.key}`, 30).padEnd(30), fg: C.value },
|
|
270
|
-
{ text: fitDisplay(` source=${lock.source}`, 24).padEnd(24), fg: C.info },
|
|
271
|
-
{ text: truncateDisplay(` ${lock.reason}`, Math.max(0, width - 56)), fg: C.dim },
|
|
272
|
-
], C, { selected: index === this.browseIndex })),
|
|
273
|
-
emptyMessage: ' No managed locks are currently active.',
|
|
274
|
-
};
|
|
275
|
-
case 'failures':
|
|
276
|
-
return {
|
|
277
|
-
title: 'Sync & Managed-Setting Failures',
|
|
278
|
-
rows: snapshot.recentFailures.map((failure, index) => buildPanelListRow(width, [
|
|
279
|
-
{ text: ` ${failure.surface}`.padEnd(10), fg: C.bad },
|
|
280
|
-
{ text: truncateDisplay(` ${failure.message}`, Math.max(0, width - 12)), fg: C.dim },
|
|
281
|
-
], C, { selected: index === this.browseIndex })),
|
|
282
|
-
emptyMessage: ' No recent sync or managed-setting failures.',
|
|
283
|
-
};
|
|
284
|
-
case 'conflicts':
|
|
285
|
-
return {
|
|
286
|
-
title: 'Settings Conflicts',
|
|
287
|
-
rows: snapshot.conflicts.map((conflict, index) => buildPanelListRow(width, [
|
|
288
|
-
{ text: fitDisplay(` ${conflict.key}`, 30).padEnd(30), fg: C.value },
|
|
289
|
-
{ text: fitDisplay(` ${conflict.source}`, 10).padEnd(10), fg: C.warn },
|
|
290
|
-
{ text: truncateDisplay(` local=${String(conflict.localValue)} incoming=${String(conflict.incomingValue)}`, Math.max(0, width - 42)), fg: C.dim },
|
|
291
|
-
], C, { selected: index === this.browseIndex })),
|
|
292
|
-
emptyMessage: ' No settings conflicts detected. Resolve conflicts from the keys list (Enter on a conflicted entry).',
|
|
293
|
-
};
|
|
294
|
-
case 'rollback':
|
|
295
|
-
return {
|
|
296
|
-
title: 'Managed Rollback History',
|
|
297
|
-
rows: snapshot.rollbackHistory.map((entry, index) => buildPanelListRow(width, [
|
|
298
|
-
{ text: fitDisplay(` ${entry.token}`, 18).padEnd(18), fg: C.info },
|
|
299
|
-
{ text: fitDisplay(` ${entry.profileName}`, 18).padEnd(18), fg: C.value },
|
|
300
|
-
{ text: ` restored=${String(entry.restoredKeys.length).padEnd(4)}`, fg: C.warn },
|
|
301
|
-
{ text: truncateDisplay(` ${new Date(entry.appliedAt).toLocaleString()}`, Math.max(0, width - 46)), fg: C.dim },
|
|
302
|
-
], C, { selected: index === this.browseIndex })),
|
|
303
|
-
emptyMessage: ' No managed rollback records yet.',
|
|
304
|
-
};
|
|
305
|
-
default:
|
|
306
|
-
return { title: '', rows: [], emptyMessage: '' };
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
private _renderKeysMode(width: number, height: number, snapshot: SettingsSnapshot): Line[] {
|
|
311
|
-
const headerLines = this._buildPostureHeader(width, snapshot);
|
|
312
|
-
|
|
313
|
-
this.clampSelection();
|
|
314
|
-
// Detail must describe the row the (possibly filtered) list highlights —
|
|
315
|
-
// raw resolvedEntries desyncs selectedIndex under an applied '/' filter.
|
|
316
|
-
const selectedEntry = this.getSelectedItem();
|
|
317
|
-
const detailLines: Line[] = this._resolvePrompt
|
|
318
|
-
? this._buildResolvePromptLines(width, this._resolvePrompt.key)
|
|
319
|
-
: (selectedEntry
|
|
320
|
-
? buildDetailBlock(width, 'Selected setting', [
|
|
321
|
-
buildPanelLine(width, [[' key ', C.label], [selectedEntry.key, C.value], [' category ', C.label], [selectedEntry.category, C.info]]),
|
|
322
|
-
buildPanelLine(width, [[' effective ', C.label], [selectedEntry.effectiveSource, selectedEntry.effectiveSource === 'managed' ? C.warn : selectedEntry.effectiveSource === 'synced' ? C.good : selectedEntry.effectiveSource === 'local' ? C.info : C.dim], [' locked ', C.label], [selectedEntry.locked ? 'yes' : 'no', selectedEntry.locked ? C.warn : C.dim], [' conflict ', C.label], [selectedEntry.conflict ? 'yes' : 'no', selectedEntry.conflict ? C.bad : C.good]]),
|
|
323
|
-
buildPanelLine(width, [[' source ', C.label], [truncateDisplay(selectedEntry.sourceLabel ?? 'local/default', Math.max(0, width - 10)), C.dim]]),
|
|
324
|
-
buildPanelLine(width, [[' overrides ', C.label], [truncateDisplay(selectedEntry.overriddenSources.length > 0 ? selectedEntry.overriddenSources.join(', ') : 'none', Math.max(0, width - 13)), C.dim]]),
|
|
325
|
-
buildPanelLine(width, [[' local ', C.label], [truncateDisplay(String(selectedEntry.localValue), Math.max(0, width - 9)), C.dim]]),
|
|
326
|
-
buildPanelLine(width, [[' synced ', C.label], [truncateDisplay(String(selectedEntry.syncedValue ?? '(unset)'), Math.max(0, width - 10)), C.good]]),
|
|
327
|
-
buildPanelLine(width, [[' managed ', C.label], [truncateDisplay(String(selectedEntry.managedValue ?? '(unset)'), Math.max(0, width - 11)), C.warn]]),
|
|
328
|
-
], C)
|
|
329
|
-
: [buildPanelLine(width, [[' Select a setting above to inspect its effective value, source, and overrides.', C.dim]])]);
|
|
330
|
-
|
|
331
|
-
return this.renderList(width, height, {
|
|
332
|
-
title: 'Settings Sync',
|
|
333
|
-
header: headerLines,
|
|
334
|
-
// Keyboard hints are placed BEFORE the detail block (rather than after,
|
|
335
|
-
// which is the usual convention) so that if the fixed-row budget is
|
|
336
|
-
// tight, the tail of the detail block is what gets clipped by the
|
|
337
|
-
// panel-workspace row budget — not the hints row itself.
|
|
338
|
-
footer: [
|
|
339
|
-
buildKeyboardHints(width, [
|
|
340
|
-
{ keys: '↑/↓', label: 'browse' },
|
|
341
|
-
{ keys: '/', label: 'filter' },
|
|
342
|
-
{ keys: 'enter', label: 'resolve conflict' },
|
|
343
|
-
{ keys: 'tab', label: 'events/locks/failures/conflicts/rollback' },
|
|
344
|
-
{ keys: 'm', label: 'managed review' },
|
|
345
|
-
], C),
|
|
346
|
-
...detailLines,
|
|
347
|
-
],
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
private _renderBrowseMode(width: number, height: number, snapshot: SettingsSnapshot): Line[] {
|
|
352
|
-
this.needsRender = false;
|
|
353
|
-
const postureSection: PanelWorkspaceSection = { lines: this._buildPostureHeader(width, snapshot) };
|
|
354
|
-
const content = this._buildBrowseModeContent(width, snapshot);
|
|
355
|
-
const itemCount = content.rows.length;
|
|
356
|
-
this.browseIndex = itemCount > 0 ? Math.min(this.browseIndex, itemCount - 1) : 0;
|
|
357
|
-
const scrollableLines = itemCount > 0 ? content.rows : [buildPanelLine(width, [[content.emptyMessage, C.dim]])];
|
|
358
|
-
|
|
359
|
-
const hintsLine = buildKeyboardHints(width, [
|
|
360
|
-
{ keys: '↑/↓', label: 'browse' },
|
|
361
|
-
{ keys: 'tab', label: 'next mode' },
|
|
362
|
-
{ keys: 'm', label: 'managed review' },
|
|
363
|
-
], C);
|
|
364
|
-
|
|
365
|
-
const resolved = resolveScrollablePanelSection(width, height, {
|
|
366
|
-
palette: C,
|
|
367
|
-
beforeSections: [postureSection],
|
|
368
|
-
footerLines: [hintsLine],
|
|
369
|
-
section: {
|
|
370
|
-
title: content.title,
|
|
371
|
-
scrollableLines,
|
|
372
|
-
selectedIndex: itemCount > 0 ? this.browseIndex : undefined,
|
|
373
|
-
scrollOffset: this.browseScrollOffset,
|
|
374
|
-
guardRows: 1,
|
|
375
|
-
minRows: 4,
|
|
376
|
-
appendWindowSummary: { dimColor: C.dim },
|
|
377
|
-
},
|
|
378
|
-
});
|
|
379
|
-
this.browseScrollOffset = resolved.scrollOffset;
|
|
380
|
-
|
|
381
|
-
const lines = buildPanelWorkspace(width, height, {
|
|
382
|
-
title: 'Settings Sync',
|
|
383
|
-
sections: [postureSection, resolved.section],
|
|
384
|
-
footerLines: [hintsLine],
|
|
385
|
-
palette: C,
|
|
386
|
-
});
|
|
387
|
-
while (lines.length < height) lines.push(createEmptyLine(width));
|
|
388
|
-
return lines.slice(0, height);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
public render(width: number, height: number): Line[] {
|
|
392
|
-
const snapshot = getSettingsControlPlaneSnapshot(this.configManager);
|
|
393
|
-
if (this.browseMode !== 'keys') {
|
|
394
|
-
return this._renderBrowseMode(width, height, snapshot);
|
|
395
|
-
}
|
|
396
|
-
return this._renderKeysMode(width, height, snapshot);
|
|
397
|
-
}
|
|
398
|
-
}
|