diff --git a/docs/inventory/visible-controls.json b/docs/inventory/visible-controls.json index 16375bffd..f99d9fb29 100644 --- a/docs/inventory/visible-controls.json +++ b/docs/inventory/visible-controls.json @@ -2372,10 +2372,10 @@ {"source": "flybot_workspace/static/onboarding/app.mjs", "line": 463, "construction": "const box = document.createElement('input');", "execution_profile": "onboarding", "verification": "unverified dynamic construction site; conditional instances require execution"}, {"source": "flybot_workspace/static/onboarding/app.mjs", "line": 484, "construction": "const choice = document.createElement('select');", "execution_profile": "onboarding", "verification": "unverified dynamic construction site; conditional instances require execution"}, {"source": "flybot_workspace/static/profile/app.mjs", "line": 297, "construction": "const link = document.createElement('a');", "execution_profile": "profile", "verification": "unverified dynamic construction site; conditional instances require execution"}, - {"source": "flybot_workspace/static/settings/app.mjs", "line": 642, "construction": "const cancel = document.createElement('button');", "execution_profile": "settings", "verification": "unverified dynamic construction site; conditional instances require execution"}, - {"source": "flybot_workspace/static/settings/app.mjs", "line": 646, "construction": "const confirm = document.createElement('button');", "execution_profile": "settings", "verification": "unverified dynamic construction site; conditional instances require execution"}, - {"source": "flybot_workspace/static/settings/app.mjs", "line": 854, "construction": "const button = document.createElement('button');", "execution_profile": "settings", "verification": "unverified dynamic construction site; conditional instances require execution"}, - {"source": "flybot_workspace/static/settings/app.mjs", "line": 1008, "construction": "const remove = document.createElement('button');", "execution_profile": "settings", "verification": "unverified dynamic construction site; conditional instances require execution"}, + {"source": "flybot_workspace/static/settings/app.mjs", "line": 732, "construction": "const cancel = document.createElement('button');", "execution_profile": "settings", "verification": "unverified dynamic construction site; conditional instances require execution"}, + {"source": "flybot_workspace/static/settings/app.mjs", "line": 736, "construction": "const confirm = document.createElement('button');", "execution_profile": "settings", "verification": "unverified dynamic construction site; conditional instances require execution"}, + {"source": "flybot_workspace/static/settings/app.mjs", "line": 944, "construction": "const button = document.createElement('button');", "execution_profile": "settings", "verification": "unverified dynamic construction site; conditional instances require execution"}, + {"source": "flybot_workspace/static/settings/app.mjs", "line": 1098, "construction": "const remove = document.createElement('button');", "execution_profile": "settings", "verification": "unverified dynamic construction site; conditional instances require execution"}, {"source": "flybot_workspace/static/settings/connected-tools.mjs", "line": 55, "construction": "const button = document.createElement('button')", "execution_profile": "settings", "verification": "unverified dynamic construction site; conditional instances require execution"}, {"source": "flybot_workspace/static/settings/custom-mcp.mjs", "line": 23, "construction": "const remove = document.createElement('button')", "execution_profile": "settings", "verification": "unverified dynamic construction site; conditional instances require execution"}, {"source": "flybot_workspace/static/shell/app.mjs", "line": 257, "construction": "link = doc.createElement('a');", "execution_profile": "shell", "verification": "unverified dynamic construction site; conditional instances require execution"}, diff --git a/flybot_workspace/static/settings/app.mjs b/flybot_workspace/static/settings/app.mjs index 2e6be80e9..e928a8f57 100644 --- a/flybot_workspace/static/settings/app.mjs +++ b/flybot_workspace/static/settings/app.mjs @@ -254,49 +254,136 @@ export function pickConnection(items, toolkit) { return best; } -export function composioRowState(row, configured, connection, readState = 'ready') { +// Runtime strings for the connectors card. The rows carry data-ui-* markers that +// the shell localizes on load, but the state the API reports is written over the +// same nodes afterwards, so these phrases need the same zh/en pair here. Keys +// that already live in the shared catalog are reused through uiText on purpose, +// so the marker text and the runtime text cannot drift apart. +const CONNECTORS_CHOICES = { + 'connectors.unavailable': ['未接通', 'Not available'], + 'connectors.unavailable_hint': ['未接通:Composio 没有这个应用,暂时不能连接。', + 'Not available: Composio does not have this app, so it cannot be connected yet.'], + 'connectors.status_unavailable': ['状态暂不可用', 'Status unavailable'], + 'connectors.unconfigured': ['未配置 Composio', 'Composio not configured'], + 'connectors.set_key': ['配置密钥', 'Set key'], + 'connectors.set_key_hint': ['前往 Composio API key 输入框。', 'Go to the Composio API key field.'], + 'connectors.connected': ['已连接', 'Connected'], + 'connectors.disconnect': ['断开', 'Disconnect'], + 'connectors.disconnect_hint': ['断开会删除你 Composio 项目里的这个连接。', + 'Disconnecting deletes this connection from your Composio project.'], + 'connectors.connecting': ['连接中…', 'Connecting…'], + 'connectors.cancel': ['取消', 'Cancel'], + 'connectors.connecting_hint': ['正在等待你在 Composio 授权页完成授权。', + 'Waiting for you to finish authorizing on the Composio page.'], + 'connectors.needs_auth_config': ['需自建 auth config', 'Needs its own auth config'], + 'connectors.needs_auth_config_hint': ['未接通:Composio 没有为这个应用托管 OAuth 应用,需要先在你的 Composio 项目里建 auth config;本页暂不支持。', + 'Not available: Composio has no hosted OAuth app for this one; create an auth config in your Composio project first. This page does not support that yet.'], + 'connectors.inactive': ['未激活', 'Inactive'], + 'connectors.failed': ['连接失败', 'Connection failed'], + 'connectors.retry': ['重试', 'Retry'], + 'connectors.reason': ['{label}:{reason}', '{label}: {reason}'], + 'connectors.idle': ['未连接', 'Not connected'], + 'connectors.idle_hint': ['通过你的 Composio 项目授权连接。', + 'Connect by authorizing in your Composio project.'], + 'connectors.connected_count': [' 个已连接', ' connected'], + 'connectors.key_saved_prefix': ['已保存 ', 'Saved '], + 'connectors.key_replace_placeholder': ['输入新 key 替换(原文不会显示)', + 'Enter a new key to replace the stored one (never shown)'], + 'connectors.error.not_configured': ['未配置 Composio:先填入你自己的 Composio API key。', + 'Composio is not configured: paste your own Composio API key first.'], + 'connectors.error.key_rejected': ['Composio 拒绝了这个 API key,请检查后重新保存。', + 'Composio rejected this API key. Check it and save again.'], + 'connectors.error.unreachable': ['暂时连不上 Composio,请稍后再试。', + 'Cannot reach Composio right now. Try again later.'], + 'connectors.error.conflict': ['Composio 报告连接冲突。请刷新页面查看当前连接,再重试。', + 'Composio reported a connection conflict. Refresh the page to see the current connection, then retry.'], + 'connectors.error.rate_limited': ['Composio 暂时限制了请求次数。请稍后重试。', + 'Composio is rate-limiting requests right now. Retry later.'], + 'connectors.error.upstream': ['Composio 服务暂时异常,请稍后重试。', + 'The Composio service is having trouble. Retry later.'], + 'connectors.error.not_found': ['Composio 里找不到这个连接。', 'Composio has no such connection.'], + 'connectors.error.failed': ['Composio 请求失败。', 'The Composio request failed.'], + 'connectors.read_failed': ['暂时无法读取 Composio 配置。', 'Cannot read the Composio configuration right now.'], + 'connectors.connections_failed': ['暂时无法读取应用连接状态。', + 'Cannot read the app connection status right now.'], + 'connectors.cached_note': ['暂时读不到 Composio 上的最新状态,显示的是本地记录。', + 'Cannot reach the latest state from Composio; showing local records.'], + 'connectors.key_paste_first': ['请先粘贴你的 Composio API key。', 'Paste your Composio API key first.'], + 'connectors.key_save_failed': ['无法保存 Composio API key。', "Couldn't save the Composio API key."], + 'connectors.key_saved': ['已保存你的 Composio API key(原文不会再显示)。', + 'Saved your Composio API key (it is never shown again).'], + 'connectors.key_remove_failed': ['无法移除 Composio API key。', "Couldn't remove the Composio API key."], + 'connectors.key_removed': ['已移除 Composio API key。本地连接记录已清除,Composio 项目里的账号不会被删除。', + 'Removed your Composio API key. Local connection records are cleared; accounts in your Composio project are not deleted.'], + 'connectors.connect_failed': ['无法开始连接。', "Couldn't start the connection."], + 'connectors.connect_opened': ['已打开 Composio 授权页。完成授权后这里会自动更新状态。', + 'Opened the Composio authorization page. The status here updates once you finish.'], + 'connectors.disconnect_failed': ['无法断开连接。', "Couldn't disconnect."], + 'connectors.disconnected': ['已断开。', 'Disconnected.'], + 'connectors.catalog_count': ['{apps} 个应用 · {categories} 个分类', '{apps} apps · {categories} categories'], +}; + +// uiText reads document.documentElement.lang; without a document it falls back +// to the Chinese side, which is what the pure helpers and their callers expect. +export function connectorsText(document, key, values) { + return uiText(document, key, values, CONNECTORS_CHOICES) || ''; +} + +export function composioRowState(row, configured, connection, readState = 'ready', t = null) { + const text = (key, values) => (t ? t(key, values) : uiText(null, key, values, CONNECTORS_CHOICES) || ''); if (!row || !row.toolkit) { - return {state: 'unavailable', status: '未接通', button: '+ 连接', disabled: true, action: '', - title: '未接通:Composio 没有这个应用,暂时不能连接。'}; + return {state: 'unavailable', status: text('connectors.unavailable'), + button: text('settings.connectors.connect'), disabled: true, action: '', + title: text('connectors.unavailable_hint')}; } if (readState !== 'ready') { - const status = readState === 'loading' ? '正在读取…' : '状态暂不可用'; - return {state:readState, status, button:'+ 连接', disabled:true, action:'', title:status}; + const status = readState === 'loading' ? text('settings.connectors.loading') + : text('connectors.status_unavailable'); + return {state:readState, status, button: text('settings.connectors.connect'), disabled:true, action:'', title:status}; } if (!configured) { - return {state: 'unconfigured', status: '未配置 Composio', button: '配置密钥', disabled: false, action: 'focus-key', - title: '前往 Composio API key 输入框。'}; + return {state: 'unconfigured', status: text('connectors.unconfigured'), + button: text('connectors.set_key'), disabled: false, action: 'focus-key', + title: text('connectors.set_key_hint')}; } if (connection && connection.state === 'connected') { - return {state: 'connected', status: '已连接', button: '断开', disabled: false, action: 'disconnect', - title: '断开会删除你 Composio 项目里的这个连接。'}; + return {state: 'connected', status: text('connectors.connected'), + button: text('connectors.disconnect'), disabled: false, action: 'disconnect', + title: text('connectors.disconnect_hint')}; } if (connection && connection.state === 'connecting') { - return {state: 'connecting', status: '连接中…', button: '取消', disabled: false, action: 'disconnect', - title: '正在等待你在 Composio 授权页完成授权。'}; + return {state: 'connecting', status: text('connectors.connecting'), + button: text('connectors.cancel'), disabled: false, action: 'disconnect', + title: text('connectors.connecting_hint')}; } if (row.managed === 'own') { - return {state: 'needs-auth-config', status: '需自建 auth config', button: '+ 连接', disabled: true, action: '', - title: '未接通:Composio 没有为这个应用托管 OAuth 应用,需要先在你的 Composio 项目里建 auth config;本页暂不支持。'}; + return {state: 'needs-auth-config', status: text('connectors.needs_auth_config'), + button: text('settings.connectors.connect'), disabled: true, action: '', + title: text('connectors.needs_auth_config_hint')}; } if (connection && (connection.state === 'failed' || connection.state === 'inactive')) { - const label = connection.state === 'inactive' ? '未激活' : '连接失败'; - const reason = connection.status_reason ? ':' + connection.status_reason : ''; - return {state: connection.state, status: label, button: '重试', disabled: false, action: 'connect', - title: label + reason}; - } - return {state: 'idle', status: '未连接', button: '+ 连接', disabled: false, action: 'connect', - title: '通过你的 Composio 项目授权连接。'}; + const label = connection.state === 'inactive' ? text('connectors.inactive') + : text('connectors.failed'); + const title = connection.status_reason + ? text('connectors.reason', {label, reason: connection.status_reason}) + : label; + return {state: connection.state, status: label, button: text('connectors.retry'), + disabled: false, action: 'connect', title}; + } + return {state: 'idle', status: text('connectors.idle'), + button: text('settings.connectors.connect'), disabled: false, action: 'connect', + title: text('connectors.idle_hint')}; } export function applyComposioRows(document, configured, items, readState = 'ready') { const list = document.getElementById('connectors-catalog'); if (!list) return []; const applied = []; + const text = (key, values) => connectorsText(document, key, values); for (const node of list.querySelectorAll('[data-connector-id]')) { const row = {toolkit: node.getAttribute('data-composio-toolkit'), managed: node.getAttribute('data-composio-managed')}; const connection = row.toolkit ? pickConnection(items, row.toolkit) : null; - const view = composioRowState(row, configured, connection, readState); + const view = composioRowState(row, configured, connection, readState, text); const status = node.querySelector('.connector-status'); const button = node.querySelector('button'); if (status) { @@ -315,25 +402,28 @@ export function applyComposioRows(document, configured, items, readState = 'read } const connectedCount = document.getElementById('connectors-connected-count'); if (connectedCount) { - connectedCount.textContent = applied.filter(row => row.state === 'connected').length + ' 个已连接'; + connectedCount.textContent = applied.filter(row => row.state === 'connected').length + + text('connectors.connected_count'); connectedCount.hidden = readState !== 'ready'; } return applied; } const COMPOSIO_ERRORS = { - composio_not_configured: '未配置 Composio:先填入你自己的 Composio API key。', - composio_key_rejected: 'Composio 拒绝了这个 API key,请检查后重新保存。', - composio_unreachable: '暂时连不上 Composio,请稍后再试。', - composio_conflict: 'Composio 报告连接冲突。请刷新页面查看当前连接,再重试。', - composio_rate_limited: 'Composio 暂时限制了请求次数。请稍后重试。', - composio_upstream: 'Composio 服务暂时异常,请稍后重试。', - composio_not_found: 'Composio 里找不到这个连接。', - composio_failed: 'Composio 请求失败。', + composio_not_configured: 'connectors.error.not_configured', + composio_key_rejected: 'connectors.error.key_rejected', + composio_unreachable: 'connectors.error.unreachable', + composio_conflict: 'connectors.error.conflict', + composio_rate_limited: 'connectors.error.rate_limited', + composio_upstream: 'connectors.error.upstream', + composio_not_found: 'connectors.error.not_found', + composio_failed: 'connectors.error.failed', }; -export function composioMessage(error, fallback) { - return error && Object.hasOwn(COMPOSIO_ERRORS, error.code) ? COMPOSIO_ERRORS[error.code] : fallback; +export function composioMessage(error, fallback, t = null) { + const key = error && Object.hasOwn(COMPOSIO_ERRORS, error.code) ? COMPOSIO_ERRORS[error.code] : null; + if (!key) return fallback; + return (t && t(key)) || uiText(null, key, undefined, CONNECTORS_CHOICES) || ''; } function placeAppearanceStatus(document, auto) { @@ -1176,6 +1266,7 @@ export function mount(document, {fetcher = globalThis.fetch.bind(globalThis)} = let composioPoll = null; let composioRead; let composioReadState = 'loading'; + const text = (key, values) => connectorsText(document, key, values); function composioNote(kind, text) { const node = document.getElementById('composio-key-message'); @@ -1204,13 +1295,18 @@ export function mount(document, {fetcher = globalThis.fetch.bind(globalThis)} = const remove = document.getElementById('composio-key-remove'); const status = document.getElementById('composio-read-message'); if (badge) { - badge.textContent = view ? (composioConfigured ? '已保存 ' + (view.key_hint || '') : '未配置 Composio') - : readState === 'loading' ? '正在读取配置…' : '状态暂不可用'; + badge.textContent = view ? (composioConfigured + ? text('connectors.key_saved_prefix') + (view.key_hint || '') + : text('connectors.unconfigured')) + : readState === 'loading' ? text('settings.connectors.key_state_loading') + : text('connectors.status_unavailable'); badge.setAttribute('data-state', view ? (composioConfigured ? 'configured' : 'unconfigured') : readState); } if (input) { input.disabled = !view; - input.placeholder = composioConfigured ? '输入新 key 替换(原文不会显示)' : '粘贴你的 Composio API key'; + input.placeholder = composioConfigured + ? text('connectors.key_replace_placeholder') + : text('settings.connectors.key_placeholder'); } if (status) { status.textContent = message; @@ -1235,7 +1331,7 @@ export function mount(document, {fetcher = globalThis.fetch.bind(globalThis)} = const view = await request('GET', '/v1/composio'); if (!active()) return; if (view.status !== 200 || typeof view.body?.composio?.configured !== 'boolean') { - renderComposio(null, 'error', '暂时无法读取 Composio 配置。'); + renderComposio(null, 'error', text('connectors.read_failed')); return; } config = view.body.composio; @@ -1244,17 +1340,19 @@ export function mount(document, {fetcher = globalThis.fetch.bind(globalThis)} = const listed = await request('GET', '/v1/composio/connections'); if (!active()) return; if (listed.status !== 200 || !Array.isArray(listed.body?.items)) { - renderComposio(config, 'error', '暂时无法读取应用连接状态。'); + renderComposio(config, 'error', text('connectors.connections_failed')); return; } composioItems = listed.body.items; - if (listed.body.sync === 'failed') cached = '暂时读不到 Composio 上的最新状态,显示的是本地记录。'; + if (listed.body.sync === 'failed') cached = text('connectors.cached_note'); } renderComposio(config, 'ready', cached); if (cached && composioRetry) composioRetry.hidden = false; if (composioItems.some(item => item.state === 'connecting')) startComposioPoll(); } catch { - if (active()) renderComposio(config, 'error', config ? '暂时无法读取应用连接状态。' : '暂时无法读取 Composio 配置。'); + if (active()) renderComposio(config, 'error', config + ? text('connectors.connections_failed') + : text('connectors.read_failed')); } finally { if (composioRead === read) composioRead = null; } @@ -1295,16 +1393,16 @@ export function mount(document, {fetcher = globalThis.fetch.bind(globalThis)} = if (input?.disabled) return; const value = input ? String(input.value || '').trim() : ''; if (!value) { - composioNote('error', '请先粘贴你的 Composio API key。'); + composioNote('error', text('connectors.key_paste_first')); return; } const result = await request('POST', '/v1/composio/key', {api_key: value}); if (input) input.value = ''; if (result.status !== 200) { - composioNote('error', messageFor(result.body.error, '无法保存 Composio API key。')); + composioNote('error', messageFor(result.body.error, text('connectors.key_save_failed'))); return; } - composioNote('ok', '已保存你的 Composio API key(原文不会再显示)。'); + composioNote('ok', text('connectors.key_saved')); await syncComposio({refresh:true}); }); } @@ -1313,10 +1411,10 @@ export function mount(document, {fetcher = globalThis.fetch.bind(globalThis)} = composioRemove.addEventListener('click', async () => { const result = await request('POST', '/v1/composio/key', {api_key: null}); if (result.status !== 200) { - composioNote('error', messageFor(result.body.error, '无法移除 Composio API key。')); + composioNote('error', messageFor(result.body.error, text('connectors.key_remove_failed'))); return; } - composioNote('ok', '已移除 Composio API key。本地连接记录已清除,Composio 项目里的账号不会被删除。'); + composioNote('ok', text('connectors.key_removed')); await syncComposio({refresh:true}); }); } @@ -1339,13 +1437,13 @@ export function mount(document, {fetcher = globalThis.fetch.bind(globalThis)} = const result = await request('POST', '/v1/composio/connections', {toolkit}); if (result.status !== 201) { if (popup) popup.close(); - composioNote('error', composioMessage(result.body.error, '无法开始连接。')); + composioNote('error', composioMessage(result.body.error, text('connectors.connect_failed'), text)); applyComposioRows(document, composioConfigured, composioItems, composioReadState); return; } composioItems = composioItems.concat([result.body.connection]); applyComposioRows(document, composioConfigured, composioItems, composioReadState); - composioNote('ok', '已打开 Composio 授权页。完成授权后这里会自动更新状态。'); + composioNote('ok', text('connectors.connect_opened')); if (popup) { popup.opener = null; popup.location.href = result.body.redirect_url; @@ -1359,13 +1457,13 @@ export function mount(document, {fetcher = globalThis.fetch.bind(globalThis)} = button.disabled = true; const result = await request('POST', '/v1/composio/connections/' + id + '/disconnect', {}); if (result.status !== 200 && result.status !== 404) { - composioNote('error', composioMessage(result.body.error, '无法断开连接。')); + composioNote('error', composioMessage(result.body.error, text('connectors.disconnect_failed'), text)); applyComposioRows(document, composioConfigured, composioItems, composioReadState); return; } composioItems = composioItems.filter(item => item.id !== id); applyComposioRows(document, composioConfigured, composioItems, composioReadState); - composioNote('ok', '已断开。'); + composioNote('ok', text('connectors.disconnected')); } }); if (typeof globalThis.addEventListener === 'function') { @@ -1384,7 +1482,8 @@ export function mount(document, {fetcher = globalThis.fetch.bind(globalThis)} = groups.set(row.category, (groups.get(row.category) || 0) + 1); } const overview = document.getElementById('connectors-catalog-count'); - if (overview) overview.textContent = CONNECTOR_CATALOG.length + ' 个应用 · ' + groups.size + ' 个分类'; + if (overview) overview.textContent = text('connectors.catalog_count', + {apps: CONNECTOR_CATALOG.length, categories: groups.size}); const choices = filters.querySelectorAll('[data-connector-group]'); for (const choice of choices) { diff --git a/tests/settings_page.test.mjs b/tests/settings_page.test.mjs index 13e3db623..70d8296d4 100644 --- a/tests/settings_page.test.mjs +++ b/tests/settings_page.test.mjs @@ -2,7 +2,7 @@ import assert from 'node:assert/strict'; import test from 'node:test'; import { readFileSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; -import { applyComposioRows, applyConnectorSearch, applySettingsView, composioMessage, composioRowState, pickConnection, CONNECTOR_CATALOG, csrfCookie, describeAppearance, diff, filterConnectorCatalog, mount, newlineBinding, privacyChanges, readForm, renderModelApi, settingsViewFromLocation, syncAppearanceExtras, syncOverviewCurrentValues, syncMcpDialog, syncPrivacySaveButton, syncShortcutRows } from '../flybot_workspace/static/settings/app.mjs'; +import { applyComposioRows, applyConnectorSearch, applySettingsView, composioMessage, composioRowState, connectorsText, pickConnection, CONNECTOR_CATALOG, csrfCookie, describeAppearance, diff, filterConnectorCatalog, mount, newlineBinding, privacyChanges, readForm, renderModelApi, settingsViewFromLocation, syncAppearanceExtras, syncOverviewCurrentValues, syncMcpDialog, syncPrivacySaveButton, syncShortcutRows } from '../flybot_workspace/static/settings/app.mjs'; import { mountToolApprovals } from '../flybot_workspace/static/settings/connected-tools.mjs'; test('csrfCookie reads host-bound and development cookie names only', () => { @@ -1075,6 +1075,37 @@ test('applyComposioRows updates status, button and connection id from server dat assert.equal(github.button.attrs['data-connection-id'], undefined); }); +test('connector state strings follow the system locale', () => { + function node(attrs) { + const status = {textContent: '', attrs: {}, setAttribute(k, v) { this.attrs[k] = v; }}; + const button = {textContent: '', disabled: true, title: '', attrs: {}, + setAttribute(k, v) { this.attrs[k] = v; }, removeAttribute(k) { delete this.attrs[k]; }}; + return {status, button, getAttribute: k => attrs[k] ?? null, + querySelector: sel => sel === 'button' ? button : status}; + } + const github = node({'data-connector-id': 'github', 'data-composio-toolkit': 'github', 'data-composio-managed': 'yes'}); + const amap = node({'data-connector-id': 'amap'}); + const count = {hidden: true}; + const nodes = {'connectors-catalog': {querySelectorAll: () => [github, amap]}, 'connectors-connected-count': count}; + const document = {documentElement: {lang: 'en'}, getElementById: id => nodes[id]}; + applyComposioRows(document, true, [{id: 'c1', toolkit: 'github', state: 'connected', created_at: 1}]); + assert.equal(github.status.textContent, 'Connected'); + assert.equal(github.button.textContent, 'Disconnect'); + assert.match(github.button.title, /^Disconnecting deletes this connection/); + assert.equal(amap.status.textContent, 'Not available'); + assert.match(amap.button.title, /^Not available: Composio does not have this app/); + assert.equal(count.textContent, '1 connected'); + assert.equal(connectorsText(document, 'settings.connectors.connect'), '+ Connect'); + assert.match(composioMessage({code: 'composio_conflict'}, '', key => connectorsText(document, key)), + /^Composio reported a connection conflict/); + document.documentElement.lang = 'zh-CN'; + applyComposioRows(document, true, [{id: 'c1', toolkit: 'github', state: 'connected', created_at: 1}]); + assert.equal(github.status.textContent, '已连接'); + assert.equal(amap.status.textContent, '未接通'); + assert.equal(count.textContent, '1 个已连接'); + assert.equal(composioMessage({code: 'composio_conflict'}, ''), 'Composio 报告连接冲突。请刷新页面查看当前连接,再重试。'); +}); + test('connected-tool approvals do not imply a connected account before key setup', () => { const source = readFileSync(fileURLToPath(new URL('../flybot_workspace/static/settings/connected-tools.mjs', import.meta.url)), 'utf8');