@fbincon/claude-code-statusline 3.9.2 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +79 -78
  2. package/candidate.json +347 -256
  3. package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js +8 -4
  4. package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js.map +1 -1
  5. package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.js +7 -18
  6. package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.js.map +1 -1
  7. package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/input.d.ts +5 -0
  8. package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/input.js +36 -0
  9. package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/input.js.map +1 -0
  10. package/node_modules/@fbincon/statusline-cli/dist/src/help.js +1 -1
  11. package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
  12. package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.d.ts +1 -1
  13. package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +4 -3
  14. package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
  15. package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.js +1 -1
  16. package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.js.map +1 -1
  17. package/node_modules/@fbincon/statusline-cli/dist/src/main.js +5 -1
  18. package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
  19. package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.d.ts +8 -0
  20. package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js +147 -0
  21. package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js.map +1 -0
  22. package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.d.ts +14 -1
  23. package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js +2 -1
  24. package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js.map +1 -1
  25. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.d.ts +15 -0
  26. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js +90 -0
  27. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js.map +1 -0
  28. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.d.ts +1 -0
  29. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.js +33 -0
  30. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.js.map +1 -0
  31. package/node_modules/@fbincon/statusline-cli/dist/src/management/review.d.ts +5 -0
  32. package/node_modules/@fbincon/statusline-cli/dist/src/management/review.js +44 -0
  33. package/node_modules/@fbincon/statusline-cli/dist/src/management/review.js.map +1 -0
  34. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.d.ts +4 -0
  35. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js +10 -3
  36. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js.map +1 -1
  37. package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js +2 -2
  38. package/node_modules/@fbincon/statusline-cli/dist/src/rendering/preview.js.map +1 -1
  39. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.d.ts +1 -0
  40. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js +11 -4
  41. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js.map +1 -1
  42. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.d.ts +3 -0
  43. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.js +25 -0
  44. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.js.map +1 -0
  45. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +6 -5
  46. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +40 -3
  47. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -1
  48. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +1 -1
  49. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +103 -57
  50. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +13 -7
  51. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +13 -1
  52. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +7 -2
  53. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/color-manager.ts +177 -0
  54. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/diagnosis-view.ts +123 -0
  55. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +7 -0
  56. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/explanation.ts +2 -1
  57. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/gradients.ts +10 -0
  58. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/package-manager.ts +314 -0
  59. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/package-validation.ts +43 -0
  60. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/preview-settings.ts +8 -0
  61. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/setup.ts +7 -0
  62. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/task-viewer.ts +319 -0
  63. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/themes.ts +40 -0
  64. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +86 -15
  65. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +834 -6
  66. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/presentation.ts +3 -1
  67. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +24 -17
  68. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +11 -3
  69. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +5 -2
  70. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +1 -1
  71. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +3 -3
  72. package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js +1 -1
  73. package/node_modules/@fbincon/statusline-core/dist/src/config/display.d.ts +1 -1
  74. package/node_modules/@fbincon/statusline-core/dist/src/config/display.js +6 -5
  75. package/node_modules/@fbincon/statusline-core/dist/src/config/display.js.map +1 -1
  76. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +89 -8
  77. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +7 -10
  78. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -1
  79. package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +14 -7
  80. package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
  81. package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.d.ts +23 -0
  82. package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.js +153 -0
  83. package/node_modules/@fbincon/statusline-core/dist/src/editor/color-manager.js.map +1 -0
  84. package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.d.ts +29 -0
  85. package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.js +107 -0
  86. package/node_modules/@fbincon/statusline-core/dist/src/editor/diagnosis-view.js.map +1 -0
  87. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +7 -0
  88. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +7 -0
  89. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
  90. package/node_modules/@fbincon/statusline-core/dist/src/editor/explanation.js +3 -1
  91. package/node_modules/@fbincon/statusline-core/dist/src/editor/explanation.js.map +1 -1
  92. package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.d.ts +9 -0
  93. package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.js +9 -0
  94. package/node_modules/@fbincon/statusline-core/dist/src/editor/gradients.js.map +1 -1
  95. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.d.ts +41 -0
  96. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js +281 -0
  97. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js.map +1 -0
  98. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.d.ts +3 -0
  99. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js +42 -0
  100. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js.map +1 -0
  101. package/node_modules/@fbincon/statusline-core/dist/src/editor/preview-settings.d.ts +7 -0
  102. package/node_modules/@fbincon/statusline-core/dist/src/editor/preview-settings.js +7 -0
  103. package/node_modules/@fbincon/statusline-core/dist/src/editor/preview-settings.js.map +1 -0
  104. package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.d.ts +4 -0
  105. package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js +17 -0
  106. package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js.map +1 -1
  107. package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.d.ts +46 -0
  108. package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js +279 -0
  109. package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js.map +1 -0
  110. package/node_modules/@fbincon/statusline-core/dist/src/editor/themes.d.ts +17 -0
  111. package/node_modules/@fbincon/statusline-core/dist/src/editor/themes.js +30 -0
  112. package/node_modules/@fbincon/statusline-core/dist/src/editor/themes.js.map +1 -0
  113. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +828 -0
  114. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +834 -6
  115. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
  116. package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js +2 -1
  117. package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js.map +1 -1
  118. package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +1 -1
  119. package/node_modules/@fbincon/statusline-core/dist/src/release.js +1 -1
  120. package/node_modules/@fbincon/statusline-core/dist/src/release.js.map +1 -1
  121. package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.d.ts +2 -1
  122. package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js +12 -13
  123. package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js.map +1 -1
  124. package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js +1 -1
  125. package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js.map +1 -1
  126. package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js +2 -0
  127. package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js.map +1 -1
  128. package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.d.ts +1 -1
  129. package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.js +2 -1
  130. package/node_modules/@fbincon/statusline-core/dist/src/rendering/gradients.js.map +1 -1
  131. package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js +5 -2
  132. package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js.map +1 -1
  133. package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +3 -3
  134. package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js.map +1 -1
  135. package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.d.ts +4 -1
  136. package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +2 -2
  137. package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js.map +1 -1
  138. package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.d.ts +2 -1
  139. package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js +8 -8
  140. package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js.map +1 -1
  141. package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.d.ts +11 -52
  142. package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js +48 -7
  143. package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js.map +1 -1
  144. package/node_modules/@fbincon/statusline-core/dist/src/rendering/sample-scenarios.d.ts +6 -0
  145. package/node_modules/@fbincon/statusline-core/dist/src/rendering/sample-scenarios.js +38 -0
  146. package/node_modules/@fbincon/statusline-core/dist/src/rendering/sample-scenarios.js.map +1 -0
  147. package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.d.ts +2 -1
  148. package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js +14 -17
  149. package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js.map +1 -1
  150. package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.d.ts +2 -1
  151. package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js +19 -1
  152. package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.js.map +1 -1
  153. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +139 -1
  154. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +139 -1
  155. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +139 -1
  156. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +139 -1
  157. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +139 -1
  158. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +139 -1
  159. package/node_modules/@fbincon/statusline-platform/dist/src/diagnostic-files.js +3 -2
  160. package/node_modules/@fbincon/statusline-platform/dist/src/diagnostic-files.js.map +1 -1
  161. package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.d.ts +4 -0
  162. package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.js +22 -0
  163. package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.js.map +1 -0
  164. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +22 -0
  165. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js.map +1 -1
  166. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js +12 -0
  167. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js.map +1 -1
  168. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js +9 -0
  169. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
  170. package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +9 -6
  171. package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
  172. package/node_modules/@fbincon/statusline-tui/dist/src/session.d.ts +3 -2
  173. package/node_modules/@fbincon/statusline-tui/dist/src/session.js +53 -7
  174. package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
  175. package/node_modules/@fbincon/statusline-tui/dist/src/setup.d.ts +2 -1
  176. package/node_modules/@fbincon/statusline-tui/dist/src/setup.js +7 -5
  177. package/node_modules/@fbincon/statusline-tui/dist/src/setup.js.map +1 -1
  178. package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +1 -1
  179. package/node_modules/@fbincon/statusline-tui/dist/src/state.js +62 -3
  180. package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
  181. package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.d.ts +6 -0
  182. package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.js +34 -0
  183. package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.js.map +1 -0
  184. package/package.json +3 -3
