@fbincon/claude-code-statusline 3.2.0 → 3.4.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 +74 -70
- package/candidate.json +287 -211
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.d.ts +12 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js +101 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profiles.d.ts +54 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profiles.js +199 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profiles.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js +5 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js +4 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.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 +107 -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 +18 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.js +68 -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 +13 -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 +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +3 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js +4 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +38 -9
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/configuration.d.ts +12 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/configuration.js +59 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/configuration.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/main.js +15 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/main.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/tasks/command.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js +25 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/service.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/service.js +93 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +8 -4
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +41 -9
- 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 +89 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +78 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +8 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/profile-manager.ts +239 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/task-detail.ts +27 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +93 -5
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +1152 -12
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/session.ts +2 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +16 -14
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +6 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +1 -0
- 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/profiles.d.ts +16 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/profiles.js +69 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/profiles.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js +1 -1
- 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 +144 -4
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +3 -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 +100 -4
- 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 +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.d.ts +60 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js +330 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-detail.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-detail.js +25 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-detail.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +1146 -6
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +1152 -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.js +2 -2
- 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 +5 -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 +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js +23 -18
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js.map +1 -1
- 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 +15 -12
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js.map +1 -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/preview.js +1 -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 +11 -11
- 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 +4 -3
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js +5 -4
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js.map +1 -1
- 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/tasks/details.d.ts +24 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/details.js +153 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/details.js.map +1 -0
- 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/resources/i18n/locales/en.json +192 -2
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +192 -2
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +192 -2
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +192 -2
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +192 -2
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +192 -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/project-paths.d.ts +8 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/project-paths.js +41 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/project-paths.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +5 -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 +2 -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 +2 -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 +3 -2
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +7 -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 +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +18 -2
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/package.json +1 -1
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
2
|
import type { ExplanationView } from './explanation.ts';
|
|
3
|
+
import type { ProfileManager } from './profile-manager.ts';
|
|
3
4
|
import type { QuickSetup } from './quick-setup.ts';
|
|
4
5
|
import { t, type Language } from '../i18n/index.ts';
|
|
5
6
|
import { nodes, newInstance, reconcileRows } from './instances.ts';
|
|
@@ -43,6 +44,7 @@ export class Editor {
|
|
|
43
44
|
review: ReviewState | null = null;
|
|
44
45
|
quick: QuickSetup | null = null;
|
|
45
46
|
explanation: ExplanationView | null = null;
|
|
47
|
+
profiles: ProfileManager | null = null;
|
|
46
48
|
preset = 'minimal';
|
|
47
49
|
path = 'statusline.json';
|
|
48
50
|
pendingTransfer: 'import' | 'export' | 'preset' | null = null;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { ConfigTarget, DisplayDraft, Operation, ProfilesResult, ResultFor } from '../generated-contracts.ts';
|
|
3
|
+
import { t, text, type Language, type LocalizedText } from '../i18n/index.ts';
|
|
4
|
+
import type { Editor } from './draft.ts';
|
|
5
|
+
import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
|
|
6
|
+
import { wrapText } from '../../ui/text.ts';
|
|
7
|
+
import { BackendError } from '../backend.ts';
|
|
8
|
+
|
|
9
|
+
type Action = 'edit' | 'activate' | 'save' | 'save_bind' | 'rename' | 'delete' | 'bind' | 'unbind' | 'import' | 'export';
|
|
10
|
+
type Switch = { target: ConfigTarget; display?: DisplayDraft };
|
|
11
|
+
type Effect = { kind: 'load' } | { kind: 'switch'; next: Switch; save: boolean } |
|
|
12
|
+
{ kind: 'mutation'; payload: Record<string, unknown> } | { kind: 'import'; path: string } |
|
|
13
|
+
{ kind: 'export'; path: string; name: string; display: DisplayDraft; overwrite: boolean };
|
|
14
|
+
export interface ProfileManager {
|
|
15
|
+
library: ProfilesResult | null;
|
|
16
|
+
page: 'list' | 'actions' | 'form' | 'confirm' | 'dirty';
|
|
17
|
+
selected: string | null;
|
|
18
|
+
projectRoot: string | null;
|
|
19
|
+
cursor: number;
|
|
20
|
+
action: Action | null;
|
|
21
|
+
fields: { key: 'name' | 'path'; input: TextInput }[];
|
|
22
|
+
field: number;
|
|
23
|
+
candidate: DisplayDraft | null;
|
|
24
|
+
confirmation: Effect | null;
|
|
25
|
+
next: Switch | null;
|
|
26
|
+
effect: Effect | null;
|
|
27
|
+
message: LocalizedText | null;
|
|
28
|
+
uncertain: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ProfileBackend { request<O extends Operation>(operation: O, payload?: unknown): ResultFor<O> | Promise<ResultFor<O>> }
|
|
31
|
+
export function openProfiles(editor: Editor): void {
|
|
32
|
+
editor.profiles = { library: null, page: 'list', selected: null, projectRoot: null, cursor: 0, action: null, fields: [], field: 0, candidate: null,
|
|
33
|
+
confirmation: null, next: null, effect: { kind: 'load' }, message: null, uncertain: false };
|
|
34
|
+
}
|
|
35
|
+
export function targetLabel(editor: Editor, language: Language): string {
|
|
36
|
+
const c = editor.baseline.configuration;
|
|
37
|
+
if (!c) return t('profiles.user', language);
|
|
38
|
+
return t('profiles.target', language, { name: c.profile_name ?? t('profiles.user', language),
|
|
39
|
+
root: c.project_root ?? '—', count: c.shared_projects.length });
|
|
40
|
+
}
|
|
41
|
+
function entries(m: ProfileManager): { key: string; label: string; raw?: boolean }[] {
|
|
42
|
+
if (m.page === 'actions') return ['edit','activate','rename','delete','bind','export'].map(key => ({ key, label: 'profiles.action.' + key }));
|
|
43
|
+
return [{ key: 'user', label: 'profiles.user' }, ...(m.library?.profiles ?? []).map(p => ({ key: p.id, label: p.name, raw: true })),
|
|
44
|
+
...(m.library?.bindings ?? []).map(b=>({key:'binding:'+b.root,label:b.root+' → '+(m.library!.profiles.find(p=>p.id===b.profile_id)?.name ?? b.profile_id),raw:true})),
|
|
45
|
+
...['save','save_bind','import','unbind'].map(key => ({ key: 'action:' + key, label: 'profiles.action.' + key }))];
|
|
46
|
+
}
|
|
47
|
+
function startForm(e: Editor, action: Action): void {
|
|
48
|
+
const m = e.profiles!, profile = m.library?.profiles.find(p => p.id === m.selected), project = e.baseline.configuration;
|
|
49
|
+
const path = m.projectRoot ?? (project?.target.kind === 'project' ? project.target.path : project?.project_root ?? '');
|
|
50
|
+
m.action = action; m.page = 'form'; m.field = 0; m.message = null;
|
|
51
|
+
const keys = ['save','rename'].includes(action) ? ['name'] : action === 'save_bind' ? ['name','path'] : ['path'];
|
|
52
|
+
m.fields = keys.map(key => ({ key: key as 'name' | 'path', input: textInput(key === 'name' ? action === 'rename' ? profile?.name ?? '' : '' : ['bind','unbind','save_bind'].includes(action) ? path : 'profile.json') }));
|
|
53
|
+
}
|
|
54
|
+
function switching(e: Editor, next: Switch): void {
|
|
55
|
+
const m = e.profiles!;
|
|
56
|
+
if (e.modified) { m.next = next; m.page = 'dirty'; m.cursor = 0; }
|
|
57
|
+
else m.effect = { kind: 'switch', next, save: false };
|
|
58
|
+
}
|
|
59
|
+
function submitForm(e: Editor): void {
|
|
60
|
+
const m = e.profiles!, values = Object.fromEntries(m.fields.map(f => [f.key, f.input.value]));
|
|
61
|
+
const profile = m.library?.profiles.find(p => p.id === m.selected);
|
|
62
|
+
if (m.fields.some(f => !f.input.value.trim())) { m.message = text('profiles.required'); return; }
|
|
63
|
+
if (m.action === 'import') { m.effect = { kind: 'import', path: values.path! }; return; }
|
|
64
|
+
if (m.action === 'export' && profile) {
|
|
65
|
+
m.confirmation = { kind: 'export', path: values.path!, name: profile.name, display: profile.display, overwrite: false };
|
|
66
|
+
} else {
|
|
67
|
+
const payload: Record<string, unknown> = { action: m.action === 'save_bind' ? 'save' : m.action, expected_revision: m.library!.revision, overwrite: false };
|
|
68
|
+
if (m.action === 'save' || m.action === 'save_bind') Object.assign(payload, { name: values.name, display: m.candidate ?? e.draft.display, ...(m.action === 'save_bind' ? { bind_path: values.path } : {}) });
|
|
69
|
+
if (m.action === 'rename') Object.assign(payload, { id: m.selected, name: values.name });
|
|
70
|
+
if (m.action === 'bind') Object.assign(payload, { id: m.selected, path: values.path });
|
|
71
|
+
if (m.action === 'unbind') payload.path = values.path;
|
|
72
|
+
m.confirmation = { kind: 'mutation', payload };
|
|
73
|
+
}
|
|
74
|
+
m.page = 'confirm'; m.cursor = 0;
|
|
75
|
+
}
|
|
76
|
+
/** One reducer supplies both editors; text never dispatches shortcuts. */
|
|
77
|
+
export function profilesKey(e: Editor, event: TextKey): 'profiles' | null {
|
|
78
|
+
const m = e.profiles;
|
|
79
|
+
if (!m) return null;
|
|
80
|
+
const key = event.key === 'return' ? 'enter' : event.key, plain = !event.ctrl && !event.meta && !event.text && !event.paste;
|
|
81
|
+
const cancel = !event.text && !event.paste && (key === 'escape' || event.ctrl && key.toLowerCase() === 'g');
|
|
82
|
+
if (event.overflow) { m.message = text('input.overflow'); return null; }
|
|
83
|
+
if (cancel) {
|
|
84
|
+
if (m.uncertain) { m.message = text('profiles.uncertain'); return null; }
|
|
85
|
+
if (m.page === 'list') e.profiles = null;
|
|
86
|
+
else { m.page = 'list'; m.cursor = 0; m.candidate = null; m.confirmation = null; }
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
if (m.page === 'form') {
|
|
90
|
+
if (plain && key === 'enter') {
|
|
91
|
+
if (m.field + 1 < m.fields.length) m.field++;
|
|
92
|
+
else submitForm(e);
|
|
93
|
+
} else if (plain && key === 'tab') m.field = (m.field + 1) % m.fields.length;
|
|
94
|
+
else {
|
|
95
|
+
const field = m.fields[m.field]!, edited = inputKey(field.input.value, field.input, event, field.key === 'name' ? 128 : 4096);
|
|
96
|
+
field.input = edited.state;
|
|
97
|
+
m.message = edited.error ? text('input.' + edited.error, { limit: field.key === 'name' ? 128 : 4096 }) : null;
|
|
98
|
+
}
|
|
99
|
+
return m.effect ? 'profiles' : null;
|
|
100
|
+
}
|
|
101
|
+
if (!plain) return null;
|
|
102
|
+
if (key.toLowerCase() === 'r') { m.effect = { kind: 'load' }; return 'profiles'; }
|
|
103
|
+
if (m.uncertain) { m.message = text('profiles.uncertain'); return null; }
|
|
104
|
+
if (m.page === 'dirty') {
|
|
105
|
+
const choices = ['save','discard','cancel'];
|
|
106
|
+
if (key === 'up') m.cursor = Math.max(0, m.cursor - 1);
|
|
107
|
+
if (key === 'down') m.cursor = Math.min(2, m.cursor + 1);
|
|
108
|
+
if (key === 'enter') {
|
|
109
|
+
if (choices[m.cursor] === 'cancel') { m.page = 'list'; m.cursor = 0; }
|
|
110
|
+
else m.effect = { kind: 'switch', next: m.next!, save: m.cursor === 0 };
|
|
111
|
+
}
|
|
112
|
+
return m.effect ? 'profiles' : null;
|
|
113
|
+
}
|
|
114
|
+
if (m.page === 'confirm') {
|
|
115
|
+
if (key === 'up' || key === 'down') m.cursor = 1 - m.cursor;
|
|
116
|
+
if (key === 'enter') {
|
|
117
|
+
if (m.cursor === 1) { m.page = 'list'; m.cursor = 0; m.confirmation = null; }
|
|
118
|
+
else { m.effect = m.confirmation; return 'profiles'; }
|
|
119
|
+
}
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
const rows = entries(m);
|
|
123
|
+
if (key === 'up') m.cursor = Math.max(0, m.cursor - 1);
|
|
124
|
+
if (key === 'down') m.cursor = Math.min(rows.length - 1, m.cursor + 1);
|
|
125
|
+
if (key === 'home') m.cursor = 0;
|
|
126
|
+
if (key === 'end') m.cursor = rows.length - 1;
|
|
127
|
+
if (key === 'pageup') m.cursor = Math.max(0, m.cursor - 5);
|
|
128
|
+
if (key === 'pagedown') m.cursor = Math.min(rows.length - 1, m.cursor + 5);
|
|
129
|
+
if (key === 'enter') {
|
|
130
|
+
const row = rows[m.cursor]!;
|
|
131
|
+
if (m.page === 'list') {
|
|
132
|
+
if (row.key === 'user') switching(e, { target: { kind: 'user' } });
|
|
133
|
+
else if (row.key.startsWith('action:')) { m.candidate = null; startForm(e, row.key.slice(7) as Action); }
|
|
134
|
+
else {
|
|
135
|
+
m.projectRoot = row.key.startsWith('binding:') ? row.key.slice(8) : null;
|
|
136
|
+
m.selected = m.projectRoot ? m.library!.bindings.find(b=>b.root===m.projectRoot)!.profile_id : row.key;
|
|
137
|
+
const selected = m.library!.profiles.find(p=>p.id===m.selected);
|
|
138
|
+
if (!selected) { m.message=text('profiles.error.missing',{value:m.selected}); return null; }
|
|
139
|
+
m.candidate=selected.display; m.page='actions';m.cursor=0;
|
|
140
|
+
}
|
|
141
|
+
} else if (row.key === 'edit') switching(e, { target: m.projectRoot ? {kind:'project',path:m.projectRoot} : { kind: 'profile', id: m.selected! } });
|
|
142
|
+
else if (row.key === 'activate') switching(e, { target: { kind: 'user' }, display: m.candidate! });
|
|
143
|
+
else if (row.key === 'delete') {
|
|
144
|
+
m.action = 'delete'; m.confirmation = { kind: 'mutation', payload: { action: 'delete', id: m.selected, expected_revision: m.library!.revision } };
|
|
145
|
+
m.page = 'confirm'; m.cursor = 1;
|
|
146
|
+
} else startForm(e, row.key as Action);
|
|
147
|
+
}
|
|
148
|
+
return m.effect ? 'profiles' : null;
|
|
149
|
+
}
|
|
150
|
+
export async function performProfileAction(e: Editor, backend: ProfileBackend): Promise<void> {
|
|
151
|
+
const m = e.profiles, effect = m?.effect;
|
|
152
|
+
if (!m || !effect) return;
|
|
153
|
+
m.effect = null;
|
|
154
|
+
let writing = false;
|
|
155
|
+
try {
|
|
156
|
+
if (effect.kind === 'load') {
|
|
157
|
+
m.library = await backend.request('profiles_read'); m.page = 'list'; m.cursor = 0;
|
|
158
|
+
m.message = m.uncertain ? text('profiles.review_saved') : null; m.uncertain = false; return;
|
|
159
|
+
}
|
|
160
|
+
if (effect.kind === 'switch') {
|
|
161
|
+
if (effect.save) {
|
|
162
|
+
if (!e.acceptNumeric()) throw new BackendError('invalid_draft', text('profiles.invalid_draft'));
|
|
163
|
+
writing = true;
|
|
164
|
+
const saved = await backend.request('apply', { draft: e.draft, expected_revision: e.baseline.revision,
|
|
165
|
+
...(e.baseline.configuration ? { target: e.baseline.configuration.target } : {}) });
|
|
166
|
+
e.committed(saved); writing = false;
|
|
167
|
+
}
|
|
168
|
+
const current = await backend.request('read', { target: effect.next.target });
|
|
169
|
+
e.committed(current);
|
|
170
|
+
e.replaceDraft(current.draft);
|
|
171
|
+
if (effect.next.display) e.replaceDraft({ ...current.draft, display: JSON.parse(JSON.stringify(effect.next.display)) as DisplayDraft });
|
|
172
|
+
e.profiles = null; return;
|
|
173
|
+
}
|
|
174
|
+
if (effect.kind === 'import') {
|
|
175
|
+
const result = await backend.request('profile_import', { path: effect.path });
|
|
176
|
+
m.candidate = result.display; startForm(e, 'save'); m.fields[0]!.input = textInput(result.name);
|
|
177
|
+
m.message = text('profiles.import_review'); return;
|
|
178
|
+
}
|
|
179
|
+
writing = true;
|
|
180
|
+
if (effect.kind === 'export') {
|
|
181
|
+
await backend.request('profile_export', { path: effect.path, name: effect.name, display: effect.display, overwrite: effect.overwrite });
|
|
182
|
+
} else {
|
|
183
|
+
m.library = await backend.request('profiles_apply', effect.payload);
|
|
184
|
+
writing = false;
|
|
185
|
+
if (effect.payload.bind_path && typeof effect.payload.bind_path === 'string') {
|
|
186
|
+
const host = e.draft.host;
|
|
187
|
+
const current = await backend.request('read', { target: { kind: 'project', path: effect.payload.bind_path } });
|
|
188
|
+
e.committed(current); e.replaceDraft({ ...current.draft, host });
|
|
189
|
+
} else if (e.baseline.configuration && (e.baseline.configuration.target.kind !== 'profile' ||
|
|
190
|
+
m.library.profiles.some(p=>p.id===e.baseline.configuration!.profile_id))) {
|
|
191
|
+
const current = await backend.request('read', { target: e.baseline.configuration.target });
|
|
192
|
+
if (current.configuration?.profile_id === e.baseline.configuration.profile_id &&
|
|
193
|
+
JSON.stringify(current.draft) === JSON.stringify(e.baseline.draft)) e.baseline = current;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
m.page = 'list'; m.cursor = 0; m.candidate = null; m.confirmation = null; m.message = text('profiles.saved');
|
|
197
|
+
} catch (error) {
|
|
198
|
+
const code = error instanceof BackendError ? error.code : '';
|
|
199
|
+
if (code === 'profile_duplicate' || code === 'profile_bound' || effect.kind === 'export' && code === 'io_error' && /EEXIST/u.test(String(error))) {
|
|
200
|
+
m.confirmation = effect.kind === 'mutation' ? { ...effect, payload: { ...effect.payload, overwrite: true } }
|
|
201
|
+
: effect.kind === 'export' ? { ...effect, overwrite: true } : null;
|
|
202
|
+
m.page = 'confirm'; m.cursor = 1; m.message = text('profiles.overwrite');
|
|
203
|
+
} else {
|
|
204
|
+
m.uncertain = writing && !['profile_conflict','profile_referenced','profile_invalid','profile_name','profile_path','ownership_mismatch','configuration_conflict','invalid_request','profile_size'].includes(code);
|
|
205
|
+
m.message = error instanceof BackendError && error.localization ? error.localization : text('profiles.failed', { value: error instanceof Error ? error.message : String(error) });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
export function profilesView(e: Editor, language: Language, width: number, height: number): { text: string; selected: boolean }[] {
|
|
210
|
+
const m = e.profiles!;
|
|
211
|
+
const tr = (key: string) => t(key, language);
|
|
212
|
+
const lines: { text: string; selected: boolean }[] = [];
|
|
213
|
+
const add = (value: string, selected = false) => lines.push({ text: value, selected });
|
|
214
|
+
if (m.message) for (const line of wrapText([t(m.message.key, language, m.message.params)], width)) add(line);
|
|
215
|
+
if (m.uncertain) add(tr('profiles.uncertain'));
|
|
216
|
+
if (!m.library) { add(tr('profiles.loading')); return lines.slice(0, height); }
|
|
217
|
+
if (m.page === 'form') {
|
|
218
|
+
add(tr('profiles.action.' + m.action));
|
|
219
|
+
m.fields.forEach((f,i) => add(tr('profiles.field.' + f.key) + ': ' + inputView({ ...f.input }, Math.max(1, width - 12)), i === m.field));
|
|
220
|
+
add(tr('profiles.form_help')); return lines.slice(0, height);
|
|
221
|
+
}
|
|
222
|
+
const rows = m.page === 'confirm' ? [{ key:'confirm',label:'profiles.confirm' },{ key:'cancel',label:'profiles.cancel' }] :
|
|
223
|
+
m.page === 'dirty' ? ['save','discard','cancel'].map(key => ({ key, label:'profiles.'+key })) : entries(m);
|
|
224
|
+
if (m.page === 'dirty') add(tr('profiles.dirty'));
|
|
225
|
+
if (m.page === 'confirm') {
|
|
226
|
+
const value = m.confirmation;
|
|
227
|
+
add(tr('profiles.action.' + (m.action ?? 'export')));
|
|
228
|
+
if (value?.kind === 'mutation') add(String(value.payload.name ?? value.payload.path ?? m.library.profiles.find(p=>p.id===value.payload.id)?.name ?? ''));
|
|
229
|
+
if (value?.kind === 'export') add(value.path);
|
|
230
|
+
}
|
|
231
|
+
if (m.page === 'actions') {
|
|
232
|
+
add(m.library.profiles.find(p => p.id === m.selected)?.name ?? '');
|
|
233
|
+
add(t('profiles.shared', language, { count: m.library.bindings.filter(b => b.profile_id === m.selected).length }));
|
|
234
|
+
}
|
|
235
|
+
const capacity = Math.max(1, height - lines.length - 1), start = Math.max(0, Math.min(m.cursor, rows.length - capacity));
|
|
236
|
+
rows.slice(start,start+capacity).forEach((row,i) => add(('raw' in row && row.raw ? row.label : tr(row.label)), start+i === m.cursor));
|
|
237
|
+
add(tr('profiles.navigation'));
|
|
238
|
+
return lines.slice(0,height);
|
|
239
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/task-detail.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { TaskDetails } from '../generated-contracts.ts';
|
|
3
|
+
import { t, type Language } from '../i18n/index.ts';
|
|
4
|
+
import { wrapText } from '../../ui/text.ts';
|
|
5
|
+
|
|
6
|
+
/** Both native and CLI presentations retain every evidence source and timestamp. */
|
|
7
|
+
export function taskDetailLines(report: TaskDetails, language: Language, width = 100): string[] {
|
|
8
|
+
const tr = (key: string, params: Record<string, unknown> = {}) => t(key, language, params);
|
|
9
|
+
const status = (value: string | null) => value === null ? tr('task.unknown') : t('task.value.' + value, language, {}, value);
|
|
10
|
+
const duration = (value: number | null) => value === null ? tr('task.unknown') : value.toFixed(1) + 's';
|
|
11
|
+
const lines = [
|
|
12
|
+
tr('task.session', { value: report.session_id }), tr('task.prompt', { value: report.prompt_id ?? tr('task.unknown') }),
|
|
13
|
+
tr('task.captured', { value: report.captured_at }),
|
|
14
|
+
tr('task.status', { value: status(report.status), phase: status(report.phase) }),
|
|
15
|
+
tr('task.elapsed', { value: duration(report.elapsed_seconds) }), tr('task.active', { value: duration(report.active_seconds) }),
|
|
16
|
+
tr('task.progress', { value: report.progress ? report.progress.completed + '/' + report.progress.total : tr('task.unknown') }),
|
|
17
|
+
tr('task.agents'),
|
|
18
|
+
...report.agents.flatMap(agent => [
|
|
19
|
+
`${agent.parent_id ? agent.parent_id + ' → ' : ''}${agent.name ?? agent.id} [${agent.id}]: ${status(agent.status)}`,
|
|
20
|
+
...agent.evidence.map(e => tr('task.evidence', { source:e.source, scope:e.scope, status:status(e.status), time:e.observed_at ?? tr('task.unknown'), freshness:status(e.freshness) })),
|
|
21
|
+
]),
|
|
22
|
+
tr('task.sources'),
|
|
23
|
+
...report.evidence.map(e => tr('task.evidence', { source:e.source, scope:e.scope, status:status(e.status), time:e.observed_at ?? tr('task.unknown'), freshness:status(e.freshness) })),
|
|
24
|
+
...report.limitations.map(reason => t('task.limit.' + reason, language, {}, reason)),
|
|
25
|
+
];
|
|
26
|
+
return wrapText(lines.map(line=>line.replace(/\x1b\[[0-?]*[ -/]*[@-~]/gu,'').replace(/[\p{Cc}\p{Cs}]/gu,'')), Math.max(2,width));
|
|
27
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
-
export const PROTOCOL_VERSION =
|
|
2
|
+
export const PROTOCOL_VERSION = 15 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;
|
|
@@ -7,7 +7,7 @@ export const EDITOR_FIELDS = {"global": [{"key": "theme", "label": "Statusline t
|
|
|
7
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" | "explain";
|
|
33
|
+
export type Operation = "describe" | "read" | "preview" | "apply" | "import" | "export" | "preset" | "read_ui_preferences" | "set_ui_language" | "review_import" | "explain" | "diagnose" | "profiles_read" | "profiles_apply" | "profile_import" | "profile_export" | "task_details";
|
|
34
34
|
export interface ItemGuidance {
|
|
35
35
|
source_kinds: string[];
|
|
36
36
|
measurement_scope: string;
|
|
@@ -193,6 +193,44 @@ export interface ExplainResult {
|
|
|
193
193
|
preview: PreviewResult;
|
|
194
194
|
instances: ExplainInstance[];
|
|
195
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
|
+
configuration?: ResolvedConfiguration;
|
|
227
|
+
output: { id: string; spans: Span[] }[];
|
|
228
|
+
instances: DiagnoseInstance[];
|
|
229
|
+
host_fields: {
|
|
230
|
+
worktree: { session_name: string | null; git_name: string | null; selected_source: string | null };
|
|
231
|
+
cache_miss: { status: string; causes: string[]; last_miss_at: number | null; tools_added: number | null; tools_removed: number | null; system_char_delta: number | null };
|
|
232
|
+
};
|
|
233
|
+
}
|
|
196
234
|
export interface LocalizedMessage {
|
|
197
235
|
key: string;
|
|
198
236
|
params: Record<string, unknown>;
|
|
@@ -215,6 +253,49 @@ export interface ReadResult {
|
|
|
215
253
|
installation: Record<string, unknown>;
|
|
216
254
|
capabilities: Capabilities;
|
|
217
255
|
backend_version: string;
|
|
256
|
+
configuration?: ResolvedConfiguration;
|
|
257
|
+
}
|
|
258
|
+
export type ConfigTarget = { kind: "user" } | { kind: "profile"; id: string } | { kind: "project"; path: string };
|
|
259
|
+
export interface DisplayProfile { id: string; name: string; display: DisplayDraft }
|
|
260
|
+
export interface ProjectBinding { root: string; profile_id: string }
|
|
261
|
+
export interface ProfileCollection { version: 1; profiles: DisplayProfile[]; bindings: ProjectBinding[] }
|
|
262
|
+
export interface ResolvedConfiguration {
|
|
263
|
+
target: ConfigTarget;
|
|
264
|
+
profile_id: string | null;
|
|
265
|
+
profile_name: string | null;
|
|
266
|
+
project_root: string | null;
|
|
267
|
+
reason: string;
|
|
268
|
+
shared_projects: string[];
|
|
269
|
+
}
|
|
270
|
+
export interface ProfilesResult extends ProfileCollection { revision: string; changed?: boolean; backup_dir?: string | null }
|
|
271
|
+
export interface ProfileImportResult { name: string; display: DisplayDraft }
|
|
272
|
+
export interface TaskEvidence {
|
|
273
|
+
source: string;
|
|
274
|
+
scope: string;
|
|
275
|
+
status: string;
|
|
276
|
+
observed_at: string | null;
|
|
277
|
+
freshness: "current" | "stale" | "unknown" | "newer_than_input";
|
|
278
|
+
}
|
|
279
|
+
export interface TaskAgentDetail {
|
|
280
|
+
id: string;
|
|
281
|
+
parent_id: string | null;
|
|
282
|
+
name: string | null;
|
|
283
|
+
status: string | null;
|
|
284
|
+
evidence: TaskEvidence[];
|
|
285
|
+
}
|
|
286
|
+
export interface TaskDetails {
|
|
287
|
+
version: 1;
|
|
288
|
+
session_id: string;
|
|
289
|
+
prompt_id: string | null;
|
|
290
|
+
captured_at: string;
|
|
291
|
+
status: string | null;
|
|
292
|
+
phase: string | null;
|
|
293
|
+
elapsed_seconds: number | null;
|
|
294
|
+
active_seconds: number | null;
|
|
295
|
+
progress: { completed: number; total: number } | null;
|
|
296
|
+
agents: TaskAgentDetail[];
|
|
297
|
+
evidence: TaskEvidence[];
|
|
298
|
+
limitations: string[];
|
|
218
299
|
}
|
|
219
300
|
export interface EditorField {
|
|
220
301
|
key: string;
|
|
@@ -274,12 +355,14 @@ export interface ApplyResult {
|
|
|
274
355
|
backend_version: string;
|
|
275
356
|
changed: boolean;
|
|
276
357
|
backup_dir: string | null;
|
|
358
|
+
configuration?: ResolvedConfiguration;
|
|
277
359
|
}
|
|
278
360
|
export interface ResultMap {
|
|
279
361
|
describe: DescribeResult;
|
|
280
362
|
read: ReadResult;
|
|
281
363
|
preview: PreviewResult;
|
|
282
364
|
explain: ExplainResult;
|
|
365
|
+
diagnose: DiagnoseResult;
|
|
283
366
|
apply: ApplyResult;
|
|
284
367
|
import: TransferResult;
|
|
285
368
|
review_import: ImportReviewResult;
|
|
@@ -287,6 +370,11 @@ export interface ResultMap {
|
|
|
287
370
|
preset: TransferResult;
|
|
288
371
|
read_ui_preferences: UiPreferencesResult;
|
|
289
372
|
set_ui_language: UiPreferencesResult;
|
|
373
|
+
profiles_read: ProfilesResult;
|
|
374
|
+
profiles_apply: ProfilesResult;
|
|
375
|
+
profile_import: ProfileImportResult;
|
|
376
|
+
profile_export: ExportResult;
|
|
377
|
+
task_details: TaskDetails;
|
|
290
378
|
}
|
|
291
379
|
export type ResultFor<O extends Operation> = ResultMap[O];
|
|
292
380
|
export interface Request {
|
|
@@ -294,5 +382,5 @@ export interface Request {
|
|
|
294
382
|
operation: Operation;
|
|
295
383
|
payload: unknown;
|
|
296
384
|
}
|
|
297
|
-
export type Result = ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult;
|
|
385
|
+
export type Result = DiagnoseResult | ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult | ProfilesResult | ProfileImportResult | TaskDetails;
|
|
298
386
|
export type Response = { protocol_version: typeof PROTOCOL_VERSION; result: Result } | { protocol_version: typeof PROTOCOL_VERSION; error: ProtocolError };
|