@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,177 @@
1
+ // Generated by tools/generation/resources.ts; do not edit.
2
+ import type { Draft, Scope, Span } from '../generated-contracts.ts';
3
+ import type { Editor } from './draft.ts';
4
+ import { copyDraft } from './draft.ts';
5
+ import { THEME_IDS, ANSI_ROLES, ANSI_BLOCKS, themeDefinition } from './themes.ts';
6
+ import { GRADIENT_PRESETS, GRADIENT_SURFACES, parseGradient, gradientName } from './gradients.ts';
7
+ import { normalizeColor, validColor } from './appearance.ts';
8
+ import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
9
+ import { t, type Language } from '../i18n/index.ts';
10
+ export interface ColorManager {
11
+ kind: 'theme' | 'solid' | 'gradient';
12
+ key: string;
13
+ scope: Scope;
14
+ id: string;
15
+ cursor: number;
16
+ candidate: string | string[] | null;
17
+ generation: number;
18
+ input: TextInput | null;
19
+ editing: number | null;
20
+ error: boolean;
21
+ }
22
+ interface Choice {
23
+ id: string;
24
+ label: string;
25
+ value?: string | string[] | null;
26
+ colors?: readonly string[];
27
+ surface?: string;
28
+ }
29
+ export function openColors(e: Editor, key: string): boolean {
30
+ if (!['field:theme', 'item:foreground', 'item:background', 'item:foreground_gradient', 'item:background_gradient'].includes(key))
31
+ return false;
32
+ if (!e.canMutateDraft())
33
+ return true;
34
+ const kind = key === 'field:theme' ? 'theme' : key.endsWith('_gradient') ? 'gradient' : 'solid';
35
+ const detail = e.detail, node = detail ? e.instance(detail.scope, detail.id) : null;
36
+ const value = kind === 'theme' ? e.draft.display.theme : node?.options[key.slice(5) as 'foreground'] ?? null;
37
+ e.colors = { kind, key, scope: detail?.scope ?? 'main', id: detail?.id ?? '', cursor: 0, candidate: Array.isArray(value) ? [...value] : value, generation: e.mutationGeneration, input: null, editing: null, error: false };
38
+ return true;
39
+ }
40
+ function choices(e: Editor, language: Language): Choice[] {
41
+ const m = e.colors!, tr = (key: string) => t('colors.' + key, language);
42
+ let rows: Choice[];
43
+ if (m.kind === 'theme')
44
+ rows = THEME_IDS.map(id => ({ id, label: t('values.' + id, language), value: id, colors: id === 'terminal' ? (e.draft.display.separator_style === 'powerline' ? ANSI_BLOCKS : ANSI_ROLES).map(value => 'ansi:' + value) : e.draft.display.separator_style === 'powerline' ? themeDefinition(id).backgrounds : themeDefinition(id).foreground, surface: themeDefinition(id).surface }));
45
+ else if (m.kind === 'solid') {
46
+ const definition = themeDefinition(e.draft.display.theme);
47
+ const values = [...new Set([...definition.foreground, ...definition.backgrounds])];
48
+ rows = [{ id: 'inherit', label: tr('inherit'), value: null }, { id: 'default', label: tr('default'), value: 'default' },
49
+ ...Array.from({ length: 16 }, (_, i) => ({ id: 'ansi:' + i, label: 'ANSI ' + i, value: 'ansi:' + i, colors: ['ansi:' + i] })),
50
+ ...values.map(color => ({ id: color, label: color, value: color, colors: [color] })), { id: 'custom', label: tr('custom') }];
51
+ }
52
+ else {
53
+ rows = [{ id: 'off', label: tr('off'), value: null }, ...Object.entries(GRADIENT_PRESETS).map(([id, colors]) => ({ id, label: t('gradients.preset.' + id, language), value: [...colors], colors, surface: GRADIENT_SURFACES[id as keyof typeof GRADIENT_PRESETS] })),
54
+ { id: 'custom', label: tr('custom') }, { id: 'reverse', label: tr('reverse') },
55
+ ...(Array.isArray(m.candidate) ? m.candidate.map((color, i) => ({ id: 'stop:' + i, label: tr('stop') + ' ' + (i + 1) + ' ' + color, colors: [color] })) : []),
56
+ { id: 'add', label: tr('add') }, { id: 'remove', label: tr('remove') }];
57
+ }
58
+ return [...rows, { id: 'apply', label: tr('apply') }, { id: 'cancel', label: tr('cancel') }];
59
+ }
60
+ export function colorDraft(e: Editor): Draft {
61
+ const m = e.colors;
62
+ if (!m)
63
+ return e.draft;
64
+ const draft = copyDraft(e.draft);
65
+ if (m.kind === 'theme')
66
+ draft.display.theme = m.candidate as Draft['display']['theme'];
67
+ else {
68
+ const node = (m.scope === 'main' ? draft.display.instances : draft.display.subagents.instances).find(n => n.id === m.id);
69
+ if (node)
70
+ (node.options as unknown as Record<string, unknown>)[m.key.slice(5)] = Array.isArray(m.candidate) ? [...m.candidate] : m.candidate;
71
+ }
72
+ return draft;
73
+ }
74
+ export function colorsKey(e: Editor, event: TextKey, language: Language): null {
75
+ const m = e.colors!, key = event.key;
76
+ if ((e.saveState !== 'idle' || m.generation !== e.mutationGeneration) && !(key === 'escape' || event.ctrl && key.toLowerCase() === 'g' || ['up', 'down', 'home', 'end', 'pageup', 'pagedown'].includes(key))) {
77
+ e.canMutateDraft(m.generation);
78
+ return null;
79
+ }
80
+ if (m.input) {
81
+ if (key === 'escape' || event.ctrl && key.toLowerCase() === 'g') {
82
+ m.input = null;
83
+ m.error = false;
84
+ return null;
85
+ }
86
+ if (key === 'return' && !event.text && !event.paste) {
87
+ try {
88
+ if (m.kind === 'gradient' && m.editing === null)
89
+ m.candidate = parseGradient(m.input.value);
90
+ else if (m.kind === 'gradient') {
91
+ if (!/^#[0-9a-f]{6}$/iu.test(m.input.value))
92
+ throw new Error();
93
+ (m.candidate as string[])[m.editing!] = m.input.value.toLowerCase();
94
+ }
95
+ else {
96
+ const value = m.input.value === 'inherit' ? null : m.input.value;
97
+ if (!validColor(value))
98
+ throw new Error();
99
+ m.candidate = normalizeColor(value) as string | null;
100
+ }
101
+ m.input = null;
102
+ m.error = false;
103
+ }
104
+ catch {
105
+ m.error = true;
106
+ }
107
+ }
108
+ else {
109
+ const result = inputKey(m.input.value, m.input, event, 256);
110
+ m.input = result.state;
111
+ m.error = !!result.error;
112
+ }
113
+ return null;
114
+ }
115
+ if (event.text || event.paste || event.meta || event.overflow)
116
+ return null;
117
+ if (key === 'escape' || event.ctrl && key.toLowerCase() === 'g') {
118
+ e.colors = null;
119
+ return null;
120
+ }
121
+ const rows = choices(e, language);
122
+ if (['up', 'down', 'pageup', 'pagedown', 'tab'].includes(key))
123
+ m.cursor = Math.max(0, Math.min(rows.length - 1, m.cursor + (key === 'up' ? -1 : key === 'pageup' ? -5 : key === 'pagedown' ? 5 : 1)));
124
+ if (key === 'home')
125
+ m.cursor = 0;
126
+ if (key === 'end')
127
+ m.cursor = rows.length - 1;
128
+ const selected = rows[m.cursor]!;
129
+ if (event.ctrl && key.toLowerCase() === 's' || key === 'return' && selected.id === 'apply') {
130
+ if (e.canMutateDraft(m.generation)) {
131
+ e.draft = colorDraft(e);
132
+ e.colors = null;
133
+ }
134
+ return null;
135
+ }
136
+ if (event.ctrl)
137
+ return null;
138
+ if (key === 'return' || key === 'left' || key === 'right') {
139
+ if (selected.id === 'cancel') {
140
+ e.colors = null;
141
+ return null;
142
+ }
143
+ if (Object.hasOwn(selected, 'value'))
144
+ m.candidate = Array.isArray(selected.value) ? [...selected.value] : selected.value!;
145
+ else if (selected.id === 'custom' || selected.id.startsWith('stop:')) {
146
+ m.editing = selected.id.startsWith('stop:') ? Number(selected.id.slice(5)) : null;
147
+ m.input = textInput(m.editing === null ? (m.kind === 'gradient' ? gradientName(m.candidate) : m.candidate === null ? 'inherit' : String(m.candidate)) : (m.candidate as string[])[m.editing]!);
148
+ }
149
+ else if (selected.id === 'reverse' && Array.isArray(m.candidate))
150
+ m.candidate.reverse();
151
+ else if (selected.id === 'add') {
152
+ if (!Array.isArray(m.candidate))
153
+ m.candidate = [...GRADIENT_PRESETS.ocean];
154
+ else if (m.candidate.length < 5)
155
+ m.candidate.push(m.candidate.at(-1)!);
156
+ }
157
+ else if (selected.id === 'remove' && Array.isArray(m.candidate) && m.candidate.length > 2)
158
+ m.candidate.pop();
159
+ m.error = false;
160
+ }
161
+ return null;
162
+ }
163
+ const plain = (text: string): Span => ({ text, bold: false, foreground: null, background: null });
164
+ export function colorsView(e: Editor, language: Language, width: number, height: number): {
165
+ spans: Span[];
166
+ selected: boolean;
167
+ }[] {
168
+ const m = e.colors!, tr = (key: string) => t('colors.' + key, language);
169
+ if (m.input)
170
+ return [{ spans: [plain(tr('input'))], selected: false }, { spans: [plain(inputView(m.input, width))], selected: true }, { spans: [plain(m.error ? tr('invalid') : tr('input_help'))], selected: false }];
171
+ const rows = choices(e, language), capacity = Math.max(1, height - 2), start = Math.floor(m.cursor / capacity) * capacity;
172
+ return [{ spans: [plain(tr('help'))], selected: false }, ...rows.slice(start, start + capacity).map((row, index) => {
173
+ const selected = start + index === m.cursor;
174
+ const spans = [plain(selected ? '› ' : ' '), ...(row.colors ?? []).map(color => ({ ...plain('██'), foreground: color.startsWith('ansi:') ? { kind: 'ansi' as const, value: Number(color.slice(5)) } : { kind: 'rgb' as const, value: color } })), plain(' ' + row.label + (row.surface ? ' · ' + tr((m.kind === 'theme' ? 'theme_surface_' : 'surface_') + row.surface) : ''))];
175
+ return { spans, selected };
176
+ }), { spans: [plain(`${m.cursor + 1}/${rows.length} · ${e.saveState !== 'idle' || m.generation !== e.mutationGeneration ? t('editor.save_locked', language) : m.error ? tr('invalid') : tr('draft_only')}`)], selected: false }];
177
+ }
@@ -0,0 +1,123 @@
1
+ // Generated by tools/generation/resources.ts; do not edit.
2
+ import type { DiagnoseResult, Scope } from '../generated-contracts.ts';
3
+ import type { Editor } from './draft.ts';
4
+ import { copyDraft } from './draft.ts';
5
+ import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
6
+ import { t, type Language } from '../i18n/index.ts';
7
+ import { wrapText } from '../../ui/text.ts';
8
+ import { targetLabel } from './profile-manager.ts';
9
+ export interface DiagnosisView {
10
+ path: string;
11
+ scope: Scope;
12
+ observedAt: string;
13
+ includeLocal: boolean;
14
+ cursor: number;
15
+ input: TextInput | null;
16
+ result: DiagnoseResult | null;
17
+ error: string;
18
+ scroll: number;
19
+ busy: boolean;
20
+ report: boolean;
21
+ generation: number;
22
+ }
23
+ export function openDiagnosis(e: Editor): void { e.diagnosis = { path: '', scope: e.detail?.scope ?? (e.page === 'subagents' ? 'subagent' : 'main'), observedAt: '', includeLocal: false, cursor: 0, input: null, result: null, error: '', scroll: 0, busy: false, report: false, generation: 0 }; }
24
+ export function diagnosisRequest(e: Editor, width: number) { const v = e.diagnosis!; return { draft: copyDraft(e.draft), path: v.path, scope: v.scope, width, observed_at: v.observedAt || null, include_local: v.includeLocal }; }
25
+ export function diagnosisKey(e: Editor, event: TextKey): 'diagnoseFile' | null {
26
+ const v = e.diagnosis!, key = event.key, cancel = key === 'escape' || event.ctrl && key.toLowerCase() === 'g';
27
+ if (v.input) {
28
+ if (cancel) {
29
+ v.input = null;
30
+ return null;
31
+ }
32
+ if (key === 'return' && !event.text && !event.paste) {
33
+ v.generation++;
34
+ if (v.cursor === 0)
35
+ v.path = v.input.value;
36
+ else
37
+ v.observedAt = v.input.value;
38
+ v.input = null;
39
+ v.error = '';
40
+ }
41
+ else
42
+ v.input = inputKey(v.input.value, v.input, event, v.cursor === 0 ? 4096 : 128).state;
43
+ return null;
44
+ }
45
+ if (event.text || event.paste || event.meta)
46
+ return null;
47
+ if (cancel) {
48
+ if (v.report) {
49
+ v.report = false;
50
+ v.generation++;
51
+ }
52
+ else
53
+ e.diagnosis = null;
54
+ return null;
55
+ }
56
+ if (v.report) {
57
+ if (key === 'up' || key === 'pageup')
58
+ v.scroll = Math.max(0, v.scroll - (key === 'up' ? 1 : 8));
59
+ if (key === 'down' || key === 'pagedown')
60
+ v.scroll += key === 'down' ? 1 : 8;
61
+ if (key === 'home')
62
+ v.scroll = 0;
63
+ if (key === 'end')
64
+ v.scroll = 1000000;
65
+ return null;
66
+ }
67
+ if (event.ctrl)
68
+ return null;
69
+ if (['up', 'down', 'tab'].includes(key))
70
+ v.cursor = Math.max(0, Math.min(6, v.cursor + (key === 'up' ? -1 : 1)));
71
+ if (key === 'home')
72
+ v.cursor = 0;
73
+ if (key === 'end')
74
+ v.cursor = 6;
75
+ if (['return', 'left', 'right'].includes(key)) {
76
+ if (v.cursor === 0 || v.cursor === 2) {
77
+ v.generation++;
78
+ v.input = textInput(v.cursor === 0 ? v.path : v.observedAt);
79
+ }
80
+ if (v.cursor === 1) {
81
+ v.generation++;
82
+ v.scope = v.scope === 'main' ? 'subagent' : 'main';
83
+ }
84
+ if (v.cursor === 3) {
85
+ v.generation++;
86
+ v.includeLocal = !v.includeLocal;
87
+ }
88
+ if (v.cursor === 4 && !v.busy) {
89
+ v.generation++;
90
+ return 'diagnoseFile';
91
+ }
92
+ if (v.cursor === 5 && v.result)
93
+ v.report = true;
94
+ if (v.cursor === 6)
95
+ e.diagnosis = null;
96
+ }
97
+ return null;
98
+ }
99
+ export function diagnosisLines(e: Editor, language: Language, width: number): string[] {
100
+ const v = e.diagnosis!, r = v.result, tr = (key: string, params: Record<string, unknown> = {}) => t('diagnose.' + key, language, params);
101
+ if (!v.report || !r)
102
+ return wrapText([t('diagnosis.target', language, { target: targetLabel(e, language) }),
103
+ ...[t('diagnosis.path', language) + ': ' + v.path, t('diagnosis.scope', language) + ': ' + v.scope, t('diagnosis.time', language) + ': ' + (v.observedAt || tr('unknown')), t('diagnosis.local', language) + ': ' + t('values.' + (v.includeLocal ? 'on' : 'off'), language), t(v.busy ? 'diagnosis.busy' : 'diagnosis.run', language), t('diagnosis.previous', language), t('colors.cancel', language)].map((line, i) => (i === v.cursor ? '› ' : ' ') + line),
104
+ ...(v.input ? [inputView(v.input, width)] : []), v.error, t('diagnosis.help', language)], width);
105
+ const lines = [t('diagnosis.title', language), t('diagnosis.target', language, { target: targetLabel(e, language) }), tr('source', { value: r.source }), tr('times', { input: r.observed_at ?? tr('unknown'), now: r.diagnosed_at }), t(r.include_local ? 'diagnosis.with_local' : 'diagnosis.input_only', language), tr('identity', { session: r.session_id ?? tr('unknown'), prompt: r.prompt_id ?? tr('unknown') }), tr('output', { width: r.width }), ...r.output.map(row => row.spans.map(s => s.text).join(''))];
106
+ for (const item of r.instances) {
107
+ lines.push('', e.instanceLabel(r.scope, item.id, language) + ' (' + item.id + ')');
108
+ for (const reason of item.reasons)
109
+ lines.push(t('explain.reason.' + reason.code, language));
110
+ for (const evidence of item.evidence) {
111
+ lines.push(tr('evidence', { source: evidence.source, scope: evidence.scope, status: tr('status.' + evidence.status), time: evidence.observed_at ?? tr('unknown'), freshness: tr('freshness.' + evidence.freshness) }));
112
+ for (const field of evidence.fields)
113
+ lines.push(field.path + ': ' + tr('status.' + field.status));
114
+ }
115
+ for (const row of item.rows) {
116
+ lines.push(row.row_id + ': ' + tr('layout.' + row.outcome) + (row.truncated ? ' · ' + tr('layout.truncated') : ''));
117
+ for (const reason of row.style_reasons ?? [])
118
+ lines.push(t('explain.style.' + reason.code, language) + (reason.owner_id ? ' (' + reason.owner_id + ')' : ''));
119
+ }
120
+ }
121
+ lines.push('', tr('limits'));
122
+ return wrapText(lines, width);
123
+ }
@@ -46,6 +46,9 @@ export class Editor {
46
46
  draft: Draft;
47
47
  baseline: ReadResult;
48
48
  page: Page = 'main';
49
+ previewScenario: import('./preview-settings.js').PreviewScenario = 'normal';
50
+ previewWidth = 'auto';
51
+ previewOffset = 0;
49
52
  advanced = false;
50
53
  adding = false;
51
54
  pickerSaved: {search:string;category:string;selected:string} | null = null;
@@ -53,9 +56,13 @@ export class Editor {
53
56
  guidanceScroll: number | null = null;
54
57
  review: ReviewState | null = null;
55
58
  quick: QuickSetup | null = null;
59
+ diagnosis: import('./diagnosis-view.js').DiagnosisView | null = null;
60
+ colors: import('./color-manager.js').ColorManager | null = null;
56
61
  explanation: ExplanationView | null = null;
57
62
  profiles: ProfileManager | null = null;
58
63
  sources: SourceManager | null = null;
64
+ taskViewer: import('./task-viewer.js').TaskViewer | null = null;
65
+ packages: import('./package-manager.js').PackageManager | null = null;
59
66
  groupManager: GroupManager | null = null;
60
67
  alignmentManager: AlignmentManager | null = null;
61
68
  compositionError: LocalizedText = text('composition.invalid');
@@ -18,7 +18,7 @@ export function explanationLines(editor:Editor,language:Language,width:number):
18
18
  const view=editor.explanation!;
19
19
  const tr=(key:string,params:Record<string,unknown>={})=>t('explain.'+key,language,params);
20
20
  const item=view.result?.instances.find(item=>item.id===view.id);
21
- const lines=[tr('sample'),editor.instanceLabel(view.scope,view.id,language)+' ('+view.id+')'];
21
+ const lines=[tr('sample')+' · '+t('preview.scenario.'+(view.result?.preview.scenario??editor.previewScenario),language),editor.instanceLabel(view.scope,view.id,language)+' ('+view.id+')'];
22
22
  if(!item) return wrapText([...lines,view.error||tr('loading')],width);
23
23
  for(const [heading,origins] of [['configuration',['configuration']],['requirements',['local_configuration','host_capability','unknown']]] as const) {
24
24
  lines.push('',tr(heading));
@@ -29,6 +29,7 @@ export function explanationLines(editor:Editor,language:Language,width:number):
29
29
  for(const sample of item.samples) {
30
30
  lines.push(tr('row.'+sample.row_id)+': '+tr('reason.'+sample.outcome));
31
31
  if(sample.truncated) lines.push(tr('reason.sample_truncated'));
32
+ for(const reason of sample.style_reasons??[])lines.push(tr('style.'+reason.code)+(reason.owner_id?' ('+reason.owner_id+')':''));
32
33
  }
33
34
  lines.push('',tr('panel_note'));
34
35
  return wrapText(lines,width);
@@ -5,6 +5,14 @@ export const GRADIENT_PRESETS = {
5
5
  ocean: ['#22d3ee', '#3b82f6'],
6
6
  sunset: ['#fb923c', '#f472b6', '#a78bfa'],
7
7
  aurora: ['#34d399', '#22d3ee', '#a78bfa'],
8
+ glacier: ['#67e8f9', '#60a5fa', '#818cf8'],
9
+ lagoon: ['#0c4a6e', '#164e63', '#1e3a8a'],
10
+ flame: ['#fbbf24', '#f97316', '#ef4444'],
11
+ copper: ['#7c2d12', '#78350f', '#831843'],
12
+ steel: ['#94a3b8', '#b8c4d1', '#cbd5e1'],
13
+ sage: ['#304c40', '#405647', '#455663'],
14
+ petal: ['#fbcfe8', '#e9d5ff', '#dbeafe'],
15
+ twilight: ['#c4b5fd', '#f9a8d4', '#fdba74'],
8
16
  } as const;
9
17
  export const GRADIENT_KEYS = ['foreground_gradient', 'background_gradient'] as const;
10
18
  export const GRADIENT_DEFAULTS = { foreground_gradient: null, background_gradient: null };
@@ -27,3 +35,5 @@ export function gradientName(value: unknown): string {
27
35
  if (value == null) return 'off';
28
36
  return Object.entries(GRADIENT_PRESETS).find(([, colors]) => JSON.stringify(colors) === JSON.stringify(value))?.[0] ?? String(value);
29
37
  }
38
+
39
+ export const GRADIENT_SURFACES: Record<keyof typeof GRADIENT_PRESETS, 'dark' | 'light'> = {ocean:'dark',sunset:'dark',aurora:'dark',glacier:'dark',lagoon:'light',flame:'dark',copper:'light',steel:'dark',sage:'light',petal:'dark',twilight:'dark'};