@fbincon/claude-code-statusline 3.5.0 → 3.7.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 +77 -74
- package/candidate.json +437 -315
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js +23 -5
- package/node_modules/@fbincon/statusline-cli/dist/src/config/arguments.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.js +43 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/config/commands.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/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 +4 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/help.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/doctor.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/install.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/model.js +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.js +2 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/integration/mods.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/main.js +19 -3
- 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/runtime/live/protocol.js +11 -3
- package/node_modules/@fbincon/statusline-cli/dist/src/runtime/live/protocol.js.map +1 -1
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic-state.d.ts +35 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic-state.js +75 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic-state.js.map +1 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic.d.ts +12 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic.js +99 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/automatic.js.map +1 -0
- 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 +119 -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/lifecycle.d.ts +6 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/lifecycle.js +12 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/lifecycle.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 +40 -0
- package/node_modules/@fbincon/statusline-cli/dist/src/sources/service.js +425 -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 +30 -1
- 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 +15 -5
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/backend.ts +15 -8
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/keys.ts +10 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/client/settings.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/appearance.ts +26 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/cost-rate.ts +9 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/draft.ts +8 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/forms.ts +4 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/group-manager.ts +102 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/groups.ts +89 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/indicators.ts +20 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-manager.ts +304 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/editor/source-validation.ts +46 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/generated-contracts.ts +94 -11
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/generated-locales.ts +1020 -6
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/lib/i18n/presentation.ts +3 -1
- 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 +23 -17
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/draw.ts +9 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-native/ui/client/help.ts +2 -0
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/.claude-plugin/plugin.json +7 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/hooks/observe.ts +27 -2
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/lib/generated-contracts.ts +1 -1
- package/node_modules/@fbincon/statusline-cli/resources/statusline-runtime/resource-manifest.json +6 -6
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.d.ts +214 -0
- package/node_modules/@fbincon/statusline-core/dist/src/config/catalog-data.js +418 -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.js +2 -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 +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/config/display.js +31 -14
- 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 +13 -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.js +11 -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 +6 -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 +14 -7
- package/node_modules/@fbincon/statusline-core/dist/src/config/instances.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/config/presets.js +1 -1
- 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 +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/generated-catalog.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/runtime.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/runtime.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.d.ts +170 -9
- package/node_modules/@fbincon/statusline-core/dist/src/contracts/ui.js +5 -5
- 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 +31 -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 +18 -8
- package/node_modules/@fbincon/statusline-core/dist/src/editor/backend.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/cost-rate.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/cost-rate.js +8 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/cost-rate.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/draft.js +6 -1
- 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 +4 -2
- package/node_modules/@fbincon/statusline-core/dist/src/editor/forms.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.d.ts +23 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.js +131 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/group-manager.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/groups.d.ts +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/groups.js +103 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/groups.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/indicators.d.ts +11 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/indicators.js +18 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/indicators.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.d.ts +40 -0
- package/node_modules/@fbincon/statusline-core/dist/src/editor/source-manager.js +279 -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 +47 -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 +238 -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 +1014 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/generated-locales.js +1020 -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 +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/en.js +31 -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 +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ja.js +31 -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 +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/ko.js +31 -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 +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-CN.js +31 -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 +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-HK.js +31 -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 +30 -0
- package/node_modules/@fbincon/statusline-core/dist/src/i18n/statusline/zh-TW.js +31 -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.js +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/appearance.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.d.ts +2 -2
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/diagnose.js +6 -3
- 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 +6 -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/groups.d.ts +7 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js +124 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/groups.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/indicators.d.ts +4 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/indicators.js +48 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/indicators.js.map +1 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/items.js +19 -2
- 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/metrics.d.ts +3 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/metrics.js +14 -0
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/metrics.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/powerline.js +1 -1
- 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 +1 -1
- 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 +23 -2
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/subagents.js.map +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/rendering/trace.d.ts +1 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/model.d.ts +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/model.js +2 -1
- package/node_modules/@fbincon/statusline-core/dist/src/runtime/live/model.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 +170 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ja.json +170 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/ko.json +170 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-CN.json +170 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-HK.json +170 -1
- package/node_modules/@fbincon/statusline-core/resources/i18n/locales/zh-TW.json +170 -1
- package/node_modules/@fbincon/statusline-platform/dist/src/files.d.ts +3 -0
- package/node_modules/@fbincon/statusline-platform/dist/src/files.js +7 -2
- package/node_modules/@fbincon/statusline-platform/dist/src/files.js.map +1 -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 +52 -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 +10 -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 +8 -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 +4 -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/state.d.ts +1 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js +23 -1
- package/node_modules/@fbincon/statusline-tui/dist/src/state.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { SourceDefinition, SourceContext, SourceReference, SourceJob, SourcesResult, SourceMutationResult, SourceView, AutomaticStatus } from '@fbincon/statusline-core/contracts/ui';
|
|
2
|
+
import type { ConfigurationService } from '../config/service.js';
|
|
3
|
+
import { refreshGithub } from './providers.js';
|
|
4
|
+
export declare class SourceService {
|
|
5
|
+
readonly configuration: ConfigurationService;
|
|
6
|
+
readonly now: () => number;
|
|
7
|
+
readonly launchWorker?: ((job: SourceJob) => void) | undefined;
|
|
8
|
+
readonly githubRefresh: typeof refreshGithub;
|
|
9
|
+
readonly root: string;
|
|
10
|
+
constructor(configuration: ConfigurationService, now?: () => number, launchWorker?: ((job: SourceJob) => void) | undefined, githubRefresh?: typeof refreshGithub);
|
|
11
|
+
read(): SourcesResult;
|
|
12
|
+
review(id: unknown): {
|
|
13
|
+
source: SourceDefinition;
|
|
14
|
+
review_revision: string;
|
|
15
|
+
};
|
|
16
|
+
source(id: unknown): SourceDefinition;
|
|
17
|
+
private canonical;
|
|
18
|
+
mutate(value: unknown): SourceMutationResult;
|
|
19
|
+
private write;
|
|
20
|
+
private readValue;
|
|
21
|
+
private jobPath;
|
|
22
|
+
job(id: unknown): SourceJob;
|
|
23
|
+
jobs(): SourceJob[];
|
|
24
|
+
private cancelSource;
|
|
25
|
+
cancel(id: unknown): SourceJob;
|
|
26
|
+
start(id: unknown, contextValue: unknown, owner: unknown, trigger?: 'manual' | 'automatic'): SourceJob;
|
|
27
|
+
private observationPath;
|
|
28
|
+
private stored;
|
|
29
|
+
private publish;
|
|
30
|
+
view(ref: SourceReference | undefined, context: SourceContext, publishLocal?: boolean): SourceView;
|
|
31
|
+
diagnose(id: unknown, context: SourceContext): {
|
|
32
|
+
source: SourceDefinition;
|
|
33
|
+
view: SourceView;
|
|
34
|
+
jobs: SourceJob[];
|
|
35
|
+
automatic: AutomaticStatus;
|
|
36
|
+
};
|
|
37
|
+
cancelInactiveAutomatic(): void;
|
|
38
|
+
work(id: string): Promise<void>;
|
|
39
|
+
private prune;
|
|
40
|
+
}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { join, resolve, isAbsolute } from 'node:path';
|
|
4
|
+
import { readdirSync, statSync, unlinkSync, mkdirSync, rmdirSync } from 'node:fs';
|
|
5
|
+
import { SOURCE_FILENAME, MAX_SOURCE_BYTES, emptyRegistry, registry, definition, sourceError, sourceId, sourceContext, matchesScope, sameContext, observationContext, sourceView, emptyObservation, stamp, scalar } from '@fbincon/statusline-core/extensions/model';
|
|
6
|
+
import { object, ConfigError, integer } from '@fbincon/statusline-core/config/validation';
|
|
7
|
+
import { readJson } from '@fbincon/statusline-core/json-read';
|
|
8
|
+
import { revision } from '@fbincon/statusline-platform/hash';
|
|
9
|
+
import { readSourceFile } from '@fbincon/statusline-platform/source-files';
|
|
10
|
+
import { decodeUtf8 } from '@fbincon/statusline-platform/utf8';
|
|
11
|
+
import { privateDirectory, atomicWrite } from '@fbincon/statusline-platform/files';
|
|
12
|
+
import { expandUser, which } from '@fbincon/statusline-platform/commands';
|
|
13
|
+
import { projectPaths } from '@fbincon/statusline-platform/project-paths';
|
|
14
|
+
import { jsonBytes, artifact } from '../config/storage.js';
|
|
15
|
+
import { commit } from '../recovery/files.js';
|
|
16
|
+
import { safeTarget } from '../integration/paths.js';
|
|
17
|
+
import { contextFor, authRevision } from './context.js';
|
|
18
|
+
import { automaticJobActive, automaticStatus, refreshIdentity, readAutomatic, writeAutomatic } from './automatic-state.js';
|
|
19
|
+
import { readLocal, refreshCommand, refreshGithub } from './providers.js';
|
|
20
|
+
export class SourceService {
|
|
21
|
+
configuration;
|
|
22
|
+
now;
|
|
23
|
+
launchWorker;
|
|
24
|
+
githubRefresh;
|
|
25
|
+
root;
|
|
26
|
+
constructor(configuration, now = Date.now, launchWorker, githubRefresh = refreshGithub) {
|
|
27
|
+
this.configuration = configuration;
|
|
28
|
+
this.now = now;
|
|
29
|
+
this.launchWorker = launchWorker;
|
|
30
|
+
this.githubRefresh = githubRefresh;
|
|
31
|
+
this.root = join(configuration.context.configDir, 'statusline_runtime', 'sources');
|
|
32
|
+
}
|
|
33
|
+
read() {
|
|
34
|
+
const bytes = readSourceFile(join(this.configuration.context.configDir, SOURCE_FILENAME));
|
|
35
|
+
const value = bytes === null ? emptyRegistry() : registry(readJson(decodeUtf8(bytes), { duplicate: () => sourceError('invalid'), constant: () => sourceError('type') }));
|
|
36
|
+
return { ...value, revision: revision(value) };
|
|
37
|
+
}
|
|
38
|
+
review(id) { const source = this.source(id); return { source, review_revision: source.revision }; }
|
|
39
|
+
source(id) {
|
|
40
|
+
const source = this.read().sources.find(source => source.id === sourceId(id));
|
|
41
|
+
if (!source)
|
|
42
|
+
sourceError('not_found');
|
|
43
|
+
return source;
|
|
44
|
+
}
|
|
45
|
+
canonical(source) {
|
|
46
|
+
const result = definition(source), s = result.settings;
|
|
47
|
+
if (result.scope.project) {
|
|
48
|
+
const project = projectPaths.canonical(resolve(expandUser(result.scope.project)));
|
|
49
|
+
if (!project)
|
|
50
|
+
sourceError('scope');
|
|
51
|
+
result.scope.project = contextFor(project).project;
|
|
52
|
+
}
|
|
53
|
+
if (s.path)
|
|
54
|
+
s.path = resolve(expandUser(s.path));
|
|
55
|
+
if (s.cwd) {
|
|
56
|
+
const cwd = projectPaths.canonical(resolve(expandUser(s.cwd)));
|
|
57
|
+
if (!cwd)
|
|
58
|
+
sourceError('scope');
|
|
59
|
+
s.cwd = cwd;
|
|
60
|
+
}
|
|
61
|
+
if (s.executable) {
|
|
62
|
+
const found = isAbsolute(s.executable) ? s.executable : which(s.executable);
|
|
63
|
+
if (!found)
|
|
64
|
+
sourceError('missing_program');
|
|
65
|
+
s.executable = resolve(found);
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
mutate(value) {
|
|
70
|
+
if (!object(value) || typeof value.action !== 'string')
|
|
71
|
+
sourceError('invalid');
|
|
72
|
+
return this.configuration.io.lock(this.configuration.context.configDir, () => {
|
|
73
|
+
const current = this.read();
|
|
74
|
+
if (value.expected_revision !== current.revision)
|
|
75
|
+
sourceError('conflict');
|
|
76
|
+
const path = join(this.configuration.context.configDir, SOURCE_FILENAME), raw = readSourceFile(path);
|
|
77
|
+
const state = registry({ version: 2, sources: current.sources, bindings: current.bindings, automatic: current.automatic });
|
|
78
|
+
let binding;
|
|
79
|
+
const id = sourceId(value.id), selected = state.sources.find(s => s.id === id);
|
|
80
|
+
if (value.action === 'add' || value.action === 'edit') {
|
|
81
|
+
if (!object(value.source) || (value.action === 'add' ? selected !== undefined : selected === undefined))
|
|
82
|
+
sourceError('conflict');
|
|
83
|
+
const source = this.canonical(definition({ ...value.source, id, enabled: false, revision: randomUUID() }));
|
|
84
|
+
state.automatic = state.automatic.filter(p => p.source_id !== id);
|
|
85
|
+
if (selected) {
|
|
86
|
+
this.cancelSource(id);
|
|
87
|
+
state.sources[state.sources.indexOf(selected)] = source;
|
|
88
|
+
}
|
|
89
|
+
else
|
|
90
|
+
state.sources.push(source);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (!selected)
|
|
94
|
+
sourceError('not_found');
|
|
95
|
+
if (value.action === 'auto-on' || value.action === 'auto-off') {
|
|
96
|
+
if (selected.kind !== 'github')
|
|
97
|
+
sourceError('invalid');
|
|
98
|
+
const prior = state.automatic.find(p => p.source_id === id);
|
|
99
|
+
if (value.action === 'auto-on') {
|
|
100
|
+
if (!selected.enabled || value.review_revision !== selected.revision)
|
|
101
|
+
sourceError('review');
|
|
102
|
+
const interval = value.interval_seconds === undefined ? prior?.interval_seconds ?? Math.max(60, Math.min(86400, selected.ttl_seconds)) : integer(value.interval_seconds, 60, 86400, 'interval_seconds');
|
|
103
|
+
state.automatic = state.automatic.filter(p => p.source_id !== id);
|
|
104
|
+
state.automatic.push({ source_id: id, enabled: true, review_revision: selected.revision, interval_seconds: interval, auth_revision: authRevision() });
|
|
105
|
+
const scheduling = readAutomatic(this.configuration.context.configDir);
|
|
106
|
+
scheduling.schedules = scheduling.schedules.filter(s => s.source_id !== id);
|
|
107
|
+
const priorJobs = this.jobs().filter(j => j.source_id === id).sort((a, b) => Date.parse(b.started_at) - Date.parse(a.started_at));
|
|
108
|
+
for (const job of priorJobs)
|
|
109
|
+
if (!scheduling.schedules.some(s => s.key === job.identity))
|
|
110
|
+
scheduling.schedules.push({ key: job.identity, source_id: id, job_id: job.id, processed: job.id, next: this.now(), failures: 0, paused: null, last_attempt: job.started_at, last_success: null });
|
|
111
|
+
scheduling.schedules = scheduling.schedules.slice(-512);
|
|
112
|
+
writeAutomatic(this.configuration.context.configDir, scheduling);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
if (prior)
|
|
116
|
+
prior.enabled = false;
|
|
117
|
+
this.cancelSource(id, true);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else if (value.action === 'enable') {
|
|
121
|
+
if (value.review_revision !== selected.revision)
|
|
122
|
+
sourceError('review');
|
|
123
|
+
selected.enabled = true;
|
|
124
|
+
}
|
|
125
|
+
else if (value.action === 'disable') {
|
|
126
|
+
this.cancelSource(id);
|
|
127
|
+
state.automatic = state.automatic.filter(p => p.source_id !== id);
|
|
128
|
+
selected.enabled = false;
|
|
129
|
+
}
|
|
130
|
+
else if (value.action === 'remove') {
|
|
131
|
+
this.cancelSource(id);
|
|
132
|
+
state.sources = state.sources.filter(s => s.id !== id);
|
|
133
|
+
state.automatic = state.automatic.filter(p => p.source_id !== id);
|
|
134
|
+
state.bindings = state.bindings.filter(b => b.source_id !== id);
|
|
135
|
+
}
|
|
136
|
+
else if (value.action === 'bind') {
|
|
137
|
+
const bid = randomUUID();
|
|
138
|
+
state.bindings.push({ id: bid, source_id: id });
|
|
139
|
+
binding = { binding: bid, hint: selected.name };
|
|
140
|
+
}
|
|
141
|
+
else if (value.action === 'unbind')
|
|
142
|
+
state.bindings = state.bindings.filter(b => !(b.source_id === id && b.id === value.binding));
|
|
143
|
+
else
|
|
144
|
+
sourceError('invalid');
|
|
145
|
+
}
|
|
146
|
+
const validated = registry(state), bytes = jsonBytes(validated);
|
|
147
|
+
if (bytes.length > MAX_SOURCE_BYTES)
|
|
148
|
+
sourceError('output_limit');
|
|
149
|
+
const backup = commit(this.configuration.context.configDir, 'source-' + value.action, [{ ...artifact(path, raw), desired: bytes }], this.configuration.io);
|
|
150
|
+
return { ...validated, revision: revision(validated), ...(binding ? { binding } : {}), backup_dir: backup };
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
write(path, value) {
|
|
154
|
+
safeTarget(this.configuration.context.configDir, path);
|
|
155
|
+
privateDirectory(this.root);
|
|
156
|
+
privateDirectory(join(this.root, 'jobs'));
|
|
157
|
+
privateDirectory(join(this.root, 'observations'));
|
|
158
|
+
safeTarget(this.configuration.context.configDir, path);
|
|
159
|
+
const bytes = jsonBytes(value);
|
|
160
|
+
if (bytes.length > MAX_SOURCE_BYTES)
|
|
161
|
+
sourceError('output_limit');
|
|
162
|
+
atomicWrite(path, bytes);
|
|
163
|
+
}
|
|
164
|
+
readValue(path) {
|
|
165
|
+
const bytes = readSourceFile(path);
|
|
166
|
+
return bytes === null ? null : JSON.parse(decodeUtf8(bytes));
|
|
167
|
+
}
|
|
168
|
+
jobPath(id) { return join(this.root, 'jobs', sourceId(id) + '.json'); }
|
|
169
|
+
job(id) {
|
|
170
|
+
const value = this.readValue(this.jobPath(sourceId(id)));
|
|
171
|
+
if (!object(value) || ![1, 2].includes(value.version) || !['running', 'completed', 'failed', 'cancelled'].includes(value.state))
|
|
172
|
+
sourceError('not_found');
|
|
173
|
+
sourceId(value.id);
|
|
174
|
+
sourceId(value.source_id);
|
|
175
|
+
sourceId(value.source_revision);
|
|
176
|
+
sourceId(value.owner);
|
|
177
|
+
sourceContext(value.context);
|
|
178
|
+
if (!stamp(value.started_at) || !stamp(value.deadline_at) || typeof value.reason !== 'string')
|
|
179
|
+
sourceError('invalid');
|
|
180
|
+
const job = (value.version === 1 ? { ...value, version: 2, trigger: 'manual', identity: revision([value.source_id, value.source_revision, value.context]) } : value);
|
|
181
|
+
if (!['manual', 'automatic'].includes(job.trigger) || !/^[a-f0-9]{64}$/.test(job.identity))
|
|
182
|
+
sourceError('invalid');
|
|
183
|
+
if (job.state === 'running' && Date.parse(job.deadline_at) + 2000 < this.now())
|
|
184
|
+
return { ...job, state: 'failed', reason: 'timeout' };
|
|
185
|
+
return job;
|
|
186
|
+
}
|
|
187
|
+
jobs() {
|
|
188
|
+
try {
|
|
189
|
+
return readdirSync(join(this.root, 'jobs')).filter(name => /^[A-Za-z0-9_-]+\.json$/u.test(name)).flatMap(name => {
|
|
190
|
+
try {
|
|
191
|
+
return [this.job(name.slice(0, -5))];
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return [];
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
cancelSource(id, automaticOnly = false) {
|
|
203
|
+
for (const job of this.jobs())
|
|
204
|
+
if (job.source_id === id && job.state === 'running' && (!automaticOnly || job.trigger === 'automatic'))
|
|
205
|
+
this.write(this.jobPath(job.id), { ...job, state: 'cancelled', reason: 'cancelled' });
|
|
206
|
+
}
|
|
207
|
+
cancel(id) {
|
|
208
|
+
return this.configuration.io.lock(this.configuration.context.configDir, () => {
|
|
209
|
+
const job = this.job(id);
|
|
210
|
+
if (job.state === 'running') {
|
|
211
|
+
job.state = 'cancelled';
|
|
212
|
+
job.reason = 'cancelled';
|
|
213
|
+
this.write(this.jobPath(job.id), job);
|
|
214
|
+
const source = this.source(job.source_id);
|
|
215
|
+
if (source.enabled && source.revision === job.source_revision)
|
|
216
|
+
this.publish(source, job.context, emptyObservation(source, job.context, 'cancelled'));
|
|
217
|
+
}
|
|
218
|
+
return job;
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
start(id, contextValue, owner, trigger = 'manual') {
|
|
222
|
+
let createdNew = false;
|
|
223
|
+
const actual = sourceContext(contextValue), ownerId = sourceId(owner);
|
|
224
|
+
const job = this.configuration.io.lock(this.configuration.context.configDir, () => {
|
|
225
|
+
const source = this.source(id);
|
|
226
|
+
if (!source.enabled)
|
|
227
|
+
sourceError('disabled');
|
|
228
|
+
if (!matchesScope(source.scope, actual))
|
|
229
|
+
sourceError('scope');
|
|
230
|
+
const context = observationContext(source, actual), identity = refreshIdentity(source, context);
|
|
231
|
+
const existing = this.jobs().find(job => job.source_id === source.id && job.state === 'running' && (source.kind !== 'github' || job.identity === identity));
|
|
232
|
+
if (existing) {
|
|
233
|
+
if (source.kind !== 'github')
|
|
234
|
+
sourceError('busy');
|
|
235
|
+
if (trigger === 'manual' && existing.trigger === 'automatic') {
|
|
236
|
+
existing.trigger = 'manual';
|
|
237
|
+
existing.owner = ownerId;
|
|
238
|
+
this.write(this.jobPath(existing.id), existing);
|
|
239
|
+
}
|
|
240
|
+
return existing;
|
|
241
|
+
}
|
|
242
|
+
const created = { version: 2, trigger, identity, id: randomUUID(), source_id: source.id, source_revision: source.revision, owner: ownerId, context,
|
|
243
|
+
started_at: new Date(this.now()).toISOString(), deadline_at: new Date(this.now() + (source.kind === 'github' ? 30000 : source.settings.timeout_ms ?? 5000)).toISOString(), state: 'running', reason: 'running' };
|
|
244
|
+
if (trigger === 'automatic' && !automaticJobActive(this.configuration.context.configDir, created, this.now()))
|
|
245
|
+
sourceError('disabled');
|
|
246
|
+
this.write(this.jobPath(created.id), created);
|
|
247
|
+
createdNew = true;
|
|
248
|
+
return created;
|
|
249
|
+
});
|
|
250
|
+
if (!createdNew)
|
|
251
|
+
return job;
|
|
252
|
+
if (this.launchWorker) {
|
|
253
|
+
this.launchWorker(job);
|
|
254
|
+
return job;
|
|
255
|
+
}
|
|
256
|
+
const launch = this.configuration.context.launch;
|
|
257
|
+
const worker = spawn(launch.executable, [...launch.args, 'source', '--config-dir', this.configuration.context.configDir, '_worker', job.id], { detached: true, stdio: 'ignore', windowsHide: true });
|
|
258
|
+
worker.once('error', () => {
|
|
259
|
+
try {
|
|
260
|
+
this.cancel(job.id);
|
|
261
|
+
}
|
|
262
|
+
catch { /* Expires if the registry is unavailable. */ }
|
|
263
|
+
});
|
|
264
|
+
worker.unref();
|
|
265
|
+
return job;
|
|
266
|
+
}
|
|
267
|
+
observationPath(source, context) { return join(this.root, 'observations', source.id + '-' + revision(context) + '.json'); }
|
|
268
|
+
stored(source, context) {
|
|
269
|
+
try {
|
|
270
|
+
const raw = this.readValue(this.observationPath(source, context));
|
|
271
|
+
if (!object(raw) || raw.version !== 1)
|
|
272
|
+
return null;
|
|
273
|
+
const parse = (value) => {
|
|
274
|
+
if (value === null)
|
|
275
|
+
return null;
|
|
276
|
+
if (!object(value) || value.version !== 1 || value.source_id !== source.id || value.source_revision !== source.revision || !['valid', 'missing', 'partial', 'error', 'unsupported'].includes(value.state))
|
|
277
|
+
sourceError('invalid');
|
|
278
|
+
sourceContext(value.context);
|
|
279
|
+
stamp(value.observed_at);
|
|
280
|
+
if (value.value !== null)
|
|
281
|
+
scalar(value.value);
|
|
282
|
+
if (value.fields !== undefined && (!object(value.fields) || Object.values(value.fields).some(v => v !== null && !['string', 'number', 'boolean'].includes(typeof v))))
|
|
283
|
+
sourceError('invalid');
|
|
284
|
+
return value;
|
|
285
|
+
};
|
|
286
|
+
const current = parse(raw.current);
|
|
287
|
+
return current ? { version: 1, current, good: parse(raw.good) } : null;
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
publish(source, context, observation) {
|
|
294
|
+
const previous = this.stored(source, context);
|
|
295
|
+
if (previous && JSON.stringify(previous.current) === JSON.stringify(observation))
|
|
296
|
+
return;
|
|
297
|
+
this.write(this.observationPath(source, context), { version: 1, current: observation, good: observation.value !== null && ['valid', 'partial'].includes(observation.state) ? observation : previous?.good ?? null });
|
|
298
|
+
this.prune();
|
|
299
|
+
}
|
|
300
|
+
view(ref, context, publishLocal = true) {
|
|
301
|
+
const registry = this.read(), binding = registry.bindings.find(b => b.id === ref?.binding), source = registry.sources.find(s => s.id === binding?.source_id);
|
|
302
|
+
if (!source || !source.enabled || !matchesScope(source.scope, context))
|
|
303
|
+
return sourceView(source, context, null, null, this.now());
|
|
304
|
+
context = observationContext(source, context);
|
|
305
|
+
if (source.kind === 'json') {
|
|
306
|
+
const observed = readLocal(source, context);
|
|
307
|
+
try {
|
|
308
|
+
if (publishLocal)
|
|
309
|
+
this.publish(source, context, observed);
|
|
310
|
+
}
|
|
311
|
+
catch { /* Local cache is optional; report the actual read below. */ }
|
|
312
|
+
const prior = this.stored(source, context);
|
|
313
|
+
return sourceView(source, context, observed, prior?.good ?? null, this.now());
|
|
314
|
+
}
|
|
315
|
+
const data = this.stored(source, context);
|
|
316
|
+
const identity = data?.current.identity ?? data?.good?.identity;
|
|
317
|
+
if (source.kind === 'github' && identity && (identity.auth_revision !== authRevision() || identity.host !== source.settings.host || identity.repository !== source.settings.repository || identity.account !== source.settings.account))
|
|
318
|
+
return { ...sourceView(source, context, null, null, this.now()), state: 'mismatch', reason: 'identity' };
|
|
319
|
+
return sourceView(source, context, data?.current ?? null, data?.good ?? null, this.now());
|
|
320
|
+
}
|
|
321
|
+
diagnose(id, context) {
|
|
322
|
+
const source = this.source(id), applicable = matchesScope(source.scope, context);
|
|
323
|
+
if (applicable)
|
|
324
|
+
context = observationContext(source, context);
|
|
325
|
+
const data = applicable ? this.stored(source, context) : null;
|
|
326
|
+
let view = sourceView(source, context, data?.current ?? null, data?.good ?? null, this.now());
|
|
327
|
+
const identity = data?.current.identity ?? data?.good?.identity;
|
|
328
|
+
if (source.kind === 'github' && identity && identity.auth_revision !== authRevision())
|
|
329
|
+
view = { ...view, state: 'mismatch', reason: 'identity', value: null, fields: undefined };
|
|
330
|
+
const jobs = this.jobs().filter(job => job.source_id === source.id);
|
|
331
|
+
return { source, view, jobs, automatic: automaticStatus(this.configuration.context.configDir, source, context, this.now(), jobs) };
|
|
332
|
+
}
|
|
333
|
+
cancelInactiveAutomatic() {
|
|
334
|
+
this.configuration.io.lock(this.configuration.context.configDir, () => {
|
|
335
|
+
for (const job of this.jobs())
|
|
336
|
+
if (job.trigger === 'automatic' && job.state === 'running' && !automaticJobActive(this.configuration.context.configDir, job, this.now()))
|
|
337
|
+
this.write(this.jobPath(job.id), { ...job, state: 'cancelled', reason: 'lease_expired' });
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
async work(id) {
|
|
341
|
+
const job = this.job(id);
|
|
342
|
+
if (job.state !== 'running')
|
|
343
|
+
return;
|
|
344
|
+
const claim = this.jobPath(id) + '.claim';
|
|
345
|
+
try {
|
|
346
|
+
mkdirSync(claim, { mode: 0o700 });
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
if (error.code === 'EEXIST')
|
|
350
|
+
return;
|
|
351
|
+
throw error;
|
|
352
|
+
}
|
|
353
|
+
const abort = new AbortController();
|
|
354
|
+
const watcher = setInterval(() => {
|
|
355
|
+
try {
|
|
356
|
+
const source = this.source(job.source_id), current = this.job(id);
|
|
357
|
+
if (current.state !== 'running' || source.revision !== job.source_revision || !source.enabled || !automaticJobActive(this.configuration.context.configDir, current, this.now()))
|
|
358
|
+
abort.abort();
|
|
359
|
+
}
|
|
360
|
+
catch {
|
|
361
|
+
abort.abort();
|
|
362
|
+
}
|
|
363
|
+
}, 100);
|
|
364
|
+
const deadline = setTimeout(() => abort.abort(), Math.max(1, Date.parse(job.deadline_at) - this.now()));
|
|
365
|
+
try {
|
|
366
|
+
const source = this.source(job.source_id);
|
|
367
|
+
if (!source.enabled || source.revision !== job.source_revision || !automaticJobActive(this.configuration.context.configDir, this.job(id), this.now()))
|
|
368
|
+
return;
|
|
369
|
+
let observation;
|
|
370
|
+
if (!sameContext(observationContext(source, contextFor(job.context.project, job.context.session, job.context.agent)), job.context))
|
|
371
|
+
observation = emptyObservation(source, job.context, 'identity');
|
|
372
|
+
else
|
|
373
|
+
observation = source.kind === 'json' ? readLocal(source, job.context) : source.kind === 'command' ? await refreshCommand(source, job.context, abort.signal) : await this.githubRefresh(source, job.context, abort.signal);
|
|
374
|
+
if (observation.reason === 'cancelled' && this.now() >= Date.parse(job.deadline_at))
|
|
375
|
+
observation = emptyObservation(source, job.context, 'timeout');
|
|
376
|
+
this.configuration.io.lock(this.configuration.context.configDir, () => {
|
|
377
|
+
const latest = this.source(job.source_id), state = this.job(id);
|
|
378
|
+
if (state.state !== 'running' || !latest.enabled || latest.revision !== job.source_revision)
|
|
379
|
+
return;
|
|
380
|
+
if (!automaticJobActive(this.configuration.context.configDir, state, this.now())) {
|
|
381
|
+
this.write(this.jobPath(id), { ...state, state: 'cancelled', reason: 'lease_expired' });
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (!sameContext(observationContext(latest, contextFor(job.context.project, job.context.session, job.context.agent)), job.context))
|
|
385
|
+
observation = emptyObservation(source, job.context, 'identity');
|
|
386
|
+
if (observation.reason !== 'identity' && observation.reason !== 'account')
|
|
387
|
+
this.publish(source, job.context, observation);
|
|
388
|
+
else
|
|
389
|
+
this.write(this.observationPath(source, job.context), { version: 1, current: observation, good: null });
|
|
390
|
+
state.state = observation.state === 'error' ? 'failed' : 'completed';
|
|
391
|
+
state.reason = observation.reason;
|
|
392
|
+
this.write(this.jobPath(id), state);
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
catch (error) {
|
|
396
|
+
try {
|
|
397
|
+
const state = this.job(id);
|
|
398
|
+
if (state.state === 'running')
|
|
399
|
+
this.write(this.jobPath(id), { ...state, state: 'failed', reason: error instanceof ConfigError ? error.code : 'refresh_failed' });
|
|
400
|
+
}
|
|
401
|
+
catch { /* Deadline remains the durable recovery marker. */ }
|
|
402
|
+
}
|
|
403
|
+
finally {
|
|
404
|
+
clearInterval(watcher);
|
|
405
|
+
clearTimeout(deadline);
|
|
406
|
+
try {
|
|
407
|
+
rmdirSync(claim);
|
|
408
|
+
}
|
|
409
|
+
catch { /* A crashed job is not resumed. */ }
|
|
410
|
+
this.prune();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
prune() {
|
|
414
|
+
for (const name of ['jobs', 'observations']) {
|
|
415
|
+
try {
|
|
416
|
+
const root = join(this.root, name), paths = readdirSync(root).filter(file => /^[A-Za-z0-9_-]+\.json$/u.test(file)).map(file => ({ path: join(root, file), age: statSync(join(root, file)).mtimeMs })).sort((a, b) => b.age - a.age);
|
|
417
|
+
for (const entry of paths.slice(512))
|
|
418
|
+
if (entry.age < this.now() - 60000)
|
|
419
|
+
unlinkSync(entry.path);
|
|
420
|
+
}
|
|
421
|
+
catch { /* Cleanup cannot alter a completed observation. */ }
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/sources/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAc,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,gBAAgB,EAAE,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AAI,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;gBACpO,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;oBAChC,IAAI,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;wBAC9B,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC;YACD,MAAM,CAAC,CAAC,mDAAmD,CAAC,CAAC;QACjE,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -3,8 +3,8 @@ import type { Diagnose } from '../diagnostics/service.js';
|
|
|
3
3
|
import * as contracts from '@fbincon/statusline-core/contracts/ui';
|
|
4
4
|
import type { Draft } from '@fbincon/statusline-core/contracts/ui';
|
|
5
5
|
import { ConfigurationService, type EffectiveConfig } from '../config/service.js';
|
|
6
|
-
export declare const BACKEND_VERSION = "3.
|
|
7
|
-
export declare const OPERATIONS: readonly ["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"];
|
|
6
|
+
export declare const BACKEND_VERSION = "3.7.0";
|
|
7
|
+
export declare const OPERATIONS: readonly ["sources_read", "sources_apply", "source_review", "source_context", "source_refresh", "source_status", "source_cancel", "source_diagnose", "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"];
|
|
8
8
|
export type Preview = (draft: Draft, width: number, trace?: RenderTrace) => contracts.PreviewResult;
|
|
9
9
|
export declare function capabilities(version: readonly number[] | null): contracts.Capabilities;
|
|
10
10
|
export declare function configurationOptions(): contracts.ConfigurationOptions;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { SourceService } from '../sources/service.js';
|
|
2
|
+
import { contextFor } from '../sources/context.js';
|
|
3
|
+
import { sourceContext } from '@fbincon/statusline-core/extensions/model';
|
|
1
4
|
import { RenderTrace } from '@fbincon/statusline-core/rendering/trace';
|
|
2
5
|
import { explain } from '@fbincon/statusline-core/rendering/explain';
|
|
3
6
|
import { explanationFacts } from './explain.js';
|
|
@@ -21,7 +24,7 @@ import { errorDescription } from '@fbincon/statusline-platform/errors';
|
|
|
21
24
|
import { ProfileService } from '../config/profiles.js';
|
|
22
25
|
import { taskAdapter } from '../tasks/service.js';
|
|
23
26
|
export const BACKEND_VERSION = VERSION;
|
|
24
|
-
export const 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'];
|
|
27
|
+
export const OPERATIONS = ['sources_read', 'sources_apply', 'source_review', 'source_context', 'source_refresh', 'source_status', 'source_cancel', 'source_diagnose', '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'];
|
|
25
28
|
export function capabilities(version) {
|
|
26
29
|
return {
|
|
27
30
|
host_version: version?.join('.') ?? null,
|
|
@@ -63,6 +66,32 @@ export class ConfigurationProtocol {
|
|
|
63
66
|
if (typeof operation !== 'string' || !OPERATIONS.includes(operation))
|
|
64
67
|
throw new ConfigError('errors.protocol.unsupported_configuration_operation', {}, 'unsupported_operation');
|
|
65
68
|
const payload = request.payload;
|
|
69
|
+
if (operation.startsWith('source')) {
|
|
70
|
+
const sources = new SourceService(this.service);
|
|
71
|
+
if (operation === 'sources_read') {
|
|
72
|
+
requestObject(payload, [], 'payload');
|
|
73
|
+
return sources.read();
|
|
74
|
+
}
|
|
75
|
+
if (operation === 'sources_apply')
|
|
76
|
+
return sources.mutate(payload);
|
|
77
|
+
if (operation === 'source_context') {
|
|
78
|
+
requestObject(payload, ['project', 'session', 'agent'], 'payload');
|
|
79
|
+
for (const key of ['project', 'session', 'agent'])
|
|
80
|
+
if (payload[key] !== null && typeof payload[key] !== 'string')
|
|
81
|
+
throw new ConfigError('sources.error.invalid');
|
|
82
|
+
return contextFor(payload.project ?? process.cwd(), payload.session, payload.agent);
|
|
83
|
+
}
|
|
84
|
+
requestObject(payload, operation === 'source_refresh' ? ['id', 'context', 'owner'] : operation === 'source_diagnose' ? ['id', 'context'] : ['id'], 'payload');
|
|
85
|
+
if (operation === 'source_review')
|
|
86
|
+
return sources.review(payload.id);
|
|
87
|
+
if (operation === 'source_status')
|
|
88
|
+
return sources.job(payload.id);
|
|
89
|
+
if (operation === 'source_cancel')
|
|
90
|
+
return sources.cancel(payload.id);
|
|
91
|
+
if (operation === 'source_diagnose')
|
|
92
|
+
return sources.diagnose(payload.id, sourceContext(payload.context));
|
|
93
|
+
return sources.start(payload.id, payload.context, payload.owner);
|
|
94
|
+
}
|
|
66
95
|
if (operation === 'task_details')
|
|
67
96
|
return taskAdapter(this.service.context.configDir)(payload);
|
|
68
97
|
if (operation === 'profiles_read' || operation === 'profiles_apply' || operation === 'profile_import' || operation === 'profile_export') {
|