import { RepositorySettingsRepository } from "@agimon-ai/po-core/web"; //#region src/types/settings.d.ts export declare const SETTINGS_CONFIG_API_ROUTE = "/api/settings"; export declare const SETTINGS_VALUE_API_ROUTE = "/api/settings/value"; export declare const SETTINGS_REPOSITORIES_API_ROUTE = "/api/settings/repositories"; export declare const SETTINGS_MODELS_API_ROUTE = "/api/plugins/po/models"; export declare const SETTINGS_REPOSITORY_API_ROUTE = "/api/settings/repository"; export declare const SETTINGS_REPOSITORY_SELECTION_API_ROUTE = "/api/settings/repository/selection"; export declare const SETTINGS_IMAGES_API_ROUTE = "/api/settings/images"; export declare const SETTINGS_PRESETS_API_ROUTE = "/api/settings/presets"; /** * The image limits, which live in Pi's settings.json rather than the Po * config, so they have their own route instead of a key path: Pi's own toggle * writes that file, and a machine should not end up with two answers to how * large an image reaches a model. */ export interface SettingsImagesView { /** Off leaves every image at the size it arrived. */ autoResize: boolean; /** Longest edge an image keeps once resizing is on. */ maxDimension: number; /** The range the hub accepts; a value outside it is clamped rather than refused. */ minDimension: number; maxAllowedDimension: number; } export interface SettingsImagesWriteRequest { autoResize?: boolean; maxDimension?: number; } /** One layer a preset turns on, with the Po plugins (packages) it bundles. */ export interface SettingsPresetLayer { name: string; packages: string[]; } /** One effective preset, with its layers in load order. */ export interface SettingsPreset { name: string; description: string; layers: SettingsPresetLayer[]; /** True when this workspace definition replaces a host preset of the same name. */ overridesHost?: boolean; /** True when a workspace reads this preset from the host file because it has none of its own. */ inherited?: boolean; } /** Settings > Presets: your presets, the default new sessions start with, and what every preset includes. */ export interface SettingsPresetsView { defaultPreset: string; presets: SettingsPreset[]; /** `default.packages`: loaded before any preset's layers. */ alwaysIncluded: string[]; /** sha256 of the mount's presets file, empty when absent. */ hash: string; /** The host token, used when adding to an inherited host default. */ hostHash?: string; /** The token an add to the default preset (`name: ''`) checks: the host file's when that default is inherited. */ defaultHash?: string; file?: string; writtenFile?: string; } export interface SettingsPresetsWriteRequest { scope?: PresetScope; defaultPreset: string; expectedHash: string; } /** Preset writes use the admitted workspace mount, never a caller-supplied path. */ export type PresetScope = 'host' | `workspace:${string}`; export interface PresetWriteRequest { scope: PresetScope; expectedHash: string; name: string; } export interface PresetCreateRequest extends PresetWriteRequest { description: string; layers?: string[]; } export interface PresetRenameRequest extends PresetWriteRequest { newName: string; } /** A caller-supplied curated definition. Existing layers are never modified. */ export interface PresetLayerDefinition { packages?: Array; }>; extensions?: string[]; hookGroups?: string[]; } export interface PresetLayerRequest extends PresetWriteRequest { /** Set name to an empty string to add to the scope's default preset. */ layer: string; definition?: PresetLayerDefinition; } export type PresetOperation = 'create' | 'rename' | 'delete' | 'default' | 'add-layer' | 'remove-layer'; export interface PresetReference { file: string; key: string; } /** * Which settings tier a read or write is about: `host` is this machine's config file and * `repository` the workspace's. `global` is reserved for the member tier: it has its own issuer * endpoint and never travels on the host settings API. */ export type SettingsScope = 'host' | 'repository' | 'global'; /** The two config files the host settings API reads and writes. */ export type SettingsFileScope = Exclude; /** Where the effective value came from, or that no file set it. */ export type SettingsOrigin = 'host' | 'repository' | 'default'; /** Which scopes a key may be written at, as the merge policy decides. */ export type SettingsKeyScope = 'host' | 'repository' | 'both'; /** Host settings wire values. */ export type SettingsWireScope = 'host' | 'repository'; export type SettingsWireOrigin = 'host' | 'repository' | 'default'; export type SettingsWireKeyScope = 'host' | 'repository' | 'both'; /** One repository the picker offers. */ export type SettingsRepository = RepositorySettingsRepository; /** One model the machine can actually use, for a field declaring optionsFrom: 'models'. */ export interface SettingsModel { /** `provider/model-id`, which is what the config file holds. */ value: string; label: string; group: string; } /** One key's current state, keyed by its dotted path. */ export interface SettingsValueView { /** The effective value, stringified for display; absent when nothing set it. */ value?: string; origin: SettingsOrigin; /** Which scopes may hold this key. A field outside the chosen scope is read-only. */ scope: SettingsKeyScope; } /** What the read route answers with. */ export interface SettingsConfigView { /** Empty when the page has no repository in view; the host half still applies. */ repoRoot: string; /** Keyed by dotted key path, for every key the page asked about. */ values: Record; /** Per-scope file identity, so a write can prove which bytes it read. */ hashes: Record; } /** One key's state as the host settings API sends it. */ export interface SettingsWireValueView { value?: string; origin: SettingsWireOrigin; scope: SettingsWireKeyScope; } /** Host settings wire values. */ export interface SettingsWireConfigView { repoRoot: string; values: Record; /** Host settings wire values. */ hashes: { host: string; repository: string; }; } /** What the write route takes. `value: null` clears the key at that scope. */ export interface SettingsWriteRequest { /** Required for a repository write; ignored, and may be empty, for a host one. */ repoRoot: string; scope: SettingsFileScope; keyPath: readonly string[]; value: string | number | null; /** The hash of the target file when the page read it. */ expectedHash: string; } /** One atomic save, validated as a whole before replacing the configuration file. */ export interface SettingsBatchWriteRequest { repoRoot: string; scope: SettingsFileScope; edits: readonly Pick[]; expectedHash: string; } /** A named option from one effective repository catalog. */ export interface RepositoryCatalogOption { name: string; description?: string; /** Present for a domain alias, naming the entries it expands to. */ expandsTo?: readonly string[]; /** Present for a preset, naming its ordered layers. */ layers?: readonly string[]; } /** One selection axis, keeping an inherited effective value apart from this repository's override. */ export interface RepositorySelectionValue { effective?: T; repository?: T; origin: SettingsOrigin; } /** The repository control plane's safe, non-secret catalog and selection view. */ export interface RepositorySettingsView { repository: SettingsRepository; hash: string; catalogs: { presets: readonly RepositoryCatalogOption[]; domains: readonly RepositoryCatalogOption[]; profiles: readonly RepositoryCatalogOption[]; }; selection: { preset: RepositorySelectionValue; domains: RepositorySelectionValue; profile: RepositorySelectionValue; }; } export interface RepositorySelectionChanges { preset?: string | null; domains?: readonly string[] | null; profile?: string | null; } /** An optimistic, atomic write into one repository's selection defaults. */ export interface RepositorySelectionWriteRequest { repositoryId: string; expectedHash: string; changes: RepositorySelectionChanges; } /** What a route reports when it refuses; the page shows `error` verbatim. */ export interface SettingsErrorView { error: string; /** Present when a preset cannot be renamed or deleted while referenced. */ references?: PresetReference[]; /** On a stale write, the hash the target file actually holds now. */ hash?: string; } //#endregion //# sourceMappingURL=settings.d.mts.map