@fbincon/claude-code-statusline 3.10.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -78
- package/candidate.json +201 -148
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.d.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +2 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +5 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.d.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js +147 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.d.ts +14 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.d.ts +15 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js +90 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.js +33 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review.d.ts +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review.js +44 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/review.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js +10 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js +11 -4
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.js +25 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +3 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +23 -0
- 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 +77 -52
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +4 -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/package-manager.ts +314 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/package-validation.ts +43 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/task-viewer.ts +319 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +75 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +336 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +16 -13
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +3 -1
- 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/contracts/ui.d.ts +75 -3
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +2 -2
- 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 +5 -0
- 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 +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.d.ts +41 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js +281 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js +42 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.d.ts +46 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js +279 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +330 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +336 -6
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.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/resources/i18n/locales/en.json +56 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +56 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +56 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +56 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +56 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +56 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.js +22 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +10 -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 +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 +4 -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 +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.d.ts +3 -2
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +22 -4
- 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 +20 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.d.ts +6 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.js +34 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { PackageReviewRequest } from '../generated-contracts.ts';
|
|
3
|
+
const object = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
4
|
+
const string = (value: unknown): value is string => typeof value === 'string' && value.length <= 8192 && !/[\p{Cc}\p{Cs}]/u.test(value);
|
|
5
|
+
const nullable = (value: unknown) => value === null || string(value);
|
|
6
|
+
const exact = (value: Record<string, unknown>, keys: string[]) => Object.keys(value).sort().join(',') === keys.sort().join(',');
|
|
7
|
+
const strings = (value: unknown) => Array.isArray(value) && value.length <= 128 && value.every(string);
|
|
8
|
+
const channel = (value: unknown) => value === null || value === 'latest' || value === 'beta';
|
|
9
|
+
export function isPackageRequest(value: unknown): value is PackageReviewRequest {
|
|
10
|
+
return object(value) && exact(value, ['action', 'prefix', 'expected_revision', 'target', 'channel', 'backup_id', 'expected_integrity']) &&
|
|
11
|
+
['check', 'update', 'rollback', 'recover-package', 'restore-config'].includes(String(value.action)) && string(value.prefix) && !!value.prefix &&
|
|
12
|
+
typeof value.expected_revision === 'string' && /^[0-9a-f]{64}$/u.test(value.expected_revision) && nullable(value.target) &&
|
|
13
|
+
(value.target === null || /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u.test(String(value.target))) && channel(value.channel) &&
|
|
14
|
+
nullable(value.backup_id) && (value.backup_id === null || /^pkg-[0-9a-f-]{36}$/u.test(String(value.backup_id))) &&
|
|
15
|
+
nullable(value.expected_integrity) && (value.expected_integrity === null || /^sha512-[A-Za-z0-9+/]{86}==$/u.test(String(value.expected_integrity))) &&
|
|
16
|
+
!(value.target && value.channel) &&
|
|
17
|
+
(value.action !== 'restore-config' || !!value.backup_id && value.target === null && value.channel === null) &&
|
|
18
|
+
(['check', 'update'].includes(String(value.action)) || value.channel === null);
|
|
19
|
+
}
|
|
20
|
+
function history(value: unknown): boolean {
|
|
21
|
+
return object(value) && exact(value, ['id', 'version', 'created', 'stage', 'backup', 'running']) && string(value.id) && nullable(value.version) &&
|
|
22
|
+
nullable(value.created) && string(value.stage) && ['verified', 'missing', 'invalid'].includes(String(value.backup)) && typeof value.running === 'boolean';
|
|
23
|
+
}
|
|
24
|
+
function review(value: unknown): boolean {
|
|
25
|
+
return object(value) && exact(value, ['action', 'current', 'target', 'prefix', 'entry', 'config_dir', 'channel', 'registry', 'integrity', 'node_engine', 'host', 'artifact_verified', 'compatible', 'reasons', 'configuration_conflicts', 'backup_id', 'files']) &&
|
|
26
|
+
['check', 'update', 'rollback', 'recover-package', 'restore-config'].includes(String(value.action)) &&
|
|
27
|
+
['current', 'target', 'entry', 'registry', 'integrity', 'node_engine', 'host', 'backup_id'].every(key => nullable(value[key])) &&
|
|
28
|
+
string(value.prefix) && string(value.config_dir) && channel(value.channel) && typeof value.artifact_verified === 'boolean' && typeof value.compatible === 'boolean' &&
|
|
29
|
+
strings(value.reasons) && strings(value.configuration_conflicts) && strings(value.files);
|
|
30
|
+
}
|
|
31
|
+
export function isPackageResult(operation: string, value: unknown): boolean {
|
|
32
|
+
if (!object(value) || value.version !== 1)
|
|
33
|
+
return false;
|
|
34
|
+
if (operation === 'package_status')
|
|
35
|
+
return exact(value, ['version', 'backend_version', 'captured_at', 'revision', 'prefix', 'entry', 'config_dir', 'current', 'previous', 'channel', 'node_version', 'host', 'compatible', 'reasons', 'pending', 'history', 'offset', 'total']) &&
|
|
36
|
+
['backend_version', 'captured_at', 'revision', 'config_dir', 'node_version'].every(key => string(value[key])) && /^[0-9a-f]{64}$/u.test(String(value.revision)) &&
|
|
37
|
+
['prefix', 'entry', 'current', 'previous', 'host'].every(key => nullable(value[key])) && channel(value.channel) && typeof value.compatible === 'boolean' && strings(value.reasons) &&
|
|
38
|
+
(value.pending === null || history(value.pending)) && Array.isArray(value.history) && value.history.length <= 16 && value.history.every(history) &&
|
|
39
|
+
Number.isSafeInteger(value.offset) && Number(value.offset) >= 0 && Number.isSafeInteger(value.total) && Number(value.total) >= 0;
|
|
40
|
+
return exact(value, ['version', 'id', 'owner', 'state', 'started_at', 'finished_at', 'request', 'review', 'error']) &&
|
|
41
|
+
['id', 'owner', 'started_at'].every(key => string(value[key])) && ['running', 'complete', 'failed', 'cancelled'].includes(String(value.state)) &&
|
|
42
|
+
nullable(value.finished_at) && nullable(value.error) && isPackageRequest(value.request) && (value.review === null || review(value.review));
|
|
43
|
+
}
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/task-viewer.ts
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
import type { TaskDetails, TaskEvidence, TaskAgentDetail } from '../generated-contracts.ts';
|
|
3
|
+
import { t, text, renderMessage, type Language, type LocalizedText } from '../i18n/index.ts';
|
|
4
|
+
import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
|
|
5
|
+
import { wrapText } from '../../ui/text.ts';
|
|
6
|
+
import { clip as clipText } from '../unicode.ts';
|
|
7
|
+
import { BackendError } from '../backend.ts';
|
|
8
|
+
export interface TaskRow {
|
|
9
|
+
key: string;
|
|
10
|
+
text: string;
|
|
11
|
+
agent?: string;
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface TaskViewer {
|
|
15
|
+
session: string;
|
|
16
|
+
prompt: string | null;
|
|
17
|
+
report: TaskDetails | null;
|
|
18
|
+
language: Language;
|
|
19
|
+
warning: LocalizedText | null;
|
|
20
|
+
error: LocalizedText | string | null;
|
|
21
|
+
busy: boolean;
|
|
22
|
+
closed: boolean;
|
|
23
|
+
generation: number;
|
|
24
|
+
query: string;
|
|
25
|
+
status: string;
|
|
26
|
+
evidence: boolean;
|
|
27
|
+
collapsed: string[];
|
|
28
|
+
selected: string;
|
|
29
|
+
scroll: number;
|
|
30
|
+
rows: TaskRow[];
|
|
31
|
+
capacity: number;
|
|
32
|
+
cache: {
|
|
33
|
+
report: TaskDetails | null;
|
|
34
|
+
key: string;
|
|
35
|
+
rows: TaskRow[];
|
|
36
|
+
} | null;
|
|
37
|
+
input: 'session' | 'prompt' | 'search' | null;
|
|
38
|
+
sessionInput: TextInput;
|
|
39
|
+
promptInput: TextInput;
|
|
40
|
+
searchInput: TextInput;
|
|
41
|
+
}
|
|
42
|
+
export function taskViewer(session = '', prompt: string | null = null, language: Language = 'en'): TaskViewer {
|
|
43
|
+
return { session, prompt, language, report: null, warning: null, error: null, busy: false, closed: false, generation: 0,
|
|
44
|
+
query: '', status: '', evidence: false, collapsed: [], selected: '', scroll: 0, rows: [], capacity: 1, cache: null,
|
|
45
|
+
input: session ? null : 'session', sessionInput: textInput(session), promptInput: textInput(prompt ?? ''), searchInput: textInput('') };
|
|
46
|
+
}
|
|
47
|
+
export function receiveTask(view: TaskViewer, report: TaskDetails): void {
|
|
48
|
+
if (view.report && report.evidence.length && report.evidence.every(e => ['source_unavailable', 'invalid_field', 'session_mismatch', 'preferences_unavailable'].includes(e.status)))
|
|
49
|
+
throw new BackendError('task_read_failed', text('task.viewer.read_failed'));
|
|
50
|
+
if (report.session_id !== view.session || view.prompt !== null && report.prompt_id === null)
|
|
51
|
+
throw new BackendError('invalid_request', text('task.error.input'));
|
|
52
|
+
if (view.report && view.report.prompt_id !== report.prompt_id) {
|
|
53
|
+
view.selected = '';
|
|
54
|
+
view.scroll = 0;
|
|
55
|
+
view.collapsed = [];
|
|
56
|
+
}
|
|
57
|
+
view.report = report;
|
|
58
|
+
view.collapsed = view.collapsed.filter(id => report.agents.some(agent => agent.id === id));
|
|
59
|
+
view.error = null;
|
|
60
|
+
}
|
|
61
|
+
export async function readTask(view: TaskViewer, backend: {
|
|
62
|
+
request(operation: 'read_ui_preferences' | 'task_details', payload?: unknown): unknown | Promise<unknown>;
|
|
63
|
+
}, hostAgents?: unknown, fixedLanguage?: Language): Promise<void> {
|
|
64
|
+
if (view.busy || view.closed || !view.session)
|
|
65
|
+
return;
|
|
66
|
+
view.busy = true;
|
|
67
|
+
const generation = view.generation;
|
|
68
|
+
try {
|
|
69
|
+
try {
|
|
70
|
+
const preference = await backend.request('read_ui_preferences') as {
|
|
71
|
+
ui_language: Language;
|
|
72
|
+
warning: LocalizedText | null;
|
|
73
|
+
};
|
|
74
|
+
if (view.closed || view.generation !== generation)
|
|
75
|
+
return;
|
|
76
|
+
view.language = fixedLanguage ?? preference.ui_language;
|
|
77
|
+
view.warning = preference.warning;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
if (view.closed || view.generation !== generation)
|
|
81
|
+
return;
|
|
82
|
+
view.language = fixedLanguage ?? 'en';
|
|
83
|
+
view.warning = text('task.language_unavailable');
|
|
84
|
+
}
|
|
85
|
+
const report = await backend.request('task_details', { session_id: view.session, prompt_id: view.prompt,
|
|
86
|
+
...(hostAgents ? { host_agents: hostAgents } : {}) }) as TaskDetails;
|
|
87
|
+
if (view.closed || view.generation !== generation)
|
|
88
|
+
return;
|
|
89
|
+
receiveTask(view, report);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (!view.closed && view.generation === generation)
|
|
93
|
+
view.error = error instanceof BackendError && error.localization ? error.localization : text('task.viewer.read_failed');
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
if (view.generation === generation)
|
|
97
|
+
view.busy = false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const safe = (value: string) => value.replace(/\x1b\[[0-?]*[ -/]*[@-~]/gu, '').replace(/[\p{Cc}\p{Cs}]/gu, '');
|
|
101
|
+
const validIdentity = (value: string) => !!value && [...value].length <= 1024 && !/[\p{Cc}\p{Cs}]/u.test(value);
|
|
102
|
+
export function taskViewerRows(view: TaskViewer, width: number): TaskRow[] {
|
|
103
|
+
const cacheKey = JSON.stringify([width, view.language, view.query, view.status, view.evidence, view.collapsed, view.busy]);
|
|
104
|
+
if (view.cache?.report === view.report && view.cache?.key === cacheKey)
|
|
105
|
+
return view.cache.rows;
|
|
106
|
+
const language = view.language, tr = (key: string, params: Record<string, unknown> = {}) => t(key, language, params);
|
|
107
|
+
const status = (value: string | null) => value === null ? tr('task.unknown') : t('task.value.' + value, language, {}, value);
|
|
108
|
+
const duration = (value: number | null) => value === null ? tr('task.unknown') : value.toFixed(1) + 's';
|
|
109
|
+
const rows: TaskRow[] = [], add = (key: string, value: string, agent?: string) => {
|
|
110
|
+
wrapText([safe(value)], Math.max(2, width)).forEach((text, index) => rows.push({ key: key + ':' + index, text, ...(agent ? { agent } : {}) }));
|
|
111
|
+
};
|
|
112
|
+
const evidence = (prefix: string, values: TaskEvidence[]) => values.forEach((e, index) => add(prefix + ':' + e.source + ':' + e.scope + ':' + index, tr('task.evidence', { source: e.source, scope: e.scope, status: status(e.status), time: e.observed_at ?? tr('task.unknown'), freshness: status(e.freshness) })));
|
|
113
|
+
const report = view.report;
|
|
114
|
+
if (!report) {
|
|
115
|
+
add('empty', tr(view.busy ? 'profiles.loading' : 'task.unknown'));
|
|
116
|
+
return rows;
|
|
117
|
+
}
|
|
118
|
+
add('captured', tr('task.captured', { value: report.captured_at }));
|
|
119
|
+
add('status', tr('task.status', { value: status(report.status), phase: status(report.phase) }));
|
|
120
|
+
add('elapsed', tr('task.elapsed', { value: duration(report.elapsed_seconds) }));
|
|
121
|
+
add('active', tr('task.active', { value: duration(report.active_seconds) }));
|
|
122
|
+
add('progress', tr('task.progress', { value: report.progress ? report.progress.completed + '/' + report.progress.total : tr('task.unknown') }));
|
|
123
|
+
add('agents', tr('task.agents'));
|
|
124
|
+
const agents = new Map(report.agents.map(agent => [agent.id, agent]));
|
|
125
|
+
const childrenByParent = new Map<string, TaskAgentDetail[]>();
|
|
126
|
+
for (const agent of report.agents)
|
|
127
|
+
if (agent.parent_id) {
|
|
128
|
+
const children = childrenByParent.get(agent.parent_id) ?? [];
|
|
129
|
+
children.push(agent);
|
|
130
|
+
childrenByParent.set(agent.parent_id, children);
|
|
131
|
+
}
|
|
132
|
+
const collapsedAgents = new Set(view.collapsed);
|
|
133
|
+
const matched = new Set(report.agents.filter(agent => (!view.status || (agent.status ?? 'unknown') === view.status) &&
|
|
134
|
+
(!view.query || (agent.id + '\n' + (agent.name ?? '')).toLowerCase().includes(view.query.toLowerCase()))).map(agent => agent.id));
|
|
135
|
+
const included = new Set(matched);
|
|
136
|
+
for (const id of matched) {
|
|
137
|
+
let parent = agents.get(id)?.parent_id;
|
|
138
|
+
const seen = new Set([id]);
|
|
139
|
+
while (parent && agents.has(parent) && !seen.has(parent) && !included.has(parent)) {
|
|
140
|
+
seen.add(parent);
|
|
141
|
+
included.add(parent);
|
|
142
|
+
parent = agents.get(parent)?.parent_id ?? null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const visited = new Set<string>(), filtering = !!(view.query || view.status);
|
|
146
|
+
const append = (agent: TaskAgentDetail, depth: number) => {
|
|
147
|
+
if (visited.has(agent.id) || !included.has(agent.id))
|
|
148
|
+
return;
|
|
149
|
+
visited.add(agent.id);
|
|
150
|
+
const children = (childrenByParent.get(agent.id) ?? []).filter(child => included.has(child.id));
|
|
151
|
+
const collapsed = !filtering && collapsedAgents.has(agent.id);
|
|
152
|
+
add('agent:' + agent.id, ' '.repeat(Math.min(depth, 8)) + (children.length ? collapsed ? '▸ ' : '▾ ' : ' ') +
|
|
153
|
+
(agent.name ?? agent.id) + ' [' + agent.id + ']: ' + status(agent.status) +
|
|
154
|
+
(matched.has(agent.id) ? '' : ' · ' + tr('task.viewer.context')), agent.id);
|
|
155
|
+
if (view.evidence)
|
|
156
|
+
evidence('agent-evidence:' + agent.id, agent.evidence);
|
|
157
|
+
if (!collapsed)
|
|
158
|
+
children.forEach(child => append(child, depth + 1));
|
|
159
|
+
};
|
|
160
|
+
report.agents.filter(agent => !agent.parent_id || !agents.has(agent.parent_id)).forEach(agent => append(agent, 0));
|
|
161
|
+
// Defensive cycle handling for a malformed wire response; never invent a parent.
|
|
162
|
+
report.agents.filter(agent => included.has(agent.id) && !visited.has(agent.id) &&
|
|
163
|
+
!(agent.parent_id && agents.has(agent.parent_id) && collapsedAgents.has(agent.parent_id) && !filtering)).forEach(agent => {
|
|
164
|
+
let parent = agent.parent_id;
|
|
165
|
+
const seen = new Set([agent.id]);
|
|
166
|
+
while (parent && agents.has(parent) && !seen.has(parent)) {
|
|
167
|
+
if (!filtering && collapsedAgents.has(parent))
|
|
168
|
+
return;
|
|
169
|
+
seen.add(parent);
|
|
170
|
+
parent = agents.get(parent)?.parent_id ?? null;
|
|
171
|
+
}
|
|
172
|
+
if (parent && seen.has(parent))
|
|
173
|
+
append(agent, 0);
|
|
174
|
+
});
|
|
175
|
+
if (!matched.size)
|
|
176
|
+
add('no-agents', tr('task.viewer.no_matches'));
|
|
177
|
+
if (view.evidence) {
|
|
178
|
+
add('sources', tr('task.sources'));
|
|
179
|
+
evidence('evidence', report.evidence);
|
|
180
|
+
}
|
|
181
|
+
report.limitations.forEach(reason => add('limit:' + reason, t('task.limit.' + reason, language, {}, reason)));
|
|
182
|
+
view.cache = { report: view.report, key: cacheKey, rows };
|
|
183
|
+
return rows;
|
|
184
|
+
}
|
|
185
|
+
/** Header identity and error remain visible while the evidence body pages. */
|
|
186
|
+
export function taskViewerView(view: TaskViewer, width: number, height: number): TaskRow[] {
|
|
187
|
+
const tr = (key: string, params: Record<string, unknown> = {}) => t(key, view.language, params);
|
|
188
|
+
const header: TaskRow[] = [
|
|
189
|
+
{ key: 'identity-session', text: tr('task.session', { value: view.input === 'session' ? inputView(view.sessionInput, Math.max(2, width - 12)) : view.session || tr('task.unknown') }) },
|
|
190
|
+
{ key: 'identity-prompt', text: tr('task.prompt', { value: view.input === 'prompt' ? inputView(view.promptInput, Math.max(2, width - 12)) : view.report?.prompt_id ?? view.prompt ?? tr('task.viewer.current') }) },
|
|
191
|
+
];
|
|
192
|
+
const detail = view.input === 'session' || view.input === 'prompt' ? tr('task.viewer.identity_help') : view.input === 'search' ? '/ ' + inputView(view.searchInput, Math.max(2, width - 2)) :
|
|
193
|
+
tr('task.viewer.filter', { status: view.status ? t('task.value.' + view.status, view.language, {}, view.status) : tr('task.viewer.all'), query: view.query || '—' });
|
|
194
|
+
header.push({ key: 'controls', text: detail });
|
|
195
|
+
if (view.warning)
|
|
196
|
+
header.push({ key: 'warning', text: renderMessage(view.warning, view.language) });
|
|
197
|
+
if (view.error)
|
|
198
|
+
header.push({ key: 'error', text: renderMessage(view.error, view.language) + (view.report ? ' · ' + tr('task.captured', { value: view.report.captured_at }) : '') });
|
|
199
|
+
const rows = taskViewerRows(view, width);
|
|
200
|
+
const previous = view.rows.findIndex(row => row.key === view.selected);
|
|
201
|
+
let index = rows.findIndex(row => row.key === view.selected);
|
|
202
|
+
if (index < 0 && view.selected) {
|
|
203
|
+
const logical = view.selected.replace(/:\d+$/u, '');
|
|
204
|
+
index = rows.findIndex(row => row.key.replace(/:\d+$/u, '') === logical);
|
|
205
|
+
}
|
|
206
|
+
if (index < 0)
|
|
207
|
+
index = Math.max(0, Math.min(previous, rows.length - 1));
|
|
208
|
+
view.selected = rows[index]?.key ?? '';
|
|
209
|
+
view.rows = rows;
|
|
210
|
+
view.capacity = Math.max(1, height - header.length);
|
|
211
|
+
view.scroll = Math.max(0, Math.min(view.scroll, index, Math.max(0, rows.length - view.capacity)));
|
|
212
|
+
if (index >= view.scroll + view.capacity)
|
|
213
|
+
view.scroll = index - view.capacity + 1;
|
|
214
|
+
// Body rows were sanitized and wrapped for this width once. Re-scanning every
|
|
215
|
+
// grapheme on each page or native capacity probe makes large reports costly.
|
|
216
|
+
const boundedHeader = header.map(row => ({ ...row, text: clipText(safe(row.text), Math.max(1, width)) }));
|
|
217
|
+
const body = rows.slice(view.scroll, view.scroll + view.capacity).map(row => ({ ...row,
|
|
218
|
+
...(width < 2 ? { text: clipText(row.text, 1) } : {}), selected: row.key === view.selected }));
|
|
219
|
+
return [...boundedHeader, ...body].slice(0, Math.max(1, height));
|
|
220
|
+
}
|
|
221
|
+
export function taskViewerKey(view: TaskViewer, event: TextKey): 'read' | 'close' | null {
|
|
222
|
+
const key = event.key === 'return' ? 'enter' : event.key;
|
|
223
|
+
const cancel = !event.text && !event.paste && (key === 'escape' || event.ctrl && key.toLowerCase() === 'g');
|
|
224
|
+
if (view.input) {
|
|
225
|
+
if (cancel) {
|
|
226
|
+
view.input = null;
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
if (!event.text && !event.paste && key === 'tab' && view.input !== 'search') {
|
|
230
|
+
view.input = view.input === 'session' ? 'prompt' : 'session';
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
if (!event.text && !event.paste && key === 'enter') {
|
|
234
|
+
if (view.input === 'search') {
|
|
235
|
+
view.query = view.searchInput.value;
|
|
236
|
+
view.input = null;
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
if (!validIdentity(view.sessionInput.value) || view.promptInput.value && !validIdentity(view.promptInput.value)) {
|
|
240
|
+
view.error = text('task.error.input');
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
const changed = view.session !== view.sessionInput.value || view.prompt !== (view.promptInput.value || null);
|
|
244
|
+
if (changed) {
|
|
245
|
+
view.generation++;
|
|
246
|
+
view.busy = false;
|
|
247
|
+
view.report = null;
|
|
248
|
+
view.selected = '';
|
|
249
|
+
view.scroll = 0;
|
|
250
|
+
view.collapsed = [];
|
|
251
|
+
view.query = '';
|
|
252
|
+
view.status = '';
|
|
253
|
+
}
|
|
254
|
+
view.session = view.sessionInput.value;
|
|
255
|
+
view.prompt = view.promptInput.value || null;
|
|
256
|
+
view.input = null;
|
|
257
|
+
return 'read';
|
|
258
|
+
}
|
|
259
|
+
const field = view.input === 'session' ? 'sessionInput' : view.input === 'prompt' ? 'promptInput' : 'searchInput';
|
|
260
|
+
const result = inputKey(view[field].value, view[field], event, field === 'searchInput' ? 256 : 1024);
|
|
261
|
+
view[field] = result.state;
|
|
262
|
+
if (result.error)
|
|
263
|
+
view.error = text('input.' + result.error, { limit: field === 'searchInput' ? 256 : 1024 });
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
if (event.text || event.paste || event.meta)
|
|
267
|
+
return null;
|
|
268
|
+
if (cancel || !event.ctrl && key.toLowerCase() === 'q') {
|
|
269
|
+
view.closed = true;
|
|
270
|
+
view.generation++;
|
|
271
|
+
return 'close';
|
|
272
|
+
}
|
|
273
|
+
if (event.ctrl)
|
|
274
|
+
return null;
|
|
275
|
+
if (key.toLowerCase() === 'r')
|
|
276
|
+
return 'read';
|
|
277
|
+
if (key.toLowerCase() === 's') {
|
|
278
|
+
view.sessionInput = textInput(view.session);
|
|
279
|
+
view.promptInput = textInput(view.prompt ?? '');
|
|
280
|
+
view.input = 'session';
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
if (key === '/') {
|
|
284
|
+
view.searchInput = textInput(view.query);
|
|
285
|
+
view.input = 'search';
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
if (key.toLowerCase() === 'e') {
|
|
289
|
+
view.evidence = !view.evidence;
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
if (key.toLowerCase() === 'f') {
|
|
293
|
+
const statuses = ['', ...new Set(view.report?.agents.map(agent => agent.status ?? 'unknown') ?? [])].sort();
|
|
294
|
+
view.status = statuses[(statuses.indexOf(view.status) + 1) % statuses.length]!;
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
let index = Math.max(0, view.rows.findIndex(row => row.key === view.selected));
|
|
298
|
+
if (key === 'up')
|
|
299
|
+
index--;
|
|
300
|
+
if (key === 'down')
|
|
301
|
+
index++;
|
|
302
|
+
if (key === 'pageup' || key.toLowerCase() === 'k')
|
|
303
|
+
index -= view.capacity;
|
|
304
|
+
if (key === 'pagedown' || key.toLowerCase() === 'j')
|
|
305
|
+
index += view.capacity;
|
|
306
|
+
if (key === 'home')
|
|
307
|
+
index = 0;
|
|
308
|
+
if (key === 'end')
|
|
309
|
+
index = view.rows.length - 1;
|
|
310
|
+
const agent = view.rows[index]?.agent;
|
|
311
|
+
if (agent && ['left', 'right', 'enter'].includes(key)) {
|
|
312
|
+
if (key === 'left' || key === 'enter' && !view.collapsed.includes(agent))
|
|
313
|
+
view.collapsed = [...new Set([...view.collapsed, agent])];
|
|
314
|
+
else
|
|
315
|
+
view.collapsed = view.collapsed.filter(id => id !== agent);
|
|
316
|
+
}
|
|
317
|
+
view.selected = view.rows[Math.max(0, Math.min(index, view.rows.length - 1))]?.key ?? '';
|
|
318
|
+
return null;
|
|
319
|
+
}
|
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 = 27 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", "cost_rate"]} as const;
|
|
@@ -504,7 +504,7 @@ export const SEPARATORSTYLE_VALUES = ["classic", "compact", "powerline"] as cons
|
|
|
504
504
|
export const SCOPELABELS_VALUES = ["off", "when-subagents", "always"] as const;
|
|
505
505
|
export const STATUSLINELANGUAGE_VALUES = ["en", "zh-CN", "zh-TW", "zh-HK", "ja", "ko"] as const;
|
|
506
506
|
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;
|
|
507
|
-
export const OPERATIONS = ['sources_read', 'sources_apply', 'source_review', 'source_context', 'source_refresh', 'source_status', 'source_release', 'source_cancel', 'source_diagnose', 'describe', 'read', 'preview', 'apply', 'import', 'export', 'preset', 'read_ui_preferences', 'set_ui_language', 'review_import', 'explain', 'diagnose', 'diagnose_file', 'profiles_read', 'profiles_apply', 'profile_import', 'profile_export', 'task_details'] as const;
|
|
507
|
+
export const OPERATIONS = ['package_status', 'package_review_start', 'package_review_status', 'package_review_cancel', 'sources_read', 'sources_apply', 'source_review', 'source_context', 'source_refresh', 'source_status', 'source_release', 'source_cancel', 'source_diagnose', 'describe', 'read', 'preview', 'apply', 'import', 'export', 'preset', 'read_ui_preferences', 'set_ui_language', 'review_import', 'explain', 'diagnose', 'diagnose_file', 'profiles_read', 'profiles_apply', 'profile_import', 'profile_export', 'task_details'] as const;
|
|
508
508
|
export type Operation = typeof OPERATIONS[number];
|
|
509
509
|
export interface ItemGuidance {
|
|
510
510
|
source_kinds: string[];
|
|
@@ -874,6 +874,74 @@ export interface TaskDetails {
|
|
|
874
874
|
evidence: TaskEvidence[];
|
|
875
875
|
limitations: string[];
|
|
876
876
|
}
|
|
877
|
+
/** Read-only package inspection. These views do not grant installation authority. */
|
|
878
|
+
export interface PackageStatus {
|
|
879
|
+
version: 1;
|
|
880
|
+
backend_version: string;
|
|
881
|
+
captured_at: string;
|
|
882
|
+
revision: string;
|
|
883
|
+
prefix: string | null;
|
|
884
|
+
entry: string | null;
|
|
885
|
+
config_dir: string;
|
|
886
|
+
current: string | null;
|
|
887
|
+
previous: string | null;
|
|
888
|
+
channel: 'latest' | 'beta' | null;
|
|
889
|
+
node_version: string;
|
|
890
|
+
host: string | null;
|
|
891
|
+
compatible: boolean;
|
|
892
|
+
reasons: string[];
|
|
893
|
+
pending: PackageHistoryRow | null;
|
|
894
|
+
history: PackageHistoryRow[];
|
|
895
|
+
offset: number;
|
|
896
|
+
total: number;
|
|
897
|
+
}
|
|
898
|
+
export interface PackageHistoryRow {
|
|
899
|
+
id: string;
|
|
900
|
+
version: string | null;
|
|
901
|
+
created: string | null;
|
|
902
|
+
stage: string;
|
|
903
|
+
backup: 'verified' | 'missing' | 'invalid';
|
|
904
|
+
running: boolean;
|
|
905
|
+
}
|
|
906
|
+
export interface PackageReviewRequest {
|
|
907
|
+
action: 'check' | 'update' | 'rollback' | 'recover-package' | 'restore-config';
|
|
908
|
+
prefix: string;
|
|
909
|
+
expected_revision: string;
|
|
910
|
+
target: string | null;
|
|
911
|
+
channel: 'latest' | 'beta' | null;
|
|
912
|
+
backup_id: string | null;
|
|
913
|
+
expected_integrity: string | null;
|
|
914
|
+
}
|
|
915
|
+
export interface PackageReviewView {
|
|
916
|
+
action: PackageReviewRequest['action'];
|
|
917
|
+
current: string | null;
|
|
918
|
+
target: string | null;
|
|
919
|
+
prefix: string;
|
|
920
|
+
entry: string | null;
|
|
921
|
+
config_dir: string;
|
|
922
|
+
channel: 'latest' | 'beta' | null;
|
|
923
|
+
registry: string | null;
|
|
924
|
+
integrity: string | null;
|
|
925
|
+
node_engine: string | null;
|
|
926
|
+
host: string | null;
|
|
927
|
+
artifact_verified: boolean;
|
|
928
|
+
compatible: boolean;
|
|
929
|
+
reasons: string[];
|
|
930
|
+
configuration_conflicts: string[];
|
|
931
|
+
backup_id: string | null;
|
|
932
|
+
files: string[];
|
|
933
|
+
}
|
|
934
|
+
export interface PackageReviewJob {
|
|
935
|
+
version: 1;
|
|
936
|
+
id: string;
|
|
937
|
+
owner: string;
|
|
938
|
+
state: 'running' | 'complete' | 'failed' | 'cancelled';
|
|
939
|
+
started_at: string;
|
|
940
|
+
finished_at: string | null;
|
|
941
|
+
request: PackageReviewRequest;
|
|
942
|
+
review: PackageReviewView | null;
|
|
943
|
+
error: string | null;
|
|
944
|
+
}
|
|
877
945
|
export interface EditorField {
|
|
878
946
|
key: string;
|
|
879
947
|
label: string;
|
|
@@ -935,6 +1003,10 @@ export interface ApplyResult {
|
|
|
935
1003
|
configuration?: ResolvedConfiguration;
|
|
936
1004
|
}
|
|
937
1005
|
export interface ResultMap {
|
|
1006
|
+
package_status: PackageStatus;
|
|
1007
|
+
package_review_start: PackageReviewJob;
|
|
1008
|
+
package_review_status: PackageReviewJob;
|
|
1009
|
+
package_review_cancel: PackageReviewJob;
|
|
938
1010
|
sources_read: SourcesResult;
|
|
939
1011
|
sources_apply: SourceMutationResult;
|
|
940
1012
|
source_review: SourceReview;
|
|
@@ -969,5 +1041,5 @@ export interface Request {
|
|
|
969
1041
|
operation: Operation;
|
|
970
1042
|
payload: unknown;
|
|
971
1043
|
}
|
|
972
|
-
export type Result = DiagnoseResult | ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult | ProfilesResult | ProfileImportResult | TaskDetails;
|
|
1044
|
+
export type Result = PackageStatus | PackageReviewJob | DiagnoseResult | ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult | ProfilesResult | ProfileImportResult | TaskDetails;
|
|
973
1045
|
export type Response = { protocol_version: typeof PROTOCOL_VERSION; result: Result } | { protocol_version: typeof PROTOCOL_VERSION; error: ProtocolError };
|