@fbincon/claude-code-statusline 3.10.0 → 3.12.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 (174) hide show
  1. package/README.md +79 -78
  2. package/candidate.json +325 -221
  3. package/node_modules/@fbincon/statusline-cli/dist/src/help.js +1 -1
  4. package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
  5. package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.d.ts +1 -1
  6. package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +7 -3
  7. package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
  8. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-bootstrap.d.ts +1 -0
  9. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-bootstrap.js +41 -0
  10. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-bootstrap.js.map +1 -0
  11. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-worker-entry.d.ts +1 -0
  12. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-worker-entry.js +14 -0
  13. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-worker-entry.js.map +1 -0
  14. package/node_modules/@fbincon/statusline-cli/dist/src/main.js +14 -1
  15. package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
  16. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution-worker-entry.d.ts +1 -0
  17. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution-worker-entry.js +4 -0
  18. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution-worker-entry.js.map +1 -0
  19. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution.d.ts +29 -0
  20. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution.js +228 -0
  21. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution.js.map +1 -0
  22. package/node_modules/@fbincon/statusline-cli/dist/src/management/history.d.ts +4 -0
  23. package/node_modules/@fbincon/statusline-cli/dist/src/management/history.js +150 -0
  24. package/node_modules/@fbincon/statusline-cli/dist/src/management/history.js.map +1 -0
  25. package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.d.ts +8 -0
  26. package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js +164 -0
  27. package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js.map +1 -0
  28. package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition.js +2 -2
  29. package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition.js.map +1 -1
  30. package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.d.ts +14 -1
  31. package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js +2 -1
  32. package/node_modules/@fbincon/statusline-cli/dist/src/management/restore.js.map +1 -1
  33. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.d.ts +16 -0
  34. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js +95 -0
  35. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js.map +1 -0
  36. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.d.ts +1 -0
  37. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.js +33 -0
  38. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-worker-entry.js.map +1 -0
  39. package/node_modules/@fbincon/statusline-cli/dist/src/management/review.d.ts +5 -0
  40. package/node_modules/@fbincon/statusline-cli/dist/src/management/review.js +44 -0
  41. package/node_modules/@fbincon/statusline-cli/dist/src/management/review.js.map +1 -0
  42. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.d.ts +6 -0
  43. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js +19 -8
  44. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js.map +1 -1
  45. package/node_modules/@fbincon/statusline-cli/dist/src/management/store.js +6 -6
  46. package/node_modules/@fbincon/statusline-cli/dist/src/management/store.js.map +1 -1
  47. package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic-state.d.ts +1 -0
  48. package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic-state.js +6 -6
  49. package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic-state.js.map +1 -1
  50. package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic.js +76 -28
  51. package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic.js.map +1 -1
  52. package/node_modules/@fbincon/statusline-cli/dist/src/sources/bindings.d.ts +17 -0
  53. package/node_modules/@fbincon/statusline-cli/dist/src/sources/bindings.js +176 -0
  54. package/node_modules/@fbincon/statusline-cli/dist/src/sources/bindings.js.map +1 -0
  55. package/node_modules/@fbincon/statusline-cli/dist/src/sources/command.js +11 -3
  56. package/node_modules/@fbincon/statusline-cli/dist/src/sources/command.js.map +1 -1
  57. package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js +26 -8
  58. package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js.map +1 -1
  59. package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.d.ts +3 -0
  60. package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.js +54 -14
  61. package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.js.map +1 -1
  62. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.d.ts +1 -0
  63. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js +11 -4
  64. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js.map +1 -1
  65. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.d.ts +3 -0
  66. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.js +25 -0
  67. package/node_modules/@fbincon/statusline-cli/dist/src/tasks/view.js.map +1 -0
  68. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +3 -3
  69. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +59 -0
  70. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -1
  71. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +1 -1
  72. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +92 -59
  73. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +3 -0
  74. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +6 -1
  75. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +1 -0
  76. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +6 -0
  77. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/package-manager.ts +187 -0
  78. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/package-validation.ts +52 -0
  79. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-manager.ts +53 -41
  80. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-summary.ts +22 -0
  81. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-validation.ts +11 -2
  82. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/task-viewer.ts +319 -0
  83. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +113 -5
  84. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +7 -12392
  85. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/en.ts +2220 -0
  86. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/ja.ts +2220 -0
  87. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/ko.ts +2220 -0
  88. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-CN.ts +2220 -0
  89. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-HK.ts +2220 -0
  90. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-TW.ts +2220 -0
  91. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +25 -15
  92. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +3 -1
  93. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +1 -0
  94. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +1 -1
  95. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/hooks/observe.ts +10 -3
  96. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +4 -4
  97. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +169 -5
  98. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +2 -2
  99. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -1
  100. package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +5 -0
  101. package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
  102. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +5 -0
  103. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +9 -0
  104. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
  105. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.d.ts +49 -0
  106. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js +498 -0
  107. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js.map +1 -0
  108. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.d.ts +3 -0
  109. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js +53 -0
  110. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js.map +1 -0
  111. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.d.ts +9 -3
  112. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js +74 -26
  113. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js.map +1 -1
  114. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-summary.d.ts +5 -0
  115. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-summary.js +25 -0
  116. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-summary.js.map +1 -0
  117. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.d.ts +1 -0
  118. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.js +13 -2
  119. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.js.map +1 -1
  120. package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.d.ts +46 -0
  121. package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js +279 -0
  122. package/node_modules/@fbincon/statusline-core/dist/src/editor/task-viewer.js.map +1 -0
  123. package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.d.ts +2 -0
  124. package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.js +15 -3
  125. package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.js.map +1 -1
  126. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +936 -12
  127. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +942 -18
  128. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
  129. package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js +1 -0
  130. package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js.map +1 -1
  131. package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +1 -1
  132. package/node_modules/@fbincon/statusline-core/dist/src/release.js +1 -1
  133. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +157 -3
  134. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +157 -3
  135. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +157 -3
  136. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +157 -3
  137. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +157 -3
  138. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +157 -3
  139. package/node_modules/@fbincon/statusline-platform/dist/src/native.d.ts +2 -0
  140. package/node_modules/@fbincon/statusline-platform/dist/src/native.js +2 -0
  141. package/node_modules/@fbincon/statusline-platform/dist/src/native.js.map +1 -1
  142. package/node_modules/@fbincon/statusline-platform/dist/src/npm.d.ts +2 -0
  143. package/node_modules/@fbincon/statusline-platform/dist/src/npm.js +20 -1
  144. package/node_modules/@fbincon/statusline-platform/dist/src/npm.js.map +1 -1
  145. package/node_modules/@fbincon/statusline-platform/dist/src/private-state.d.ts +3 -0
  146. package/node_modules/@fbincon/statusline-platform/dist/src/private-state.js +53 -0
  147. package/node_modules/@fbincon/statusline-platform/dist/src/private-state.js.map +1 -0
  148. package/node_modules/@fbincon/statusline-platform/dist/src/processes.d.ts +2 -0
  149. package/node_modules/@fbincon/statusline-platform/dist/src/processes.js +45 -0
  150. package/node_modules/@fbincon/statusline-platform/dist/src/processes.js.map +1 -1
  151. package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.d.ts +4 -0
  152. package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.js +22 -0
  153. package/node_modules/@fbincon/statusline-platform/dist/src/review-worker.js.map +1 -0
  154. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.d.ts +5 -0
  155. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js +8 -1
  156. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js.map +1 -1
  157. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +10 -0
  158. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js.map +1 -1
  159. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js +4 -0
  160. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js.map +1 -1
  161. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js +4 -0
  162. package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
  163. package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +1 -1
  164. package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
  165. package/node_modules/@fbincon/statusline-tui/dist/src/session.d.ts +5 -3
  166. package/node_modules/@fbincon/statusline-tui/dist/src/session.js +31 -8
  167. package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
  168. package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +1 -1
  169. package/node_modules/@fbincon/statusline-tui/dist/src/state.js +24 -1
  170. package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
  171. package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.d.ts +6 -0
  172. package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.js +34 -0
  173. package/node_modules/@fbincon/statusline-tui/dist/src/task-viewer.js.map +1 -0
  174. 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
