@fbincon/claude-code-statusline 3.11.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 (130) hide show
  1. package/README.md +79 -79
  2. package/candidate.json +247 -196
  3. package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +5 -1
  4. package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
  5. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-bootstrap.d.ts +1 -0
  6. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-bootstrap.js +41 -0
  7. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-bootstrap.js.map +1 -0
  8. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-worker-entry.d.ts +1 -0
  9. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-worker-entry.js +14 -0
  10. package/node_modules/@fbincon/statusline-cli/dist/src/integration/editor-worker-entry.js.map +1 -0
  11. package/node_modules/@fbincon/statusline-cli/dist/src/main.js +9 -0
  12. package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
  13. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution-worker-entry.d.ts +1 -0
  14. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution-worker-entry.js +4 -0
  15. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution-worker-entry.js.map +1 -0
  16. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution.d.ts +29 -0
  17. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution.js +228 -0
  18. package/node_modules/@fbincon/statusline-cli/dist/src/management/execution.js.map +1 -0
  19. package/node_modules/@fbincon/statusline-cli/dist/src/management/history.d.ts +4 -0
  20. package/node_modules/@fbincon/statusline-cli/dist/src/management/history.js +150 -0
  21. package/node_modules/@fbincon/statusline-cli/dist/src/management/history.js.map +1 -0
  22. package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js +30 -13
  23. package/node_modules/@fbincon/statusline-cli/dist/src/management/inspection.js.map +1 -1
  24. package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition.js +2 -2
  25. package/node_modules/@fbincon/statusline-cli/dist/src/management/mod-transition.js.map +1 -1
  26. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.d.ts +1 -0
  27. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js +11 -6
  28. package/node_modules/@fbincon/statusline-cli/dist/src/management/review-jobs.js.map +1 -1
  29. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.d.ts +2 -0
  30. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js +9 -5
  31. package/node_modules/@fbincon/statusline-cli/dist/src/management/service.js.map +1 -1
  32. package/node_modules/@fbincon/statusline-cli/dist/src/management/store.js +6 -6
  33. package/node_modules/@fbincon/statusline-cli/dist/src/management/store.js.map +1 -1
  34. package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic-state.d.ts +1 -0
  35. package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic-state.js +6 -6
  36. package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic-state.js.map +1 -1
  37. package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic.js +76 -28
  38. package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic.js.map +1 -1
  39. package/node_modules/@fbincon/statusline-cli/dist/src/sources/bindings.d.ts +17 -0
  40. package/node_modules/@fbincon/statusline-cli/dist/src/sources/bindings.js +176 -0
  41. package/node_modules/@fbincon/statusline-cli/dist/src/sources/bindings.js.map +1 -0
  42. package/node_modules/@fbincon/statusline-cli/dist/src/sources/command.js +11 -3
  43. package/node_modules/@fbincon/statusline-cli/dist/src/sources/command.js.map +1 -1
  44. package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js +26 -8
  45. package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js.map +1 -1
  46. package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.d.ts +3 -0
  47. package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.js +54 -14
  48. package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.js.map +1 -1
  49. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +3 -3
  50. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +36 -0
  51. package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -1
  52. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +1 -1
  53. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +23 -15
  54. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +4 -2
  55. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +4 -0
  56. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/package-manager.ts +164 -291
  57. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/package-validation.ts +10 -1
  58. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-manager.ts +53 -41
  59. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-summary.ts +22 -0
  60. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-validation.ts +11 -2
  61. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +42 -6
  62. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +7 -12722
  63. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/en.ts +2220 -0
  64. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/ja.ts +2220 -0
  65. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/ko.ts +2220 -0
  66. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-CN.ts +2220 -0
  67. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-HK.ts +2220 -0
  68. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/locales/zh-TW.ts +2220 -0
  69. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +21 -14
  70. package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +1 -1
  71. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +1 -1
  72. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/hooks/observe.ts +10 -3
  73. package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +4 -4
  74. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +98 -6
  75. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +2 -2
  76. package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -1
  77. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +3 -0
  78. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +7 -0
  79. package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
  80. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.d.ts +12 -4
  81. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js +302 -85
  82. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-manager.js.map +1 -1
  83. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js +12 -1
  84. package/node_modules/@fbincon/statusline-core/dist/src/editor/package-validation.js.map +1 -1
  85. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.d.ts +9 -3
  86. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js +74 -26
  87. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js.map +1 -1
  88. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-summary.d.ts +5 -0
  89. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-summary.js +25 -0
  90. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-summary.js.map +1 -0
  91. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.d.ts +1 -0
  92. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.js +13 -2
  93. package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.js.map +1 -1
  94. package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.d.ts +2 -0
  95. package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.js +15 -3
  96. package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.js.map +1 -1
  97. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +606 -12
  98. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +612 -18
  99. package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
  100. package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js +1 -0
  101. package/node_modules/@fbincon/statusline-core/dist/src/management/compatibility.js.map +1 -1
  102. package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +1 -1
  103. package/node_modules/@fbincon/statusline-core/dist/src/release.js +1 -1
  104. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +102 -3
  105. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +102 -3
  106. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +102 -3
  107. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +102 -3
  108. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +102 -3
  109. package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +102 -3
  110. package/node_modules/@fbincon/statusline-platform/dist/src/native.d.ts +2 -0
  111. package/node_modules/@fbincon/statusline-platform/dist/src/native.js +2 -0
  112. package/node_modules/@fbincon/statusline-platform/dist/src/native.js.map +1 -1
  113. package/node_modules/@fbincon/statusline-platform/dist/src/npm.d.ts +2 -0
  114. package/node_modules/@fbincon/statusline-platform/dist/src/npm.js +20 -1
  115. package/node_modules/@fbincon/statusline-platform/dist/src/npm.js.map +1 -1
  116. package/node_modules/@fbincon/statusline-platform/dist/src/private-state.d.ts +3 -0
  117. package/node_modules/@fbincon/statusline-platform/dist/src/private-state.js +53 -0
  118. package/node_modules/@fbincon/statusline-platform/dist/src/private-state.js.map +1 -0
  119. package/node_modules/@fbincon/statusline-platform/dist/src/processes.d.ts +2 -0
  120. package/node_modules/@fbincon/statusline-platform/dist/src/processes.js +45 -0
  121. package/node_modules/@fbincon/statusline-platform/dist/src/processes.js.map +1 -1
  122. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.d.ts +5 -0
  123. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js +8 -1
  124. package/node_modules/@fbincon/statusline-platform/dist/src/terminal/windows-modes.js.map +1 -1
  125. package/node_modules/@fbincon/statusline-tui/dist/src/session.d.ts +2 -1
  126. package/node_modules/@fbincon/statusline-tui/dist/src/session.js +10 -5
  127. package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
  128. package/node_modules/@fbincon/statusline-tui/dist/src/state.js +4 -0
  129. package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
  130. package/package.json +3 -3
