Skip to content

Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.

TypeScript

fix: report pairing command copy failures accurately

bingqilinweimaotaibc9212fff26b
diff --git a/src/desktop/MeView.tsx b/src/desktop/MeView.tsx
index a071357..ab1f339 100644
--- a/src/desktop/MeView.tsx
+++ b/src/desktop/MeView.tsx
@@ -915,9 +915,28 @@ function ComputersTab() {
}
useEffect(() => { if (!copied) return; const id = window.setTimeout(() => setCopied(false), 1600); return () => window.clearTimeout(id) }, [copied])
- function copyCommand() {
- void navigator.clipboard?.writeText(pairCommand)
- setCopied(true)
+ async function copyCommand() {
+ setErr(null)
+ setCopied(false)
+ try {
+ if (!navigator.clipboard?.writeText) throw new Error('clipboard unavailable')
+ await navigator.clipboard.writeText(pairCommand)
+ setCopied(true)
+ } catch {
+ setErr(t('me.copyFailed'))
+ }
+ }
+
+ async function copyRepairCommand(command: string) {
+ setErr(null)
+ setRepairCopied(false)
+ try {
+ if (!navigator.clipboard?.writeText) throw new Error('clipboard unavailable')
+ await navigator.clipboard.writeText(command)
+ setRepairCopied(true)
+ } catch {
+ setErr(t('me.copyFailed'))
+ }
}
const origin = getPairingServerOrigin()
@@ -1305,7 +1324,7 @@ function ComputersTab() {
) : (
<>
<pre className="bg-ink-900 text-cloud rounded-[10px] p-3 text-[12px] overflow-x-auto whitespace-pre-wrap break-all font-mono select-all">{repairCmd}</pre>
- <button type="button" onClick={(e) => { e.stopPropagation(); void navigator.clipboard?.writeText(repairCmd); setRepairCopied(true) }}
+ <button type="button" onClick={(e) => { e.stopPropagation(); void copyRepairCommand(repairCmd) }}
className="mt-2 inline-flex items-center justify-center min-w-[120px] text-[12px] font-semibold px-3 py-1.5 rounded-[9px] text-white transition-colors duration-200"
style={{ background: repairCopied ? '#3BB273' : 'var(--skype)' }}>
{repairCopied ? t('me.copied') : t('me.copyCommand')}
diff --git a/src/desktop/Onboarding.tsx b/src/desktop/Onboarding.tsx
index 326468f..df513e1 100644
--- a/src/desktop/Onboarding.tsx
+++ b/src/desktop/Onboarding.tsx
@@ -76,6 +76,18 @@ export function Onboarding() {
finally { setBusy(false) }
}
+ async function copyCommand() {
+ setErr(null)
+ setCopied(false)
+ try {
+ if (!navigator.clipboard?.writeText) throw new Error('clipboard unavailable')
+ await navigator.clipboard.writeText(cmd)
+ setCopied(true)
+ } catch {
+ setErr(t('onboard.copyFailed'))
+ }
+ }
+
return (
// TitleBar carries the window drag region (and traffic-light spacing) — the
// onboarding screen replaces the whole app, so without it the window can't
@@ -108,6 +120,7 @@ export function Onboarding() {
) : (
<>
<div className="text-[13px] font-semibold text-ink-900 mb-1">{t('onboard.runThis')}</div>
+ {err && <div className="text-[12px] text-coral-deep bg-coral-soft rounded-[8px] p-2 mb-3">{err}</div>}
<div className="text-[11.5px] text-ink-500 mb-2.5 italic font-display">
{t('onboard.tokenHint')}
</div>
@@ -138,7 +151,7 @@ export function Onboarding() {
</label>
<pre className="bg-ink-900 text-cloud rounded-[10px] p-3 text-[12px] overflow-x-auto whitespace-pre-wrap break-all font-mono select-all">{cmd}</pre>
<div className="flex items-center gap-3 mt-3">
- <button type="button" onClick={() => { void navigator.clipboard?.writeText(cmd); setCopied(true) }}
+ <button type="button" onClick={() => { void copyCommand() }}
className="inline-flex items-center justify-center min-w-[120px] text-[12px] font-semibold px-3 py-1.5 rounded-[9px] text-white transition-colors duration-200"
style={{ background: copied ? '#3BB273' : 'var(--skype)' }}>
{copied ? t('onboard.copied') : t('onboard.copy')}
diff --git a/src/locales/en.ts b/src/locales/en.ts
index 829d0bf..2094925 100644
--- a/src/locales/en.ts
+++ b/src/locales/en.ts
@@ -1127,6 +1127,7 @@ export const en = {
'onboard.backgroundDetail': '— auto-start when you sign in, auto-restart on crash, auto-update. Otherwise this terminal has to stay open.',
'onboard.copy': 'Copy command',
'onboard.copied': '✓ Copied!',
+ 'onboard.copyFailed': 'Could not copy. Select the command and copy it manually.',
'onboard.waiting': 'Waiting for your computer to connect…',
'onboard.cloudCta': 'Want managed cloud agents instead?',
'onboard.upgradePro': 'Upgrade to Pro',
@@ -1295,6 +1296,7 @@ export const en = {
'me.removeConfirm': 'Remove "{label}"? Its agents will go offline until you re-pair. This revokes only this device; it does not rotate the workspace pairing code.',
'me.repairHint': 'Run this computer-specific reconnect command on “{name}” to reconnect it — its agents stay attached. This code is separate from the workspace code for adding computers.',
'me.copyCommand': 'Copy command',
+ 'me.copyFailed': 'Could not copy. Select the command and copy it manually.',
'me.copied': '✓ Copied!',
'me.copy': 'Copy',
'me.copiedShort': '✓ Copied',
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index 3fb3108..eef3e67 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -1128,6 +1128,7 @@ export const zhCN: Partial<Record<keyof typeof en, string>> = {
'onboard.backgroundDetail': '—— 登录自启、崩溃自恢复、自动更新。否则这个终端就得一直开着。',
'onboard.copy': '复制命令',
'onboard.copied': '✓ 已复制!',
+ 'onboard.copyFailed': '复制失败,请手动选中命令复制。',
'onboard.waiting': '等待你的计算机连接…',
'onboard.cloudCta': '想要托管式的云端智能体?',
'onboard.upgradePro': '升级到 Pro',
@@ -1297,6 +1298,7 @@ export const zhCN: Partial<Record<keyof typeof en, string>> = {
'me.removeConfirm': '移除「{label}」?它上面的智能体会离线,直到你重新配对。此操作只撤销这台设备,不会轮换工作区配对码。',
'me.repairHint': '在「{name}」上运行这条单机重连命令 —— 智能体仍会跟着。此码与用于添加计算机的工作区配对码相互独立。',
'me.copyCommand': '复制命令',
+ 'me.copyFailed': '复制失败,请手动选中命令复制。',
'me.copied': '✓ 已复制!',
'me.copy': '复制',
'me.copiedShort': '✓ 已复制',