feat(hermes): add browser camofox controls

This commit is contained in:
晴天
2026-05-27 06:43:41 +08:00
parent 3c29431be0
commit b51bde929e
6 changed files with 327 additions and 4 deletions

View File

@@ -309,6 +309,10 @@ const BROWSER_DEFAULTS = {
browserAllowPrivateUrls: false,
browserAutoLocalForPrivateUrls: true,
browserCdpUrl: '',
browserCamofoxManagedPersistence: false,
browserCamofoxUserId: '',
browserCamofoxSessionKey: '',
browserCamofoxAdoptExistingTab: false,
browserDialogPolicy: 'must_respond',
browserDialogTimeout: 300,
}
@@ -2411,6 +2415,27 @@ export function render() {
<span>${t('engine.hermesBrowserConfigAutoLocalForPrivateUrls')}</span>
</label>
</div>
<div class="hm-config-subtitle">${t('engine.hermesBrowserConfigCamofoxTitle')}</div>
<div class="hm-config-runtime-grid hm-config-browser-camofox-grid">
<label class="hm-field">
<span class="hm-field-label">${t('engine.hermesBrowserConfigCamofoxUserId')}</span>
<input id="hm-browser-camofox-user-id" class="hm-input" type="text" autocomplete="off" spellcheck="false" value="${esc(browserValues.browserCamofoxUserId)}" ${disabled ? 'disabled' : ''}>
</label>
<label class="hm-field">
<span class="hm-field-label">${t('engine.hermesBrowserConfigCamofoxSessionKey')}</span>
<input id="hm-browser-camofox-session-key" class="hm-input" type="text" autocomplete="off" spellcheck="false" value="${esc(browserValues.browserCamofoxSessionKey)}" ${disabled ? 'disabled' : ''}>
</label>
</div>
<div class="hm-config-check-grid">
<label class="hm-channel-check">
<input id="hm-browser-camofox-managed-persistence" type="checkbox" ${browserValues.browserCamofoxManagedPersistence ? 'checked' : ''} ${disabled ? 'disabled' : ''}>
<span>${t('engine.hermesBrowserConfigCamofoxManagedPersistence')}</span>
</label>
<label class="hm-channel-check">
<input id="hm-browser-camofox-adopt-existing-tab" type="checkbox" ${browserValues.browserCamofoxAdoptExistingTab ? 'checked' : ''} ${disabled ? 'disabled' : ''}>
<span>${t('engine.hermesBrowserConfigCamofoxAdoptExistingTab')}</span>
</label>
</div>
<div class="hm-channel-footnote">${t('engine.hermesBrowserConfigFootnote')}</div>
</div>
</div>
@@ -4816,6 +4841,10 @@ export function render() {
browserAllowPrivateUrls: !!el.querySelector('#hm-browser-allow-private-urls')?.checked,
browserAutoLocalForPrivateUrls: !!el.querySelector('#hm-browser-auto-local-for-private-urls')?.checked,
browserCdpUrl: el.querySelector('#hm-browser-cdp-url')?.value || '',
browserCamofoxManagedPersistence: !!el.querySelector('#hm-browser-camofox-managed-persistence')?.checked,
browserCamofoxUserId: el.querySelector('#hm-browser-camofox-user-id')?.value || '',
browserCamofoxSessionKey: el.querySelector('#hm-browser-camofox-session-key')?.value || '',
browserCamofoxAdoptExistingTab: !!el.querySelector('#hm-browser-camofox-adopt-existing-tab')?.checked,
browserDialogPolicy: el.querySelector('#hm-browser-dialog-policy')?.value || 'must_respond',
browserDialogTimeout: el.querySelector('#hm-browser-dialog-timeout')?.value || '300',
}

View File

@@ -714,12 +714,17 @@ export default {
hermesBrowserConfigAutoLocalForPrivateUrls: _('私网地址自动切到本地浏览器', 'Use local browser automatically for private URLs', '私網位址自動切到本機瀏覽器'),
hermesBrowserConfigCdpUrl: _('CDP 连接地址', 'CDP endpoint URL', 'CDP 連線位址'),
hermesBrowserConfigCdpUrlPlaceholder: _('留空则自动创建浏览器', 'Leave empty to launch browser automatically', '留空則自動建立瀏覽器'),
hermesBrowserConfigCamofoxTitle: _('Camofox 高级身份', 'Camofox advanced identity', 'Camofox 進階身分'),
hermesBrowserConfigCamofoxManagedPersistence: _('启用 Camofox 托管持久化', 'Enable Camofox managed persistence', '啟用 Camofox 託管持久化'),
hermesBrowserConfigCamofoxUserId: _('Camofox 用户 ID', 'Camofox user ID', 'Camofox 使用者 ID'),
hermesBrowserConfigCamofoxSessionKey: _('Camofox 会话 Key', 'Camofox session key', 'Camofox 工作階段 Key'),
hermesBrowserConfigCamofoxAdoptExistingTab: _('接管已有 Camofox 标签页', 'Adopt existing Camofox tab', '接管既有 Camofox 分頁'),
hermesBrowserConfigDialogPolicy: _('弹窗处理策略', 'Dialog handling policy', '彈窗處理策略'),
hermesBrowserConfigDialogPolicy_must_respond: _('等待用户处理', 'Wait for user response', '等待使用者處理'),
hermesBrowserConfigDialogPolicy_auto_dismiss: _('自动取消弹窗', 'Auto dismiss dialogs', '自動取消彈窗'),
hermesBrowserConfigDialogPolicy_auto_accept: _('自动确认弹窗', 'Auto accept dialogs', '自動確認彈窗'),
hermesBrowserConfigDialogTimeout: _('弹窗等待超时秒数', 'Dialog wait timeout seconds', '彈窗等待逾時秒數'),
hermesBrowserConfigFootnote: _('Lightpanda 导航更快但不支持截图;录制会把 WebM 写入 Hermes browser_recordings 目录,请只在需要审计时开启。允许私网地址会放开 localhost / 192.168 等目标;CDP 地址留空表示自动创建浏览器Camofox 嵌套高级字段会保留在 raw YAML 中。', 'Lightpanda navigates faster but does not support screenshots. Recording writes WebM files into the Hermes browser_recordings directory, so enable it only for audits. Allowing private URLs opens localhost / 192.168-style targets. Empty CDP URL means Hermes launches a browser automatically. Nested Camofox advanced fields stay in raw YAML.', 'Lightpanda 導覽更快但不支援截圖;錄製會把 WebM 寫入 Hermes browser_recordings 目錄,請只在需要稽核時開啟。允許私網位址會放開 localhost / 192.168 等目標;CDP 位址留空表示自動建立瀏覽器Camofox 巢狀進階欄位會保留在 raw YAML 中。'),
hermesBrowserConfigFootnote: _('Lightpanda 导航更快但不支持截图;录制会把 WebM 写入 Hermes browser_recordings 目录请只在需要审计时开启。CDP 地址留空表示自动创建浏览器Camofox 身份字段只影响 Camofox 后端user_id / session_key 会复用远端 profile 或 session不保存密码或 API Key接管已有标签页仅在 Camofox 服务返回 tabs 时生效。', 'Lightpanda navigates faster but does not support screenshots. Recording writes WebM files into the Hermes browser_recordings directory, so enable it only for audits. Empty CDP URL means Hermes launches a browser automatically. Camofox identity fields only affect the Camofox backend; user_id / session_key reuse a remote profile or session and do not store passwords or API keys. Existing-tab adoption only works when the Camofox service returns tabs.', 'Lightpanda 導覽更快但不支援截圖;錄製會把 WebM 寫入 Hermes browser_recordings 目錄請只在需要稽核時開啟。CDP 位址留空表示自動建立瀏覽器Camofox 身分欄位只影響 Camofox 後端user_id / session_key 會複用遠端 profile 或 session不儲存密碼或 API Key接管既有分頁僅在 Camofox 服務返回 tabs 時生效。'),
hermesWebConfigTitle: _('Web 工具后端', 'Web tool backends', 'Web 工具後端'),
hermesWebConfigDesc: _('控制 web_search / web_extract 的默认和分能力后端,只保存后端选择,不保存 API Key。', 'Control default and per-capability backends for web_search / web_extract. This stores backend choices only, not API keys.', '控制 web_search / web_extract 的預設和分能力後端,只儲存後端選擇,不儲存 API Key。'),
hermesWebConfigStatusReady: _('结构化配置', 'structured settings', '結構化設定'),