Merged origin/main (release v3.0.0) into main and preserved fork features: - Minimal compact prompt window (140px) that expands with editor/history. - Larger pet speech bubbles that scale with pet/window size. - Improved chat command memory extraction (/remember, /memorize, /note, don't forget). - Continuous pet scale slider from 0.16x to 10x (screen-filling). Version bumped to 3.1.0.
69 lines
5.3 KiB
JavaScript
69 lines
5.3 KiB
JavaScript
const { contextBridge, ipcRenderer } = require("electron");
|
|
|
|
const api = {
|
|
getPetsState: () => ipcRenderer.invoke("openpets:get-pets-state"),
|
|
getDashboardSnapshot: () => ipcRenderer.invoke("openpets:get-dashboard-snapshot"),
|
|
getSettingsState: () => ipcRenderer.invoke("openpets:get-settings-state"),
|
|
getOpenApiChatSettings: () => ipcRenderer.invoke("openpets:get-openapi-chat-settings"),
|
|
getI18n: () => ipcRenderer.invoke("openpets:get-i18n"),
|
|
updatePreferences: (patch) => ipcRenderer.invoke("openpets:update-preferences", patch),
|
|
saveOpenApiCredential: (apiKey) => ipcRenderer.invoke("openpets:save-openapi-credential", apiKey),
|
|
clearOpenApiCredential: () => ipcRenderer.invoke("openpets:clear-openapi-credential"),
|
|
getReactionAnimationSettings: () => ipcRenderer.invoke("openpets:get-reaction-animation-settings"),
|
|
getLaunchAtLogin: () => ipcRenderer.invoke("openpets:get-launch-at-login"),
|
|
setLaunchAtLogin: (enabled) => ipcRenderer.invoke("openpets:set-launch-at-login", enabled),
|
|
getUpdateStatus: () => ipcRenderer.invoke("openpets:get-update-status"),
|
|
checkForUpdates: () => ipcRenderer.invoke("openpets:check-for-updates"),
|
|
openUpdateReleasePage: () => ipcRenderer.invoke("openpets:open-update-release-page"),
|
|
resetDefaultPetPosition: () => ipcRenderer.invoke("openpets:reset-default-pet-position"),
|
|
getPluginsSnapshot: () => ipcRenderer.invoke("openpets:plugins-snapshot"),
|
|
getPluginCatalogSnapshot: (refresh) => ipcRenderer.invoke("openpets:plugins-catalog-snapshot", refresh),
|
|
setPluginEnabled: (id, enabled) => ipcRenderer.invoke("openpets:plugins-set-enabled", id, enabled),
|
|
savePluginConfig: (id, config) => ipcRenderer.invoke("openpets:plugins-save-config", id, config),
|
|
pickPluginConfigSound: (id) => ipcRenderer.invoke("openpets:plugins-pick-config-sound", id),
|
|
reloadPlugin: (id) => ipcRenderer.invoke("openpets:plugins-reload", id),
|
|
executePluginCommand: (id, commandId, args) => ipcRenderer.invoke("openpets:plugins-execute-command", id, commandId, args),
|
|
loadLocalPlugin: () => ipcRenderer.invoke("openpets:plugins-load-local"),
|
|
installCatalogPlugin: (id) => ipcRenderer.invoke("openpets:plugins-install-catalog", id),
|
|
updateCatalogPlugin: (id) => ipcRenderer.invoke("openpets:plugins-update-catalog", id),
|
|
uninstallPlugin: (id) => ipcRenderer.invoke("openpets:plugins-uninstall", id),
|
|
getPluginInspector: (id) => ipcRenderer.invoke("openpets:plugins-inspector", id),
|
|
getPluginPlatformSettings: () => ipcRenderer.invoke("openpets:plugin-platform-settings-get"),
|
|
updatePluginPlatformSettings: (patch) => ipcRenderer.invoke("openpets:plugin-platform-settings-update", patch),
|
|
setPluginAiApiKey: (key) => ipcRenderer.invoke("openpets:plugin-platform-ai-key-set", key),
|
|
getPluginAiApiKeyStatus: () => ipcRenderer.invoke("openpets:plugin-platform-ai-key-status"),
|
|
getCatalog: () => ipcRenderer.invoke("openpets:get-catalog"),
|
|
getCatalogPage: (page) => ipcRenderer.invoke("openpets:get-catalog-page", page),
|
|
getCatalogSearch: () => ipcRenderer.invoke("openpets:get-catalog-search"),
|
|
getCodexPets: () => ipcRenderer.invoke("openpets:get-codex-pets"),
|
|
setDefaultPet: (petId) => ipcRenderer.invoke("openpets:set-default-pet", petId),
|
|
installPet: (petId) => ipcRenderer.invoke("openpets:install-pet", petId),
|
|
installLocalPet: () => ipcRenderer.invoke("openpets:install-local-pet"),
|
|
importCodexPet: (petId) => ipcRenderer.invoke("openpets:import-codex-pet", petId),
|
|
openGallery: () => ipcRenderer.invoke("openpets:open-gallery"),
|
|
removePet: (petId) => ipcRenderer.invoke("openpets:remove-pet", petId),
|
|
onRouteChange: (callback) => {
|
|
const listener = (_event, route) => callback(route);
|
|
ipcRenderer.on("openpets:control-center-route", listener);
|
|
return () => ipcRenderer.removeListener("openpets:control-center-route", listener);
|
|
},
|
|
onPluginsRefresh: (callback) => {
|
|
const listener = () => callback();
|
|
ipcRenderer.on("openpets:plugins-refresh", listener);
|
|
return () => ipcRenderer.removeListener("openpets:plugins-refresh", listener);
|
|
},
|
|
getIntegrationsState: (selectedPetId, commandMode) => ipcRenderer.invoke("openpets:agent-setup-snapshot", selectedPetId, commandMode),
|
|
runIntegrationAction: (action, selectedPetId, commandMode) => ipcRenderer.invoke("openpets:agent-setup-action", action, selectedPetId, commandMode),
|
|
updateIntegrationCommandPaths: (patch) => ipcRenderer.invoke("openpets:agent-setup-command-paths", patch),
|
|
copyText: (text) => ipcRenderer.invoke("openpets:copy-text", text),
|
|
openExternalUrl: (url) => ipcRenderer.invoke("openpets:open-external-url", url),
|
|
installMcpToolkit: (target) => ipcRenderer.invoke("openpets:install-mcp-toolkit", target),
|
|
getVanillaChatMcpTools: () => ipcRenderer.invoke("openpets:get-vanilla-chat-mcp-tools"),
|
|
setVanillaChatMcpTools: (toolIds) => ipcRenderer.invoke("openpets:set-vanilla-chat-mcp-tools", toolIds),
|
|
getMemories: (query, limit) => ipcRenderer.invoke("openpets:get-memories", query, limit),
|
|
storeMemory: (text, kind, tags, importance) => ipcRenderer.invoke("openpets:store-memory", text, kind, tags, importance),
|
|
updateMemory: (id, text, kind, tags, importance) => ipcRenderer.invoke("openpets:update-memory", id, text, kind, tags, importance),
|
|
deleteMemory: (id) => ipcRenderer.invoke("openpets:delete-memory", id),
|
|
};
|
|
|
|
contextBridge.exposeInMainWorld("openPetsControlCenter", api);
|