@fbincon/claude-code-statusline 3.9.2 → 3.11.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/README.md +79 -78
- package/candidate.json +347 -256
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js +8 -4
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.js +7 -18
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/input.d.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/input.js +36 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/input.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.d.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +4 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +5 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.d.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js +147 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.d.ts +14 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.d.ts +15 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js +90 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.js +33 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review.d.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review.js +44 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js +10 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js +2 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js +11 -4
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.js +25 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +6 -5
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +40 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +103 -57
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +13 -7
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +13 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +7 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/color-manager.ts +177 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/diagnosis-view.ts +123 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +7 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/explanation.ts +2 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/gradients.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/package-manager.ts +314 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/package-validation.ts +43 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/preview-settings.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/setup.ts +7 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/task-viewer.ts +319 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/themes.ts +40 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +86 -15
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +834 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/presentation.ts +3 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +24 -17
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +11 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +5 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +3 -3
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js +6 -5
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +89 -8
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +7 -10
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +14 -7
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.d.ts +23 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.js +153 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.d.ts +29 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.js +107 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/explanation.js +3 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/explanation.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.js +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.d.ts +41 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js +281 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js +42 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/preview-settings.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/preview-settings.js +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/preview-settings.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js +17 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.d.ts +46 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js +279 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/themes.d.ts +17 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/themes.js +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/themes.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +828 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +834 -6
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/release.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/release.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.d.ts +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js +12 -13
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.js +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js +5 -2
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +3 -3
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.d.ts +4 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.d.ts +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js +8 -8
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.d.ts +11 -52
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js +48 -7
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/sample-scenarios.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/sample-scenarios.js +38 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/sample-scenarios.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.d.ts +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js +14 -17
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.d.ts +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js +19 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +139 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +139 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +139 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +139 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +139 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +139 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/diagnostic-files.js +3 -2
- package/node_modules/@fbincon/statusline-platform/dist/src/diagnostic-files.js.map +1 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.js +22 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +22 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js +12 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js +9 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +9 -6
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.d.ts +3 -2
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +53 -7
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.d.ts +2 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.js +7 -5
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +62 -3
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.d.ts +6 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.js +34 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.js.map +1 -0
- package/package.json +3 -3
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { performPackage, closePackage } from '../lib/editor/package-manager.ts';
|
|
2
|
+
import { diagnosisRequest } from '../lib/editor/diagnosis-view.ts';
|
|
3
|
+
import { colorDraft } from '../lib/editor/color-manager.ts';
|
|
4
|
+
import { previewWidth } from '../lib/editor/preview-settings.ts';
|
|
1
5
|
import { performSourceAction, closeSources } from '../lib/editor/source-manager.ts';
|
|
2
|
-
import {
|
|
6
|
+
import { taskViewer, taskViewerView, taskViewerKey, receiveTask, type TaskViewer } from '../lib/editor/task-viewer.ts';
|
|
3
7
|
import { receivePreset } from '../lib/editor/quick-setup.ts';
|
|
4
8
|
import { performProfileAction } from '../lib/editor/profile-manager.ts';
|
|
5
9
|
import type {
|
|
@@ -28,7 +32,7 @@ import { MIN_COLUMNS, MIN_ROWS, contentColumns, clip } from '../ui/layout.ts';
|
|
|
28
32
|
import { recoveryButton, styles } from '../ui/theme.ts';
|
|
29
33
|
import { clientProps } from '../lib/session.ts';
|
|
30
34
|
import type { View } from '../lib/session.ts';
|
|
31
|
-
import { withinBudget } from '../ui/frame.ts';
|
|
35
|
+
import { withinBudget, frameElements } from '../ui/frame.ts';
|
|
32
36
|
import { parseBatch } from '../lib/client/messages.ts';
|
|
33
37
|
import { handleKey } from '../lib/client/keys.ts';
|
|
34
38
|
import { DEFAULT_PREVIEW_BACKGROUND, PREVIEW_BACKGROUND_KEY, previewBackground } from '../lib/preview-preferences.ts';
|
|
@@ -122,12 +126,14 @@ interface Session {
|
|
|
122
126
|
epoch: number;
|
|
123
127
|
previewKey: string;
|
|
124
128
|
previewTimer: Timer | null;
|
|
129
|
+
diagnosisTimer:Timer|null;
|
|
125
130
|
writing: boolean;
|
|
126
131
|
}
|
|
127
132
|
|
|
128
133
|
function discard(state: Session): void {
|
|
129
134
|
state.previewTimer?.cancel();
|
|
130
135
|
state.previewTimer = null;
|
|
136
|
+
state.diagnosisTimer?.cancel();state.diagnosisTimer=null;
|
|
131
137
|
state.epoch += 1;
|
|
132
138
|
state.view = emptyView();
|
|
133
139
|
state.previewKey = '';
|
|
@@ -162,6 +168,7 @@ async function load(
|
|
|
162
168
|
state: Session,
|
|
163
169
|
options: PluginOptions,
|
|
164
170
|
) {
|
|
171
|
+
if (state.view.editor?.packages) await closePackage(state.view.editor.packages,{request:(operation,payload)=>callBackend($,options,operation,payload)});
|
|
165
172
|
if (state.view.editor?.sources) await closeSources(state.view.editor,{request:(operation,payload)=>callBackend($,options,operation,payload)});
|
|
166
173
|
discard(state);
|
|
167
174
|
const opening = state.epoch;
|
|
@@ -448,7 +455,8 @@ async function close($: EngineInterface, state: Session, options: PluginOptions)
|
|
|
448
455
|
return;
|
|
449
456
|
}
|
|
450
457
|
try {
|
|
451
|
-
if (state.view.editor?.
|
|
458
|
+
if (state.view.editor?.packages) await closePackage(state.view.editor.packages,{request:(operation,payload)=>callBackend($,options,operation,payload)});
|
|
459
|
+
if (state.view.editor?.sources) await closeSources(state.view.editor,{request:(operation,payload)=>callBackend($,options,operation,payload)});
|
|
452
460
|
await $.ui.close({ id: PANE });
|
|
453
461
|
const open = await $.ui.panes();
|
|
454
462
|
if (!open.some((p) => p.id === PANE)) discard(state);
|
|
@@ -489,14 +497,13 @@ async function openEditor(
|
|
|
489
497
|
|
|
490
498
|
/** Task host calls stay in this statically inspected entry; presentation is shared in core. */
|
|
491
499
|
const TASK_COMMAND = 'statusline-task', TASK_PANE = 'statusline-task-details';
|
|
492
|
-
export interface TaskPaneState {
|
|
493
|
-
owned: boolean;
|
|
494
|
-
language: Language; report: TaskDetails | null; error: LocalizedText | null; warning: LocalizedText | null;
|
|
495
|
-
lines: { report: TaskDetails; language: Language; width: number; value: string[] } | null;
|
|
500
|
+
export interface TaskPaneState extends TaskViewer {
|
|
501
|
+
owned: boolean; epoch: number; ack: number; frameGeneration: number; chain: Promise<void>;
|
|
496
502
|
}
|
|
497
503
|
export function taskPaneState(): TaskPaneState {
|
|
498
|
-
return {
|
|
504
|
+
return {...taskViewer(),input:null,owned:false,epoch:0,ack:0,frameGeneration:0,chain:Promise.resolve()};
|
|
499
505
|
}
|
|
506
|
+
|
|
500
507
|
async function taskLanguage($: EngineInterface, options: PluginOptions, state: TaskPaneState, epoch: number): Promise<boolean> {
|
|
501
508
|
try {
|
|
502
509
|
const preference=await callBackend($,options,'read_ui_preferences');
|
|
@@ -516,77 +523,94 @@ async function taskCommand($: EngineInterface, state: TaskPaneState, epoch: numb
|
|
|
516
523
|
return state.owned && state.generation===epoch;
|
|
517
524
|
}
|
|
518
525
|
export async function startTaskDetails($: EngineInterface, state: TaskPaneState, options: PluginOptions): Promise<void> {
|
|
519
|
-
|
|
520
|
-
|
|
526
|
+
const generation=state.generation+1,epoch=state.epoch+1;
|
|
527
|
+
Object.assign(state,taskPaneState(),{generation,epoch});
|
|
528
|
+
if(await taskLanguage($,options,state,generation))await taskCommand($,state,generation);
|
|
521
529
|
}
|
|
522
530
|
async function refreshTaskDetails($: EngineInterface, options: PluginOptions, state: TaskPaneState, readLanguage=true): Promise<void> {
|
|
523
|
-
if(state.
|
|
524
|
-
state.
|
|
531
|
+
if(state.busy||state.closed)return;
|
|
532
|
+
state.busy=true;const generation=state.generation;
|
|
525
533
|
$.ui.invalidate('ui.render');
|
|
526
534
|
try {
|
|
527
535
|
if(readLanguage) {
|
|
528
536
|
const previous=state.language;
|
|
529
|
-
if(!await taskLanguage($,options,state,
|
|
537
|
+
if(!await taskLanguage($,options,state,generation)||!await taskCommand($,state,generation))return;
|
|
530
538
|
if(previous!==state.language)await $.ui.open({id:TASK_PANE,title:t('task.title',state.language),closeOnEscape:true,rows:24,columns:88});
|
|
531
539
|
}
|
|
532
540
|
const session=await $.session.id();
|
|
541
|
+
if(!state.session)state.session=session;
|
|
533
542
|
let host_agents: { observed_at:number; agents:{id:string;name:string|null}[] } | undefined;
|
|
534
|
-
try {
|
|
543
|
+
if(state.session===session)try {
|
|
535
544
|
const agents=await $.agent.list();
|
|
536
545
|
host_agents={observed_at:await $.clock.now(),agents:agents.slice(0,256).map(a=>({id:a.id,name:[...(a.name ?? a.description ?? '').replace(/[\p{Cc}\p{Cs}]/gu,'')].slice(0,256).join('') || null}))};
|
|
537
546
|
}catch { /* Published evidence remains usable without a host snapshot. */ }
|
|
538
|
-
if(state.generation!==
|
|
539
|
-
const result=await callBackend($,options,'task_details',{session_id:session,...(host_agents?{host_agents}:{})});
|
|
540
|
-
if(state.generation!==
|
|
541
|
-
|
|
542
|
-
state.report=result;state.offset=0;
|
|
547
|
+
if(state.generation!==generation)return;
|
|
548
|
+
const result=await callBackend($,options,'task_details',{session_id:state.session,prompt_id:state.prompt,...(host_agents?{host_agents}:{})});
|
|
549
|
+
if(state.generation!==generation)return;
|
|
550
|
+
receiveTask(state,result);
|
|
543
551
|
}catch(failure) {
|
|
544
|
-
if(state.generation===
|
|
552
|
+
if(state.generation===generation)state.error=failureMessage(failure);
|
|
545
553
|
}finally {
|
|
546
|
-
if(state.generation===
|
|
554
|
+
if(state.generation===generation){state.busy=false;$.ui.invalidate('ui.render');}
|
|
547
555
|
}
|
|
548
556
|
}
|
|
557
|
+
|
|
549
558
|
export function registerTaskDetails(on: On, options: PluginOptions, state: TaskPaneState): void {
|
|
550
559
|
const tr=(key:string)=>t(key,state.language);
|
|
551
560
|
on('command.run',{command:'statusline-task'},async($,e,next)=>{
|
|
552
561
|
if(!state.owned)return next(e);
|
|
553
|
-
|
|
554
|
-
if(!
|
|
562
|
+
await startTaskDetails($,state,options);
|
|
563
|
+
if(!state.owned)return next(e);
|
|
555
564
|
const opened=await $.ui.open({id:TASK_PANE,title:tr('task.title'),focus:true,closeOnEscape:true,rows:24,columns:88});
|
|
556
565
|
if(!opened.isPlaced)return {text:tr('task.fallback')};
|
|
557
566
|
await refreshTaskDetails($,options,state,false);return {};
|
|
558
567
|
});
|
|
559
568
|
on('ui.close',{id:'statusline-task-details'},async($,e,next)=>{
|
|
560
|
-
state.generation++;state.
|
|
569
|
+
state.generation++;state.epoch++;state.closed=true;state.busy=false;state.report=null;return next(e);
|
|
570
|
+
});
|
|
571
|
+
on('ui.message',{component:'Pane'},async($,e,next)=>{
|
|
572
|
+
if(e.requestId!==TASK_PANE||e.element!=='task-client-'+state.epoch||e.module!=='ui/client/surface.ts'||e.surface!=='terminal'||!state.owned||state.closed)return next(e);
|
|
573
|
+
const batch=parseBatch(e.data);
|
|
574
|
+
if(!batch){state.error=localizedText('task.fallback');$.ui.invalidate('ui.render');return {};}
|
|
575
|
+
const run=state.chain.then(async()=>{
|
|
576
|
+
if(batch.epoch!==state.epoch||state.closed)return {};
|
|
577
|
+
for(const message of batch.events){
|
|
578
|
+
if(message.seq<=state.ack)continue;
|
|
579
|
+
if(message.seq!==state.ack+1){state.error=localizedText('task.fallback');break;}
|
|
580
|
+
state.ack=message.seq;
|
|
581
|
+
const action=taskViewerKey(state,message.event);
|
|
582
|
+
if(action==='close'){await $.ui.close({id:TASK_PANE});break;}
|
|
583
|
+
if(action==='read')await refreshTaskDetails($,options,state);
|
|
584
|
+
}
|
|
585
|
+
$.ui.invalidate('ui.render');return {};
|
|
586
|
+
});
|
|
587
|
+
state.chain=run.then(()=>{},()=>{});return run;
|
|
561
588
|
});
|
|
562
589
|
on('ui.render',{component:'Pane',requestId:'statusline-task-details'},async($,e,next)=>{
|
|
563
590
|
if(!state.owned)return next(e);
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
let width=Math.max(2,Math.min(10000,e.props.bodyColumns)),height=Math.max(
|
|
591
|
+
if(e.surface!=='terminal')return $.ui.resolve(e).Text({...styles.text,children:[tr('task.fallback')]});
|
|
592
|
+
const {Box,Text,Button,Client}=$.ui.resolve(e);
|
|
593
|
+
let width=Math.max(2,Math.min(10000,e.props.bodyColumns)),height=Math.max(6,Math.min(10000,e.props.scroll.bodyRows));
|
|
567
594
|
for(;;) {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
if(height>4)height=Math.max(4,Math.floor(height*.75));
|
|
588
|
-
else if(width>32)width=Math.max(32,Math.floor(width*.75));
|
|
589
|
-
else return Text({...styles.text,children:[tr('task.fallback')]});
|
|
595
|
+
const lines=taskViewerView(state,Math.max(2,width-2),Math.max(1,height-3));
|
|
596
|
+
const {elements,frame}=frameElements();
|
|
597
|
+
elements.Text({...styles.muted,wrap:'truncate',children:[clip(tr('task.viewer.help_read'),width)]});
|
|
598
|
+
const reduced=width<e.props.bodyColumns||height<e.props.scroll.bodyRows;
|
|
599
|
+
const pane=Box({width,height,flexDirection:'column',children:[
|
|
600
|
+
Text({...styles.accent,bold:true,wrap:'truncate',children:[clip((reduced?t('native.capacity.reduced',state.language,{columns:width,rows:height})+' · ':'')+tr('task.title')+' · '+(state.busy?tr('profiles.loading'):tr('task.readonly')),width)]}),
|
|
601
|
+
...lines.map(row=>Text({...styles.text,bold:row.selected,wrap:'truncate',children:[row.text]})),
|
|
602
|
+
Client({key:'task-client-'+state.epoch,module:'../ui/client/surface.ts',width,height:1,props:{epoch:state.epoch,ack:state.ack,generation:++state.frameGeneration,columns:width,rows:1,displayColumns:width,displayRows:1,language:state.language,busy:false,frame}}),
|
|
603
|
+
Box({flexDirection:'row',columnGap:1,children:[
|
|
604
|
+
Button({...recoveryButton,key:'task-up',label:'↑',hotkey:'k',onPress:()=>{taskViewerKey(state,{key:'pageup'});$.ui.invalidate('ui.render');}}),
|
|
605
|
+
Button({...recoveryButton,key:'task-down',label:'↓',hotkey:'j',onPress:()=>{taskViewerKey(state,{key:'pagedown'});$.ui.invalidate('ui.render');}}),
|
|
606
|
+
Button({...recoveryButton,key:'task-refresh',label:tr('profiles.refresh'),hotkey:'r',onPress:()=>refreshTaskDetails($,options,state)}),
|
|
607
|
+
Button({...recoveryButton,key:'task-close',label:tr('task.close'),hotkey:'q',onPress:()=>$.ui.close({id:TASK_PANE})}),
|
|
608
|
+
]}),
|
|
609
|
+
]});
|
|
610
|
+
if(withinBudget(pane))return pane;
|
|
611
|
+
if(height>6)height=Math.max(6,Math.floor(height*.75));
|
|
612
|
+
else if(width>32)width=Math.max(32,Math.floor(width*.75));
|
|
613
|
+
else return Text({...styles.text,children:[tr('task.fallback')]});
|
|
590
614
|
}
|
|
591
615
|
});
|
|
592
616
|
}
|
|
@@ -614,13 +638,15 @@ export const register: Register = (on, options) => {
|
|
|
614
638
|
inputChain: Promise.resolve(),
|
|
615
639
|
previewKey: '',
|
|
616
640
|
previewTimer: null,
|
|
641
|
+
diagnosisTimer:null,
|
|
617
642
|
writing: false,
|
|
618
643
|
};
|
|
619
644
|
|
|
620
645
|
on('session.start', async ($, e, next) => {
|
|
621
646
|
await startTaskDetails($, taskDetails, options);
|
|
622
647
|
state.ownsCommand = false;
|
|
623
|
-
if (state.view.editor?.
|
|
648
|
+
if (state.view.editor?.packages) await closePackage(state.view.editor.packages,{request:(operation,payload)=>callBackend($,options,operation,payload)});
|
|
649
|
+
if (state.view.editor?.sources) await closeSources(state.view.editor,{request:(operation,payload)=>callBackend($,options,operation,payload)});
|
|
624
650
|
discard(state);
|
|
625
651
|
const open = await $.ui.panes();
|
|
626
652
|
if (open.some((p) => p.id === PANE)) {
|
|
@@ -658,7 +684,8 @@ export const register: Register = (on, options) => {
|
|
|
658
684
|
$.ui.invalidate('ui.render');
|
|
659
685
|
return { deny: state.view.error };
|
|
660
686
|
}
|
|
661
|
-
if (state.view.editor?.
|
|
687
|
+
if (state.view.editor?.packages) await closePackage(state.view.editor.packages,{request:(operation,payload)=>callBackend($,options,operation,payload)});
|
|
688
|
+
if (state.view.editor?.sources) await closeSources(state.view.editor,{request:(operation,payload)=>callBackend($,options,operation,payload)});
|
|
662
689
|
const result = await next(e);
|
|
663
690
|
const open = await $.ui.panes();
|
|
664
691
|
if (!open.some((p) => p.id === PANE)) discard(state);
|
|
@@ -734,6 +761,25 @@ export const register: Register = (on, options) => {
|
|
|
734
761
|
state.placed = true;
|
|
735
762
|
} else if (effect === 'reconcile') await reconcile($, state, options);
|
|
736
763
|
else if (effect === 'transfer') await transferDraft($, state, options);
|
|
764
|
+
else if(effect==='diagnoseFile'&&state.view.editor) {
|
|
765
|
+
const editor=state.view.editor,view=editor.diagnosis!,generation=view.generation;
|
|
766
|
+
const payload=diagnosisRequest(editor,previewWidth(contentColumns(state.displayColumns,state.displayRows),editor.previewWidth));
|
|
767
|
+
view.busy=true;
|
|
768
|
+
state.diagnosisTimer?.cancel();
|
|
769
|
+
const timer:Timer=$.clock.after(0,async()=>{
|
|
770
|
+
try {
|
|
771
|
+
const result=await callBackend($,options,'diagnose_file',payload);
|
|
772
|
+
if(editor.diagnosis===view&&view.generation===generation&&state.epoch===currentEpoch){view.result=result;view.error='';view.report=true;view.scroll=0;}
|
|
773
|
+
}catch(failure){
|
|
774
|
+
if(editor.diagnosis===view&&view.generation===generation&&state.epoch===currentEpoch)view.error=renderMessage(failureMessage(failure),state.view.language??'en');
|
|
775
|
+
}finally{view.busy=false;if(state.diagnosisTimer===timer)state.diagnosisTimer=null;$.ui.invalidate('ui.render');}
|
|
776
|
+
});
|
|
777
|
+
state.diagnosisTimer=timer;
|
|
778
|
+
}
|
|
779
|
+
else if (effect === 'packages' && state.view.editor?.packages) {
|
|
780
|
+
const view=state.view.editor.packages;await performPackage(view,{request:(operation,payload)=>callBackend($,options,operation,payload)});
|
|
781
|
+
if(view.closed)state.view.editor.packages=null;
|
|
782
|
+
}
|
|
737
783
|
else if (effect === 'sources' && state.view.editor) {
|
|
738
784
|
state.writing=true;
|
|
739
785
|
try { await performSourceAction(state.view.editor,{request:(operation,payload)=>callBackend($,options,operation,payload)}); }
|
|
@@ -818,16 +864,16 @@ export const register: Register = (on, options) => {
|
|
|
818
864
|
state.columns = width;
|
|
819
865
|
state.rows = height;
|
|
820
866
|
const editor = state.view.editor;
|
|
821
|
-
const previewDraft = editor?.profiles?.candidate ? { ...editor.draft, display: editor.profiles.candidate } : editor?.quick?.candidate ?? editor?.review?.result.draft ?? editor?.draft;
|
|
822
|
-
const previewColumns = contentColumns(width,
|
|
867
|
+
const previewDraft = editor?.colors ? colorDraft(editor) : editor?.profiles?.candidate ? { ...editor.draft, display: editor.profiles.candidate } : editor?.quick?.candidate ?? editor?.review?.result.draft ?? editor?.draft;
|
|
868
|
+
const previewColumns = previewWidth(contentColumns(width,height),editor?.previewWidth ?? 'auto');
|
|
823
869
|
const explanation=editor?.explanation;
|
|
824
|
-
const key = `${state.epoch}:${previewColumns}:${explanation ? explanation.scope+':'+explanation.id : ''}:${previewDraft ? JSON.stringify(previewDraft) : ''}`;
|
|
870
|
+
const key = `${state.epoch}:${previewColumns}:${editor?.previewScenario}:${explanation ? explanation.scope+':'+explanation.id : ''}:${previewDraft ? JSON.stringify(previewDraft) : ''}`;
|
|
825
871
|
if (
|
|
826
872
|
editor &&
|
|
827
873
|
width >= MIN_COLUMNS &&
|
|
828
874
|
height >= MIN_ROWS &&
|
|
829
875
|
!state.writing &&
|
|
830
|
-
state.previewKey !== key
|
|
876
|
+
!editor?.diagnosis && !editor?.packages && state.previewKey !== key
|
|
831
877
|
) {
|
|
832
878
|
state.previewKey = key;
|
|
833
879
|
const requestedEpoch = state.epoch;
|
|
@@ -836,9 +882,9 @@ export const register: Register = (on, options) => {
|
|
|
836
882
|
state.view.previewBusy = true;
|
|
837
883
|
state.previewTimer = $.clock.after(0, async () => {
|
|
838
884
|
try {
|
|
839
|
-
const explained=explanation ? await callBackend($,options,'explain',{draft,scope:explanation.scope,width:previewColumns}) : null;
|
|
885
|
+
const explained=explanation ? await callBackend($,options,'explain',{draft,scope:explanation.scope,width:previewColumns,scenario:editor?.previewScenario}) : null;
|
|
840
886
|
if(explained && (explained.scope!==explanation!.scope || explained.width!==previewColumns)) throw new Error('Explanation response does not match the request');
|
|
841
|
-
const preview=explained?.preview ?? await callBackend($, options, 'preview', {draft,width:previewColumns});
|
|
887
|
+
const preview=explained?.preview ?? await callBackend($, options, 'preview', {draft,width:previewColumns,scenario:editor?.previewScenario});
|
|
842
888
|
if (state.epoch === requestedEpoch && state.previewKey === key) {
|
|
843
889
|
if(explanation && explained) { explanation.result=explained;explanation.error=''; }
|
|
844
890
|
state.view.preview = preview;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import { isPackageResult } from './editor/package-validation.ts';
|
|
3
|
+
import { isScenario } from './editor/preview-settings.ts';
|
|
2
4
|
import { validAlignments } from './editor/alignments.ts';
|
|
3
5
|
import { GRADIENT_KEYS, validGradient } from './editor/gradients.ts';
|
|
4
6
|
import { validCostRateOptions } from './editor/cost-rate.ts';
|
|
5
7
|
import { validGroups } from './editor/groups.ts';
|
|
6
8
|
import { INDICATOR_KEYS, validIndicatorOptions } from './editor/indicators.ts';
|
|
7
|
-
import { SAMPLE_REASONS, EXPLAIN_REASONS, LAYOUT_REASONS, EVIDENCE_STATUSES } from './generated-contracts.ts';
|
|
9
|
+
import { STYLE_REASONS, SAMPLE_REASONS, EXPLAIN_REASONS, LAYOUT_REASONS, EVIDENCE_STATUSES } from './generated-contracts.ts';
|
|
8
10
|
import { text as localizedText } from './i18n/index.ts';
|
|
9
11
|
/** Protocol parsing only. Host calls stay in the hooks entry for static analysis. */
|
|
10
12
|
import {
|
|
@@ -175,7 +177,7 @@ export function isDraft(value: unknown): value is Draft {
|
|
|
175
177
|
)
|
|
176
178
|
return false;
|
|
177
179
|
if (
|
|
178
|
-
d.schema_version !==
|
|
180
|
+
d.schema_version !== 16 ||
|
|
179
181
|
!object(d.powerline) || !exact(d.powerline, POWERLINE_FIELDS.map(f => f.key.slice(10))) ||
|
|
180
182
|
!POWERLINE_FIELDS.every(f => f.kind === 'boolean' ? typeof (d.powerline as Record<string, unknown>)[f.key.slice(10)] === 'boolean' :
|
|
181
183
|
(f.choices as readonly unknown[]).includes((d.powerline as Record<string, unknown>)[f.key.slice(10)])) ||
|
|
@@ -477,6 +479,8 @@ export function parseResponse<O extends Operation>(
|
|
|
477
479
|
if (!exact(result, ['draft','changes']) || !isDraft(result.draft) || !Array.isArray(result.changes) || !result.changes.every(isImportChange)) fail();
|
|
478
480
|
} else if (operation === 'import' || operation === 'preset') {
|
|
479
481
|
if (!isDraft(result.draft)) fail();
|
|
482
|
+
} else if (operation.startsWith('package_')) {
|
|
483
|
+
if (!isPackageResult(operation,result)) fail();
|
|
480
484
|
} else if (operation.startsWith('source')) {
|
|
481
485
|
if (!isSourceResult(operation,result)) fail();
|
|
482
486
|
} else if (operation === 'profiles_read' || operation === 'profiles_apply') {
|
|
@@ -490,7 +494,7 @@ export function parseResponse<O extends Operation>(
|
|
|
490
494
|
} else if (operation === 'explain') {
|
|
491
495
|
if (!exact(result,['sample','scope','width','actual_availability','preview','instances']) || result.sample!==true ||
|
|
492
496
|
!['main','subagent'].includes(String(result.scope)) || !Number.isInteger(result.width) || Number(result.width)<2 || Number(result.width)>10000 || result.actual_availability!=='not_observed' ||
|
|
493
|
-
!object(result.preview) || result.preview.sample!==true || !Array.isArray(result.preview.main) || !Array.isArray(result.preview.subagents) ||
|
|
497
|
+
!object(result.preview) || result.preview.scenario!==undefined&&!isScenario(result.preview.scenario) || result.preview.sample!==true || !Array.isArray(result.preview.main) || !Array.isArray(result.preview.subagents) ||
|
|
494
498
|
![...result.preview.main,...result.preview.subagents].every(row=>Array.isArray(row)&&row.every(isSpan)) ||
|
|
495
499
|
!Array.isArray(result.instances) || result.instances.length>10000) fail();
|
|
496
500
|
const ids=new Set<string>();
|
|
@@ -498,13 +502,13 @@ export function parseResponse<O extends Operation>(
|
|
|
498
502
|
if(!object(item)||!exact(item,['id','type_id','enabled','reasons','samples'])||!text(item.id)||ids.has(item.id)||!text(item.type_id)||typeof item.enabled!=='boolean'||!Array.isArray(item.reasons)||!Array.isArray(item.samples)) fail();
|
|
499
503
|
ids.add(item.id as string);
|
|
500
504
|
if(!item.reasons.every((reason:unknown)=>object(reason)&&exact(reason,['code','origin'])&&EXPLAIN_REASONS.includes(reason.code as typeof EXPLAIN_REASONS[number])&&['configuration','local_configuration','host_capability','unknown'].includes(String(reason.origin)))) fail();
|
|
501
|
-
if(!item.samples.every((row:unknown)=>object(row)&&exact(row,['row_id','outcome','truncated'])&&text(row.row_id)&&SAMPLE_REASONS.includes(row.outcome as typeof SAMPLE_REASONS[number])&&typeof row.truncated==='boolean')) fail();
|
|
505
|
+
if(!item.samples.every((row:unknown)=>object(row)&&exact(row,['row_id','outcome','truncated',...(row.style_reasons!==undefined?['style_reasons']:[])])&&text(row.row_id)&&SAMPLE_REASONS.includes(row.outcome as typeof SAMPLE_REASONS[number])&&typeof row.truncated==='boolean'&&validStyleReasons(row.style_reasons))) fail();
|
|
502
506
|
}
|
|
503
|
-
} else if (operation === 'diagnose') {
|
|
507
|
+
} else if (operation === 'diagnose'||operation==='diagnose_file') {
|
|
504
508
|
if (!isDiagnosis(result)) fail();
|
|
505
509
|
} else if (operation === 'preview') {
|
|
506
510
|
if (
|
|
507
|
-
result.sample !== true ||
|
|
511
|
+
result.sample !== true || result.scenario!==undefined&&!isScenario(result.scenario) ||
|
|
508
512
|
!Array.isArray(result.main) ||
|
|
509
513
|
!Array.isArray(result.subagents) ||
|
|
510
514
|
![...result.main, ...result.subagents].every(
|
|
@@ -588,7 +592,7 @@ function isDiagnosis(value: Record<string, unknown>): boolean {
|
|
|
588
592
|
ids.add(item.id);
|
|
589
593
|
return item.reasons.every((reason: unknown) => object(reason) && exact(reason,['code','origin']) && EXPLAIN_REASONS.includes(reason.code as typeof EXPLAIN_REASONS[number]) && ['configuration','local_configuration','host_capability','unknown'].includes(String(reason.origin))) &&
|
|
590
594
|
item.evidence.every((e: unknown) => object(e) && exact(e,['source','scope','status','observed_at','freshness','fields']) && text(e.source) && text(e.scope) && EVIDENCE_STATUSES.includes(e.status as typeof EVIDENCE_STATUSES[number]) && stamp(e.observed_at) && ['current','stale','unknown','newer_than_input'].includes(String(e.freshness)) && Array.isArray(e.fields) && e.fields.every((f: unknown) => object(f) && exact(f,['path','status']) && text(f.path) && ['observed','not_observed','invalid_field'].includes(String(f.status)))) &&
|
|
591
|
-
item.rows.every((row: unknown) => object(row) && exact(row,['row_id','outcome','truncated']) && text(row.row_id) && LAYOUT_REASONS.includes(row.outcome as typeof LAYOUT_REASONS[number]) && typeof row.truncated === 'boolean');
|
|
595
|
+
item.rows.every((row: unknown) => object(row) && exact(row,['row_id','outcome','truncated',...(row.style_reasons!==undefined?['style_reasons']:[])]) && text(row.row_id) && LAYOUT_REASONS.includes(row.outcome as typeof LAYOUT_REASONS[number]) && typeof row.truncated === 'boolean');
|
|
592
596
|
})) return false;
|
|
593
597
|
const tree = value.host_fields.worktree, cache = value.host_fields.cache_miss;
|
|
594
598
|
return exact(value.host_fields,['worktree','cache_miss']) && object(tree) && exact(tree,['session_name','git_name','selected_source']) && nullable(tree.session_name) && nullable(tree.git_name) && [null,'worktree.name','workspace.git_worktree'].includes(tree.selected_source as string | null) &&
|
|
@@ -603,3 +607,5 @@ export function spanColor(span: Span, channel: 'foreground' | 'background' = 'fo
|
|
|
603
607
|
return `ansi256(${Number(color.value)})`;
|
|
604
608
|
return undefined;
|
|
605
609
|
}
|
|
610
|
+
|
|
611
|
+
function validStyleReasons(value:unknown):boolean {return value===undefined||Array.isArray(value)&&value.every(r=>object(r)&&exact(r,['code','owner_id'])&&STYLE_REASONS.includes(r.code as typeof STYLE_REASONS[number])&&(r.owner_id===null||text(r.owner_id)));}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { packageManager, packageKey } from '../editor/package-manager.ts';
|
|
2
|
+
import { openDiagnosis, diagnosisKey } from '../editor/diagnosis-view.ts';
|
|
3
|
+
import { openColors, colorsKey } from '../editor/color-manager.ts';
|
|
4
|
+
import { SCENARIO_IDS, PREVIEW_WIDTHS, cyclePreview } from '../editor/preview-settings.ts';
|
|
1
5
|
import { openAlignments, alignmentsKey } from '../editor/alignment-manager.ts';
|
|
2
6
|
import { openGroups, groupsKey } from '../editor/group-manager.ts';
|
|
3
7
|
import { openSources, sourcesKey } from '../editor/source-manager.ts';
|
|
@@ -17,7 +21,7 @@ import { formSelection, pageSelection } from '../editor/navigation.ts';
|
|
|
17
21
|
import { guidanceLines } from '../editor/guidance.ts';
|
|
18
22
|
import { navigateReview } from '../editor/import-review.ts';
|
|
19
23
|
|
|
20
|
-
export type Effect = 'save' | 'finish' | 'close' | 'reload' | 'reconcile' | 'retry' | 'applyPreferences' | 'transfer' | 'previewBackground' | 'uiLanguage' | 'reviewPreview' | 'explain' | 'profiles' | 'sources' | null;
|
|
24
|
+
export type Effect = 'packages' | 'diagnoseFile' | 'save' | 'finish' | 'close' | 'reload' | 'reconcile' | 'retry' | 'applyPreferences' | 'transfer' | 'previewBackground' | 'uiLanguage' | 'reviewPreview' | 'explain' | 'profiles' | 'sources' | null;
|
|
21
25
|
|
|
22
26
|
export function cancelInput(view: View): void {
|
|
23
27
|
const input = view.input, e = view.editor;
|
|
@@ -39,6 +43,10 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
39
43
|
if (e) e.setSaveState(view.uncertain ? 'unknown' : view.busy ? 'pending' : 'idle');
|
|
40
44
|
if (!e || view.busy) return null;
|
|
41
45
|
if (event.overflow) { setMessage(view, 'message', localizedText('input.overflow')); return null; }
|
|
46
|
+
if(e.packages)return packageKey(e.packages,event);
|
|
47
|
+
if(e.diagnosis)return diagnosisKey(e,event);
|
|
48
|
+
if(e.colors)return colorsKey(e,event,view.language ?? 'en');
|
|
49
|
+
if(event.ctrl&&key.toLowerCase()==='l'&&!view.input&&!e.sources&&!e.profiles&&!e.groupManager&&!e.alignmentManager&&!e.quick&&!e.review&&!e.explanation){openDiagnosis(e);return null;}
|
|
42
50
|
if (e.alignmentManager) return alignmentsKey(e,event);
|
|
43
51
|
if (e.groupManager) return groupsKey(e, event);
|
|
44
52
|
if (event.ctrl && key.toLowerCase() === 'b' && !view.input && !view.uncertain && !e.sources && !e.profiles && !e.review && !e.quick && !e.explanation && !event.text) { openGroups(e); return null; }
|
|
@@ -50,6 +58,7 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
50
58
|
return null;
|
|
51
59
|
}
|
|
52
60
|
if (event.text && (!view.input || view.input.kind === 'category')) return null;
|
|
61
|
+
if(event.ctrl&&['v','w','n'].includes(key.toLowerCase())&&!view.input){if(key.toLowerCase()==='v'){e.previewScenario=cyclePreview(SCENARIO_IDS,e.previewScenario,1);e.previewOffset=0;}else if(key.toLowerCase()==='w')e.previewWidth=cyclePreview(PREVIEW_WIDTHS,e.previewWidth as typeof PREVIEW_WIDTHS[number],1);else {const scope=e.quick?.previewScope??e.review?.previewScope??(e.page==='subagents'?'subagent':'main');e.previewOffset=(e.previewOffset+1)%Math.max(1,view.preview?.[scope==='main'?'main':'subagents'].length??0);}return null;}
|
|
53
62
|
if(e.explanation) { if(!explanationKey(e.explanation,event.ctrl && key.toLowerCase()==='g'?'cancel':event.ctrl||event.meta?'':key,Math.max(1,rows-10))) e.explanation=null; return null; }
|
|
54
63
|
if (e.quick) return controlQuick(e,event.ctrl && key.toLowerCase()==='g' ? 'cancel' : event.ctrl || event.meta ? '' : key);
|
|
55
64
|
if (event.ctrl && key.toLowerCase()==='p' && !view.input && !e.detail && !e.adding && !e.review && !view.uncertain) {
|
|
@@ -206,9 +215,12 @@ export function handleKey(view: View, event: NativeKeyEvent, columns: number, ro
|
|
|
206
215
|
return isSettings && e.setting === 'preview-background' ? 'previewBackground' : isSettings && e.setting === 'ui-language' ? 'uiLanguage' : null;
|
|
207
216
|
} else if (key === 'return' || key === ' ' || key === 'space') {
|
|
208
217
|
if (!isSettings) { if(!e.toggle(scope, selected))setMessage(view,"message",e.compositionError); }
|
|
218
|
+
else if(e.setting==='diagnose-file'){openDiagnosis(e);return null;}
|
|
219
|
+
else if(openColors(e,e.setting))return null;
|
|
209
220
|
else if (e.setting === 'row-alignment') { openAlignments(e); return null; }
|
|
210
221
|
else if (e.setting === 'component-groups') { openGroups(e); return null; }
|
|
211
222
|
else if (e.setting === 'sources') {openSources(e);return 'sources';}
|
|
223
|
+
else if (e.setting === 'package-management') {e.packages=packageManager();return 'packages';}
|
|
212
224
|
else if (e.setting === 'profiles') { if (e.acceptNumeric()) { openProfiles(e); return 'profiles'; } }
|
|
213
225
|
else if (e.setting === 'quick-setup') { if (e.acceptNumeric()) e.quick=openQuick(e.draft); }
|
|
214
226
|
else if(e.setting==='item-explain' && e.detail) { e.explanation=openExplanation(e.detail.scope,e.detail.id); return 'explain'; }
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SCENARIO_IDS, PREVIEW_WIDTHS, cyclePreview } from '../editor/preview-settings.ts';
|
|
1
2
|
import { setMessage, failureMessage } from '../i18n/messages.ts';
|
|
2
3
|
import { text as localizedText } from '../i18n/index.ts';
|
|
3
4
|
import type { View } from '../session.ts';
|
|
@@ -15,7 +16,7 @@ export interface SettingRow {
|
|
|
15
16
|
|
|
16
17
|
export function settingRows(view: View): SettingRow[] {
|
|
17
18
|
const e = view.editor!;
|
|
18
|
-
if (e.detail) return [...(!e.adding ? [{key:'item-explain',label:'Configuration and sample explanation',group:'Item format',value:'Enter',editable:true}] : []), {key:'item-guidance', label:'Sources and requirements', group:'Item format', value:'Enter: read guidance', editable:true}, ...formRows(view)];
|
|
19
|
+
if (e.detail) return [...(!e.adding ? [{key:'item-explain',label:'Configuration and sample explanation',group:'Item format',value:'Enter',editable:true}] : []), {key:'item-guidance', label:'Sources and requirements', group:'Item format', value:'Enter: read guidance', editable:true},...(!e.adding?[{key:'diagnose-file',label:'Diagnose input file',group:'Item format',value:'Enter',editable:true}]:[]), ...formRows(view)];
|
|
19
20
|
if (e.page === 'layout') {
|
|
20
21
|
const fields = formRows(view);
|
|
21
22
|
if (!e.draft.display.instances.length) return fields;
|
|
@@ -100,7 +101,8 @@ export function settingRows(view: View): SettingRow[] {
|
|
|
100
101
|
rows.splice(appearanceEnd, 0, ...fields.filter(row => row.group === 'Appearance'));
|
|
101
102
|
rows.push(...fields.filter(row => row.group !== 'Appearance'));
|
|
102
103
|
rows.push(
|
|
103
|
-
{
|
|
104
|
+
{key:'preview-scenario',label:'Sample scenario',group:'Preview',value:e.previewScenario,editable:true},
|
|
105
|
+
{key:'preview-width',label:'Preview width',group:'Preview',value:e.previewWidth,editable:true}, {key:'diagnose-file',label:'Diagnose input file',group:'Presets / portable files',value:'Enter',editable:true}, { key: 'ui-language', label: 'Interface language (saved immediately)', group: 'Interface', value: LANGUAGE_NAMES[view.language ?? 'en'], editable: true },
|
|
104
106
|
{ key: 'component-groups', label: 'Component groups', group: 'Presets / portable files', value: 'Enter', editable: true },
|
|
105
107
|
{ key: 'sources', label: 'Data sources', group: 'Presets / portable files', value: 'Enter', editable: true },
|
|
106
108
|
{ key: 'profiles', label: 'Display schemes and projects', group: 'Presets / portable files', value: 'Enter', editable: true },
|
|
@@ -109,6 +111,7 @@ export function settingRows(view: View): SettingRow[] {
|
|
|
109
111
|
{ key: 'preset-apply', label: 'Expand selected preset', group: 'Presets / portable files', value: 'replace draft; save later', editable: true },
|
|
110
112
|
{ key: 'import-file', label: 'Import file', group: 'Presets / portable files', value: 'file path; save later', editable: true },
|
|
111
113
|
{ key: 'export-file', label: 'Export current draft', group: 'Presets / portable files', value: 'new file path (may be unsaved)', editable: true },
|
|
114
|
+
{ key: 'package-management', label: 'Version and installation', group: 'Inspection', value: 'Enter', editable: true },
|
|
112
115
|
);
|
|
113
116
|
if (e.advanced) {
|
|
114
117
|
for (const spec of PREFERENCE_SPECS) {
|
|
@@ -124,6 +127,8 @@ export function settingRows(view: View): SettingRow[] {
|
|
|
124
127
|
|
|
125
128
|
export function adjustSetting(view: View, delta: -1 | 1): void {
|
|
126
129
|
const e = view.editor!;
|
|
130
|
+
if(e.setting==='preview-scenario'){e.previewScenario=cyclePreview(SCENARIO_IDS,e.previewScenario,delta);e.previewOffset=0;return;}
|
|
131
|
+
if(e.setting==='preview-width'){e.previewWidth=cyclePreview(PREVIEW_WIDTHS,e.previewWidth as typeof PREVIEW_WIDTHS[number],delta);return;}
|
|
127
132
|
if (!e.canMutateDraft() && !['ui-language','preview-background'].includes(e.setting) && !e.setting.startsWith('host-')) { setMessage(view, 'message', e.compositionError);return; }
|
|
128
133
|
const d = e.draft.display;
|
|
129
134
|
const form = formRows(view).find((row) => row.key === e.setting);
|