mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Adds encrypted, account-bound sync of AI settings (providers, models, MCP servers) as a kind 30078 addressable event with a 'shakespeare-ai-settings' d tag. Settings JSON is nip44-encrypted to the user's own pubkey, so secrets stay private on relays. - aiSettingsSync.ts: build/fetch/decrypt helpers + nip44 guard - useAISettingsSync + provider/context: debounced push-on-change, pull on login (newest-wins), manual back up / restore, auto-sync toggle - configUtils: export aiSettingsSchema; local-only ai-sync.json metadata - AISettings page: signed-in-only "Sync to Nostr" card - replaceSettings bulk setter on AISettings context - i18n keys translated across all locales Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
22 lines
731 B
TypeScript
22 lines
731 B
TypeScript
import type { ReactNode } from 'react';
|
|
import { AISettingsSyncContext } from '@/contexts/AISettingsSyncContext';
|
|
import { useAISettingsSync } from '@/hooks/useAISettingsSync';
|
|
|
|
interface AISettingsSyncProviderProps {
|
|
children: ReactNode;
|
|
}
|
|
|
|
/**
|
|
* Runs NIP-78 AI-settings sync once for the whole app and exposes its state to
|
|
* descendants (e.g. the AI settings page). Must live below NostrProvider and
|
|
* AISettingsProvider so it can read the active account and current settings.
|
|
*/
|
|
export function AISettingsSyncProvider({ children }: AISettingsSyncProviderProps) {
|
|
const sync = useAISettingsSync();
|
|
return (
|
|
<AISettingsSyncContext.Provider value={sync}>
|
|
{children}
|
|
</AISettingsSyncContext.Provider>
|
|
);
|
|
}
|