@fbincon/claude-code-statusline 3.4.0 → 3.6.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 +78 -75
- package/candidate.json +392 -297
- package/node_modules/@fbincon/statusline-cli/dist/src/config/operations.js +5 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/operations.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profiles.js +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/profiles.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.d.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js +14 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/config/service.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js +5 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/config/transfer.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.js +24 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/diagnostics/service.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js +8 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/arguments.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/arguments.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js +2 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/model.d.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup-service.d.ts +23 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup-service.js +168 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup-service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.js +64 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/setup.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +24 -4
- 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/environment.js +46 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/rendering/environment.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/command.d.ts +3 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/command.js +117 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/command.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.d.ts +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.js +35 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/context.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.d.ts +8 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js +118 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/providers.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.d.ts +35 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.js +359 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.d.ts +2 -2
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js +31 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/ui/protocol.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-config/SKILL.md +5 -0
- 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 +15 -5
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +14 -7
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +6 -2
- 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/appearance.ts +24 -6
- 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/forms.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/profile-manager.ts +21 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/quick-setup.ts +14 -11
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/setup.ts +60 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-manager.ts +301 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-validation.ts +45 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +577 -10
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +1164 -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 +21 -18
- 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/catalog-data.d.ts +91 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.js +250 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.d.ts +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js +5 -2
- package/node_modules/@fbincon/statusline-core/dist/src/config/defaults.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js +21 -12
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js +7 -10
- package/node_modules/@fbincon/statusline-core/dist/src/config/editor-fields.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js +15 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/formatting.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js +4 -2
- package/node_modules/@fbincon/statusline-core/dist/src/config/import-review.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js +7 -2
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js +37 -3
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/profiles.js +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/profiles.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/transfer.js +5 -3
- package/node_modules/@fbincon/statusline-core/dist/src/config/transfer.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.d.ts +26 -2
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js +3 -3
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +263 -6
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +486 -3
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.d.ts +4 -2
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js +29 -6
- package/node_modules/@fbincon/statusline-core/dist/src/editor/appearance.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js +16 -7
- 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/forms.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js +26 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/profile-manager.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/quick-setup.d.ts +4 -4
- package/node_modules/@fbincon/statusline-core/dist/src/editor/quick-setup.js +16 -9
- package/node_modules/@fbincon/statusline-core/dist/src/editor/quick-setup.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.d.ts +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js +96 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/setup.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.d.ts +39 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js +270 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.d.ts +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.js +45 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-validation.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.d.ts +27 -0
- package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.js +222 -0
- package/node_modules/@fbincon/statusline-core/dist/src/extensions/model.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/extensions/portable.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/extensions/portable.js +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/extensions/portable.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.d.ts +1158 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +1164 -6
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.d.ts +26 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js +27 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.d.ts +26 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js +27 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.d.ts +26 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js +27 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.d.ts +26 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js +27 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-HK.d.ts +26 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-HK.js +27 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-HK.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-TW.d.ts +26 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-TW.js +27 -1
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-TW.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/rendering/appearance.d.ts +3 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js +25 -3
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.d.ts +3 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js +18 -5
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/components.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/context.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js +2 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/explain.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/extensions.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/extensions.js +35 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/extensions.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +12 -6
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js +30 -9
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/layout.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.d.ts +15 -5
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +78 -48
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preferences.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js +3 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/preview.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.d.ts +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.js +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/spans.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js +15 -4
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/links.d.ts +6 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/links.js +37 -0
- package/node_modules/@fbincon/statusline-core/dist/src/terminal/links.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/en.json +194 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +194 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +194 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +194 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +194 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +194 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/posix-source-exec.d.ts +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/posix-source-exec.js +26 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/posix-source-exec.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/source-files.d.ts +2 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/source-files.js +37 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/source-files.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/source-process.d.ts +19 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/source-process.js +122 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/source-process.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.d.ts +4 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.js +61 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-environment.js.map +1 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-job.d.ts +3 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-job.js +61 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/windows-source-job.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/canvas.js +3 -2
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/canvas.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing/pages.js +6 -1
- 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 +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/drawing.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js +6 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/session.js.map +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.d.ts +12 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.js +75 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/setup.js.map +1 -0
- package/node_modules/@fbincon/statusline-tui/dist/src/state.d.ts +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +12 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,301 @@
|
|
|
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';
|
|
3
|
+
import type { Editor } from './draft.ts';
|
|
4
|
+
import { t, text, type Language, type LocalizedText } from '../i18n/index.ts';
|
|
5
|
+
import { inputKey, inputView, textInput, type TextInput, type TextKey } from './text-input.ts';
|
|
6
|
+
import { wrapText } from '../../ui/text.ts';
|
|
7
|
+
import { BackendError } from '../backend.ts';
|
|
8
|
+
type Action = 'edit' | 'review' | 'disable' | 'remove' | 'bind' | 'unbind' | 'refresh' | 'status' | 'cancel' | 'diagnose';
|
|
9
|
+
export interface SourceManager {
|
|
10
|
+
library: SourcesResult | null;
|
|
11
|
+
context: SourceContext | null;
|
|
12
|
+
owner: string;
|
|
13
|
+
page: 'list' | 'actions' | 'kind' | 'form' | 'review' | 'remove' | 'bind' | 'unbind' | 'diagnose';
|
|
14
|
+
cursor: number;
|
|
15
|
+
scroll: number;
|
|
16
|
+
selected: string | null;
|
|
17
|
+
kind: SourceDefinition['kind'];
|
|
18
|
+
editing: boolean;
|
|
19
|
+
fields: {
|
|
20
|
+
key: string;
|
|
21
|
+
input: TextInput;
|
|
22
|
+
}[];
|
|
23
|
+
review: SourceReview | null;
|
|
24
|
+
details: string[];
|
|
25
|
+
jobs: SourceJob[];
|
|
26
|
+
message: LocalizedText | null;
|
|
27
|
+
effect: 'load' | 'save' | 'review' | 'enable' | 'disable' | 'remove' | 'bind' | 'refresh' | 'status' | 'cancel' | 'diagnose' | 'close' | null;
|
|
28
|
+
target: {
|
|
29
|
+
scope: Scope;
|
|
30
|
+
id: string;
|
|
31
|
+
} | null;
|
|
32
|
+
}
|
|
33
|
+
export interface SourceBackend {
|
|
34
|
+
request<O extends Operation>(operation: O, payload?: unknown): ResultFor<O> | Promise<ResultFor<O>>;
|
|
35
|
+
}
|
|
36
|
+
const external = ['external-value', 'github-pr', 'github-ci'];
|
|
37
|
+
export function openSources(editor: Editor): void {
|
|
38
|
+
editor.sources = { library: null, context: null, owner: 'editor-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2), page: 'list', cursor: 0, scroll: 0, selected: null, kind: 'json', editing: false, fields: [], review: null, details: [], jobs: [], message: null, effect: 'load', target: null };
|
|
39
|
+
}
|
|
40
|
+
function source(editor: Editor): SourceDefinition | undefined { return editor.sources!.library?.sources.find(s => s.id === editor.sources!.selected); }
|
|
41
|
+
function actions(editor: Editor): Action[] { return ['edit', 'review', ...(source(editor)?.enabled ? ['disable' as const] : []), 'bind', 'refresh', 'status', 'cancel', 'diagnose', 'remove', 'unbind']; }
|
|
42
|
+
function targets(editor: Editor) {
|
|
43
|
+
const s = source(editor);
|
|
44
|
+
return (['main', 'subagent'] as const).flatMap(scope => (scope === 'main' ? editor.draft.display.instances : editor.draft.display.subagents.instances)
|
|
45
|
+
.filter(node => external.includes(node.type_id) && (s?.kind === 'github' || !node.type_id.startsWith('github-')) && (editor.sources!.page !== 'unbind' || editor.sources!.library?.bindings.some(binding => binding.source_id === s?.id && binding.id === node.source?.binding))).map(node => ({ scope, id: node.id })));
|
|
46
|
+
}
|
|
47
|
+
function form(editor: Editor, kind: SourceDefinition['kind'], editing = false): void {
|
|
48
|
+
const m = editor.sources!, s = editing ? source(editor) : undefined, settings = s?.settings ?? {};
|
|
49
|
+
const common: Record<string, unknown> = { id: s?.id ?? '', name: s?.name ?? '', project: s ? s.scope.project ?? '' : m.context?.project ?? '', session: s?.scope.session ?? '', agent: s?.scope.agent ?? '', ttl_seconds: s?.ttl_seconds ?? 300 };
|
|
50
|
+
const extra = kind === 'json' ? { path: settings.path ?? '', pointer: settings.pointer ?? '/value', observed_at_pointer: settings.observed_at_pointer ?? '/observed_at', unit: settings.unit ?? '' }
|
|
51
|
+
: kind === 'github' ? { host: settings.host ?? 'github.com', repository: settings.repository ?? '', branch: settings.branch ?? m.context?.branch ?? '', account: settings.account ?? '', pr: settings.pr ?? '' }
|
|
52
|
+
: { executable: settings.executable ?? '', args: JSON.stringify(settings.args ?? []), cwd: settings.cwd ?? m.context?.project ?? '', input: JSON.stringify(settings.input ?? {}), output: settings.output ?? 'json', timeout_ms: settings.timeout_ms ?? 5000 };
|
|
53
|
+
m.kind = kind;
|
|
54
|
+
m.editing = editing;
|
|
55
|
+
m.page = 'form';
|
|
56
|
+
m.cursor = 0;
|
|
57
|
+
m.scroll = 0;
|
|
58
|
+
m.message = null;
|
|
59
|
+
m.fields = Object.entries({ ...common, ...extra }).map(([key, value]) => ({ key, input: textInput(String(value)) }));
|
|
60
|
+
}
|
|
61
|
+
function count(editor: Editor): number {
|
|
62
|
+
const m = editor.sources!;
|
|
63
|
+
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;
|
|
64
|
+
}
|
|
65
|
+
export function sourcesKey(editor: Editor, event: TextKey): 'sources' | null {
|
|
66
|
+
const m = editor.sources;
|
|
67
|
+
if (!m)
|
|
68
|
+
return null;
|
|
69
|
+
const key = event.key === 'return' ? 'enter' : event.key, plain = !event.text && !event.paste && !event.ctrl && !event.meta;
|
|
70
|
+
if (!event.text && !event.paste && (key === 'escape' || event.ctrl && key.toLowerCase() === 'g')) {
|
|
71
|
+
if (m.page === 'list')
|
|
72
|
+
m.effect = 'close';
|
|
73
|
+
else {
|
|
74
|
+
m.page = 'list';
|
|
75
|
+
m.cursor = 0;
|
|
76
|
+
m.scroll = 0;
|
|
77
|
+
m.message = null;
|
|
78
|
+
}
|
|
79
|
+
return m.effect ? 'sources' : null;
|
|
80
|
+
}
|
|
81
|
+
if (m.page === 'form') {
|
|
82
|
+
if (!event.text && (key === 'tab' || plain && ['up', 'down'].includes(key)))
|
|
83
|
+
m.cursor = Math.max(0, Math.min(m.fields.length - 1, m.cursor + (key === 'up' ? -1 : 1)));
|
|
84
|
+
else if (!event.text && (key === 'enter' || event.ctrl && key.toLowerCase() === 's')) {
|
|
85
|
+
if (key === 'enter' && m.cursor < m.fields.length - 1)
|
|
86
|
+
m.cursor++;
|
|
87
|
+
else
|
|
88
|
+
m.effect = 'save';
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const field = m.fields[m.cursor]!;
|
|
92
|
+
if (!(m.editing && field.key === 'id')) {
|
|
93
|
+
const changed = inputKey(field.input.value, field.input, event, 8192);
|
|
94
|
+
field.input = changed.state;
|
|
95
|
+
m.message = changed.error ? text('input.' + changed.error, { limit: 8192 }) : null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return m.effect ? 'sources' : null;
|
|
99
|
+
}
|
|
100
|
+
if (!plain)
|
|
101
|
+
return null;
|
|
102
|
+
if (['review', 'diagnose'].includes(m.page) && ['up', 'down', 'pageup', 'pagedown', 'home'].includes(key)) {
|
|
103
|
+
m.scroll = key === 'home' ? 0 : Math.max(0, m.scroll + (key === 'up' ? -1 : key === 'pageup' ? -8 : key === 'pagedown' ? 8 : 1));
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
if (key === 'up' || key === 'down')
|
|
107
|
+
m.cursor = Math.max(0, Math.min(count(editor) - 1, m.cursor + (key === 'up' ? -1 : 1)));
|
|
108
|
+
if (key === 'r' && m.page === 'list')
|
|
109
|
+
m.effect = 'load';
|
|
110
|
+
if (key === 'enter') {
|
|
111
|
+
if (m.page === 'list') {
|
|
112
|
+
const selected = m.library?.sources[m.cursor];
|
|
113
|
+
if (selected) {
|
|
114
|
+
m.selected = selected.id;
|
|
115
|
+
m.page = 'actions';
|
|
116
|
+
}
|
|
117
|
+
else
|
|
118
|
+
m.page = 'kind';
|
|
119
|
+
m.cursor = 0;
|
|
120
|
+
}
|
|
121
|
+
else if (m.page === 'kind')
|
|
122
|
+
form(editor, (['json', 'github', 'command'] as const)[m.cursor]!);
|
|
123
|
+
else if (m.page === 'actions') {
|
|
124
|
+
const action = actions(editor)[m.cursor]!;
|
|
125
|
+
if (action === 'edit')
|
|
126
|
+
form(editor, source(editor)!.kind, true);
|
|
127
|
+
else if (action === 'bind' || action === 'unbind' || action === 'remove') {
|
|
128
|
+
m.page = action;
|
|
129
|
+
m.cursor = 0;
|
|
130
|
+
}
|
|
131
|
+
else
|
|
132
|
+
m.effect = action;
|
|
133
|
+
}
|
|
134
|
+
else if (m.page === 'review')
|
|
135
|
+
m.effect = 'enable';
|
|
136
|
+
else if (m.page === 'remove')
|
|
137
|
+
m.effect = 'remove';
|
|
138
|
+
else if (m.page === 'unbind') {
|
|
139
|
+
const target = targets(editor)[m.cursor];
|
|
140
|
+
const node = target && editor.instance(target.scope, target.id);
|
|
141
|
+
if (node?.source) {
|
|
142
|
+
node.source = { ...node.source, binding: null };
|
|
143
|
+
m.message = text('sources.bound');
|
|
144
|
+
m.page = 'list';
|
|
145
|
+
m.cursor = 0;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else if (m.page === 'bind') {
|
|
149
|
+
m.target = targets(editor)[m.cursor] ?? null;
|
|
150
|
+
if (m.target)
|
|
151
|
+
m.effect = 'bind';
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return m.effect ? 'sources' : null;
|
|
155
|
+
}
|
|
156
|
+
export async function closeSources(editor: Editor, backend: SourceBackend): Promise<void> {
|
|
157
|
+
const m = editor.sources;
|
|
158
|
+
if (!m)
|
|
159
|
+
return;
|
|
160
|
+
let failed: unknown;
|
|
161
|
+
for (const job of m.jobs.filter(job => job.state === 'running')) {
|
|
162
|
+
try { await backend.request('source_cancel', { id: job.id }); }
|
|
163
|
+
catch (error) { failed = error; }
|
|
164
|
+
}
|
|
165
|
+
if (failed) throw failed;
|
|
166
|
+
if (editor.sources === m)
|
|
167
|
+
editor.sources = null;
|
|
168
|
+
}
|
|
169
|
+
export async function performSourceAction(editor: Editor, backend: SourceBackend): Promise<void> {
|
|
170
|
+
const m = editor.sources, effect = m?.effect;
|
|
171
|
+
if (!m || !effect)
|
|
172
|
+
return;
|
|
173
|
+
m.effect = null;
|
|
174
|
+
m.message = null;
|
|
175
|
+
try {
|
|
176
|
+
if (effect === 'close') {
|
|
177
|
+
await closeSources(editor, backend);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (effect === 'load') {
|
|
181
|
+
m.library = await backend.request('sources_read', {});
|
|
182
|
+
const target = editor.baseline.configuration;
|
|
183
|
+
m.context = await backend.request('source_context', { project: target?.project_root ?? (target?.target.kind === 'project' ? target.target.path : null), session: null, agent: null });
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (effect === 'review') {
|
|
187
|
+
m.review = await backend.request('source_review', { id: m.selected });
|
|
188
|
+
m.page = 'review';
|
|
189
|
+
m.scroll = 0;
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (effect === 'status' || effect === 'cancel') {
|
|
193
|
+
const selected = source(editor)!;
|
|
194
|
+
const context = await backend.request('source_context', { project: selected.scope.project ?? m.context?.project ?? null, session: selected.scope.session, agent: selected.scope.agent });
|
|
195
|
+
const observed = await backend.request('source_diagnose', { id: m.selected, context });
|
|
196
|
+
const jobs = await Promise.all(observed.jobs.map(job => backend.request(effect === 'cancel' && job.state === 'running' ? 'source_cancel' : 'source_status', { id: job.id })));
|
|
197
|
+
m.jobs = m.jobs.map(job => jobs.find(updated => updated.id === job.id) ?? job);
|
|
198
|
+
m.details = jobs.map(job => `${job.id}: ${job.state} (${job.reason})`);
|
|
199
|
+
m.page = 'diagnose';
|
|
200
|
+
m.scroll = 0;
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (effect === 'refresh' || effect === 'diagnose') {
|
|
204
|
+
const selected = source(editor)!;
|
|
205
|
+
const context = await backend.request('source_context', { project: selected.scope.project ?? m.context?.project ?? null, session: selected.scope.session, agent: selected.scope.agent });
|
|
206
|
+
if (effect === 'refresh') {
|
|
207
|
+
const job = await backend.request('source_refresh', { id: m.selected, context, owner: m.owner });
|
|
208
|
+
m.jobs.push(job);
|
|
209
|
+
m.message = text('sources.refresh_started');
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
const result = await backend.request('source_diagnose', { id: m.selected, context });
|
|
213
|
+
m.details = JSON.stringify(result, null, 2).split('\n');
|
|
214
|
+
m.page = 'diagnose';
|
|
215
|
+
m.scroll = 0;
|
|
216
|
+
}
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const payload: Record<string, unknown> = { action: effect, id: m.selected, expected_revision: m.library!.revision };
|
|
220
|
+
if (effect === 'save') {
|
|
221
|
+
const values = Object.fromEntries(m.fields.map(field => [field.key, field.input.value]));
|
|
222
|
+
const { id, name, project, session, agent, ttl_seconds, ...settings } = values;
|
|
223
|
+
const parsed: Record<string, unknown> = { ...settings };
|
|
224
|
+
for (const key of ['args', 'input'])
|
|
225
|
+
if (key in parsed)
|
|
226
|
+
parsed[key] = JSON.parse(String(parsed[key]));
|
|
227
|
+
if ('timeout_ms' in parsed)
|
|
228
|
+
parsed.timeout_ms = Number(parsed.timeout_ms);
|
|
229
|
+
if ('pr' in parsed)
|
|
230
|
+
parsed.pr = parsed.pr === '' ? null : Number(parsed.pr);
|
|
231
|
+
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 } });
|
|
232
|
+
}
|
|
233
|
+
if (effect === 'enable')
|
|
234
|
+
payload.review_revision = m.review?.review_revision;
|
|
235
|
+
const result = await backend.request('sources_apply', payload);
|
|
236
|
+
m.library = result;
|
|
237
|
+
if (effect === 'bind' && m.target && result.binding) {
|
|
238
|
+
const node = editor.instance(m.target.scope, m.target.id);
|
|
239
|
+
if (node)
|
|
240
|
+
node.source = result.binding;
|
|
241
|
+
m.message = text('sources.bound');
|
|
242
|
+
}
|
|
243
|
+
else
|
|
244
|
+
m.message = text('sources.saved');
|
|
245
|
+
m.page = 'list';
|
|
246
|
+
m.cursor = 0;
|
|
247
|
+
m.scroll = 0;
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
m.message = error instanceof BackendError ? error.localization ?? text('sources.failed') : text('sources.failed');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
export function sourcesView(editor: Editor, language: Language, width: number, height: number): {
|
|
254
|
+
text: string;
|
|
255
|
+
selected: boolean;
|
|
256
|
+
}[] {
|
|
257
|
+
const m = editor.sources!;
|
|
258
|
+
const tr = (key: string) => t('sources.' + key, language), rows: {
|
|
259
|
+
text: string;
|
|
260
|
+
selected: boolean;
|
|
261
|
+
}[] = [];
|
|
262
|
+
const add = (value: string, selected = false) => rows.push({ text: value, selected });
|
|
263
|
+
add(tr('separate_save'));
|
|
264
|
+
if (m.message)
|
|
265
|
+
add(t(m.message.key, language, m.message.params));
|
|
266
|
+
if (m.page === 'list') {
|
|
267
|
+
m.library?.sources.forEach((s, i) => add(`${s.name} · ${s.kind} · ${tr(s.enabled ? 'enabled' : 'disabled')}`, m.cursor === i));
|
|
268
|
+
add('+ ' + tr('add'), m.cursor === (m.library?.sources.length ?? 0));
|
|
269
|
+
}
|
|
270
|
+
else if (m.page === 'actions')
|
|
271
|
+
actions(editor).forEach((action, i) => add(tr(action), m.cursor === i));
|
|
272
|
+
else if (m.page === 'kind')
|
|
273
|
+
['json', 'github', 'command'].forEach((kind, i) => add(tr(kind), m.cursor === i));
|
|
274
|
+
else if (m.page === 'form') {
|
|
275
|
+
m.fields.forEach((field, i) => {
|
|
276
|
+
const label = tr('field.' + field.key) + ': ', space = Math.max(2, width - label.length);
|
|
277
|
+
const view = inputView({ ...field.input }, space);
|
|
278
|
+
add(label + view, m.cursor === i);
|
|
279
|
+
});
|
|
280
|
+
add(tr('form_help'));
|
|
281
|
+
}
|
|
282
|
+
else if (m.page === 'bind' || m.page === 'unbind') {
|
|
283
|
+
const entries = targets(editor);
|
|
284
|
+
if (!entries.length)
|
|
285
|
+
add(tr('no_components'));
|
|
286
|
+
entries.forEach((target, i) => add(`${target.scope}: ${editor.instanceLabel(target.scope, target.id, language)}`, m.cursor === i));
|
|
287
|
+
}
|
|
288
|
+
else if (m.page === 'remove')
|
|
289
|
+
add(tr('remove_confirm') + ' ' + source(editor)?.name, true);
|
|
290
|
+
else {
|
|
291
|
+
const lines = m.page === 'review' ? [tr('enable_review'), ...JSON.stringify(m.review?.source, null, 2).split('\n')] : m.details;
|
|
292
|
+
const wrapped = lines.flatMap(line => wrapText([line], width));
|
|
293
|
+
const capacity = Math.max(1, height - rows.length);
|
|
294
|
+
const start = Math.min(m.scroll, Math.max(0, wrapped.length - capacity));
|
|
295
|
+
wrapped.slice(start, start + capacity).forEach(line => add(line));
|
|
296
|
+
return rows;
|
|
297
|
+
}
|
|
298
|
+
const fixed = rows.slice(0, 1 + Number(!!m.message)), entries = rows.slice(fixed.length), capacity = Math.max(1, height - fixed.length);
|
|
299
|
+
const selected = Math.max(0, entries.findIndex(row => row.selected)), start = Math.max(0, selected - capacity + 1);
|
|
300
|
+
return [...fixed, ...entries.slice(start, start + capacity)];
|
|
301
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Generated by tools/generation/resources.ts; do not edit.
|
|
2
|
+
/** Strict response validation shared by the native and external source managers. */
|
|
3
|
+
const object = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
4
|
+
const text = (v: unknown): v is string => typeof v === 'string' && v.length <= 16384 && !/[\p{Cc}\p{Cs}]/u.test(v);
|
|
5
|
+
const nullable = (v: unknown) => v === null || text(v);
|
|
6
|
+
const scalar = (v: unknown) => v === null || text(v) || typeof v === 'boolean' || typeof v === 'number' && Number.isFinite(v);
|
|
7
|
+
const fields = (v: unknown, keys: string[]): v is Record<string, unknown> => object(v) && Object.keys(v).length === keys.length && keys.every(key => Object.hasOwn(v, key));
|
|
8
|
+
const id = (v: unknown) => text(v) && /^[A-Za-z0-9][A-Za-z0-9_-]{0,95}$/u.test(v);
|
|
9
|
+
const scope = (v: unknown) => fields(v, ['project', 'session', 'agent']) && Object.values(v).every(nullable) && (v.agent === null || v.session !== null);
|
|
10
|
+
export const isSourceContext = (v: unknown) => fields(v, ['project', 'session', 'agent', 'branch', 'head']) && Object.values(v).every(nullable);
|
|
11
|
+
function definition(v: unknown): boolean {
|
|
12
|
+
if (!fields(v, ['id', 'name', 'kind', 'scope', 'ttl_seconds', 'settings', 'enabled', 'revision']) || !id(v.id) || !text(v.name) || !['json', 'github', 'command'].includes(String(v.kind)) || !scope(v.scope) || !id(v.revision) || typeof v.enabled !== 'boolean' || typeof v.ttl_seconds !== 'number' || !Number.isInteger(v.ttl_seconds) || v.ttl_seconds < 1 || v.ttl_seconds > 86400 || !object(v.settings))
|
|
13
|
+
return false;
|
|
14
|
+
const s = v.settings;
|
|
15
|
+
if (v.kind === 'json')
|
|
16
|
+
return fields(s, ['path', 'pointer', 'observed_at_pointer', 'unit']) && Object.values(s).every(text);
|
|
17
|
+
if (v.kind === 'github')
|
|
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
|
+
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
|
+
}
|
|
21
|
+
function job(v: unknown): boolean {
|
|
22
|
+
return fields(v, ['version', 'id', 'source_id', 'source_revision', 'owner', 'context', 'started_at', 'deadline_at', 'state', 'reason']) && v.version === 1 && ['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
|
+
}
|
|
24
|
+
function view(v: unknown): boolean {
|
|
25
|
+
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));
|
|
26
|
+
}
|
|
27
|
+
export function isSourceResult(operation: string, value: unknown): boolean {
|
|
28
|
+
if (!object(value))
|
|
29
|
+
return false;
|
|
30
|
+
if (operation === 'source_context')
|
|
31
|
+
return isSourceContext(value);
|
|
32
|
+
if (operation === 'source_review')
|
|
33
|
+
return fields(value, ['source', 'review_revision']) && definition(value.source) && object(value.source) && value.review_revision === value.source.revision;
|
|
34
|
+
if (['source_refresh', 'source_status', 'source_cancel'].includes(operation))
|
|
35
|
+
return job(value);
|
|
36
|
+
if (operation === 'source_diagnose')
|
|
37
|
+
return fields(value, ['source', 'view', 'jobs']) && definition(value.source) && view(value.view) && Array.isArray(value.jobs) && value.jobs.every(job);
|
|
38
|
+
if (!['sources_read', 'sources_apply'].includes(operation) || !fields(value, ['version', 'sources', 'bindings', 'revision', ...(operation === 'sources_apply' ? ['backup_dir', ...(Object.hasOwn(value, 'binding') ? ['binding'] : [])] : [])]))
|
|
39
|
+
return false;
|
|
40
|
+
if (value.version !== 1 || !text(value.revision) || !Array.isArray(value.sources) || value.sources.length > 128 || !value.sources.every(definition) || !Array.isArray(value.bindings) || value.bindings.length > 4096)
|
|
41
|
+
return false;
|
|
42
|
+
if (!value.bindings.every(b => fields(b, ['id', 'source_id']) && id(b.id) && id(b.source_id)))
|
|
43
|
+
return false;
|
|
44
|
+
return operation === 'sources_read' || nullable(value.backup_dir) && (value.binding === undefined || fields(value.binding, ['binding', 'hint']) && id(value.binding.binding) && text(value.binding.hint));
|
|
45
|
+
}
|