@fbincon/claude-code-statusline 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -70
- package/candidate.json +190 -139
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.d.ts +12 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js +101 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profile-command.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profiles.d.ts +54 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profiles.js +199 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profiles.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js +5 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.d.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js +4 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.js +9 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/command.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.d.ts +8 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.js +6 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js +9 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.d.ts +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js +3 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/configure.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js +4 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +30 -8
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/recovery/journal.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/configuration.d.ts +12 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/configuration.js +59 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/configuration.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/main.js +15 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/main.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js +25 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/command.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/service.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/service.js +93 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/tasks/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +5 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +33 -8
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/.claude-plugin/plugin.json +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/hooks/register.ts +89 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +54 -4
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +8 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/profile-manager.ts +239 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/task-detail.ts +27 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +53 -3
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +768 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/session.ts +2 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json +16 -14
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +6 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +1 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +3 -3
- package/node_modules/@fbincon/statusline-core/dist/src/config/profiles.d.ts +16 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/profiles.js +69 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/profiles.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +82 -3
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +71 -4
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.d.ts +60 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js +330 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-detail.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-detail.js +25 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/task-detail.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +762 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +768 -6
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/release.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/release.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/details.d.ts +24 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/details.js +153 -0
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/tasks/details.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +128 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +128 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +128 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +128 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +128 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +128 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/project-paths.d.ts +8 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/project-paths.js +41 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/project-paths.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +5 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js +2 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/presentation.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js +2 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/shortcuts.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js +3 -2
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +7 -3
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +18 -2
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/package.json +1 -1
|
@@ -43,6 +43,7 @@ type EditorData = Pick<
|
|
|
43
43
|
| 'detail'
|
|
44
44
|
| 'guidanceScroll'
|
|
45
45
|
| 'explanation'
|
|
46
|
+
| 'profiles'
|
|
46
47
|
| 'quick'
|
|
47
48
|
| 'review'
|
|
48
49
|
| 'preset'
|
|
@@ -98,7 +99,7 @@ export function clientProps(
|
|
|
98
99
|
pickerSaved: e.pickerSaved,
|
|
99
100
|
detail: e.detail, preset: e.preset, path: e.path, pendingTransfer: e.pendingTransfer,
|
|
100
101
|
guidanceScroll: e.guidanceScroll,
|
|
101
|
-
review: e.review, quick: e.quick, explanation:e.explanation,
|
|
102
|
+
review: e.review, quick: e.quick, explanation:e.explanation, profiles:e.profiles,
|
|
102
103
|
setting: e.setting,
|
|
103
104
|
activeNumeric: e.activeNumeric,
|
|
104
105
|
selected: e.selected,
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-native/resource-manifest.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
|
-
"backend_version": "3.
|
|
4
|
-
"mod_version": "3.
|
|
5
|
-
"protocol_version":
|
|
3
|
+
"backend_version": "3.4.0",
|
|
4
|
+
"mod_version": "3.4.0",
|
|
5
|
+
"protocol_version": 15,
|
|
6
6
|
"files": {
|
|
7
|
-
".claude-plugin/plugin.json": "
|
|
7
|
+
".claude-plugin/plugin.json": "1cfb479569ed0dc09d731ae7768e4887e61a2726fe483d165f373bdbae1e378e",
|
|
8
8
|
"hooks/hooks.json": "8395d73f4e9d61a02c0976385465d87a05abb2825408f8b40ae916b144c05575",
|
|
9
|
-
"hooks/register.ts": "
|
|
10
|
-
"lib/backend.ts": "
|
|
9
|
+
"hooks/register.ts": "37d797d682b869e532f068c9a6c54ebc90581ed293377f4fc4b6a41535395fe6",
|
|
10
|
+
"lib/backend.ts": "986c452e7b3c34083de91d6455edc60c0480dcc1eb15d305e4d4fa6b9ad11639",
|
|
11
11
|
"lib/client/forms.ts": "0169bc1a009cdeb021ac21e7b33d332e7a3d9603c0ad9f5751b4936708396ea7",
|
|
12
|
-
"lib/client/keys.ts": "
|
|
12
|
+
"lib/client/keys.ts": "5f993ef48a8e42f8d6eed04bdedb9d142f027f794fbb3da230ab123e2c283518",
|
|
13
13
|
"lib/client/messages.ts": "2bd3f05645ef2bed015c31f48fe0773a9949f6c27e9912ece8caa5ac51db1240",
|
|
14
|
-
"lib/client/settings.ts": "
|
|
14
|
+
"lib/client/settings.ts": "a22fae5ff81fca3e64d3c284fd500bccf16cfc19d8690dc290494579ec907fce",
|
|
15
15
|
"lib/editor/appearance.ts": "70d1b49efa8647ec71d02329526801e15c1b908aadce83838903103f926ddfb3",
|
|
16
|
-
"lib/editor/draft.ts": "
|
|
16
|
+
"lib/editor/draft.ts": "9f1987c3fcd50a6f23b273ed02cfe34af3becfa99915ea6d4aec284df4be6dd0",
|
|
17
17
|
"lib/editor/explanation.ts": "ecf3e84bfa5ffc6c9c8102cc7c82f3ab965f72a6faebe078c76b05dc91a3cc60",
|
|
18
18
|
"lib/editor/forms.ts": "4ed0e1a461563cb4d16d0377f2caeac20c1e780ba9d59b51901fc2c94cc8acaa",
|
|
19
19
|
"lib/editor/guidance.ts": "0ac8d87d7162327f76db39c02fd97fa7dd80ceffa29abd08da20d6eb8b1d7574",
|
|
@@ -21,22 +21,24 @@
|
|
|
21
21
|
"lib/editor/instances.ts": "03a64e4c015de655bab1f1fde5a33b149b0705e1b663bd6179b89756af88c676",
|
|
22
22
|
"lib/editor/navigation.ts": "f66f382918f7071f8a1373955b8818fcd010d712e6bd84fe7ce461a123f4bb41",
|
|
23
23
|
"lib/editor/numeric.ts": "65645e2d9e95223662275f499541cc67c5c3d4efa177e50a4fbe9b00b51043ea",
|
|
24
|
+
"lib/editor/profile-manager.ts": "79b98f29dc63b6dcd4f777b620a78d98539a069cc8ff9cce22fc66e80a153a00",
|
|
24
25
|
"lib/editor/quick-setup.ts": "326a1615f64ac6dde5d6cb09b388b3f2a54a179f782941f50210a96be54f242d",
|
|
25
26
|
"lib/editor/search.ts": "07e9ae365f89259bcd93957d39aaeb3cbfe09572a5f2a6f82eef2c2876021f21",
|
|
27
|
+
"lib/editor/task-detail.ts": "7277f84ec6fc91c24156a010af0ed1324b4f28076150cc02e90c652a8eeed93a",
|
|
26
28
|
"lib/editor/text-input.ts": "c1968edf898e9abd96da9f5326d530c581ef320721197bfb63497825198f81f0",
|
|
27
|
-
"lib/generated-contracts.ts": "
|
|
29
|
+
"lib/generated-contracts.ts": "e01d0db5a04df15894c1fe687f4aad3f32fdfd01f9893dbd1cf6317d4dfba051",
|
|
28
30
|
"lib/generated-unicode.ts": "781c7db664dc6166bc2fcf878565937cd8b25b57d192ae420b3016e1ce510907",
|
|
29
|
-
"lib/i18n/generated-locales.ts": "
|
|
31
|
+
"lib/i18n/generated-locales.ts": "49af0a9003c7d818f38a67c5f1c6bbf7546aa0d8adfe0a74faee44024daa2f9f",
|
|
30
32
|
"lib/i18n/index.ts": "e5e62b59bdd1c984c182cbf706e5d98b398b4d5e9efb233803eacde38f7e5a9a",
|
|
31
33
|
"lib/i18n/messages.ts": "31775673f7b18efec0f131012e220c523625c77e1e34fc09ecc7732070ede5d1",
|
|
32
34
|
"lib/i18n/presentation.ts": "aac92373c1ffa0bcd0b46da342be1d9f19b4c9c64c417ca2877205649852f058",
|
|
33
35
|
"lib/launch.ts": "08303623ef74cb1ce297b6d4ca32d872908dea513ab394ebc1210b8f92c12328",
|
|
34
36
|
"lib/preferences.ts": "472cccb55fe3b1ab99ba58416654c3982f4ff83479df19960ab8f1dcd551d410",
|
|
35
37
|
"lib/preview-preferences.ts": "54fee4a98d18717064ce083a76e6fee5f6ddaead98455cfd24391641cb6aff6d",
|
|
36
|
-
"lib/session.ts": "
|
|
38
|
+
"lib/session.ts": "bf08b6e8f2b8fb359b08b58b3b0e88d9cd4ab98d1f6e2b21346efd94dae9f461",
|
|
37
39
|
"lib/unicode.ts": "f19f01c0255a3e82a227b04dec1c95457cbd6c0834387dcd857037828b1245f6",
|
|
38
|
-
"ui/client/draw.ts": "
|
|
39
|
-
"ui/client/help.ts": "
|
|
40
|
+
"ui/client/draw.ts": "a932c9700be1e2cdfb740bfcb6ab9b079cb5b0cb002042e99850ec744b857160",
|
|
41
|
+
"ui/client/help.ts": "b77b476d5b479e23622484f637d326e323d8fdd02ddec8b449783ba3d62af56a",
|
|
40
42
|
"ui/client/surface.ts": "218a7242add0e05a8ceb46e55f8d94fd37f4e35af2777157e6ccac75eee2eb50",
|
|
41
43
|
"ui/components/catalog.ts": "aceb7bf838514497aa8d5bcb2ca48b1fa7a2a969eb842ea8000cb1f84600a29d",
|
|
42
44
|
"ui/components/preview.ts": "fd7a8b836c633fd9838764c05e47300cda29cebad2132e942313b819195a9616",
|
|
@@ -19,6 +19,7 @@ import { settingPresentation, preferenceLabel } from '../../lib/i18n/presentatio
|
|
|
19
19
|
import { itemSpans } from '../components/catalog.ts';
|
|
20
20
|
import { guidanceLines } from '../../lib/editor/guidance.ts';
|
|
21
21
|
import { reviewRows } from '../../lib/editor/import-review.ts';
|
|
22
|
+
import { profilesView, targetLabel } from '../../lib/editor/profile-manager.ts';
|
|
22
23
|
|
|
23
24
|
export function draw(ui: ClientElements, view: View, columns: number, rows: number): RenderElement {
|
|
24
25
|
const tr = (key: string, params: Record<string, unknown> = {}) => t(key, view.language ?? 'en', params);
|
|
@@ -55,7 +56,10 @@ export function draw(ui: ClientElements, view: View, columns: number, rows: numb
|
|
|
55
56
|
: '');
|
|
56
57
|
const content: RenderElement[] = [];
|
|
57
58
|
let title = '';
|
|
58
|
-
if(e.
|
|
59
|
+
if(e.profiles) {
|
|
60
|
+
title = tr('profiles.title');
|
|
61
|
+
content.push(...profilesView(e,view.language ?? 'en',inner,layout.bodyRows).map(row=>line(row.text,rowStyle(row.selected))));
|
|
62
|
+
} else if(e.explanation) {
|
|
59
63
|
title=tr('explain.title');
|
|
60
64
|
const lines=explanationLines(e,view.language ?? 'en',inner), capacity=Math.max(1,layout.bodyRows-1);
|
|
61
65
|
const start=Math.min(e.explanation.scroll,Math.max(0,lines.length-capacity));
|
|
@@ -161,7 +165,7 @@ export function draw(ui: ClientElements, view: View, columns: number, rows: numb
|
|
|
161
165
|
return ui.Box({
|
|
162
166
|
width: columns, height: rows, flexDirection: 'column', overflow: 'hidden',
|
|
163
167
|
children: [
|
|
164
|
-
chromeRow(ui, line(tr("native.ui.client.draw.configure_status_line") + (pending ? ' *' : ''), { ...styles.accent, bold: true }), columns),
|
|
168
|
+
chromeRow(ui, line(tr("native.ui.client.draw.configure_status_line") + (pending ? ' *' : '') + (e.baseline.configuration ? ' · ' + targetLabel(e, view.language ?? 'en') : ''), { ...styles.accent, bold: true }), columns),
|
|
165
169
|
chromeRow(ui, spanLine(ui, tabs, columns), columns),
|
|
166
170
|
chromeRow(ui, notice ? line(notice, view.error || Object.keys(e.fieldErrors).length ? styles.error : styles.text)
|
|
167
171
|
: line(tr("native.ui.client.draw.click_region_for_keys"), styles.muted), columns),
|
|
@@ -17,6 +17,7 @@ export function editorShortcuts(view: View): Shortcut[][] {
|
|
|
17
17
|
{ key: 'Q', label: 'close (blocked)', short: 'blocked' },
|
|
18
18
|
focus,
|
|
19
19
|
]];
|
|
20
|
+
if (e.profiles) return [[{key:'Enter',label:'accept'},{key:'Ctrl+G',label:'back'},focus],[{key:'↑↓',label:'select'},{key:'R',label:'reload'}]];
|
|
20
21
|
if (e.quick) return [[{key:'Enter',label:'accept'},{key:'Backspace',label:'back'},{key:'Ctrl+G',label:'cancel'},focus],[{key:'↑↓',label:'select'},{key:'←→',label:'adjust'},{key:'Tab',label:'preview'},{key:'PgUp/PgDn',label:'scroll'}]];
|
|
21
22
|
if (e.review) return [
|
|
22
23
|
[{key:'A', label:'accept draft', short:'accept'}, {key:'Q', label:'cancel review', short:'cancel'}],
|
package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
|
-
"backend_version": "3.
|
|
4
|
-
"mod_version": "3.
|
|
3
|
+
"backend_version": "3.4.0",
|
|
4
|
+
"mod_version": "3.4.0",
|
|
5
5
|
"protocol_version": 2,
|
|
6
6
|
"files": {
|
|
7
|
-
".claude-plugin/plugin.json": "
|
|
7
|
+
".claude-plugin/plugin.json": "d0f61fbac52613b770fd24f461a097b9002f0dcdf6617d40f692b5b15ebc809d",
|
|
8
8
|
"hooks/hooks.json": "b57d3d1b4b71a64712aab61b6c53be6b74ab56c8c2b38deec60e343cf055955d",
|
|
9
9
|
"hooks/observe.ts": "7d7cfcff12a9bb89963461fe6cacdebe47a464798bafbce1028c2fa67753c0cd",
|
|
10
10
|
"lib/checklists.ts": "88dc407841f917527e70ed5f03c55cdabb9224b077e4765da92f2f5d9654a904",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ConfigTarget, DisplayProfile, ProfileCollection } from '../contracts/ui.js';
|
|
2
|
+
export declare const PROFILES_FILENAME = "claude-statusline-profiles.json";
|
|
3
|
+
export declare const PROFILE_FORMAT = "claude-code-statusline-profile";
|
|
4
|
+
export declare const PROFILE_VERSION = 1;
|
|
5
|
+
export declare const MAX_PROFILES_BYTES: number;
|
|
6
|
+
export declare const emptyProfiles: () => ProfileCollection;
|
|
7
|
+
export declare function profileError(reason: string, value?: string): never;
|
|
8
|
+
export declare function profileName(value: unknown): string;
|
|
9
|
+
export declare function profileId(value: unknown): string;
|
|
10
|
+
export declare function configTarget(value: unknown): ConfigTarget;
|
|
11
|
+
export declare function validateProfiles(value: unknown): ProfileCollection;
|
|
12
|
+
export declare function findProfile(collection: ProfileCollection, nameOrId: string): DisplayProfile;
|
|
13
|
+
export declare function importProfile(value: unknown): {
|
|
14
|
+
name: string;
|
|
15
|
+
display: DisplayProfile['display'];
|
|
16
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { validateDisplay, isSchema } from './display.js';
|
|
2
|
+
import { ConfigError, object } from './validation.js';
|
|
3
|
+
export const PROFILES_FILENAME = 'claude-statusline-profiles.json';
|
|
4
|
+
export const PROFILE_FORMAT = 'claude-code-statusline-profile';
|
|
5
|
+
export const PROFILE_VERSION = 1;
|
|
6
|
+
export const MAX_PROFILES_BYTES = 32 * 1024 * 1024;
|
|
7
|
+
export const emptyProfiles = () => ({ version: 1, profiles: [], bindings: [] });
|
|
8
|
+
export function profileError(reason, value = '') {
|
|
9
|
+
throw new ConfigError('profiles.error.' + reason, { value }, 'profile_' + reason);
|
|
10
|
+
}
|
|
11
|
+
export function profileName(value) {
|
|
12
|
+
if (typeof value !== 'string' || !value.trim() || [...value].length > 128 || /[\p{Cc}\p{Cs}\p{Zl}\p{Zp}]/u.test(value))
|
|
13
|
+
profileError('name');
|
|
14
|
+
return value.trim().normalize('NFC');
|
|
15
|
+
}
|
|
16
|
+
export function profileId(value) {
|
|
17
|
+
if (typeof value !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,95}$/u.test(value))
|
|
18
|
+
profileError('invalid');
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
export function configTarget(value) {
|
|
22
|
+
if (value === undefined)
|
|
23
|
+
return { kind: 'user' };
|
|
24
|
+
if (!object(value))
|
|
25
|
+
return profileError('invalid');
|
|
26
|
+
if (value.kind === 'user' && Object.keys(value).length === 1)
|
|
27
|
+
return { kind: 'user' };
|
|
28
|
+
if (value.kind === 'profile' && Object.keys(value).length === 2)
|
|
29
|
+
return { kind: 'profile', id: profileId(value.id) };
|
|
30
|
+
if (value.kind === 'project' && Object.keys(value).length === 2 && typeof value.path === 'string' && value.path && !/[\p{Cc}\p{Cs}]/u.test(value.path))
|
|
31
|
+
return { kind: 'project', path: value.path };
|
|
32
|
+
return profileError('invalid');
|
|
33
|
+
}
|
|
34
|
+
export function validateProfiles(value) {
|
|
35
|
+
if (!object(value) || Object.keys(value).sort().join(',') !== 'bindings,profiles,version' || !isSchema(value.version, 1) ||
|
|
36
|
+
!Array.isArray(value.profiles) || !Array.isArray(value.bindings) || value.profiles.length > 128 || value.bindings.length > 512)
|
|
37
|
+
return profileError('invalid');
|
|
38
|
+
const ids = new Set(), names = new Set(), roots = new Set();
|
|
39
|
+
const profiles = value.profiles.map(raw => {
|
|
40
|
+
if (!object(raw) || Object.keys(raw).sort().join(',') !== 'display,id,name')
|
|
41
|
+
return profileError('invalid');
|
|
42
|
+
const id = profileId(raw.id), name = profileName(raw.name);
|
|
43
|
+
if (ids.has(id) || names.has(name))
|
|
44
|
+
return profileError('duplicate', name);
|
|
45
|
+
ids.add(id);
|
|
46
|
+
names.add(name);
|
|
47
|
+
return { id, name, display: validateDisplay(raw.display) };
|
|
48
|
+
});
|
|
49
|
+
const bindings = value.bindings.map(raw => {
|
|
50
|
+
if (!object(raw) || Object.keys(raw).sort().join(',') !== 'profile_id,root' ||
|
|
51
|
+
typeof raw.root !== 'string' || !raw.root || /[\p{Cc}\p{Cs}]/u.test(raw.root) || roots.has(raw.root))
|
|
52
|
+
return profileError('invalid');
|
|
53
|
+
roots.add(raw.root);
|
|
54
|
+
// Retain a dangling reference so resolution can explain it without rewriting the file.
|
|
55
|
+
return { root: raw.root, profile_id: profileId(raw.profile_id) };
|
|
56
|
+
});
|
|
57
|
+
return { version: 1, profiles, bindings };
|
|
58
|
+
}
|
|
59
|
+
export function findProfile(collection, nameOrId) {
|
|
60
|
+
const found = collection.profiles.find(p => p.id === nameOrId) ?? collection.profiles.find(p => p.name === nameOrId.trim().normalize('NFC'));
|
|
61
|
+
return found ?? profileError('missing', nameOrId);
|
|
62
|
+
}
|
|
63
|
+
export function importProfile(value) {
|
|
64
|
+
if (!object(value) || Object.keys(value).sort().join(',') !== 'display,format,name,version' ||
|
|
65
|
+
value.format !== PROFILE_FORMAT || !isSchema(value.version, PROFILE_VERSION))
|
|
66
|
+
return profileError('format');
|
|
67
|
+
return { name: profileName(value.name), display: validateDisplay(value.display) };
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../../src/config/profiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AACnE,MAAM,CAAC,MAAM,cAAc,GAAG,gCAAgC,CAAC;AAC/D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAsB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;AACnG,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,KAAK,GAAG,EAAE;IACnD,MAAM,IAAI,WAAW,CAAC,iBAAiB,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,GAAG,MAAM,CAAC,CAAC;AACtF,CAAC;AACD,MAAM,UAAU,WAAW,CAAC,KAAc;IACtC,IAAI,O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C,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7I,OAAO,KAAK,IAAI,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACtD,CAAC;AACD,MAAM,UAAU,aAAa,CAAC,KAAc;IACxC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,6BAA6B;QACvF,KAAK,CAAC,MAAM,KAAK,cAAc,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,eAAe,CAAC;QAAE,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChH,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;AACtF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Language } from "../i18n/registry.js";
|
|
2
|
-
export declare const PROTOCOL_VERSION:
|
|
2
|
+
export declare const PROTOCOL_VERSION: 15;
|
|
3
3
|
export declare const ITEM_DEFAULTS: {
|
|
4
4
|
label: null;
|
|
5
5
|
icon: null;
|
|
@@ -429,7 +429,7 @@ export declare const SEPARATORSTYLE_VALUES: readonly ["classic", "compact", "pow
|
|
|
429
429
|
export declare const SCOPELABELS_VALUES: readonly ["off", "when-subagents", "always"];
|
|
430
430
|
export declare const STATUSLINELANGUAGE_VALUES: readonly ["en", "zh-CN", "zh-TW", "zh-HK", "ja", "ko"];
|
|
431
431
|
export declare const UNAVAILABLEREASON_VALUES: readonly ["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"];
|
|
432
|
-
export type Operation = "describe" | "read" | "preview" | "apply" | "import" | "export" | "preset" | "read_ui_preferences" | "set_ui_language" | "review_import" | "explain" | "diagnose";
|
|
432
|
+
export type Operation = "describe" | "read" | "preview" | "apply" | "import" | "export" | "preset" | "read_ui_preferences" | "set_ui_language" | "review_import" | "explain" | "diagnose" | "profiles_read" | "profiles_apply" | "profile_import" | "profile_export" | "task_details";
|
|
433
433
|
export interface ItemGuidance {
|
|
434
434
|
source_kinds: string[];
|
|
435
435
|
measurement_scope: string;
|
|
@@ -640,6 +640,7 @@ export interface DiagnoseResult {
|
|
|
640
640
|
prompt_id: string | null;
|
|
641
641
|
host_version: string | null;
|
|
642
642
|
include_local: boolean;
|
|
643
|
+
configuration?: ResolvedConfiguration;
|
|
643
644
|
output: {
|
|
644
645
|
id: string;
|
|
645
646
|
spans: Span[];
|
|
@@ -683,6 +684,78 @@ export interface ReadResult {
|
|
|
683
684
|
installation: Record<string, unknown>;
|
|
684
685
|
capabilities: Capabilities;
|
|
685
686
|
backend_version: string;
|
|
687
|
+
configuration?: ResolvedConfiguration;
|
|
688
|
+
}
|
|
689
|
+
export type ConfigTarget = {
|
|
690
|
+
kind: "user";
|
|
691
|
+
} | {
|
|
692
|
+
kind: "profile";
|
|
693
|
+
id: string;
|
|
694
|
+
} | {
|
|
695
|
+
kind: "project";
|
|
696
|
+
path: string;
|
|
697
|
+
};
|
|
698
|
+
export interface DisplayProfile {
|
|
699
|
+
id: string;
|
|
700
|
+
name: string;
|
|
701
|
+
display: DisplayDraft;
|
|
702
|
+
}
|
|
703
|
+
export interface ProjectBinding {
|
|
704
|
+
root: string;
|
|
705
|
+
profile_id: string;
|
|
706
|
+
}
|
|
707
|
+
export interface ProfileCollection {
|
|
708
|
+
version: 1;
|
|
709
|
+
profiles: DisplayProfile[];
|
|
710
|
+
bindings: ProjectBinding[];
|
|
711
|
+
}
|
|
712
|
+
export interface ResolvedConfiguration {
|
|
713
|
+
target: ConfigTarget;
|
|
714
|
+
profile_id: string | null;
|
|
715
|
+
profile_name: string | null;
|
|
716
|
+
project_root: string | null;
|
|
717
|
+
reason: string;
|
|
718
|
+
shared_projects: string[];
|
|
719
|
+
}
|
|
720
|
+
export interface ProfilesResult extends ProfileCollection {
|
|
721
|
+
revision: string;
|
|
722
|
+
changed?: boolean;
|
|
723
|
+
backup_dir?: string | null;
|
|
724
|
+
}
|
|
725
|
+
export interface ProfileImportResult {
|
|
726
|
+
name: string;
|
|
727
|
+
display: DisplayDraft;
|
|
728
|
+
}
|
|
729
|
+
export interface TaskEvidence {
|
|
730
|
+
source: string;
|
|
731
|
+
scope: string;
|
|
732
|
+
status: string;
|
|
733
|
+
observed_at: string | null;
|
|
734
|
+
freshness: "current" | "stale" | "unknown" | "newer_than_input";
|
|
735
|
+
}
|
|
736
|
+
export interface TaskAgentDetail {
|
|
737
|
+
id: string;
|
|
738
|
+
parent_id: string | null;
|
|
739
|
+
name: string | null;
|
|
740
|
+
status: string | null;
|
|
741
|
+
evidence: TaskEvidence[];
|
|
742
|
+
}
|
|
743
|
+
export interface TaskDetails {
|
|
744
|
+
version: 1;
|
|
745
|
+
session_id: string;
|
|
746
|
+
prompt_id: string | null;
|
|
747
|
+
captured_at: string;
|
|
748
|
+
status: string | null;
|
|
749
|
+
phase: string | null;
|
|
750
|
+
elapsed_seconds: number | null;
|
|
751
|
+
active_seconds: number | null;
|
|
752
|
+
progress: {
|
|
753
|
+
completed: number;
|
|
754
|
+
total: number;
|
|
755
|
+
} | null;
|
|
756
|
+
agents: TaskAgentDetail[];
|
|
757
|
+
evidence: TaskEvidence[];
|
|
758
|
+
limitations: string[];
|
|
686
759
|
}
|
|
687
760
|
export interface EditorField {
|
|
688
761
|
key: string;
|
|
@@ -742,6 +815,7 @@ export interface ApplyResult {
|
|
|
742
815
|
backend_version: string;
|
|
743
816
|
changed: boolean;
|
|
744
817
|
backup_dir: string | null;
|
|
818
|
+
configuration?: ResolvedConfiguration;
|
|
745
819
|
}
|
|
746
820
|
export interface ResultMap {
|
|
747
821
|
describe: DescribeResult;
|
|
@@ -756,6 +830,11 @@ export interface ResultMap {
|
|
|
756
830
|
preset: TransferResult;
|
|
757
831
|
read_ui_preferences: UiPreferencesResult;
|
|
758
832
|
set_ui_language: UiPreferencesResult;
|
|
833
|
+
profiles_read: ProfilesResult;
|
|
834
|
+
profiles_apply: ProfilesResult;
|
|
835
|
+
profile_import: ProfileImportResult;
|
|
836
|
+
profile_export: ExportResult;
|
|
837
|
+
task_details: TaskDetails;
|
|
759
838
|
}
|
|
760
839
|
export type ResultFor<O extends Operation> = ResultMap[O];
|
|
761
840
|
export interface Request {
|
|
@@ -763,7 +842,7 @@ export interface Request {
|
|
|
763
842
|
operation: Operation;
|
|
764
843
|
payload: unknown;
|
|
765
844
|
}
|
|
766
|
-
export type Result = DiagnoseResult | ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult;
|
|
845
|
+
export type Result = DiagnoseResult | ExplainResult | PreviewResult | UiPreferencesResult | ReadResult | TransferResult | ImportReviewResult | ExportResult | DescribeResult | ApplyResult | ProfilesResult | ProfileImportResult | TaskDetails;
|
|
767
846
|
export type Response = {
|
|
768
847
|
protocol_version: typeof PROTOCOL_VERSION;
|
|
769
848
|
result: Result;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Canonical editor protocol and static descriptors. Emit Mod copies with the TS resource generator. */
|
|
2
2
|
import { LANGUAGES } from "../i18n/registry.js";
|
|
3
3
|
import { MAIN_ITEM_IDS as generatedMAIN_ITEM_IDS, SUBAGENT_ITEM_IDS as generatedSUBAGENT_ITEM_IDS, PRESETS as generatedPRESETS } from "./generated-catalog.js";
|
|
4
|
-
export const PROTOCOL_VERSION =
|
|
4
|
+
export const PROTOCOL_VERSION = 15;
|
|
5
5
|
export const ITEM_DEFAULTS = { "label": null, "icon": null, "priority": 50, "max_width": null, "formatting": {}, "foreground": null, "background": null, "visibility": "always", "visibility_threshold": 70 };
|
|
6
6
|
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" } };
|
|
7
7
|
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"] };
|
|
@@ -342,6 +342,8 @@ export function parseResponse(operation, process) {
|
|
|
342
342
|
fail();
|
|
343
343
|
}
|
|
344
344
|
else if (operation === 'read' || operation === 'apply') {
|
|
345
|
+
if (result.configuration !== undefined && !isConfiguration(result.configuration))
|
|
346
|
+
fail();
|
|
345
347
|
if (!isDraft(result.draft) ||
|
|
346
348
|
typeof result.revision !== 'string' ||
|
|
347
349
|
!/^[0-9a-f]{64}$/.test(result.revision) ||
|
|
@@ -364,7 +366,19 @@ export function parseResponse(operation, process) {
|
|
|
364
366
|
if (!isDraft(result.draft))
|
|
365
367
|
fail();
|
|
366
368
|
}
|
|
367
|
-
else if (operation === '
|
|
369
|
+
else if (operation === 'profiles_read' || operation === 'profiles_apply') {
|
|
370
|
+
if (!isProfiles(result) || operation === 'profiles_apply' && (typeof result.changed !== 'boolean' || !(result.backup_dir === null || text(result.backup_dir))))
|
|
371
|
+
fail();
|
|
372
|
+
}
|
|
373
|
+
else if (operation === 'profile_import') {
|
|
374
|
+
if (!exact(result, ['name', 'display']) || !text(result.name) || !displayDraft(result.display))
|
|
375
|
+
fail();
|
|
376
|
+
}
|
|
377
|
+
else if (operation === 'task_details') {
|
|
378
|
+
if (!isTaskDetails(result))
|
|
379
|
+
fail();
|
|
380
|
+
}
|
|
381
|
+
else if (operation === 'export' || operation === 'profile_export') {
|
|
368
382
|
if (!text(result.path) || !result.path)
|
|
369
383
|
fail();
|
|
370
384
|
}
|
|
@@ -402,8 +416,8 @@ export function parseResponse(operation, process) {
|
|
|
402
416
|
!result.backend_version ||
|
|
403
417
|
!isOptions(result.options) ||
|
|
404
418
|
!isCapabilities(result.capabilities) ||
|
|
405
|
-
!selection(result.operations, ['describe', 'read', 'preview', 'apply', 'import', 'export', 'preset', 'read_ui_preferences', 'set_ui_language', 'review_import', 'explain', 'diagnose']) ||
|
|
406
|
-
result.operations.length !==
|
|
419
|
+
!selection(result.operations, ['describe', 'read', 'preview', 'apply', 'import', 'export', 'preset', 'read_ui_preferences', 'set_ui_language', 'review_import', 'explain', 'diagnose', 'profiles_read', 'profiles_apply', 'profile_import', 'profile_export', 'task_details']) ||
|
|
420
|
+
result.operations.length !== 17 ||
|
|
407
421
|
JSON.stringify(result.editor_fields) !== JSON.stringify(EDITOR_FIELDS) ||
|
|
408
422
|
JSON.stringify(result.presets) !== JSON.stringify(PRESETS) ||
|
|
409
423
|
!object(result.formatting_options) ||
|
|
@@ -413,10 +427,63 @@ export function parseResponse(operation, process) {
|
|
|
413
427
|
}
|
|
414
428
|
return result;
|
|
415
429
|
}
|
|
430
|
+
function displayDraft(display) {
|
|
431
|
+
return isDraft({ display, host: { padding: 0, refresh_interval: 'event', hide_vim_mode_indicator: false } });
|
|
432
|
+
}
|
|
433
|
+
function isConfiguration(value) {
|
|
434
|
+
if (!object(value) || !exact(value, ['target', 'profile_id', 'profile_name', 'project_root', 'reason', 'shared_projects']) || !object(value.target))
|
|
435
|
+
return false;
|
|
436
|
+
const target = value.target;
|
|
437
|
+
return (target.kind === 'user' && exact(target, ['kind']) || target.kind === 'profile' && exact(target, ['kind', 'id']) && text(target.id) ||
|
|
438
|
+
target.kind === 'project' && exact(target, ['kind', 'path']) && text(target.path)) &&
|
|
439
|
+
['profile_id', 'profile_name', 'project_root'].every(k => value[k] === null || text(value[k])) && text(value.reason) && strings(value.shared_projects);
|
|
440
|
+
}
|
|
441
|
+
function isProfiles(value) {
|
|
442
|
+
if (value.version !== 1 || !text(value.revision) || !/^[a-f0-9]{64}$/u.test(value.revision) ||
|
|
443
|
+
!Array.isArray(value.profiles) || !Array.isArray(value.bindings) || value.profiles.length > 128 || value.bindings.length > 512)
|
|
444
|
+
return false;
|
|
445
|
+
const ids = new Set(), names = new Set(), roots = new Set();
|
|
446
|
+
return value.profiles.every(p => {
|
|
447
|
+
if (!object(p) || !exact(p, ['id', 'name', 'display']) || !text(p.id) || !text(p.name) || ids.has(p.id) || names.has(p.name) || !displayDraft(p.display))
|
|
448
|
+
return false;
|
|
449
|
+
ids.add(p.id);
|
|
450
|
+
names.add(p.name);
|
|
451
|
+
return true;
|
|
452
|
+
}) && value.bindings.every(b => {
|
|
453
|
+
if (!object(b) || !exact(b, ['root', 'profile_id']) || !text(b.root) || !text(b.profile_id) || roots.has(b.root))
|
|
454
|
+
return false;
|
|
455
|
+
roots.add(b.root);
|
|
456
|
+
return true;
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
function isTaskDetails(value) {
|
|
460
|
+
const nullable = (v) => v === null || text(v);
|
|
461
|
+
const count = (v) => v === null || typeof v === 'number' && Number.isFinite(v) && v >= 0;
|
|
462
|
+
const stamp = (v) => v === null || text(v) && Number.isFinite(Date.parse(v));
|
|
463
|
+
const evidence = (v) => object(v) && exact(v, ['source', 'scope', 'status', 'observed_at', 'freshness']) && text(v.source) &&
|
|
464
|
+
text(v.scope) && text(v.status) && stamp(v.observed_at) && ['current', 'stale', 'unknown', 'newer_than_input'].includes(String(v.freshness));
|
|
465
|
+
if (!exact(value, ['version', 'session_id', 'prompt_id', 'captured_at', 'status', 'phase', 'elapsed_seconds', 'active_seconds', 'progress', 'agents', 'evidence', 'limitations']) ||
|
|
466
|
+
value.version !== 1 || !text(value.session_id) || !nullable(value.prompt_id) || !text(value.captured_at) || !stamp(value.captured_at) ||
|
|
467
|
+
!nullable(value.status) || !nullable(value.phase) || !count(value.elapsed_seconds) || !count(value.active_seconds) ||
|
|
468
|
+
!Array.isArray(value.evidence) || !value.evidence.every(evidence) || !strings(value.limitations) || !Array.isArray(value.agents))
|
|
469
|
+
return false;
|
|
470
|
+
if (value.progress !== null && (!object(value.progress) || !exact(value.progress, ['completed', 'total']) || !range(value.progress.completed, 0, 100000) ||
|
|
471
|
+
!range(value.progress.total, 0, 100000) || Number(value.progress.completed) > Number(value.progress.total)))
|
|
472
|
+
return false;
|
|
473
|
+
const ids = new Set();
|
|
474
|
+
return value.agents.every(agent => {
|
|
475
|
+
if (!object(agent) || !exact(agent, ['id', 'parent_id', 'name', 'status', 'evidence']) || !text(agent.id) || ids.has(agent.id) ||
|
|
476
|
+
!nullable(agent.parent_id) || !nullable(agent.name) || !nullable(agent.status) || !Array.isArray(agent.evidence) || !agent.evidence.every(evidence))
|
|
477
|
+
return false;
|
|
478
|
+
ids.add(agent.id);
|
|
479
|
+
return true;
|
|
480
|
+
});
|
|
481
|
+
}
|
|
416
482
|
function isDiagnosis(value) {
|
|
417
483
|
const nullable = (v) => v === null || text(v);
|
|
418
484
|
const stamp = (v) => v === null || typeof v === 'string' && Number.isFinite(Date.parse(v));
|
|
419
|
-
if (!exact(value, ['sample', 'scope', 'width', 'source', 'observed_at', 'diagnosed_at', 'session_id', 'prompt_id', 'host_version', 'include_local', 'output', 'instances', 'host_fields']) ||
|
|
485
|
+
if (!exact(value, ['sample', 'scope', 'width', 'source', 'observed_at', 'diagnosed_at', 'session_id', 'prompt_id', 'host_version', 'include_local', 'output', 'instances', 'host_fields', ...(value.configuration !== undefined ? ['configuration'] : [])]) ||
|
|
486
|
+
value.configuration !== undefined && !isConfiguration(value.configuration) ||
|
|
420
487
|
value.sample !== false || !['main', 'subagent'].includes(String(value.scope)) || !range(value.width, 2, 10000) || !text(value.source) ||
|
|
421
488
|
!stamp(value.observed_at) || value.diagnosed_at === null || !stamp(value.diagnosed_at) || !nullable(value.session_id) || !nullable(value.prompt_id) ||
|
|
422
489
|
!nullable(value.host_version) || typeof value.include_local !== 'boolean' || !Array.isArray(value.output) || !Array.isArray(value.instances) || !object(value.host_fields))
|