@fbincon/claude-code-statusline 3.1.4 → 3.3.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 +75 -69
- package/candidate.json +273 -210
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.d.ts +10 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.js +100 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/observations.d.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/observations.js +233 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/observations.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.d.ts +12 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.js +65 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js +4 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +14 -6
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js +3 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage.d.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage.js +1 -8
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/usage.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/explain.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/explain.js +27 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/explain.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +7 -4
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +20 -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 +12 -9
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +40 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +35 -19
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/messages.ts +12 -8
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +2 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/explanation.ts +35 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/quick-setup.ts +82 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/text-input.ts +68 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +66 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +834 -12
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/session.ts +7 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +19 -16
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +25 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +6 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/surface.ts +16 -3
- 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/catalog-data.js +46 -4
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js +5 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.d.ts +32 -14
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +127 -17
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +5 -1
- 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 +50 -2
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +3 -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.d.ts +13 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/explanation.js +41 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/explanation.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/quick-setup.d.ts +21 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/quick-setup.js +105 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/quick-setup.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/text-input.d.ts +32 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/text-input.js +89 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/text-input.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +828 -6
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +834 -12
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js +10 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js +10 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js +10 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js +10 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-HK.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-HK.js +10 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-HK.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-TW.d.ts +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-TW.js +10 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-TW.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/rendering/components.d.ts +3 -2
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js +8 -3
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/context.d.ts +7 -3
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.d.ts +15 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js +110 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.d.ts +15 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js +42 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/host-fields.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/host-fields.js +54 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/host-fields.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +29 -11
- 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 +3 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +7 -2
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js +35 -12
- 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 +14 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js +36 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/requests.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/requests.js +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/requests.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/snapshot.d.ts +3 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/snapshot.js +11 -4
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/snapshot.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/usage.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/usage.js +9 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/usage.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/key.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +139 -2
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +139 -2
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +139 -2
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +139 -2
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +139 -2
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +139 -2
- package/node_modules/@fbincon/statusline-platform/dist/src/diagnostic-files.d.ts +7 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/diagnostic-files.js +29 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/diagnostic-files.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.js +11 -3
- package/node_modules/@fbincon/statusline-platform/dist/src/terminal/input.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +15 -1
- 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 +4 -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 +15 -5
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +3 -3
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.d.ts +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +40 -3
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +6 -2
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +87 -40
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { openExplanation, explanationKey } from '../editor/explanation.ts';
|
|
2
|
+
import { openQuick, controlQuick } from '../editor/quick-setup.ts';
|
|
3
|
+
import { inputKey } from '../editor/text-input.ts';
|
|
4
|
+
import type { NativeKeyEvent } from './messages.ts';
|
|
2
5
|
import { setMessage, failureMessage } from '../i18n/messages.ts';
|
|
3
6
|
import { text as localizedText } from '../i18n/index.ts';
|
|
4
|
-
import type { ClientKeyEvent } from 'claude-code';
|
|
5
7
|
import type { View } from '../session.ts';
|
|
6
8
|
import { settingRows, adjustSetting } from './settings.ts';
|
|
7
9
|
import { formRows, setFormValue } from './forms.ts';
|
|
@@ -11,7 +13,7 @@ import { formSelection, pageSelection } from '../editor/navigation.ts';
|
|
|
11
13
|
import { guidanceLines } from '../editor/guidance.ts';
|
|
12
14
|
import { navigateReview } from '../editor/import-review.ts';
|
|
13
15
|
|
|
14
|
-
export type Effect = 'save' | 'finish' | 'close' | 'reload' | 'reconcile' | 'retry' | 'applyPreferences' | 'transfer' | 'previewBackground' | 'uiLanguage' | 'reviewPreview' | null;
|
|
16
|
+
export type Effect = 'save' | 'finish' | 'close' | 'reload' | 'reconcile' | 'retry' | 'applyPreferences' | 'transfer' | 'previewBackground' | 'uiLanguage' | 'reviewPreview' | 'explain' | null;
|
|
15
17
|
|
|
16
18
|
export function cancelInput(view: View): void {
|
|
17
19
|
const input = view.input, e = view.editor;
|
|
@@ -27,10 +29,17 @@ export function cancelInput(view: View): void {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
/** All transitions are pure; persistence remains in the host hooks module. */
|
|
30
|
-
export function handleKey(view: View, event:
|
|
32
|
+
export function handleKey(view: View, event: NativeKeyEvent, columns: number, rows: number): Effect {
|
|
31
33
|
const e = view.editor, key = event.key === 'space' ? ' ' : event.key;
|
|
32
34
|
const shortcut = /^[A-Z]$/.test(key) ? key.toLowerCase() : key;
|
|
33
35
|
if (!e || view.busy) return null;
|
|
36
|
+
if (event.overflow) { setMessage(view, 'message', localizedText('input.overflow')); return null; }
|
|
37
|
+
if (event.text && (!view.input || view.input.kind === 'category')) return null;
|
|
38
|
+
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; }
|
|
39
|
+
if (e.quick) return controlQuick(e,event.ctrl && key.toLowerCase()==='g' ? 'cancel' : event.ctrl || event.meta ? '' : key);
|
|
40
|
+
if (event.ctrl && key.toLowerCase()==='p' && !view.input && !e.detail && !e.adding && !e.review && !view.uncertain) {
|
|
41
|
+
if(e.acceptNumeric()) e.quick=openQuick(e.draft); return null;
|
|
42
|
+
}
|
|
34
43
|
if (event.ctrl && key.toLowerCase() === 'g') { const reviewing = !!e.review; cancelInput(view); return reviewing ? 'reviewPreview' : null; }
|
|
35
44
|
if (view.uncertain) return event.ctrl || event.meta ? null : shortcut === 'k' ? 'reconcile' : shortcut === 'q' ? 'close' : null;
|
|
36
45
|
if (e.review) {
|
|
@@ -72,8 +81,7 @@ export function handleKey(view: View, event: ClientKeyEvent, columns: number, ro
|
|
|
72
81
|
return null;
|
|
73
82
|
}
|
|
74
83
|
if (input?.kind === 'field' || input?.kind === 'path') {
|
|
75
|
-
if (event.
|
|
76
|
-
else if (key === 'return') {
|
|
84
|
+
if (!event.text && key === 'return') {
|
|
77
85
|
if (input.kind === 'path') {
|
|
78
86
|
if (!input.buffer.trim()) { setMessage(view, "message", localizedText("native.lib.client.keys.enter_a_file_path")); return null; }
|
|
79
87
|
e.path = input.buffer; e.pendingTransfer = input.action; view.input = null; return 'transfer';
|
|
@@ -91,22 +99,28 @@ export function handleKey(view: View, event: ClientKeyEvent, columns: number, ro
|
|
|
91
99
|
p.result = '';
|
|
92
100
|
}
|
|
93
101
|
view.input = null;
|
|
94
|
-
} else
|
|
95
|
-
|
|
102
|
+
} else {
|
|
103
|
+
const limit = input.kind === 'path' ? 4096 : 256;
|
|
104
|
+
const result = inputKey(input.buffer, input.edit, {...event,key}, limit);
|
|
105
|
+
input.edit = result.state; input.buffer = result.state.value;
|
|
106
|
+
if (result.error) setMessage(view, 'message', localizedText('input.' + result.error, {limit}));
|
|
107
|
+
else { view.message = ''; if (view.localized) delete view.localized.message; }
|
|
108
|
+
}
|
|
96
109
|
return null;
|
|
97
110
|
}
|
|
98
111
|
if (input) {
|
|
99
112
|
if (input.kind === 'search') view.message = '';
|
|
100
|
-
if (event.
|
|
101
|
-
if (input.kind === 'search') e.filter(input.scope, ''); else e.setBuffer(input.field, '');
|
|
102
|
-
} else if (key === 'return') {
|
|
113
|
+
if (!event.text && key === 'return') {
|
|
103
114
|
if (input.kind === 'search' || e.acceptNumeric(input.field)) view.input = null;
|
|
104
|
-
} else
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
} else {
|
|
116
|
+
const value = input.kind === 'search' ? e.search[input.scope] : e.buffers[input.field];
|
|
117
|
+
const limit = input.kind === 'search' ? 256 : 32;
|
|
118
|
+
const result = inputKey(value, input.edit, {...event,key}, limit);
|
|
119
|
+
input.edit = result.state;
|
|
120
|
+
if (input.kind === 'search') e.filter(input.scope, result.state.value);
|
|
121
|
+
else e.setBuffer(input.field, result.state.value);
|
|
122
|
+
if (result.error) setMessage(view, 'message', localizedText('input.' + result.error, {limit}));
|
|
123
|
+
else { view.message = ''; if (view.localized) delete view.localized.message; }
|
|
110
124
|
}
|
|
111
125
|
return null;
|
|
112
126
|
}
|
|
@@ -177,6 +191,8 @@ export function handleKey(view: View, event: ClientKeyEvent, columns: number, ro
|
|
|
177
191
|
return isSettings && e.setting === 'preview-background' ? 'previewBackground' : isSettings && e.setting === 'ui-language' ? 'uiLanguage' : null;
|
|
178
192
|
} else if (key === 'return' || key === ' ' || key === 'space') {
|
|
179
193
|
if (!isSettings) { if(!e.toggle(scope, selected))setMessage(view,"message",localizedText("composition.invalid")); }
|
|
194
|
+
else if (e.setting === 'quick-setup') { if (e.acceptNumeric()) e.quick=openQuick(e.draft); }
|
|
195
|
+
else if(e.setting==='item-explain' && e.detail) { e.explanation=openExplanation(e.detail.scope,e.detail.id); return 'explain'; }
|
|
180
196
|
else if (e.setting === 'item-guidance') e.guidanceScroll = 0;
|
|
181
197
|
else if (e.setting === 'preset-apply') { e.pendingTransfer = 'preset'; return 'transfer'; }
|
|
182
198
|
else if (e.setting === 'import-file' || e.setting === 'export-file') {
|
|
@@ -186,8 +202,8 @@ export function handleKey(view: View, event: ClientKeyEvent, columns: number, ro
|
|
|
186
202
|
} else {
|
|
187
203
|
const field = formRows(view).find((row) => row.key === e.setting);
|
|
188
204
|
const p = view.preferences.find((p) => 'host-' + p.row.key === e.setting);
|
|
189
|
-
if (field && (field.spec.kind === 'integer' || field.spec.kind === 'text')) view.input = {kind:'field',key:field.key,buffer:field.value};
|
|
190
|
-
else if (p && canEdit(p) && (p.row.kind === 'text' || p.row.kind === 'number')) view.input = {kind:'field',key:e.setting,buffer:String(p.value)};
|
|
205
|
+
if (field && (field.spec.kind === 'integer' || field.spec.kind === 'text')) view.input = {kind:'field',key:field.key,buffer:field.value,original:field.value};
|
|
206
|
+
else if (p && canEdit(p) && (p.row.kind === 'text' || p.row.kind === 'number')) view.input = {kind:'field',key:e.setting,buffer:String(p.value),original:String(p.value)};
|
|
191
207
|
else adjustSetting(view, 1);
|
|
192
208
|
}
|
|
193
209
|
return isSettings && e.setting === 'preview-background' ? 'previewBackground' : isSettings && e.setting === 'ui-language' ? 'uiLanguage' : null;
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/messages.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { ClientKeyEvent } from 'claude-code';
|
|
2
2
|
|
|
3
|
+
export type NativeKeyEvent = ClientKeyEvent & { text?: true; overflow?: true };
|
|
4
|
+
|
|
3
5
|
export const MAX_BATCH = 128;
|
|
4
6
|
export const MAX_PENDING = 512;
|
|
7
|
+
export const MAX_PENDING_TEXT = 32768;
|
|
5
8
|
export interface KeyMessage {
|
|
6
9
|
seq: number;
|
|
7
|
-
event:
|
|
10
|
+
event: NativeKeyEvent;
|
|
8
11
|
}
|
|
9
12
|
export interface Batch {
|
|
10
13
|
epoch: number;
|
|
@@ -39,17 +42,16 @@ const SPECIAL_KEYS = new Set([
|
|
|
39
42
|
]);
|
|
40
43
|
|
|
41
44
|
/** The terminal may deliver a fast printable run as a single input chunk. */
|
|
42
|
-
export function keyEvents(event: ClientKeyEvent):
|
|
45
|
+
export function keyEvents(event: ClientKeyEvent): NativeKeyEvent[] {
|
|
43
46
|
if (
|
|
44
47
|
event.ctrl ||
|
|
45
48
|
event.meta ||
|
|
46
49
|
[...event.key].length <= 1 ||
|
|
47
50
|
SPECIAL_KEYS.has(event.key) ||
|
|
48
|
-
/^f\d{1,2}$/i.test(event.key)
|
|
49
|
-
/[\x00-\x1f\x7f]/.test(event.key)
|
|
51
|
+
/^f\d{1,2}$/i.test(event.key)
|
|
50
52
|
)
|
|
51
53
|
return [event];
|
|
52
|
-
return
|
|
54
|
+
return event.key.length > 16384 || JSON.stringify(event.key).length > 32768 ? [{ key: 'input-overflow', overflow: true }] : [{ ...event, text: true }];
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
/** Posts are input, including when our own module is their usual sender. */
|
|
@@ -87,11 +89,13 @@ export function parseBatch(value: unknown): Batch | null {
|
|
|
87
89
|
Array.isArray(e) ||
|
|
88
90
|
typeof e.key !== 'string' ||
|
|
89
91
|
!e.key.length ||
|
|
90
|
-
e.key.length > 64 ||
|
|
91
|
-
/[\x00-\x1f\x7f]/.test(e.key) ||
|
|
92
|
+
e.key.length > (e.text ? 16384 : 64) ||
|
|
93
|
+
(!e.text && /[\x00-\x1f\x7f]/.test(e.key)) ||
|
|
94
|
+
(e.text && (e.ctrl || e.meta || e.overflow)) ||
|
|
95
|
+
(e.overflow && e.key !== 'input-overflow') ||
|
|
92
96
|
Object.keys(e).some(
|
|
93
97
|
(key) =>
|
|
94
|
-
!['key', 'ctrl', 'shift', 'meta'].includes(key) ||
|
|
98
|
+
!['key', 'ctrl', 'shift', 'meta', 'text', 'overflow'].includes(key) ||
|
|
95
99
|
(key !== 'key' && e[key] !== true),
|
|
96
100
|
)
|
|
97
101
|
)
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface SettingRow {
|
|
|
15
15
|
|
|
16
16
|
export function settingRows(view: View): SettingRow[] {
|
|
17
17
|
const e = view.editor!;
|
|
18
|
-
if (e.detail) return [{key:'item-guidance', label:'Sources and requirements', group:'Item format', value:'Enter: read guidance', editable:true}, ...formRows(view)];
|
|
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
19
|
if (e.page === 'layout') return formRows(view);
|
|
20
20
|
const d = e.draft.display;
|
|
21
21
|
const h = e.draft.host;
|
|
@@ -97,6 +97,7 @@ export function settingRows(view: View): SettingRow[] {
|
|
|
97
97
|
rows.push(...fields.filter(row => row.group !== 'Appearance'));
|
|
98
98
|
rows.push(
|
|
99
99
|
{ key: 'ui-language', label: 'Interface language (saved immediately)', group: 'Interface', value: LANGUAGE_NAMES[view.language ?? 'en'], editable: true },
|
|
100
|
+
{ key: 'quick-setup', label: 'Quick setup', group: 'Presets / portable files', value: 'Enter', editable: true },
|
|
100
101
|
{ key: 'preset-select', label: 'Preset', group: 'Presets / portable files', value: e.preset, editable: true },
|
|
101
102
|
{ key: 'preset-apply', label: 'Expand selected preset', group: 'Presets / portable files', value: 'replace draft; save later', editable: true },
|
|
102
103
|
{ key: 'import-file', label: 'Import file', group: 'Presets / portable files', value: 'file path; save later', editable: true },
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { ExplanationView } from './explanation.ts';
|
|
3
|
+
import type { QuickSetup } from './quick-setup.ts';
|
|
2
4
|
import { t, type Language } from '../i18n/index.ts';
|
|
3
5
|
import { nodes, newInstance, reconcileRows } from './instances.ts';
|
|
4
6
|
import { isDraft } from '../backend.ts';
|
|
@@ -39,6 +41,8 @@ export class Editor {
|
|
|
39
41
|
detail: { scope: Scope; id: string } | null = null;
|
|
40
42
|
guidanceScroll: number | null = null;
|
|
41
43
|
review: ReviewState | null = null;
|
|
44
|
+
quick: QuickSetup | null = null;
|
|
45
|
+
explanation: ExplanationView | null = null;
|
|
42
46
|
preset = 'minimal';
|
|
43
47
|
path = 'statusline.json';
|
|
44
48
|
pendingTransfer: 'import' | 'export' | 'preset' | null = null;
|
|
@@ -83,6 +87,7 @@ export class Editor {
|
|
|
83
87
|
this.activeNumeric = null;
|
|
84
88
|
this.detail = null;
|
|
85
89
|
this.guidanceScroll = null;
|
|
90
|
+
this.explanation = null;
|
|
86
91
|
this.review = null;
|
|
87
92
|
}
|
|
88
93
|
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/explanation.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { ExplainResult, Scope } from '../generated-contracts.ts';
|
|
3
|
+
import type { Editor } from './draft.ts';
|
|
4
|
+
import { t, type Language } from '../i18n/index.ts';
|
|
5
|
+
import { wrapText } from '../../ui/text.ts';
|
|
6
|
+
|
|
7
|
+
export interface ExplanationView { scope: Scope; id: string; scroll: number; result: ExplainResult | null; error: string }
|
|
8
|
+
export function openExplanation(scope:Scope,id:string): ExplanationView { return {scope,id,scroll:0,result:null,error:''}; }
|
|
9
|
+
export function explanationKey(view:ExplanationView,key:string,capacity:number): boolean {
|
|
10
|
+
if(key==='cancel'||key==='escape') return false;
|
|
11
|
+
if(key==='up'||key==='pageup') view.scroll=Math.max(0,view.scroll-(key==='up'?1:capacity));
|
|
12
|
+
if(key==='down'||key==='pagedown') view.scroll+=key==='down'?1:capacity;
|
|
13
|
+
if(key==='home') view.scroll=0;
|
|
14
|
+
if(key==='end') view.scroll=1000000;
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
export function explanationLines(editor:Editor,language:Language,width:number): string[] {
|
|
18
|
+
const view=editor.explanation!;
|
|
19
|
+
const tr=(key:string,params:Record<string,unknown>={})=>t('explain.'+key,language,params);
|
|
20
|
+
const item=view.result?.instances.find(item=>item.id===view.id);
|
|
21
|
+
const lines=[tr('sample'),editor.instanceLabel(view.scope,view.id,language)+' ('+view.id+')'];
|
|
22
|
+
if(!item) return wrapText([...lines,view.error||tr('loading')],width);
|
|
23
|
+
for(const [heading,origins] of [['configuration',['configuration']],['requirements',['local_configuration','host_capability','unknown']]] as const) {
|
|
24
|
+
lines.push('',tr(heading));
|
|
25
|
+
for(const reason of item.reasons) if((origins as readonly string[]).includes(reason.origin)) lines.push(tr('reason.'+reason.code));
|
|
26
|
+
}
|
|
27
|
+
lines.push('',tr('sample_result',{width:view.result!.width}));
|
|
28
|
+
if(!item.samples.length) lines.push(tr('no_sample'));
|
|
29
|
+
for(const sample of item.samples) {
|
|
30
|
+
lines.push(tr('row.'+sample.row_id)+': '+tr('reason.'+sample.outcome));
|
|
31
|
+
if(sample.truncated) lines.push(tr('reason.sample_truncated'));
|
|
32
|
+
}
|
|
33
|
+
lines.push('',tr('panel_note'));
|
|
34
|
+
return wrapText(lines,width);
|
|
35
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/quick-setup.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { Editor } from './draft.ts';
|
|
3
|
+
import type { Draft, Scope } from '../generated-contracts.ts';
|
|
4
|
+
import { THEME_VALUES, PALETTE_VALUES, SEPARATORSTYLE_VALUES, PRESETS } from '../generated-contracts.ts';
|
|
5
|
+
import { copyDraft } from './draft.ts';
|
|
6
|
+
import { t, type Language } from '../i18n/index.ts';
|
|
7
|
+
import { wrapText } from '../../ui/text.ts';
|
|
8
|
+
|
|
9
|
+
export interface QuickSetup {
|
|
10
|
+
base: Draft;
|
|
11
|
+
candidate: Draft;
|
|
12
|
+
step: 'scenario' | 'appearance' | 'review';
|
|
13
|
+
selected: number;
|
|
14
|
+
preset: string;
|
|
15
|
+
previewScope: Scope;
|
|
16
|
+
detailScroll: number;
|
|
17
|
+
}
|
|
18
|
+
export function openQuick(draft: Draft): QuickSetup {
|
|
19
|
+
return {base:copyDraft(draft),candidate:copyDraft(draft),step:'scenario',selected:0,preset:'developer',previewScope:'main',detailScroll:0};
|
|
20
|
+
}
|
|
21
|
+
export function receivePreset(quick: QuickSetup, draft: Draft): void {
|
|
22
|
+
quick.candidate = copyDraft(draft); quick.step = 'appearance'; quick.selected = 0; quick.detailScroll = 0;
|
|
23
|
+
}
|
|
24
|
+
export function quickKey(quick: QuickSetup, key: string): 'preset' | 'accept' | 'save' | 'cancel' | null {
|
|
25
|
+
const count = quick.step === 'scenario' ? PRESETS.length : quick.step === 'appearance' ? 5 : 3;
|
|
26
|
+
if (key === 'escape' || key === 'cancel') return 'cancel';
|
|
27
|
+
if (key === 'pageup' || key === 'pagedown') { quick.detailScroll = Math.max(0, quick.detailScroll + (key === 'pageup' ? -1 : 1)); return null; }
|
|
28
|
+
if (key === 'tab') { quick.previewScope = quick.previewScope === 'main' ? 'subagent' : 'main'; return null; }
|
|
29
|
+
if (key === 'backspace' || quick.step === 'review' && quick.selected === 2 && key === 'return') {
|
|
30
|
+
if (quick.step === 'scenario') return 'cancel';
|
|
31
|
+
quick.step = quick.step === 'review' ? 'appearance' : 'scenario';
|
|
32
|
+
quick.selected = quick.step === 'scenario' ? Math.max(0, PRESETS.findIndex(p => p.id === quick.preset)) : 0;
|
|
33
|
+
quick.detailScroll = 0; return null;
|
|
34
|
+
}
|
|
35
|
+
if (key === 'up' || key === 'down' || key === 'home' || key === 'end') {
|
|
36
|
+
quick.selected = key === 'home' ? 0 : key === 'end' ? count - 1 : Math.max(0,Math.min(count-1,quick.selected+(key==='up'?-1:1)));
|
|
37
|
+
quick.detailScroll = 0; return null;
|
|
38
|
+
}
|
|
39
|
+
if (quick.step === 'scenario' && key === 'return') { quick.preset = PRESETS[quick.selected]!.id; return 'preset'; }
|
|
40
|
+
if (quick.step === 'review' && key === 'return') return quick.selected === 0 ? 'accept' : 'save';
|
|
41
|
+
if (quick.step !== 'appearance' || !['left','right','return'].includes(key)) return null;
|
|
42
|
+
const d = quick.candidate.display, delta = key === 'left' ? -1 : 1;
|
|
43
|
+
const cycle = <T>(values: readonly T[], value: T): T => values[(values.indexOf(value)+delta+values.length)%values.length]!;
|
|
44
|
+
if (quick.selected === 0) d.theme = cycle(THEME_VALUES,d.theme);
|
|
45
|
+
if (quick.selected === 1) d.use_colors = !d.use_colors;
|
|
46
|
+
if (quick.selected === 2) d.palette = cycle(PALETTE_VALUES,d.palette);
|
|
47
|
+
if (quick.selected === 3) d.separator_style = cycle(SEPARATORSTYLE_VALUES,d.separator_style);
|
|
48
|
+
if (quick.selected === 4 && key === 'return') { quick.step='review'; quick.selected=0; quick.detailScroll=0; }
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
/** Both adapters use the same menu, selection window and scrollable requirement text. */
|
|
52
|
+
export function quickView(quick: QuickSetup, language: Language, width: number, height: number): {text:string;selected:boolean}[] {
|
|
53
|
+
const tr = (key:string,params:Record<string,unknown>={}) => t(key,language,params);
|
|
54
|
+
const preset = PRESETS.find(p=>p.id === (quick.step === 'scenario' ? PRESETS[quick.selected]!.id : quick.preset))!;
|
|
55
|
+
const d=quick.candidate.display;
|
|
56
|
+
const rows = quick.step === 'scenario' ? PRESETS.map(p=>(p.example ? tr('quick.example')+': ' : '')+tr('quick.purpose.'+p.id))
|
|
57
|
+
: quick.step === 'appearance' ? [
|
|
58
|
+
tr('fields.global.theme.label')+': '+tr('values.'+d.theme),
|
|
59
|
+
tr('settings.colors')+': '+tr('values.'+(d.use_colors?'on':'off')),
|
|
60
|
+
tr('settings.palette')+': '+d.palette,
|
|
61
|
+
tr('settings.separator-style')+': '+tr('values.'+d.separator_style), tr('quick.next'),
|
|
62
|
+
] : [tr('quick.fine_tune'),tr('quick.save'),tr('quick.back')];
|
|
63
|
+
const paragraphs=[tr(preset.requirements_key),tr('quick.sample'),
|
|
64
|
+
...(!d.subagents.enabled && preset.id==='multi-agent' ? [tr('quick.subagents_off')] : []),
|
|
65
|
+
...(quick.step==='review' ? [tr('quick.replace')] : [])];
|
|
66
|
+
const detail=wrapText(paragraphs,width), menuHeight=Math.max(1, Math.min(rows.length,Math.floor(height/2)));
|
|
67
|
+
const start=Math.max(0, Math.min(quick.selected,rows.length-menuHeight,quick.selected-menuHeight+1));
|
|
68
|
+
const result=rows.slice(start,start+menuHeight).map((text,index)=>({text:(start+index===quick.selected?'› ':' ')+text,selected:start+index===quick.selected}));
|
|
69
|
+
const capacity=Math.max(0,height-result.length), offset=Math.min(quick.detailScroll,Math.max(0,detail.length-capacity));
|
|
70
|
+
result.push(...detail.slice(offset,offset+capacity).map(text=>({text,selected:false})));
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function controlQuick(editor: Editor, key: string): 'transfer' | 'save' | null {
|
|
75
|
+
const quick = editor.quick;
|
|
76
|
+
if (!quick) return null;
|
|
77
|
+
const effect = quickKey(quick,key);
|
|
78
|
+
if (effect === 'cancel') editor.quick = null;
|
|
79
|
+
if (effect === 'preset') { editor.preset=quick.preset; editor.pendingTransfer='preset'; return 'transfer'; }
|
|
80
|
+
if (effect === 'accept' || effect === 'save') { editor.replaceDraft(quick.candidate); editor.quick=null; return effect === 'save' ? 'save' : null; }
|
|
81
|
+
return null;
|
|
82
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/text-input.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import { graphemes, displayWidth } from '../unicode.ts';
|
|
3
|
+
|
|
4
|
+
/** Offsets always lie on extended-grapheme boundaries; values retain their original bytes. */
|
|
5
|
+
export interface TextInput { value: string; cursor: number; scroll: number }
|
|
6
|
+
export interface TextKey { key: string; ctrl?: boolean; meta?: boolean; paste?: boolean; text?: boolean; overflow?: boolean }
|
|
7
|
+
export type TextAction = { kind: 'insert'; value: string } | { kind: 'left' | 'right' | 'home' | 'end' | 'backspace' | 'delete' | 'clear' };
|
|
8
|
+
export function textInput(value: string): TextInput { return { value, cursor: value.length, scroll: 0 }; }
|
|
9
|
+
function boundaries(value: string): number[] {
|
|
10
|
+
let position = 0;
|
|
11
|
+
return [0, ...graphemes(value).map(cluster => position += cluster.length)];
|
|
12
|
+
}
|
|
13
|
+
export function textAction(event: TextKey): TextAction | null {
|
|
14
|
+
if (event.paste || event.text) return { kind: 'insert', value: event.key };
|
|
15
|
+
if (event.meta) return null;
|
|
16
|
+
if (event.ctrl) return event.key.toLowerCase() === 'u' ? { kind: 'clear' } : null;
|
|
17
|
+
if (['left', 'right', 'home', 'end', 'backspace', 'delete'].includes(event.key))
|
|
18
|
+
return { kind: event.key as 'left' };
|
|
19
|
+
return [...event.key].length === 1 ? { kind: 'insert', value: event.key } : null;
|
|
20
|
+
}
|
|
21
|
+
export function editText(state: TextInput, action: TextAction, limit: number): { state: TextInput; error?: 'invalid' | 'limit' } {
|
|
22
|
+
const points = boundaries(state.value), index = Math.max(0, points.indexOf(state.cursor));
|
|
23
|
+
let value = state.value, cursor = points[index]!;
|
|
24
|
+
switch (action.kind) {
|
|
25
|
+
case 'home': cursor = 0; break;
|
|
26
|
+
case 'end': cursor = value.length; break;
|
|
27
|
+
case 'left': cursor = points[Math.max(0, index - 1)]!; break;
|
|
28
|
+
case 'right': cursor = points[Math.min(points.length - 1, index + 1)]!; break;
|
|
29
|
+
case 'clear': value = ''; cursor = 0; break;
|
|
30
|
+
case 'backspace': {
|
|
31
|
+
const before = points[Math.max(0, index - 1)]!;
|
|
32
|
+
value = value.slice(0, before) + value.slice(cursor); cursor = before; break;
|
|
33
|
+
}
|
|
34
|
+
case 'delete': value = value.slice(0, cursor) + value.slice(points[Math.min(points.length - 1, index + 1)]!); break;
|
|
35
|
+
case 'insert':
|
|
36
|
+
if (/[\p{Cc}\p{Cs}\p{Zl}\p{Zp}]/u.test(action.value)) return { state, error: 'invalid' };
|
|
37
|
+
value = value.slice(0, cursor) + action.value + value.slice(cursor);
|
|
38
|
+
if ([...value].length > limit) return { state, error: 'limit' };
|
|
39
|
+
cursor += action.value.length;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
// Insertion/deletion can join adjacent clusters (combining marks, flags or ZWJ).
|
|
43
|
+
cursor = boundaries(value).find(point => point >= cursor) ?? value.length;
|
|
44
|
+
return { state: { value, cursor, scroll: Math.min(state.scroll, cursor) } };
|
|
45
|
+
}
|
|
46
|
+
export function inputKey(value: string, previous: TextInput | undefined, event: TextKey, limit: number) {
|
|
47
|
+
const state = previous?.value === value ? previous : textInput(value), action = textAction(event);
|
|
48
|
+
return action ? editText(state, action, limit) : { state };
|
|
49
|
+
}
|
|
50
|
+
/** A visible caret takes one cell; resize only adjusts the viewport, never the value. */
|
|
51
|
+
export function inputView(state: TextInput, width: number): string {
|
|
52
|
+
width = Math.max(1, Math.trunc(width));
|
|
53
|
+
const points = boundaries(state.value);
|
|
54
|
+
let start = points.includes(state.scroll) ? Math.min(state.scroll, state.cursor) : 0;
|
|
55
|
+
while (start < state.cursor && displayWidth(state.value.slice(start, state.cursor)) + 1 > width)
|
|
56
|
+
start = points[points.indexOf(start) + 1]!;
|
|
57
|
+
state.scroll = start;
|
|
58
|
+
let output = '', used = 0;
|
|
59
|
+
for (let index = points.indexOf(start); index < points.length; index++) {
|
|
60
|
+
const point = points[index]!;
|
|
61
|
+
if (point === state.cursor) { output += '▏'; used++; }
|
|
62
|
+
if (index === points.length - 1) break;
|
|
63
|
+
const cluster = state.value.slice(point, points[index + 1]), cells = displayWidth(cluster);
|
|
64
|
+
if (used + cells > width) break;
|
|
65
|
+
output += cluster; used += cells;
|
|
66
|
+
}
|
|
67
|
+
return output;
|
|
68
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
-
export const PROTOCOL_VERSION =
|
|
2
|
+
export const PROTOCOL_VERSION = 14 as const;
|
|
3
3
|
export const ITEM_DEFAULTS = {"label": null, "icon": null, "priority": 50, "max_width": null, "formatting": {}, "foreground": null, "background": null, "visibility": "always", "visibility_threshold": 70};
|
|
4
4
|
export const VISIBILITY_ITEMS = {"main": {"git": "git-dirty", "git-changes": "git-dirty", "active-agents": "nonzero", "task-progress": "nonzero", "context-used": "used-at-least", "context-remaining": "used-at-least", "five-hour-limit": "used-at-least", "weekly-limit": "used-at-least", "spend-limit": "used-at-least"}, "subagent": {"context-used": "used-at-least", "context-remaining": "used-at-least"}} as const;
|
|
5
5
|
export const GUIDANCE_KEYS = {"source_kinds": ["configuration", "official_input", "local_git", "local_system", "transcript", "local_state", "lifecycle", "native_timing", "live_metrics", "telemetry"], "scopes": ["main", "main_context", "session", "all_sessions", "task", "subagent", "subagent_context", "repository", "local", "latest_request"], "requirements": ["observed_field", "subagent_rows", "agent_context", "configured_effort", "agent_effort_optional", "git_repository", "git_upstream", "git_base", "pull_request", "worktree_session", "usage_records", "task_observation", "native_timing", "complete_waits", "live_metrics", "owned_agents", "checklist_events", "tool_events", "complete_stream", "request_coverage", "existing_telemetry", "gateway", "gateway_284", "valid_window", "warm_cache", "fast_mode", "thinking", "agent_mode", "vim_mode", "context_observation"]} as const;
|
|
6
6
|
export const EDITOR_FIELDS = {"global": [{"key": "theme", "label": "Statusline theme", "group": "Appearance", "kind": "choice", "choices": ["classic", "dark", "light", "terminal"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "powerline_glyph", "label": "Powerline separator", "group": "Appearance", "kind": "choice", "choices": ["ascii", "powerline"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "statusline_language", "label": "Statusline language (save with display settings)", "group": "Appearance", "kind": "choice", "choices": ["en", "zh-CN", "zh-TW", "zh-HK", "ja", "ko"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "metrics.branch_diff_base_ref", "label": "Branch diff base (inherit = auto)", "group": "Git metrics", "kind": "text", "choices": [], "minimum": 0, "maximum": 10000, "nullable": true}, {"key": "formatting.model_name", "label": "Model Name", "group": "Formatting", "kind": "choice", "choices": ["original", "short"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "formatting.number_format", "label": "Number Format", "group": "Formatting", "kind": "choice", "choices": ["legacy", "compact", "full", "grouped"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "formatting.labels", "label": "Labels", "group": "Formatting", "kind": "choice", "choices": ["legacy", "short", "off"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "formatting.icons", "label": "Icons", "group": "Formatting", "kind": "choice", "choices": ["legacy", "unicode", "ascii", "off"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "formatting.allowance", "label": "Allowance", "group": "Formatting", "kind": "choice", "choices": ["remaining", "used"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "formatting.reset_format", "label": "Reset Format", "group": "Formatting", "kind": "choice", "choices": ["countdown", "time", "datetime"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "formatting.reset_timezone", "label": "Reset Timezone", "group": "Formatting", "kind": "choice", "choices": ["local", "UTC"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "formatting.thresholds.enabled", "label": "Threshold colors", "group": "Risk colors", "kind": "boolean", "choices": [], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "formatting.thresholds.warning", "label": "Warning (%)", "group": "Risk colors", "kind": "integer", "choices": [], "minimum": 0, "maximum": 100, "nullable": false}, {"key": "formatting.thresholds.critical", "label": "Critical (%)", "group": "Risk colors", "kind": "integer", "choices": [], "minimum": 0, "maximum": 100, "nullable": false}, {"key": "subagents.visibility", "label": "Visible agents", "group": "Subagent visibility", "kind": "choice", "choices": ["all", "running"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "subagents.hide_completed", "label": "Hide completed", "group": "Subagent visibility", "kind": "boolean", "choices": [], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "subagents.row_limit", "label": "Agent row limit", "group": "Subagent visibility", "kind": "integer", "choices": [], "minimum": 0, "maximum": 10000, "nullable": true}, {"key": "subagents.task_max_width", "label": "Task text width", "group": "Subagent visibility", "kind": "integer", "choices": [], "minimum": 2, "maximum": 10000, "nullable": true}], "item": [{"key": "foreground", "label": "Foreground (inherit/default/ansi:N/#RRGGBB)", "group": "Item colors", "kind": "text", "choices": [], "minimum": 0, "maximum": 10000, "nullable": true}, {"key": "background", "label": "Background (inherit/default/ansi:N/#RRGGBB)", "group": "Item colors", "kind": "text", "choices": [], "minimum": 0, "maximum": 10000, "nullable": true}, {"key": "visibility", "label": "Visibility rule", "group": "Conditional visibility", "kind": "choice", "choices": ["always", "git-dirty", "nonzero", "used-at-least"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "visibility_threshold", "label": "Minimum used (%)", "group": "Conditional visibility", "kind": "integer", "choices": [], "minimum": 0, "maximum": 100, "nullable": false}, {"key": "label", "label": "Label (inherit = default)", "group": "Item format", "kind": "text", "choices": [], "minimum": 0, "maximum": 10000, "nullable": true}, {"key": "icon", "label": "Icon (inherit = default)", "group": "Item format", "kind": "text", "choices": [], "minimum": 0, "maximum": 10000, "nullable": true}, {"key": "priority", "label": "Priority", "group": "Item fitting", "kind": "integer", "choices": [], "minimum": 0, "maximum": 100, "nullable": false}, {"key": "max_width", "label": "Maximum width", "group": "Item fitting", "kind": "integer", "choices": [], "minimum": 2, "maximum": 10000, "nullable": true}, {"key": "model_name", "label": "Model Name", "group": "Item format", "kind": "choice", "choices": ["inherit", "original", "short"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "number_format", "label": "Number Format", "group": "Item format", "kind": "choice", "choices": ["inherit", "legacy", "compact", "full", "grouped"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "labels", "label": "Labels", "group": "Item format", "kind": "choice", "choices": ["inherit", "legacy", "short", "off"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "icons", "label": "Icons", "group": "Item format", "kind": "choice", "choices": ["inherit", "legacy", "unicode", "ascii", "off"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "allowance", "label": "Allowance", "group": "Item format", "kind": "choice", "choices": ["inherit", "remaining", "used"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "reset_format", "label": "Reset Format", "group": "Item format", "kind": "choice", "choices": ["inherit", "countdown", "time", "datetime"], "minimum": 0, "maximum": 10000, "nullable": false}, {"key": "reset_timezone", "label": "Reset Timezone", "group": "Item format", "kind": "choice", "choices": ["inherit", "local", "UTC"], "minimum": 0, "maximum": 10000, "nullable": false}]} as const;
|
|
7
|
-
export const PRESETS = [{"id": "
|
|
7
|
+
export const PRESETS = [{"id": "developer", "purpose_key": "quick.purpose.developer", "requirements_key": "quick.requirements.developer", "example": false, "label": "Developer", "rows": [["model-with-effort", "current-dir", "git"], ["context-remaining", "tokens", "task-timer", "session-cost"]], "layout_mode": "explicit"}, {"id": "minimal", "purpose_key": "quick.purpose.minimal", "requirements_key": "quick.requirements.minimal", "example": false, "label": "Minimal", "rows": [["model-with-effort", "current-dir", "context-remaining", "task-timer"]], "layout_mode": "auto"}, {"id": "monitoring", "purpose_key": "quick.purpose.monitoring", "requirements_key": "quick.requirements.monitoring", "example": false, "label": "Monitoring", "rows": [["context-used", "five-hour-limit", "weekly-limit", "spend-limit"], ["five-hour-reset", "weekly-reset", "cache-state", "cache-expires"], ["session-cost", "session-duration", "api-duration", "api-requests", "cache-misses"]], "layout_mode": "explicit"}, {"id": "multi-agent", "purpose_key": "quick.purpose.multi-agent", "requirements_key": "quick.requirements.multi-agent", "example": false, "label": "Multi Agent", "rows": [["model-with-effort", "current-dir", "git"], ["context-remaining", "tokens", "task-timer"]], "layout_mode": "explicit"}, {"id": "left-right", "purpose_key": "quick.purpose.left-right", "requirements_key": "quick.requirements.left-right", "example": true, "label": "Left Right", "rows": [["model-with-effort", "git", "spacer", "context-remaining"]], "layout_mode": "explicit"}, {"id": "repeated-metrics", "purpose_key": "quick.purpose.repeated-metrics", "requirements_key": "quick.requirements.repeated-metrics", "example": true, "label": "Repeated Metrics", "rows": [["input-tokens", "input-tokens"]], "layout_mode": "explicit"}] as const;
|
|
8
8
|
export const FORMAT_CHOICES = {"model_name": ["original", "short"], "number_format": ["legacy", "compact", "full", "grouped"], "labels": ["legacy", "short", "off"], "icons": ["legacy", "unicode", "ascii", "off"], "allowance": ["remaining", "used"], "reset_format": ["countdown", "time", "datetime"], "reset_timezone": ["local", "UTC"]} as const;
|
|
9
9
|
export const FORMAT_DEFAULTS = {"model_name": "original", "number_format": "legacy", "labels": "legacy", "icons": "legacy", "allowance": "remaining", "reset_format": "countdown", "reset_timezone": "local", "thresholds": {"enabled": false, "warning": 70, "critical": 90}} as const;
|
|
10
|
-
export type MainItemId = "model-with-effort" | "model" | "effort" | "fast-mode" | "thinking" | "current-dir" | "project-name" | "hostname" | "git" | "git-branch" | "git-changes" | "git-ahead-behind" | "branch-diff" | "pr" | "repo" | "worktree" | "context-remaining" | "context-used" | "context-window-size" | "context-tokens" | "five-hour-limit" | "five-hour-reset" | "weekly-limit" | "weekly-reset" | "spend-limit" | "spend-amount" | "spend-period" | "tokens" | "input-tokens" | "output-tokens" | "prompt-cache" | "cache-state" | "cache-expires" | "cache-misses" | "api-requests" | "task-timer" | "task-active-timer" | "version" | "session" | "session-name" | "session-id" | "session-id-short" | "output-style" | "cost" | "session-cost" | "session-duration" | "api-duration" | "lines-changed" | "agent" | "vim-mode" | "run-state" | "permission-mode" | "active-agents" | "task-progress" | "last-tool" | "ttft" | "output-rate" | "prompt-input-tokens" | "prompt-output-tokens" | "prompt-cost" | "text" | "spacer";
|
|
10
|
+
export type MainItemId = "model-with-effort" | "model" | "effort" | "fast-mode" | "thinking" | "current-dir" | "project-name" | "hostname" | "git" | "git-branch" | "git-changes" | "git-ahead-behind" | "branch-diff" | "pr" | "repo" | "worktree" | "context-remaining" | "context-used" | "context-window-size" | "context-tokens" | "five-hour-limit" | "five-hour-reset" | "weekly-limit" | "weekly-reset" | "spend-limit" | "spend-amount" | "spend-period" | "tokens" | "input-tokens" | "output-tokens" | "prompt-cache" | "cache-state" | "cache-expires" | "cache-misses" | "cache-miss-reason" | "api-requests" | "task-timer" | "task-active-timer" | "version" | "session" | "session-name" | "session-id" | "session-id-short" | "output-style" | "cost" | "session-cost" | "session-duration" | "api-duration" | "lines-changed" | "agent" | "vim-mode" | "run-state" | "permission-mode" | "active-agents" | "task-progress" | "last-tool" | "ttft" | "output-rate" | "prompt-input-tokens" | "prompt-output-tokens" | "prompt-cost" | "text" | "spacer";
|
|
11
11
|
export type SubagentItemId = "status-elapsed" | "status" | "name" | "model-with-effort" | "model" | "effort" | "context-remaining" | "context-used" | "context-tokens" | "context-window-size" | "elapsed" | "task" | "tokens" | "current-dir" | "text" | "spacer";
|
|
12
12
|
export type Palette = "default" | "ansi";
|
|
13
13
|
export type Theme = "classic" | "dark" | "light" | "terminal";
|
|
@@ -19,7 +19,7 @@ export type ScopeLabels = "off" | "when-subagents" | "always";
|
|
|
19
19
|
export type StatuslineLanguage = "en" | "zh-CN" | "zh-TW" | "zh-HK" | "ja" | "ko";
|
|
20
20
|
export type Scope = "main" | "subagent";
|
|
21
21
|
export type UnavailableReason = "not_observed" | "unsupported_host" | "unknown_host_version" | "source_unavailable" | "condition_not_met" | "runtime_disabled" | "native_timing_disabled" | "wait_coverage_missing" | "stale" | "incomplete" | "ambiguous_owner" | "observed_only" | "missing_stream" | "synthetic_response" | "abnormal_clock" | "inconsistent_request" | "request_join_unavailable";
|
|
22
|
-
export const MAIN_ITEM_IDS = ["model-with-effort", "model", "effort", "fast-mode", "thinking", "current-dir", "project-name", "hostname", "git", "git-branch", "git-changes", "git-ahead-behind", "branch-diff", "pr", "repo", "worktree", "context-remaining", "context-used", "context-window-size", "context-tokens", "five-hour-limit", "five-hour-reset", "weekly-limit", "weekly-reset", "spend-limit", "spend-amount", "spend-period", "tokens", "input-tokens", "output-tokens", "prompt-cache", "cache-state", "cache-expires", "cache-misses", "api-requests", "task-timer", "task-active-timer", "version", "session", "session-name", "session-id", "session-id-short", "output-style", "cost", "session-cost", "session-duration", "api-duration", "lines-changed", "agent", "vim-mode", "run-state", "permission-mode", "active-agents", "task-progress", "last-tool", "ttft", "output-rate", "prompt-input-tokens", "prompt-output-tokens", "prompt-cost", "text", "spacer"] as const;
|
|
22
|
+
export const MAIN_ITEM_IDS = ["model-with-effort", "model", "effort", "fast-mode", "thinking", "current-dir", "project-name", "hostname", "git", "git-branch", "git-changes", "git-ahead-behind", "branch-diff", "pr", "repo", "worktree", "context-remaining", "context-used", "context-window-size", "context-tokens", "five-hour-limit", "five-hour-reset", "weekly-limit", "weekly-reset", "spend-limit", "spend-amount", "spend-period", "tokens", "input-tokens", "output-tokens", "prompt-cache", "cache-state", "cache-expires", "cache-misses", "cache-miss-reason", "api-requests", "task-timer", "task-active-timer", "version", "session", "session-name", "session-id", "session-id-short", "output-style", "cost", "session-cost", "session-duration", "api-duration", "lines-changed", "agent", "vim-mode", "run-state", "permission-mode", "active-agents", "task-progress", "last-tool", "ttft", "output-rate", "prompt-input-tokens", "prompt-output-tokens", "prompt-cost", "text", "spacer"] as const;
|
|
23
23
|
export const SUBAGENT_ITEM_IDS = ["status-elapsed", "status", "name", "model-with-effort", "model", "effort", "context-remaining", "context-used", "context-tokens", "context-window-size", "elapsed", "task", "tokens", "current-dir", "text", "spacer"] as const;
|
|
24
24
|
export const PALETTE_VALUES = ["default", "ansi"] as const;
|
|
25
25
|
export const THEME_VALUES = ["classic", "dark", "light", "terminal"] as const;
|
|
@@ -30,7 +30,7 @@ export const SEPARATORSTYLE_VALUES = ["classic", "compact", "powerline"] as cons
|
|
|
30
30
|
export const SCOPELABELS_VALUES = ["off", "when-subagents", "always"] as const;
|
|
31
31
|
export const STATUSLINELANGUAGE_VALUES = ["en", "zh-CN", "zh-TW", "zh-HK", "ja", "ko"] as const;
|
|
32
32
|
export const UNAVAILABLEREASON_VALUES = ["not_observed", "unsupported_host", "unknown_host_version", "source_unavailable", "condition_not_met", "runtime_disabled", "native_timing_disabled", "wait_coverage_missing", "stale", "incomplete", "ambiguous_owner", "observed_only", "missing_stream", "synthetic_response", "abnormal_clock", "inconsistent_request", "request_join_unavailable"] as const;
|
|
33
|
-
export type Operation = "describe" | "read" | "preview" | "apply" | "import" | "export" | "preset" | "read_ui_preferences" | "set_ui_language" | "review_import";
|
|
33
|
+
export type Operation = "describe" | "read" | "preview" | "apply" | "import" | "export" | "preset" | "read_ui_preferences" | "set_ui_language" | "review_import" | "explain" | "diagnose";
|
|
34
34
|
export interface ItemGuidance {
|
|
35
35
|
source_kinds: string[];
|
|
36
36
|
measurement_scope: string;
|
|
@@ -175,6 +175,61 @@ export interface PreviewResult {
|
|
|
175
175
|
main: Span[][];
|
|
176
176
|
subagents: Span[][];
|
|
177
177
|
}
|
|
178
|
+
export const SAMPLE_REASONS = ['sample_visible','sample_empty','sample_condition_hidden','sample_truncated','sample_priority_omitted','sample_width_omitted','sample_row_hidden','sample_spacer'] as const;
|
|
179
|
+
export type SampleReason = typeof SAMPLE_REASONS[number];
|
|
180
|
+
export const EXPLAIN_REASONS = ['configured_on','configured_off','scope_disabled','installation_owned','installation_absent','installation_foreign','installation_unknown','unknown_host_version','host_supported','unsupported_host','host_requirement_unknown','collector_unknown','native_timing_on','native_timing_off','live_metrics_on','live_metrics_off','actual_not_observed'] as const;
|
|
181
|
+
export interface ExplainReason { code: string; origin: 'configuration' | 'local_configuration' | 'host_capability' | 'unknown'; }
|
|
182
|
+
export interface InstanceSample { row_id: string; outcome: SampleReason; truncated: boolean; }
|
|
183
|
+
export interface ExplainInstance {
|
|
184
|
+
id: string; type_id: string; enabled: boolean;
|
|
185
|
+
reasons: ExplainReason[];
|
|
186
|
+
samples: InstanceSample[];
|
|
187
|
+
}
|
|
188
|
+
export interface ExplainResult {
|
|
189
|
+
sample: true;
|
|
190
|
+
scope: Scope;
|
|
191
|
+
width: number;
|
|
192
|
+
actual_availability: 'not_observed';
|
|
193
|
+
preview: PreviewResult;
|
|
194
|
+
instances: ExplainInstance[];
|
|
195
|
+
}
|
|
196
|
+
export const LAYOUT_REASONS = ['visible','empty','condition_hidden','priority_omitted','width_omitted','row_hidden','spacer'] as const;
|
|
197
|
+
export type LayoutReason = typeof LAYOUT_REASONS[number];
|
|
198
|
+
export interface InstanceLayout { row_id: string; outcome: LayoutReason; truncated: boolean; }
|
|
199
|
+
export const EVIDENCE_STATUSES = ['observed','not_observed','invalid_field','source_unavailable','association_unavailable','session_mismatch','prompt_mismatch','stale','partial','collector_off','input_only','newer_than_input','unsupported_host','no_misses','unidentified'] as const;
|
|
200
|
+
export type EvidenceStatus = typeof EVIDENCE_STATUSES[number];
|
|
201
|
+
export interface DiagnosticEvidence {
|
|
202
|
+
source: string;
|
|
203
|
+
scope: string;
|
|
204
|
+
status: EvidenceStatus;
|
|
205
|
+
observed_at: string | null;
|
|
206
|
+
freshness: 'current' | 'stale' | 'unknown' | 'newer_than_input';
|
|
207
|
+
fields: { path: string; status: 'observed' | 'not_observed' | 'invalid_field' }[];
|
|
208
|
+
}
|
|
209
|
+
export interface DiagnoseInstance {
|
|
210
|
+
id: string; type_id: string; enabled: boolean;
|
|
211
|
+
reasons: ExplainReason[];
|
|
212
|
+
evidence: DiagnosticEvidence[];
|
|
213
|
+
rows: InstanceLayout[];
|
|
214
|
+
}
|
|
215
|
+
export interface DiagnoseResult {
|
|
216
|
+
sample: false;
|
|
217
|
+
scope: Scope;
|
|
218
|
+
width: number;
|
|
219
|
+
source: string;
|
|
220
|
+
observed_at: string | null;
|
|
221
|
+
diagnosed_at: string;
|
|
222
|
+
session_id: string | null;
|
|
223
|
+
prompt_id: string | null;
|
|
224
|
+
host_version: string | null;
|
|
225
|
+
include_local: boolean;
|
|
226
|
+
output: { id: string; spans: Span[] }[];
|
|
227
|
+
instances: DiagnoseInstance[];
|
|
228
|
+
host_fields: {
|
|
229
|
+
worktree: { session_name: string | null; git_name: string | null; selected_source: string | null };
|
|
230
|
+
cache_miss: { status: string; causes: string[]; last_miss_at: number | null; tools_added: number | null; tools_removed: number | null; system_char_delta: number | null };
|
|
231
|
+
};
|
|
232
|
+
}
|
|
178
233
|
export interface LocalizedMessage {
|
|
179
234
|
key: string;
|
|
180
235
|
params: Record<string, unknown>;
|
|
@@ -209,6 +264,9 @@ export interface EditorField {
|
|
|
209
264
|
nullable: boolean;
|
|
210
265
|
}
|
|
211
266
|
export interface PresetDescription {
|
|
267
|
+
purpose_key: string;
|
|
268
|
+
requirements_key: string;
|
|
269
|
+
example: boolean;
|
|
212
270
|
id: string;
|
|
213
271
|
label: string;
|
|
214
272
|
rows: string[][];
|
|
@@ -258,6 +316,8 @@ export interface ResultMap {
|
|
|
258
316
|
describe: DescribeResult;
|
|
259
317
|
read: ReadResult;
|
|
260
318
|
preview: PreviewResult;
|
|
319
|
+
explain: ExplainResult;
|
|
320
|
+
diagnose: DiagnoseResult;
|
|
261
321
|
apply: ApplyResult;
|
|
262
322
|
import: TransferResult;
|
|
263
323
|
review_import: ImportReviewResult;
|
|
@@ -272,5 +332,5 @@ export interface Request {
|
|
|
272
332
|
operation: Operation;
|
|
273
333
|
payload: unknown;
|
|
274
334
|
}
|
|
275
|
-
export type Result = PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult;
|
|
335
|
+
export type Result = DiagnoseResult | ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult;
|
|
276
336
|
export type Response = { protocol_version: typeof PROTOCOL_VERSION; result: Result } | { protocol_version: typeof PROTOCOL_VERSION; error: ProtocolError };
|