+ }
@@ -1,5 +1,5 @@
1
1
  // Generated by tools/generation/resources.ts; do not edit.
2
- export const PROTOCOL_VERSION = 26 as const;
2
+ export const PROTOCOL_VERSION = 28 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_execute_start', 'package_execute_detach', 'package_execute_status', 'package_cleanup_review', 'package_cleanup_apply', 'source_inspect', 'source_bindings_review', 'source_bindings_cleanup', 'source_draft', '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[];
@@ -720,7 +720,7 @@ export interface SourceDefinition {
720
720
  export interface SourceBinding { id: string; source_id: string }
721
721
  export interface AutomaticPolicy { source_id: string; enabled: boolean; review_revision: string; interval_seconds: number; auth_revision: string }
722
722
  export interface AutomaticStatus { state: 'off' | 'waiting' | 'running' | 'backoff' | 'paused'; reason: string; next_at: string | null; last_attempt: string | null; last_success: string | null; interval_seconds: number }
723
- export interface SourceRegistry { version: 2; sources: SourceDefinition[]; bindings: SourceBinding[]; automatic: AutomaticPolicy[] }
723
+ export interface SourceRegistry { version: 2 | 3; sources: SourceDefinition[]; bindings: SourceBinding[]; automatic: AutomaticPolicy[] }
724
724
  export interface SourcesResult extends SourceRegistry { revision: string }
725
725
  export type SourceState = 'valid' | 'missing' | 'partial' | 'error' | 'unsupported';
726
726
  export interface SourceObservation {
@@ -728,6 +728,8 @@ export interface SourceObservation {
728
728
  observed_at: string | null; state: SourceState; reason: string;
729
729
  value: string | number | boolean | null; unit: string | null;
730
730
  fields?: Record<string, string | number | boolean | null>;
731
+ checks?: SourceCheck[];
732
+ execution?: SourceExecutionResult;
731
733
  identity?: { host: string; repository: string; account: string; auth_revision: string };
732
734
  }
733
735
  export interface SourceView {
@@ -737,10 +739,22 @@ export interface SourceView {
737
739
  fields?: Record<string, string | number | boolean | null>;
738
740
  }
739
741
  export interface SourceJob {
740
- version: 3; id: string; source_id: string; source_revision: string; owner: string; trigger: 'manual' | 'automatic'; identity: string;
742
+ version: 3 | 4; id: string; source_id: string; source_revision: string; owner: string; trigger: 'manual' | 'automatic'; identity: string;
741
743
  consumers: { owner: string; expires_at: string }[];
742
744
  context: SourceContext; started_at: string; deadline_at: string;
743
745
  state: 'running' | 'completed' | 'failed' | 'cancelled'; reason: string;
746
+ result?: SourceExecutionResult | null;
747
+ }
748
+ export interface SourceExecutionResult { finished_at: string; duration_ms: number; exit_code: number | null; reason: string; summary: string }
749
+ export interface SourceCheck { name: string; state: string; bucket: string; url: string | null }
750
+ export interface SourceInspection {
751
+ source: SourceDefinition; view: SourceView; automatic: AutomaticStatus; jobs: SourceJob[];
752
+ last_success: string | null; checks: SourceCheck[]; checks_observed_at: string | null; checks_context: SourceContext | null;
753
+ offset: number; total: number;
754
+ }
755
+ export interface BindingReview {
756
+ revision: string; rows: { id: string; source_id: string; references: string[]; duplicate: boolean; removable: boolean }[];
757
+ offset: number; total: number; uncertain: boolean;
744
758
  }
745
759
  export interface SourceReview { source: SourceDefinition; review_revision: string }
746
760
  export interface SourceMutationResult extends SourcesResult { binding?: SourceReference; backup_dir: string | null }
@@ -874,6 +888,87 @@ export interface TaskDetails {
874
888
  evidence: TaskEvidence[];
875
889
  limitations: string[];
876
890
  }
891
+ export interface PackageControl { executable: string; args: string[]; config_dir: string }
892
+ export interface PackageExecution {
893
+ version: 1; id: string; transaction_id: string | null; action: PackageReviewRequest['action']; prefix: string;
894
+ state: 'running' | 'complete' | 'failed' | 'interrupted'; stage: string; started_at: string; updated_at: string;
895
+ finished_at: string | null; error: string | null; running: boolean | null;
896
+ results: { package: boolean | null; integration: boolean | null; configuration: boolean | null };
897
+ control: PackageControl;
898
+ }
899
+ export interface PackageCleanupReview {
900
+ version: 1; revision: string; prefix: string; offset: number; total: number; uncertain: boolean;
901
+ rows: { id: string; removable: boolean; reasons: string[]; version: string | null }[];
902
+ }
903
+ /** Read-only package inspection. These views do not grant installation authority. */
904
+ export interface PackageStatus {
905
+ execution?: PackageExecution | null;
906
+ version: 1;
907
+ backend_version: string;
908
+ captured_at: string;
909
+ revision: string;
910
+ prefix: string | null;
911
+ entry: string | null;
912
+ config_dir: string;
913
+ current: string | null;
914
+ previous: string | null;
915
+ channel: 'latest' | 'beta' | null;
916
+ node_version: string;
917
+ host: string | null;
918
+ compatible: boolean;
919
+ reasons: string[];
920
+ pending: PackageHistoryRow | null;
921
+ history: PackageHistoryRow[];
922
+ offset: number;
923
+ total: number;
924
+ }
925
+ export interface PackageHistoryRow {
926
+ id: string;
927
+ version: string | null;
928
+ created: string | null;
929
+ stage: string;
930
+ backup: 'verified' | 'missing' | 'invalid';
931
+ running: boolean | null;
932
+ }
933
+ export interface PackageReviewRequest {
934
+ action: 'check' | 'update' | 'rollback' | 'recover-package' | 'restore-config';
935
+ prefix: string;
936
+ expected_revision: string;
937
+ target: string | null;
938
+ channel: 'latest' | 'beta' | null;
939
+ backup_id: string | null;
940
+ expected_integrity: string | null;
941
+ }
942
+ export interface PackageReviewView {
943
+ action: PackageReviewRequest['action'];
944
+ current: string | null;
945
+ target: string | null;
946
+ prefix: string;
947
+ entry: string | null;
948
+ config_dir: string;
949
+ channel: 'latest' | 'beta' | null;
950
+ registry: string | null;
951
+ integrity: string | null;
952
+ node_engine: string | null;
953
+ host: string | null;
954
+ artifact_verified: boolean;
955
+ compatible: boolean;
956
+ reasons: string[];
957
+ configuration_conflicts: string[];
958
+ backup_id: string | null;
959
+ files: string[];
960
+ }
961
+ export interface PackageReviewJob {
962
+ version: 1;
963
+ id: string;
964
+ owner: string;
965
+ state: 'running' | 'complete' | 'failed' | 'cancelled';
966
+ started_at: string;
967
+ finished_at: string | null;
968
+ request: PackageReviewRequest;
969
+ review: PackageReviewView | null;
970
+ error: string | null;
971
+ }
877
972
  export interface EditorField {
878
973
  key: string;
879
974
  label: string;
@@ -935,8 +1030,21 @@ export interface ApplyResult {
935
1030
  configuration?: ResolvedConfiguration;
936
1031
  }
937
1032
  export interface ResultMap {
1033
+ package_execute_detach: PackageExecution;
1034
+ package_execute_start: PackageExecution;
1035
+ package_execute_status: PackageExecution;
1036
+ package_cleanup_review: PackageCleanupReview;
1037
+ package_cleanup_apply: PackageCleanupReview;
1038
+ package_status: PackageStatus;
1039
+ package_review_start: PackageReviewJob;
1040
+ package_review_status: PackageReviewJob;
1041
+ package_review_cancel: PackageReviewJob;
938
1042
  sources_read: SourcesResult;
939
1043
  sources_apply: SourceMutationResult;
1044
+ source_inspect: SourceInspection;
1045
+ source_bindings_review: BindingReview;
1046
+ source_bindings_cleanup: BindingReview;
1047
+ source_draft: { revision: string };
940
1048
  source_review: SourceReview;
941
1049
  source_context: SourceContext;
942
1050
  source_refresh: SourceJob;
@@ -969,5 +1077,5 @@ export interface Request {
969
1077
  operation: Operation;
970
1078
  payload: unknown;
971
1079
  }
972
- export type Result = DiagnoseResult | ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult | ProfilesResult | ProfileImportResult | TaskDetails;
1080
+ export type Result = PackageExecution | PackageCleanupReview | PackageStatus | PackageReviewJob | DiagnoseResult | ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult | ProfilesResult | ProfileImportResult | TaskDetails;
973
1081
  export type Response = { protocol_version: typeof PROTOCOL_VERSION; result: Result } | { protocol_version: typeof PROTOCOL_VERSION; error: ProtocolError };