@@ -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
+ }
@@ -0,0 +1,40 @@
1
+ // Generated by tools/generation/resources.ts; do not edit.
2
+ /** One registry for persisted identities, selectors and production paint. */
3
+ export const THEME_IDS = ['classic', 'dark', 'light', 'terminal', 'ocean', 'ember', 'slate', 'blossom'] as const;
4
+ export type ThemeId = typeof THEME_IDS[number];
5
+ export const THEME_ROLES = ['model', 'directory', 'branch', 'percentage', 'tokens', 'timer'] as const;
6
+ export const ANSI_ROLES = [3, 2, 5, 3, 5, 6] as const;
7
+ export const ANSI_BLOCKS = [4, 2, 5, 3, 1, 6] as const;
8
+ export interface ThemeDefinition {
9
+ surface: 'dark' | 'light' | 'terminal';
10
+ foreground: readonly string[];
11
+ backgrounds: readonly string[];
12
+ blockText: string;
13
+ separator: string;
14
+ warning: string;
15
+ critical: string;
16
+ }
17
+ const dark: ThemeDefinition = {
18
+ surface: 'dark', foreground: ['#f6e2b7', '#abdfa7', '#c8a9ee', '#f2b590', '#e990a9', '#8ed3d3'],
19
+ backgrounds: ['#3c3548', '#234337', '#3d3155', '#543720', '#542b3c', '#1f4148'],
20
+ blockText: '#f4f5f7', separator: '#aab2bd', warning: '#f2b550', critical: '#f28686',
21
+ };
22
+ export const THEMES: Readonly<Record<ThemeId, ThemeDefinition>> = {
23
+ classic: dark, dark, terminal: { ...dark, surface: 'terminal' },
24
+ light: { surface: 'light', foreground: ['#664515', '#205727', '#633487', '#864511', '#93284a', '#126168'],
25
+ backgrounds: ['#eee1c4', '#d6ecd4', '#e7dcf2', '#f5dfce', '#f4d8e1', '#d1ecec'],
26
+ blockText: '#202630', separator: '#58616b', warning: '#805000', critical: '#a02020' },
27
+ ocean: { surface: 'dark', foreground: ['#7dd3fc', '#5eead4', '#a5b4fc', '#67e8f9', '#93c5fd', '#99f6e4'],
28
+ backgrounds: ['#173b56', '#16443f', '#303e68', '#164956', '#243f64', '#214844'],
29
+ blockText: '#f0f9ff', separator: '#94b9cc', warning: '#fbbf24', critical: '#fca5a5' },
30
+ ember: { surface: 'dark', foreground: ['#fcd34d', '#fdba74', '#fda4af', '#fed7aa', '#f9a8d4', '#fde68a'],
31
+ backgrounds: ['#4d3620', '#542f21', '#502b39', '#493b24', '#4e2d46', '#454023'],
32
+ blockText: '#fff7ed', separator: '#c9aa96', warning: '#fcd34d', critical: '#fca5a5' },
33
+ slate: { surface: 'dark', foreground: ['#cbd5e1', '#b4c7ba', '#c8bfd5', '#cfbea7', '#d0b8c0', '#adc8cb'],
34
+ backgrounds: ['#303b49', '#304239', '#3d3749', '#493d30', '#48353e', '#2d4145'],
35
+ blockText: '#f1f5f9', separator: '#94a3b8', warning: '#e8c584', critical: '#e9a4a7' },
36
+ blossom: { surface: 'light', foreground: ['#67416d', '#42654f', '#604987', '#8a4c61', '#765049', '#3d6471'],
37
+ backgrounds: ['#eddaec', '#dcebdd', '#e4dcf2', '#f5dce6', '#efdfd7', '#d8eaf0'],
38
+ blockText: '#302633', separator: '#786c80', warning: '#825300', critical: '#a52c4c' },
39
+ };
40
+ export function themeDefinition(id: string): ThemeDefinition { return THEMES[id as ThemeId] ?? THEMES.classic; }
@@ -1,5 +1,5 @@
1
1
  // Generated by tools/generation/resources.ts; do not edit.
