feat: add session authorization mode configuration (#446)

Add approvals.mode configuration to allow users to enable/disable
session operation authorization. Mode can be 'off' (no auth) or 'manual'
(require auth). Changes trigger automatic gateway restart for config
to take effect.

- Add ApprovalConfig type with mode: 'off' | 'manual'
- Add approvals section to settings store
- Add session authorization toggle in SessionSettings UI
- Add approvals to PLATFORM_SECTIONS for auto-restart
- Add i18n support for all 8 languages

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ekko
2026-05-04 21:29:39 +08:00
committed by GitHub
parent 99f9dcb2fe
commit d47abf1533
12 changed files with 94 additions and 29 deletions
@@ -1,7 +1,7 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import * as configApi from '@/api/hermes/config'
import type { DisplayConfig, AgentConfig, MemoryConfig, SessionResetConfig, PrivacyConfig } from '@/api/hermes/config'
import type { DisplayConfig, AgentConfig, MemoryConfig, SessionResetConfig, PrivacyConfig, ApprovalConfig } from '@/api/hermes/config'
export const useSettingsStore = defineStore('settings', () => {
const loading = ref(false)
@@ -12,6 +12,7 @@ export const useSettingsStore = defineStore('settings', () => {
const memory = ref<MemoryConfig>({})
const sessionReset = ref<SessionResetConfig>({})
const privacy = ref<PrivacyConfig>({})
const approvals = ref<ApprovalConfig>({})
const telegram = ref<Record<string, any>>({})
const discord = ref<Record<string, any>>({})
const slack = ref<Record<string, any>>({})
@@ -32,6 +33,7 @@ export const useSettingsStore = defineStore('settings', () => {
memory.value = data.memory || {}
sessionReset.value = data.session_reset || {}
privacy.value = data.privacy || {}
approvals.value = data.approvals || {}
telegram.value = data.telegram || {}
discord.value = data.discord || {}
slack.value = data.slack || {}
@@ -59,6 +61,7 @@ export const useSettingsStore = defineStore('settings', () => {
case 'memory': memory.value = { ...memory.value, ...values }; break
case 'session_reset': sessionReset.value = { ...sessionReset.value, ...values }; break
case 'privacy': privacy.value = { ...privacy.value, ...values }; break
case 'approvals': approvals.value = { ...approvals.value, ...values }; break
case 'telegram': telegram.value = { ...telegram.value, ...values }; break
case 'discord': discord.value = { ...discord.value, ...values }; break
case 'slack': slack.value = { ...slack.value, ...values }; break
@@ -86,7 +89,7 @@ export const useSettingsStore = defineStore('settings', () => {
return {
loading, saving,
display, agent, memory, sessionReset, privacy,
display, agent, memory, sessionReset, privacy, approvals,
telegram, discord, slack, whatsapp, matrix, wecom, feishu, dingtalk, weixin, platforms,
fetchSettings, saveSection,
}