openpetswithchatandmcp/apps/desktop/control-center-preload.cjs
OpenPets Dev 6ab3bb64d8 feat(rebrand): rename OpenPets to FamiliarOS and pets to familiars
- Rename all user-facing and technical identifiers from OpenPets/Pet to FamiliarOS/Familiar.
- Rename packages from @open-pets/* to @familiaros/*; rename install-pet/pet-format packages.
- Rename plugin IDs and directories from openpets.* to familiaros.*.
- Rename IPC namespace from openpets:* to familiaros:* and state filenames from openpets-* to familiaros-* with legacy migration.
- Rename source files (pet-window, built-in-pet, default-pet-controller, etc.) to familiar equivalents.
- Update locales (en, es-419, ja, ko, pt-BR, zh-Hans, zh-Hant) and tray/pet context menu strings.
- Add Familiar naming feature: preference, settings input, tray menu display.
- Update assets and packaging config; all desktop tests pass.
2026-06-17 01:42:08 +00:00

82 lines
6.7 KiB
JavaScript

const { contextBridge, ipcRenderer } = require("electron");
const api = {
getPetsState: () => ipcRenderer.invoke("familiaros:get-familiars-state"),
getDashboardSnapshot: () => ipcRenderer.invoke("familiaros:get-dashboard-snapshot"),
getSettingsState: () => ipcRenderer.invoke("familiaros:get-settings-state"),
getOpenApiChatSettings: () => ipcRenderer.invoke("familiaros:get-openapi-chat-settings"),
getI18n: () => ipcRenderer.invoke("familiaros:get-i18n"),
updatePreferences: (patch) => ipcRenderer.invoke("familiaros:update-preferences", patch),
saveOpenApiCredential: (apiKey) => ipcRenderer.invoke("familiaros:save-openapi-credential", apiKey),
clearOpenApiCredential: () => ipcRenderer.invoke("familiaros:clear-openapi-credential"),
getReactionAnimationSettings: () => ipcRenderer.invoke("familiaros:get-reaction-animation-settings"),
getLaunchAtLogin: () => ipcRenderer.invoke("familiaros:get-launch-at-login"),
setLaunchAtLogin: (enabled) => ipcRenderer.invoke("familiaros:set-launch-at-login", enabled),
getUpdateStatus: () => ipcRenderer.invoke("familiaros:get-update-status"),
checkForUpdates: () => ipcRenderer.invoke("familiaros:check-for-updates"),
openUpdateReleasePage: () => ipcRenderer.invoke("familiaros:open-update-release-page"),
resetDefaultPetPosition: () => ipcRenderer.invoke("familiaros:reset-default-familiar-position"),
getPluginsSnapshot: () => ipcRenderer.invoke("familiaros:plugins-snapshot"),
getPluginCatalogSnapshot: (refresh) => ipcRenderer.invoke("familiaros:plugins-catalog-snapshot", refresh),
setPluginEnabled: (id, enabled) => ipcRenderer.invoke("familiaros:plugins-set-enabled", id, enabled),
savePluginConfig: (id, config) => ipcRenderer.invoke("familiaros:plugins-save-config", id, config),
pickPluginConfigSound: (id) => ipcRenderer.invoke("familiaros:plugins-pick-config-sound", id),
reloadPlugin: (id) => ipcRenderer.invoke("familiaros:plugins-reload", id),
executePluginCommand: (id, commandId, args) => ipcRenderer.invoke("familiaros:plugins-execute-command", id, commandId, args),
loadLocalPlugin: () => ipcRenderer.invoke("familiaros:plugins-load-local"),
installCatalogPlugin: (id) => ipcRenderer.invoke("familiaros:plugins-install-catalog", id),
updateCatalogPlugin: (id) => ipcRenderer.invoke("familiaros:plugins-update-catalog", id),
uninstallPlugin: (id) => ipcRenderer.invoke("familiaros:plugins-uninstall", id),
getPluginInspector: (id) => ipcRenderer.invoke("familiaros:plugins-inspector", id),
getPluginPlatformSettings: () => ipcRenderer.invoke("familiaros:plugin-platform-settings-get"),
updatePluginPlatformSettings: (patch) => ipcRenderer.invoke("familiaros:plugin-platform-settings-update", patch),
setPluginAiApiKey: (key) => ipcRenderer.invoke("familiaros:plugin-platform-ai-key-set", key),
getPluginAiApiKeyStatus: () => ipcRenderer.invoke("familiaros:plugin-platform-ai-key-status"),
getCatalog: () => ipcRenderer.invoke("familiaros:get-catalog"),
getCatalogPage: (page) => ipcRenderer.invoke("familiaros:get-catalog-page", page),
getCatalogSearch: () => ipcRenderer.invoke("familiaros:get-catalog-search"),
getCodexPets: () => ipcRenderer.invoke("familiaros:get-codex-familiars"),
setDefaultPet: (petId) => ipcRenderer.invoke("familiaros:set-default-familiar", petId),
installPet: (petId) => ipcRenderer.invoke("familiaros:install-familiar", petId),
installLocalPet: () => ipcRenderer.invoke("familiaros:install-local-familiar"),
importCodexPet: (petId) => ipcRenderer.invoke("familiaros:import-codex-familiar", petId),
openGallery: () => ipcRenderer.invoke("familiaros:open-gallery"),
removePet: (petId) => ipcRenderer.invoke("familiaros:remove-familiar", petId),
onRouteChange: (callback) => {
const listener = (_event, route) => callback(route);
ipcRenderer.on("familiaros:control-center-route", listener);
return () => ipcRenderer.removeListener("familiaros:control-center-route", listener);
},
onPluginsRefresh: (callback) => {
const listener = () => callback();
ipcRenderer.on("familiaros:plugins-refresh", listener);
return () => ipcRenderer.removeListener("familiaros:plugins-refresh", listener);
},
getIntegrationsState: (selectedPetId, commandMode) => ipcRenderer.invoke("familiaros:agent-setup-snapshot", selectedPetId, commandMode),
runIntegrationAction: (action, selectedPetId, commandMode) => ipcRenderer.invoke("familiaros:agent-setup-action", action, selectedPetId, commandMode),
updateIntegrationCommandPaths: (patch) => ipcRenderer.invoke("familiaros:agent-setup-command-paths", patch),
getFamiliarOSMcpServerPreview: (selectedPetId, commandMode) => ipcRenderer.invoke("familiaros:familiaros-mcp-server-preview", selectedPetId, commandMode),
testFamiliarOSMcpServer: (selectedPetId, commandMode) => ipcRenderer.invoke("familiaros:test-familiaros-mcp-server", selectedPetId, commandMode),
getTtsSettings: () => ipcRenderer.invoke("familiaros:get-tts-settings"),
getTtsVoices: (provider) => ipcRenderer.invoke("familiaros:get-tts-voices", provider),
saveTtsCredential: (provider, credential) => ipcRenderer.invoke("familiaros:save-tts-credential", provider, credential),
clearTtsCredential: (provider) => ipcRenderer.invoke("familiaros:clear-tts-credential", provider),
testTtsSpeak: (text) => ipcRenderer.invoke("familiaros:test-tts", text),
stopTts: () => ipcRenderer.invoke("familiaros:tts-stop"),
copyText: (text) => ipcRenderer.invoke("familiaros:copy-text", text),
openExternalUrl: (url) => ipcRenderer.invoke("familiaros:open-external-url", url),
installMcpToolkit: (target) => ipcRenderer.invoke("familiaros:install-mcp-toolkit", target),
getVanillaChatMcpTools: () => ipcRenderer.invoke("familiaros:get-vanilla-chat-mcp-tools"),
setVanillaChatMcpTools: (toolIds) => ipcRenderer.invoke("familiaros:set-vanilla-chat-mcp-tools", toolIds),
getMemories: (query, limit) => ipcRenderer.invoke("familiaros:get-memories", query, limit),
storeMemory: (text, kind, tags, importance) => ipcRenderer.invoke("familiaros:store-memory", text, kind, tags, importance),
updateMemory: (id, text, kind, tags, importance) => ipcRenderer.invoke("familiaros:update-memory", id, text, kind, tags, importance),
deleteMemory: (id) => ipcRenderer.invoke("familiaros:delete-memory", id),
knowledgeList: (limit) => ipcRenderer.invoke("familiaros:knowledge-list", limit),
knowledgeSearch: (query, limit) => ipcRenderer.invoke("familiaros:knowledge-search", query, limit),
knowledgeDeleteFile: (id) => ipcRenderer.invoke("familiaros:knowledge-delete-file", id),
knowledgeAddMemory: (text, kind, tags, importance) => ipcRenderer.invoke("familiaros:knowledge-add-memory", text, kind, tags, importance),
knowledgeStoreFile: () => ipcRenderer.invoke("familiaros:knowledge-store-file"),
};
contextBridge.exposeInMainWorld("openPetsControlCenter", api);