2
- export const PROTOCOL_VERSION = 25 as const;
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;
@@ -76,12 +76,7 @@ export const EDITOR_FIELDS = {
76
76
  "label": "Statusline theme",
77
77
  "group": "Appearance",
78
78
  "kind": "choice",
79
- "choices": [
80
- "classic",
81
- "dark",
82
- "light",
83
- "terminal"
84
- ],
79
+ "choices": (["classic", "dark", "light", "terminal", "ocean", "ember", "slate", "blossom"] as const),
85
80
  "minimum": 0,
86
81
  "maximum": 10000,
87
82
  "nullable": false
@@ -489,7 +484,7 @@ export const FORMAT_DEFAULTS = {"model_name": "original", "number_format": "lega
489
484
  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-cost-rate" | "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" | "external-value" | "github-pr" | "github-ci";
490
485
  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" | "external-value";
491
486
  export type Palette = "default" | "ansi";
492
- export type Theme = "classic" | "dark" | "light" | "terminal";
487
+ export type Theme = typeof THEME_VALUES[number];
493
488
  export type PowerlineGlyph = "ascii" | "powerline";
494
489
  export type VisibilityRule = "always" | "git-dirty" | "nonzero" | "used-at-least";
495
490
  export type DirectoryStyle = "full" | "home" | "project-relative" | "basename";
@@ -501,7 +496,7 @@ export type UnavailableReason = "not_observed" | "unsupported_host" | "unknown_h
501
496
  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-cost-rate", "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", "external-value", "github-pr", "github-ci"] as const;
502
497
  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", "external-value"] as const;
503
498
  export const PALETTE_VALUES = ["default", "ansi"] as const;
504
- export const THEME_VALUES = ["classic", "dark", "light", "terminal"] as const;
499
+ export const THEME_VALUES = (["classic", "dark", "light", "terminal", "ocean", "ember", "slate", "blossom"] as const);
505
500
  export const POWERLINEGLYPH_VALUES = ["ascii", "powerline"] as const;
506
501
  export const VISIBILITYRULE_VALUES = ["always", "git-dirty", "nonzero", "used-at-least"] as const;
507
502
  export const DIRECTORYSTYLE_VALUES = ["full", "home", "project-relative", "basename"] as const;
@@ -509,7 +504,7 @@ export const SEPARATORSTYLE_VALUES = ["classic", "compact", "powerline"] as cons
509
504
  export const SCOPELABELS_VALUES = ["off", "when-subagents", "always"] as const;
510
505
  export const STATUSLINELANGUAGE_VALUES = ["en", "zh-CN", "zh-TW", "zh-HK", "ja", "ko"] as const;
511
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;
512
- 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', '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;
513
508
  export type Operation = typeof OPERATIONS[number];
514
509
  export interface ItemGuidance {
515
510
  source_kinds: string[];
@@ -659,7 +654,7 @@ export interface PowerlineDraft {
659
654
  }
660
655
  export interface DisplayDraft {
661
656
  groups: GroupDraft[];
662
- schema_version: 15;
657
+ schema_version: 16;
663
658
  statusline_language: StatuslineLanguage;
664
659
  instances: InstanceDraft[];
665
660
  use_colors: boolean;
@@ -751,14 +746,15 @@ export interface SourceReview { source: SourceDefinition; review_revision: strin
751
746
  export interface SourceMutationResult extends SourcesResult { binding?: SourceReference; backup_dir: string | null }
752
747
  export interface PreviewResult {
753
748
  sample: true;
749
+ scenario?: string;
754
750
  main: Span[][];
755
751
  subagents: Span[][];
756
752
  }
757
753
  export const SAMPLE_REASONS = ['sample_group_hidden','sample_visible','sample_empty','sample_condition_hidden','sample_truncated','sample_priority_omitted','sample_width_omitted','sample_row_hidden','sample_spacer'] as const;
758
754
  export type SampleReason = typeof SAMPLE_REASONS[number];
759
- export const EXPLAIN_REASONS = ['alignment_active','alignment_collapsed','cost_rate_session','cost_rate_api','indicator_bar','source_bound','source_unbound','configured_on','configured_off','scope_disabled','installation_owned','installation_absent','installation_foreign','installation_unknown','unknown_host_version','host_supported','unsupported_host','host_requirement_unknown','collector_unknown','native_timing_on','native_timing_off','live_metrics_on','live_metrics_off','actual_not_observed'] as const;
755
+ export const EXPLAIN_REASONS = ['collector_session_unobserved','diagnostic_input_missing_session','alignment_active','alignment_collapsed','cost_rate_session','cost_rate_api','indicator_bar','source_bound','source_unbound','configured_on','configured_off','scope_disabled','installation_owned','installation_absent','installation_foreign','installation_unknown','unknown_host_version','host_supported','unsupported_host','host_requirement_unknown','collector_unknown','native_timing_on','native_timing_off','live_metrics_on','live_metrics_off','actual_not_observed'] as const;
760
756
  export interface ExplainReason { code: string; origin: 'configuration' | 'local_configuration' | 'host_capability' | 'unknown'; }
761
- export interface InstanceSample { row_id: string; outcome: SampleReason; truncated: boolean; }
757
+ export interface InstanceSample { row_id: string; outcome: SampleReason; truncated: boolean; style_reasons?:StyleDecision[]; }
762
758
  export interface ExplainInstance {
763
759
  id: string; type_id: string; enabled: boolean;
764
760
  reasons: ExplainReason[];
@@ -774,7 +770,9 @@ export interface ExplainResult {
774
770
  }
775
771
  export const LAYOUT_REASONS = ['group_hidden','visible','empty','condition_hidden','priority_omitted','width_omitted','row_hidden','spacer'] as const;
776
772
  export type LayoutReason = typeof LAYOUT_REASONS[number];
777
- export interface InstanceLayout { row_id: string; outcome: LayoutReason; truncated: boolean; }
773
+ export const STYLE_REASONS = ['colors_disabled','background_gradient_requires_powerline','group_background_owned','threshold_warning','threshold_critical','color_quantized','contrast_protected'] as const;
774
+ export interface StyleDecision {code: typeof STYLE_REASONS[number];owner_id:string|null}
775
+ export interface InstanceLayout { row_id: string; outcome: LayoutReason; truncated: boolean; style_reasons?:StyleDecision[]; }
778
776
  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;
779
777
  export type EvidenceStatus = typeof EVIDENCE_STATUSES[number];
780
778
  export interface DiagnosticEvidence {
@@ -876,6 +874,74 @@ export interface TaskDetails {
876
874
  evidence: TaskEvidence[];
877
875
  limitations: string[];
878
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
+ }
879
945
  export interface EditorField {
880
946
  key: string;
881
947
  label: string;
@@ -937,6 +1003,10 @@ export interface ApplyResult {
937
1003
  configuration?: ResolvedConfiguration;
938
1004
  }
939
1005
  export interface ResultMap {
1006
+ package_status: PackageStatus;
1007
+ package_review_start: PackageReviewJob;
1008
+ package_review_status: PackageReviewJob;
1009
+ package_review_cancel: PackageReviewJob;
940
1010
  sources_read: SourcesResult;
941
1011
  sources_apply: SourceMutationResult;
942
1012
  source_review: SourceReview;
@@ -951,6 +1021,7 @@ export interface ResultMap {
951
1021
  preview: PreviewResult;
952
1022
  explain: ExplainResult;
953
1023
  diagnose: DiagnoseResult;
1024
+ diagnose_file: DiagnoseResult;
954
1025
  apply: ApplyResult;
955
1026
  import: TransferResult;
956
1027
  review_import: ImportReviewResult;
@@ -970,5 +1041,5 @@ export interface Request {
970
1041
  operation: Operation;
971
1042
  payload: unknown;
972
1043
  }
973
- 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;
974
1045
  export type Response = { protocol_version: typeof PROTOCOL_VERSION; result: Result } | { protocol_version: typeof PROTOCOL_VERSION; error: ProtocolError };