@@ -1,17 +1,22 @@
1
1
  // Generated by tools/generation/resources.ts; do not edit.
2
- import type { Operation, ResultFor, SourcesResult, SourceDefinition, SourceContext, SourceJob, SourceReview, Scope } from '../generated-contracts.ts';
2
+ import { sourceSummary, sourceReviewLines } from './source-summary.ts';
3
+ import type { Operation, ResultFor, SourcesResult, SourceDefinition, SourceContext, SourceJob, SourceReview, SourceInspection, BindingReview, Scope } from '../generated-contracts.ts';
3
4
  import type { Editor } from './draft.ts';
4
5
  import { t, text, type Language, type LocalizedText } from '../i18n/index.ts';
5
6
  import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
6
7
  import { wrapText } from '../../ui/text.ts';
7
8
  import { BackendError } from '../backend.ts';
8
- type Action = 'edit' | 'review' | 'disable' | 'remove' | 'bind' | 'unbind' | 'refresh' | 'status' | 'cancel' | 'diagnose' | 'auto-review' | 'auto-off';
9
+ type Action = 'edit' | 'review' | 'disable' | 'remove' | 'bind' | 'unbind' | 'refresh' | 'status' | 'cancel' | 'diagnose' | 'auto-review' | 'auto-off' | 'checks' | 'raw';
9
10
  export interface SourceManager {
10
11
  library: SourcesResult | null;
11
12
  context: SourceContext | null;
12
13
  owner: string;
13
14
  closed: boolean;
14
- page: 'list' | 'actions' | 'kind' | 'form' | 'review' | 'remove' | 'bind' | 'unbind' | 'diagnose' | 'auto-review';
15
+ page: 'list' | 'actions' | 'kind' | 'form' | 'review' | 'remove' | 'bind' | 'unbind' | 'diagnose' | 'auto-review' | 'checks' | 'bindings' | 'binding-cleanup';
16
+ inspection: SourceInspection | null;
17
+ bindingReview: BindingReview | null;
18
+ bindingSelection: string | null;
19
+ offset: number;
15
20
  automaticInterval: number;
16
21
  cursor: number;
17
22
  scroll: number;
@@ -26,7 +31,7 @@ export interface SourceManager {
26
31
  details: string[];
27
32
  jobs: SourceJob[];
28
33
  message: LocalizedText | null;
29
- effect: 'load' | 'save' | 'review' | 'enable' | 'disable' | 'remove' | 'bind' | 'refresh' | 'status' | 'cancel' | 'diagnose' | 'close' | 'auto-review' | 'auto-on' | 'auto-off' | null;
34
+ effect: 'load' | 'save' | 'review' | 'enable' | 'disable' | 'remove' | 'bind' | 'refresh' | 'status' | 'cancel' | 'diagnose' | 'close' | 'auto-review' | 'auto-on' | 'auto-off' | 'checks' | 'raw' | 'bindings' | 'binding-cleanup' | null;
30
35
  target: {
31
36
  scope: Scope;
32
37
  id: string;
@@ -37,10 +42,10 @@ export interface SourceBackend {
37
42
  }
38
43
  const external = ['external-value', 'github-pr', 'github-ci'];
39
44
  export function openSources(editor: Editor): void {
40
- editor.sources = { library: null, context: null, owner: 'editor-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2), closed: false, page: 'list', automaticInterval: 300, cursor: 0, scroll: 0, selected: null, kind: 'json', editing: false, fields: [], review: null, details: [], jobs: [], message: null, effect: 'load', target: null };
45
+ editor.sources = { library: null, context: null, owner: 'editor-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2), closed: false, inspection: null, bindingReview: null, bindingSelection: null, offset: 0, page: 'list', automaticInterval: 300, cursor: 0, scroll: 0, selected: null, kind: 'json', editing: false, fields: [], review: null, details: [], jobs: [], message: null, effect: 'load', target: null };
41
46
  }
42
47
  function source(editor: Editor): SourceDefinition | undefined { return editor.sources!.library?.sources.find(s => s.id === editor.sources!.selected); }
43
- function actions(editor: Editor): Action[] { return ['edit', 'review', ...(source(editor)?.enabled ? ['disable' as const] : []), 'bind', 'refresh', 'status', 'cancel', 'diagnose', 'remove', 'unbind', ...(source(editor)?.kind === 'github' ? ['auto-review' as const, 'auto-off' as const] : [])]; }
48
+ function actions(editor: Editor): Action[] { return ['edit', 'review', ...(source(editor)?.enabled ? ['disable' as const] : []), 'bind', 'refresh', 'status', 'cancel', 'diagnose', 'remove', 'unbind', ...(['github','command'].includes(source(editor)?.kind ?? '') ? ['auto-review' as const, 'auto-off' as const] : []), 'checks', 'raw']; }
44
49
  function targets(editor: Editor) {
45
50
  const s = source(editor);
46
51
  return (['main', 'subagent'] as const).flatMap(scope => (scope === 'main' ? editor.draft.display.instances : editor.draft.display.subagents.instances)
@@ -62,7 +67,7 @@ function form(editor: Editor, kind: SourceDefinition['kind'], editing = false):
62
67
  }
63
68
  function count(editor: Editor): number {
64
69
  const m = editor.sources!;
65
- return m.page === 'list' ? (m.library?.sources.length ?? 0) + 1 : m.page === 'actions' ? actions(editor).length : m.page === 'kind' ? 3 : m.page === 'form' ? m.fields.length : m.page === 'bind' || m.page === 'unbind' ? targets(editor).length : 1;
70
+ return m.page === 'list' ? (m.library?.sources.length ?? 0) + 2 : m.page === 'actions' ? actions(editor).length : m.page === 'kind' ? 3 : m.page === 'bindings' ? (m.bindingReview?.rows.length ?? 0) : m.page === 'form' ? m.fields.length : m.page === 'bind' || m.page === 'unbind' ? targets(editor).length : 1;
66
71
  }
67
72
  export function sourcesKey(editor: Editor, event: TextKey): 'sources' | null {
68
73
  const m = editor.sources;
@@ -101,10 +106,14 @@ export function sourcesKey(editor: Editor, event: TextKey): 'sources' | null {
101
106
  }
102
107
  if (!plain)
103
108
  return null;
104
- if (['review', 'diagnose', 'auto-review'].includes(m.page) && ['up', 'down', 'pageup', 'pagedown', 'home'].includes(key)) {
109
+ if (['review', 'diagnose', 'auto-review', 'checks', 'binding-cleanup'].includes(m.page) && ['up', 'down', 'pageup', 'pagedown', 'home'].includes(key)) {
105
110
  m.scroll = key === 'home' ? 0 : Math.max(0, m.scroll + (key === 'up' ? -1 : key === 'pageup' ? -8 : key === 'pagedown' ? 8 : 1));
106
111
  return null;
107
112
  }
113
+ if (['checks','bindings'].includes(m.page) && ['left','right'].includes(key)) {
114
+ const total=m.page==='checks'?m.inspection?.total:m.bindingReview?.total;
115
+ m.offset=Math.max(0,Math.min(m.offset+(key==='left'?-16:16),Math.max(0,Math.floor(((total??1)-1)/16)*16)));m.cursor=0;m.effect=m.page==='checks'?'checks':'bindings';return 'sources';
116
+ }
108
117
  if (m.page === 'auto-review' && ['left', 'right'].includes(key)) { m.automaticInterval = Math.max(60, Math.min(86400, m.automaticInterval + (key === 'left' ? -60 : 60))); return null; }
109
118
  if (key === 'up' || key === 'down')
110
119
  m.cursor = Math.max(0, Math.min(count(editor) - 1, m.cursor + (key === 'up' ? -1 : 1)));
@@ -117,14 +126,17 @@ export function sourcesKey(editor: Editor, event: TextKey): 'sources' | null {
117
126
  m.selected = selected.id;
118
127
  m.page = 'actions';
119
128
  }
129
+ else if(m.cursor === (m.library?.sources.length??0)+1){m.offset=0;m.effect='bindings';}
120
130
  else
121
131
  m.page = 'kind';
122
132
  m.cursor = 0;
123
133
  }
134
+ else if(m.page==='bindings'){const row=m.bindingReview?.rows[m.cursor];if(row?.removable){m.bindingSelection=row.id;m.page='binding-cleanup';m.scroll=0;}}
135
+ else if(m.page==='binding-cleanup')m.effect='binding-cleanup';
124
136
  else if (m.page === 'kind')
125
137
  form(editor, (['json', 'github', 'command'] as const)[m.cursor]!);
126
138
  else if (m.page === 'actions') {
127
- const action = actions(editor)[m.cursor]!;
139
+ const action = actions(editor)[m.cursor]!;m.offset=0;
128
140
  if (action === 'edit')
129
141
  form(editor, source(editor)!.kind, true);
130
142
  else if (action === 'bind' || action === 'unbind' || action === 'remove') {
@@ -188,46 +200,36 @@ export async function performSourceAction(editor: Editor, backend: SourceBackend
188
200
  m.library = await backend.request('sources_read', {});
189
201
  const target = editor.baseline.configuration;
190
202
  m.context = await backend.request('source_context', { project: target?.project_root ?? (target?.target.kind === 'project' ? target.target.path : null), session: null, agent: null });
203
+ if(!m.closed){editor.sourceDraftRegistered=true;await backend.request('source_draft',{owner:editor.sourceDraftOwner,bindings:draftBindings(editor),close:false});}
191
204
  return;
192
205
  }
206
+ if(effect==='bindings'||effect==='binding-cleanup'){
207
+ m.bindingReview=effect==='bindings'?await backend.request('source_bindings_review',{offset:m.offset}):await backend.request('source_bindings_cleanup',{revision:m.bindingReview!.revision,ids:[m.bindingSelection]});
208
+ m.page='bindings';m.cursor=0;m.scroll=0;return;
209
+ }
193
210
  if (effect === 'review' || effect === 'auto-review') {
194
211
  m.review = await backend.request('source_review', { id: m.selected });
195
212
  m.page = effect;
196
- m.automaticInterval = m.library?.automatic.find(p => p.source_id === m.selected)?.interval_seconds ?? Math.max(60, Math.min(86400, m.review.source.ttl_seconds));
213
+ m.automaticInterval = m.library?.automatic.find(p => p.source_id === m.selected)?.interval_seconds ?? (m.review.source.kind === 'command' ? 300 : Math.max(60, Math.min(86400, m.review.source.ttl_seconds)));
197
214
  m.scroll = 0;
198
215
  return;
199
216
  }
200
- if (effect === 'status' || effect === 'cancel') {
201
- const selected = source(editor)!;
202
- const context = await backend.request('source_context', { project: selected.scope.project ?? m.context?.project ?? null, session: selected.scope.session, agent: selected.scope.agent });
203
- const observed = await backend.request('source_diagnose', { id: m.selected, context });
204
- const jobs = await Promise.all(observed.jobs.map(job => backend.request(effect === 'cancel' && job.state === 'running' ? 'source_cancel' : 'source_status', { id: job.id })));
205
- m.jobs = m.jobs.map(job => jobs.find(updated => updated.id === job.id) ?? job);
206
- m.details = [JSON.stringify(observed.automatic, null, 2), ...jobs.map(job => `${job.id}: ${job.state} (${job.reason})`)];
207
- m.page = 'diagnose';
208
- m.scroll = 0;
209
- return;
210
- }
211
- if (effect === 'refresh' || effect === 'diagnose') {
212
- const selected = source(editor)!;
213
- const context = await backend.request('source_context', { project: selected.scope.project ?? m.context?.project ?? null, session: selected.scope.session, agent: selected.scope.agent });
214
- if (effect === 'refresh') {
215
- if (m.closed || editor.sources !== m) return;
216
- const job = await backend.request('source_refresh', { id: m.selected, context, owner: m.owner });
217
- if (m.closed || editor.sources !== m) {
218
- await backend.request('source_release', { id: job.id, owner: m.owner });
219
- return;
220
- }
221
- m.jobs = [...m.jobs.filter(previous=>previous.id!==job.id),job];
222
- m.message = text('sources.refresh_started');
217
+ if (['status','cancel','refresh','diagnose','checks','raw'].includes(effect)) {
218
+ const selected=source(editor)!;
219
+ const context=await backend.request('source_context',{project:selected.scope.project??m.context?.project??null,session:selected.scope.session,agent:selected.scope.agent});
220
+ if(m.closed||editor.sources!==m)return;
221
+ if(effect==='refresh'){
222
+ const job=await backend.request('source_refresh',{id:m.selected,context,owner:m.owner});
223
+ if(m.closed||editor.sources!==m){await backend.request('source_release',{id:job.id,owner:m.owner});return;}
224
+ m.jobs=[...m.jobs.filter(previous=>previous.id!==job.id),job];m.message=text('sources.refresh_started');return;
223
225
  }
224
- else {
225
- const result = await backend.request('source_diagnose', { id: m.selected, context });
226
- m.details = JSON.stringify(result, null, 2).split('\n');
227
- m.page = 'diagnose';
228
- m.scroll = 0;
226
+ if(effect==='cancel'){
227
+ const report=await backend.request('source_diagnose',{id:m.selected,context});
228
+ for(const job of report.jobs.filter(j=>j.state==='running'))await backend.request('source_cancel',{id:job.id});
229
229
  }
230
- return;
230
+ const report=await backend.request('source_inspect',{id:m.selected,context,offset:m.offset});
231
+ if(m.closed||editor.sources!==m)return;
232
+ m.inspection=report;m.jobs=m.jobs.map(j=>report.jobs.find(updated=>updated.id===j.id)??j);m.details=effect==='raw'?JSON.stringify(report,null,2).split('\n'):[];m.page=effect==='checks'?'checks':'diagnose';m.scroll=0;return;
231
233
  }
232
234
  const payload: Record<string, unknown> = { action: effect, id: m.selected, expected_revision: m.library!.revision };
233
235
  if (effect === 'save') {
@@ -243,6 +245,7 @@ export async function performSourceAction(editor: Editor, backend: SourceBackend
243
245
  parsed.pr = parsed.pr === '' ? null : Number(parsed.pr);
244
246
  Object.assign(payload, { action: m.editing ? 'edit' : 'add', id, source: { name: name || id, kind: m.kind, scope: { project: project || null, session: session || null, agent: agent || null }, ttl_seconds: Number(ttl_seconds), settings: parsed } });
245
247
  }
248
+ if(effect==='bind'){payload.binding=m.target?editor.instance(m.target.scope,m.target.id)?.source?.binding:null;payload.draft_owner=editor.sourceDraftOwner;editor.sourceDraftRegistered=true;await backend.request('source_draft',{owner:editor.sourceDraftOwner,bindings:draftBindings(editor),close:false});}
246
249
  if (effect === 'enable' || effect === 'auto-on') payload.review_revision = m.review?.review_revision;
247
250
  if (effect === 'auto-on') payload.interval_seconds = m.automaticInterval;
248
251
  const result = await backend.request('sources_apply', payload);
@@ -278,8 +281,13 @@ export function sourcesView(editor: Editor, language: Language, width: number, h
278
281
  if (m.message)
279
282
  add(t(m.message.key, language, m.message.params));
280
283
  if (m.page === 'list') {
281
- m.library?.sources.forEach((s, i) => add(`${s.name} · ${s.kind} · ${tr(s.enabled ? 'enabled' : 'disabled')}${s.kind === 'github' ? ' · ' + tr(m.library!.automatic.some(p => p.source_id === s.id && p.enabled) ? 'automatic_on' : 'automatic_off') : ''}`, m.cursor === i));
284
+ m.library?.sources.forEach((s, i) => add(`${s.name} · ${tr(s.kind)} · ${tr(s.enabled ? 'enabled' : 'disabled')}${['github','command'].includes(s.kind) ? ' · ' + tr(m.library!.automatic.some(p => p.source_id === s.id && p.enabled) ? 'automatic_on' : 'automatic_off') : ''}`, m.cursor === i));
282
285
  add('+ ' + tr('add'), m.cursor === (m.library?.sources.length ?? 0));
286
+ add(tr('bindings'),m.cursor===(m.library?.sources.length??0)+1);
287
+ }
288
+ else if(m.page==='bindings'){
289
+ add(tr(m.bindingReview?.uncertain?'bindings_uncertain':'bindings_help'));
290
+ m.bindingReview?.rows.forEach((row,i)=>add(`${row.id} · ${row.source_id} · ${tr(row.removable?'binding_unused':'binding_protected')}${row.duplicate?' · '+tr('binding_duplicate'):''} · ${row.references.join(', ')}`,m.cursor===i));
283
291
  }
284
292
  else if (m.page === 'actions')
285
293
  actions(editor).forEach((action, i) => add(tr(action), m.cursor === i));
@@ -302,7 +310,8 @@ export function sourcesView(editor: Editor, language: Language, width: number, h
302
310
  else if (m.page === 'remove')
303
311
  add(tr('remove_confirm') + ' ' + source(editor)?.name, true);
304
312
  else {
305
- const lines = ['review', 'auto-review'].includes(m.page) ? [tr(m.page === 'auto-review' ? 'automatic_review' : 'enable_review'), ...(m.page === 'auto-review' ? [tr('interval') + ': ' + m.automaticInterval + ' s (←/→)'] : []), ...JSON.stringify(m.review?.source, null, 2).split('\n')] : m.details;
313
+ const readable=m.page==='checks'?[tr('checks_help'),...(m.inspection?[[m.inspection.source.settings.repository,m.inspection.source.settings.branch,m.inspection.checks_context?.head].filter(Boolean).join(' · ')]:[]),m.inspection?.checks_observed_at??t('task.unknown',language),...(m.inspection?.checks.flatMap(c=>[`${c.name} · ${c.state} · ${tr('check.'+c.bucket)}`,...(c.url?[c.url]:[])])??[])]:m.page==='binding-cleanup'?[tr('binding_cleanup_confirm'),m.bindingSelection??'']:m.inspection?sourceSummary(m.inspection,language):m.details;
314
+ const lines = ['review', 'auto-review'].includes(m.page) ? [tr(m.page === 'auto-review' ? 'automatic_review' : 'enable_review'), ...(m.page === 'auto-review' ? [tr('interval') + ': ' + m.automaticInterval + ' s (←/→)'] : []), ...(m.review?sourceReviewLines(m.review.source,language):[])] : m.details.length?m.details:readable;
306
315
  const wrapped = lines.flatMap(line => wrapText([line], width));
307
316
  const capacity = Math.max(1, height - rows.length);
308
317
  const start = Math.min(m.scroll, Math.max(0, wrapped.length - capacity));
@@ -313,3 +322,6 @@ export function sourcesView(editor: Editor, language: Language, width: number, h
313
322
  const selected = Math.max(0, entries.findIndex(row => row.selected)), start = Math.max(0, selected - capacity + 1);
314
323
  return [...fixed, ...entries.slice(start, start + capacity)];
315
324
  }
325
+
326
+ export function draftBindings(editor:Editor):string[]{return [...new Set([...editor.draft.display.instances,...editor.draft.display.subagents.instances].flatMap(n=>n.source?.binding?[n.source.binding]:[]))];}
327
+ export async function closeSourceDraft(editor:Editor,backend:SourceBackend):Promise<void>{if(editor.sourceDraftRegistered){await backend.request('source_draft',{owner:editor.sourceDraftOwner,bindings:[],close:true});editor.sourceDraftRegistered=false;}}
@@ -0,0 +1,22 @@
1
+ // Generated by tools/generation/resources.ts; do not edit.
2
+ import type { SourceInspection, SourceDefinition } from '../generated-contracts.ts';
3
+ import { t, type Language } from '../i18n/index.ts';
4
+ /** Shared readable presentation; raw observations remain available separately. */
5
+ export function sourceSummary(report:SourceInspection,language:Language):string[] {
6
+ const tr=(key:string,params:Record<string,unknown>={})=>t('sources.'+key,language,params),unknown=t('task.unknown',language);
7
+ const {source,view,automatic}=report;
8
+ const reason=(value:string)=>t('sources.error.'+value,language,{},t('sources.reason.'+value,language,{},value));
9
+ const lines=[source.name+' · '+tr(source.enabled?'enabled':'disabled'),tr('summary_state',{state:tr('reason.'+automatic.state),reason:reason(automatic.reason)}),tr('summary_scope',{project:source.scope.project??tr('scope_all'),session:source.scope.session??tr('scope_all'),agent:source.scope.agent??tr('scope_all')}),tr('summary_value',{value:view.value===null?unknown:String(view.value),state:tr('reason.'+view.state),freshness:tr('reason.'+view.freshness)}),tr('summary_reason',{reason:reason(view.reason)}),tr('summary_success',{value:report.last_success??automatic.last_success??unknown}),tr('summary_next',{value:automatic.next_at??unknown,interval:automatic.interval_seconds})];
10
+ for(const job of report.jobs){
11
+ lines.push(tr('summary_job',{id:job.id,state:tr('reason.'+job.state),reason:reason(job.reason)}));
12
+ lines.push(tr('summary_scope',{project:job.context.project??unknown,session:job.context.session??unknown,agent:job.context.agent??unknown}));
13
+ if(job.context.branch||job.context.head)lines.push((job.context.branch??unknown)+' · '+(job.context.head??unknown));
14
+ if(job.result){lines.push(tr('summary_result',{duration:job.result.duration_ms,code:job.result.exit_code??unknown,time:job.result.finished_at}));if(job.result.summary)lines.push(job.result.summary);}
15
+ }
16
+ return lines;
17
+ }
18
+
19
+ export function sourceReviewLines(source:SourceDefinition,language:Language):string[]{
20
+ const tr=(key:string)=>t('sources.'+key,language),all=tr('scope_all');
21
+ return [tr('field.id')+': '+source.id,tr('field.name')+': '+source.name,tr(source.kind),tr('field.project')+': '+(source.scope.project??all),tr('field.session')+': '+(source.scope.session??all),tr('field.agent')+': '+(source.scope.agent??all),tr('field.ttl_seconds')+': '+source.ttl_seconds,...Object.entries(source.settings).map(([key,value])=>tr('field.'+key)+': '+(typeof value==='object'?JSON.stringify(value):String(value??'')))];
22
+ }
@@ -18,8 +18,11 @@ function definition(v: unknown): boolean {
18
18
  return fields(s, ['host', 'repository', 'branch', 'account', 'pr']) && ['host', 'repository', 'branch', 'account'].every(key => text(s[key])) && (s.pr === null || typeof s.pr === 'number' && Number.isSafeInteger(s.pr) && s.pr > 0);
19
19
  return fields(s, ['executable', 'args', 'cwd', 'input', 'output', 'timeout_ms']) && text(s.executable) && text(s.cwd) && Array.isArray(s.args) && s.args.length <= 128 && s.args.every(arg => typeof arg === 'string' && arg.length <= 8192 && !arg.includes('\0')) && object(s.input) && Object.entries(s.input).every(([key, value]) => /^[A-Za-z][A-Za-z0-9_]{0,63}$/u.test(key) && ['project', 'session', 'agent', 'branch', 'head'].includes(String(value))) && ['json', 'text'].includes(String(s.output)) && typeof s.timeout_ms === 'number' && Number.isInteger(s.timeout_ms) && s.timeout_ms >= 100 && s.timeout_ms <= 30000;
20
20
  }
21
+ export function validSourceExecution(v:unknown):boolean {
22
+ return fields(v,['finished_at','duration_ms','exit_code','reason','summary']) && text(v.finished_at) && Number.isFinite(Date.parse(v.finished_at)) && typeof v.duration_ms==='number' && Number.isFinite(v.duration_ms) && v.duration_ms>=0 && (v.exit_code===null||Number.isSafeInteger(v.exit_code)) && text(v.reason) && text(v.summary) && v.summary.length<=4096;
23
+ }
21
24
  function job(v: unknown): boolean {
22
- return fields(v, ['version', 'id', 'source_id', 'source_revision', 'owner', 'context', 'started_at', 'deadline_at', 'state', 'reason', 'trigger', 'identity', 'consumers']) && v.version === 3 && Array.isArray(v.consumers) && v.consumers.length <= 128 && new Set(v.consumers.map(c=>object(c)?c.owner:null)).size === v.consumers.length && v.consumers.every(c=>fields(c,['owner','expires_at']) && id(c.owner) && text(c.expires_at) && Number.isFinite(Date.parse(c.expires_at)) && typeof v.deadline_at==='string' && Date.parse(c.expires_at)<=Date.parse(v.deadline_at)) && ['manual', 'automatic'].includes(String(v.trigger)) && typeof v.identity === 'string' && /^[a-f0-9]{64}$/.test(v.identity) && ['id', 'source_id', 'source_revision', 'owner'].every(key => id(v[key])) && isSourceContext(v.context) && text(v.started_at) && Number.isFinite(Date.parse(v.started_at)) && text(v.deadline_at) && Number.isFinite(Date.parse(v.deadline_at)) && ['running', 'completed', 'failed', 'cancelled'].includes(String(v.state)) && text(v.reason);
25
+ return fields(v, ['version', 'id', 'source_id', 'source_revision', 'owner', 'context', 'started_at', 'deadline_at', 'state', 'reason', 'trigger', 'identity', 'consumers', ...(object(v)&&Object.hasOwn(v,'result')?['result']:[])]) && [3,4].includes(Number(v.version)) && (v.result===undefined||v.result===null||validSourceExecution(v.result)) && Array.isArray(v.consumers) && v.consumers.length <= 128 && new Set(v.consumers.map(c=>object(c)?c.owner:null)).size === v.consumers.length && v.consumers.every(c=>fields(c,['owner','expires_at']) && id(c.owner) && text(c.expires_at) && Number.isFinite(Date.parse(c.expires_at)) && typeof v.deadline_at==='string' && Date.parse(c.expires_at)<=Date.parse(v.deadline_at)) && ['manual', 'automatic'].includes(String(v.trigger)) && typeof v.identity === 'string' && /^[a-f0-9]{64}$/.test(v.identity) && ['id', 'source_id', 'source_revision', 'owner'].every(key => id(v[key])) && isSourceContext(v.context) && text(v.started_at) && Number.isFinite(Date.parse(v.started_at)) && text(v.deadline_at) && Number.isFinite(Date.parse(v.deadline_at)) && ['running', 'completed', 'failed', 'cancelled'].includes(String(v.state)) && text(v.reason);
23
26
  }
24
27
  function view(v: unknown): boolean {
25
28
  return object(v) && nullable(v.source_id) && text(v.name) && ['valid', 'missing', 'partial', 'error', 'unsupported', 'disabled', 'unbound', 'mismatch'].includes(String(v.state)) && text(v.reason) && nullable(v.observed_at) && ['current', 'stale', 'unknown'].includes(String(v.freshness)) && scalar(v.value) && nullable(v.unit) && (v.fields === undefined || object(v.fields) && Object.values(v.fields).every(scalar));
@@ -27,6 +30,12 @@ function view(v: unknown): boolean {
27
30
  export function isSourceResult(operation: string, value: unknown): boolean {
28
31
  if (!object(value))
29
32
  return false;
33
+ if(operation==='source_draft')return fields(value,['revision'])&&text(value.revision);
34
+ if(operation==='source_bindings_review'||operation==='source_bindings_cleanup')return fields(value,['revision','rows','offset','total','uncertain'])&&text(value.revision)&&typeof value.uncertain==='boolean'&&Number.isSafeInteger(value.offset)&&Number(value.offset)>=0&&Number.isSafeInteger(value.total)&&Number(value.total)>=0&&Array.isArray(value.rows)&&value.rows.length<=16&&value.rows.every(r=>fields(r,['id','source_id','references','duplicate','removable'])&&id(r.id)&&id(r.source_id)&&Array.isArray(r.references)&&r.references.length<=16&&r.references.every(text)&&typeof r.duplicate==='boolean'&&typeof r.removable==='boolean');
35
+ if(operation==='source_inspect'){
36
+ const {last_success,checks,checks_observed_at,checks_context,offset,total,...diagnosis}=value;
37
+ return fields(value,['source','view','jobs','automatic','last_success','checks','checks_observed_at','checks_context','offset','total'])&&isSourceResult('source_diagnose',diagnosis)&&nullable(last_success)&&nullable(checks_observed_at)&&(checks_context===null||isSourceContext(checks_context))&&Number.isSafeInteger(offset)&&Number(offset)>=0&&Number.isSafeInteger(total)&&Number(total)>=0&&Array.isArray(checks)&&checks.length<=16&&checks.every(c=>fields(c,['name','state','bucket','url'])&&text(c.name)&&text(c.state)&&text(c.bucket)&&nullable(c.url)&&(c.url===null||/^https?:\/\//u.test(String(c.url))));
38
+ }
30
39
  if (operation === 'source_context')
31
40
  return isSourceContext(value);
32
41
  if (operation === 'source_review')
@@ -37,7 +46,7 @@ export function isSourceResult(operation: string, value: unknown): boolean {
37
46
  return fields(value, ['source', 'view', 'jobs', 'automatic']) && object(value.automatic) && ['off', 'waiting', 'running', 'backoff', 'paused'].includes(String(value.automatic.state)) && text(value.automatic.reason) && ['next_at', 'last_attempt', 'last_success'].every(k => value.automatic && nullable((value.automatic as Record<string, unknown>)[k])) && typeof value.automatic.interval_seconds === 'number' && value.automatic.interval_seconds >= 60 && value.automatic.interval_seconds <= 86400 && definition(value.source) && view(value.view) && Array.isArray(value.jobs) && value.jobs.every(job);
38
47
  if (!['sources_read', 'sources_apply'].includes(operation) || !fields(value, ['version', 'sources', 'bindings', 'automatic', 'revision', ...(operation === 'sources_apply' ? ['backup_dir', ...(Object.hasOwn(value, 'binding') ? ['binding'] : [])] : [])]))
39
48
  return false;
40
- if (value.version !== 2 || !text(value.revision) || !Array.isArray(value.sources) || value.sources.length > 128 || !value.sources.every(definition) || !Array.isArray(value.bindings) || value.bindings.length > 4096)
49
+ if (![2,3].includes(Number(value.version)) || !text(value.revision) || !Array.isArray(value.sources) || value.sources.length > 128 || !value.sources.every(definition) || !Array.isArray(value.bindings) || value.bindings.length > 4096)
41
50
  return false;
42
51
  if (!Array.isArray(value.automatic) || value.automatic.length > value.sources.length || !value.automatic.every(p => fields(p, ['source_id', 'enabled', 'review_revision', 'interval_seconds', 'auth_revision']) && id(p.source_id) && typeof p.enabled === 'boolean' && id(p.review_revision) && typeof p.interval_seconds === 'number' && Number.isInteger(p.interval_seconds) && p.interval_seconds >= 60 && p.interval_seconds <= 86400 && typeof p.auth_revision === 'string' && /^[a-f0-9]{64}$/.test(p.auth_revision))) return false;
43
52
  if (!value.bindings.every(b => fields(b, ['id', 'source_id']) && id(b.id) && id(b.source_id)))
@@ -1,5 +1,5 @@
1
1
  // Generated by tools/generation/resources.ts; do not edit.
2
- export const PROTOCOL_VERSION = 27 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 = ['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;
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,8 +888,21 @@ 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
+ }
877
903
  /** Read-only package inspection. These views do not grant installation authority. */
878
904
  export interface PackageStatus {
905
+ execution?: PackageExecution | null;
879
906
  version: 1;
880
907
  backend_version: string;
881
908
  captured_at: string;
@@ -901,7 +928,7 @@ export interface PackageHistoryRow {
901
928
  created: string | null;
902
929
  stage: string;
903
930
  backup: 'verified' | 'missing' | 'invalid';
904
- running: boolean;
931
+ running: boolean | null;
905
932
  }
906
933
  export interface PackageReviewRequest {
907
934
  action: 'check' | 'update' | 'rollback' | 'recover-package' | 'restore-config';
@@ -1003,12 +1030,21 @@ export interface ApplyResult {
1003
1030
  configuration?: ResolvedConfiguration;
1004
1031
  }
1005
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;
1006
1038
  package_status: PackageStatus;
1007
1039
  package_review_start: PackageReviewJob;
1008
1040
  package_review_status: PackageReviewJob;
1009
1041
  package_review_cancel: PackageReviewJob;
1010
1042
  sources_read: SourcesResult;
1011
1043
  sources_apply: SourceMutationResult;
1044
+ source_inspect: SourceInspection;
1045
+ source_bindings_review: BindingReview;
1046
+ source_bindings_cleanup: BindingReview;
1047
+ source_draft: { revision: string };
1012
1048
  source_review: SourceReview;
1013
1049
  source_context: SourceContext;
1014
1050
  source_refresh: SourceJob;
@@ -1041,5 +1077,5 @@ export interface Request {
1041
1077
  operation: Operation;
1042
1078
  payload: unknown;
1043
1079
  }
1044
- export type Result = PackageStatus | PackageReviewJob | 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;
1045
1081
  export type Response = { protocol_version: typeof PROTOCOL_VERSION; result: Result } | { protocol_version: typeof PROTOCOL_VERSION; error: ProtocolError };