import { InjectionToken, type EnvironmentProviders } from '@angular/core'; import { type AparteAIProvider, type AparteClientOptions, type AparteIconProvider, type AparteLocale, type AparteMarkdownProvider, type AparteModelConfig } from '@aparte/core'; /** * Any function that initialises a plugin — sync or async, so it can wrap a * dynamic `import()` of a package YOU choose. It resolves to nothing, so `await` * the import rather than returning it: * `async () => { await import('@aparte/plugin-model-selector'); }`. */ export type ApartePluginLoader = () => void | Promise; /** * Config for {@link provideAparte}. Deliberately **instance-agnostic**: every * plugin/locale slot takes a provider OBJECT or a LOADER function you supply — * this package never hardcodes (nor depends on) a catalog of `@aparte/*` package * names, so it stays a leaf with only `@aparte/core` + Angular as peers. */ export interface ProvideAparteOptions { /** AI providers to register (e.g. from `@aparte/provider-openai-compat`). */ providers?: AparteAIProvider[]; /** Optional plugin wiring — objects or loaders, never package-name strings. */ plugins?: { /** * Action plugins, as loaders. A loader resolves to nothing, so `await` the * import rather than returning it: * `[async () => { await import('@aparte/plugin-model-selector'); }]`. */ actions?: ApartePluginLoader[]; /** An icon provider object, or a loader that registers one. */ icons?: AparteIconProvider | ApartePluginLoader; /** A loader that applies a theme. */ theme?: ApartePluginLoader; /** A markdown provider `(raw: string) => string`, or a loader that registers one. */ markdown?: AparteMarkdownProvider | ApartePluginLoader; }; /** Model selection configuration. */ modelConfig?: AparteModelConfig; /** A locale OBJECT (e.g. `fr` from `@aparte/locale-fr`) — not a package-name string. */ locale?: AparteLocale; /** Theme mode; `'auto'` follows the system preference. */ themeMode?: 'light' | 'dark' | 'auto'; /** Options for the `AparteClient` mounted by {@link AparteAiService}. */ clientOptions?: AparteClientOptions; /** * Start the {@link AparteAiService} client once the app initialises (after * providers/plugins are registered), so sends stream without a manual * `AparteAiService.connect()` — "wire the config and it works", same as the * React/Vue/Svelte wrappers. Default `true`; set `false` to control the * client lifecycle yourself. */ autoConnect?: boolean; } /** Holds the resolved aparté config, for consumers that want to inject it. */ export declare const APARTE_CONFIG_TOKEN: InjectionToken; /** * Configure aparté for a standalone Angular app. Registers your AI providers, * model config, locale and optional plugins on `aparteGlobalConfig`, * provides {@link APARTE_CLIENT_OPTIONS} for {@link AparteAiService}, and * starts the client (see `autoConnect`) — no manual * `AparteAiService.connect()` needed. * * The components (`AparteChatComponent`, `AparteUiComponent`) are standalone and * work WITHOUT this — it is config sugar. Angular is the only wrapper that has it, * and the other three lose nothing: what this provider exists for is an initializer * that runs before the first component and a `DestroyRef` to release the theme * listener. Everything it configures is a plain call — bar `theme: 'auto'`, which is a * `matchMedia` listener you own — so React, Vue and Svelte make the same ones at module * scope, before the app mounts: * * ```ts * aparteGlobalConfig.registerAIProvider(createOpenAICompatProvider(presets.OPENROUTER)); * aparteGlobalConfig.setModelConfig({ defaultModel: 'openai/gpt-4o-mini' }); * aparteGlobalConfig.setLocale(fr); * document.documentElement.setAttribute('data-aparte-theme', 'dark'); * // 'auto' is the one option with no one-liner: match prefers-color-scheme, rewrite the * // attribute on change, and drop the listener when your app tears down. * // The client stays the wrapper's own: useAparteClient(), createAparteClient(). * ``` * * @example * bootstrapApplication(App, { * providers: [ * provideAparte({ * providers: [createOpenAICompatProvider(presets.OPENROUTER)], * clientOptions: { keyResolver }, * }), * ], * }); */ export declare function provideAparte(options?: ProvideAparteOptions): EnvironmentProviders;