mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 08:03:39 +00:00
fix(mobile): close localization review findings
This commit is contained in:
@@ -16,18 +16,25 @@ export function ProtocolBlockScreen({ verdict }: Props) {
|
||||
// Why: Android APKs ship through GitHub Releases until a Play Store listing exists.
|
||||
const mobileUpdateTarget =
|
||||
Platform.OS === 'ios'
|
||||
? { label: t('m.oxg5VTs'), url: IOS_APP_STORE_URL, storeName: 'the App Store' }
|
||||
: { label: t('m.h3ZwGv0'), url: RELEASES_URL, storeName: 'GitHub Releases' }
|
||||
? {
|
||||
label: t('m.oxg5VTs'),
|
||||
url: IOS_APP_STORE_URL,
|
||||
storeName: t('protocol.block.appStoreName')
|
||||
}
|
||||
: {
|
||||
label: t('m.h3ZwGv0'),
|
||||
url: RELEASES_URL,
|
||||
storeName: t('protocol.block.githubReleasesName')
|
||||
}
|
||||
const primaryAction = isMobileTooOld
|
||||
? { label: mobileUpdateTarget.label, url: mobileUpdateTarget.url }
|
||||
: { label: t('m.h3ZwGv0'), url: RELEASES_URL }
|
||||
|
||||
const title = isMobileTooOld ? t('m.NkNSfjQ') : t('m.amP19yQ')
|
||||
const body = isMobileTooOld
|
||||
? `This desktop needs a newer Orca Mobile app. Update Orca Mobile from ${mobileUpdateTarget.storeName}, then try this host again.`
|
||||
: 'This paired desktop app is too old for your current Orca Mobile app. Update Orca on your computer, then try this host again.'
|
||||
const recoveryNote =
|
||||
'Already updated? Go back to Hosts and refresh the connection. If this message stays, remove this host and pair it again.'
|
||||
? t('protocol.block.mobileTooOldBody', { storeName: mobileUpdateTarget.storeName })
|
||||
: t('protocol.block.desktopTooOldBody')
|
||||
const recoveryNote = t('protocol.block.recoveryNote')
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
|
||||
@@ -45,12 +45,11 @@ export function PRConflictingFilesSection({ pr, isRefreshing = false, triage }:
|
||||
if (!conflict) {
|
||||
return null
|
||||
}
|
||||
let noticeBody = 'Conflict file details are unavailable'
|
||||
let noticeBody = t('pullRequest.conflicts.fileDetailsUnavailable')
|
||||
if (isRefreshing) {
|
||||
noticeBody = 'Refreshing conflict details…'
|
||||
noticeBody = t('pullRequest.conflicts.refreshing')
|
||||
} else if (conflict.localMergeClean) {
|
||||
noticeBody =
|
||||
'GitHub reports conflicts, but local Git did not reproduce them. Refresh the PR or push the branch to recalculate mergeability.'
|
||||
noticeBody = t('pullRequest.conflicts.localMergeClean')
|
||||
}
|
||||
|
||||
const copyRefreshCommands = async () => {
|
||||
|
||||
@@ -180,7 +180,7 @@ export function MobileFilePreviewScreen({ route }: Props) {
|
||||
previewParams?.worktreeName,
|
||||
previewParams?.worktreeId ?? ''
|
||||
)
|
||||
const meta = previewParams ? `${worktreeLabel} - ${displayPath}` : 'Preview'
|
||||
const meta = previewParams ? `${worktreeLabel} - ${displayPath}` : t('filePreview.metaFallback')
|
||||
const isEditableTerminalArtifact =
|
||||
previewSource?.source === 'terminalArtifact' && isEditableMobileTerminalArtifactPreview(preview)
|
||||
const canSaveArtifact =
|
||||
|
||||
@@ -2214,6 +2214,7 @@
|
||||
}
|
||||
},
|
||||
"nativeChat": {
|
||||
"toolResultLabel": "Result",
|
||||
"empty": {
|
||||
"title": "Start a chat with {{agentLabel}}",
|
||||
"subtitle": "Ask {{agentLabel}} to inspect code, explain output, or make a change."
|
||||
@@ -2237,6 +2238,9 @@
|
||||
"checking": "Checking review status…",
|
||||
"unavailable": "Review status unavailable",
|
||||
"unsupportedProvider": "Review creation unavailable for this provider"
|
||||
},
|
||||
"history": {
|
||||
"noCommitMessage": "(no commit message)"
|
||||
}
|
||||
},
|
||||
"accounts": {
|
||||
@@ -2252,8 +2256,25 @@
|
||||
"unresolvedComments": {
|
||||
"one": ", {{count}} unresolved comment",
|
||||
"other": ", {{count}} unresolved comments"
|
||||
},
|
||||
"conflicts": {
|
||||
"fileDetailsUnavailable": "Conflict file details are unavailable",
|
||||
"refreshing": "Refreshing conflict details…",
|
||||
"localMergeClean": "GitHub reports conflicts, but local Git did not reproduce them. Refresh the PR or push the branch to recalculate mergeability."
|
||||
}
|
||||
},
|
||||
"protocol": {
|
||||
"block": {
|
||||
"appStoreName": "the App Store",
|
||||
"githubReleasesName": "GitHub Releases",
|
||||
"mobileTooOldBody": "This desktop needs a newer Orca Mobile app. Update Orca Mobile from {{storeName}}, then try this host again.",
|
||||
"desktopTooOldBody": "This paired desktop app is too old for your current Orca Mobile app. Update Orca on your computer, then try this host again.",
|
||||
"recoveryNote": "Already updated? Go back to Hosts and refresh the connection. If this message stays, remove this host and pair it again."
|
||||
}
|
||||
},
|
||||
"filePreview": {
|
||||
"metaFallback": "Preview"
|
||||
},
|
||||
"voiceModels": {
|
||||
"downloadLabel": "Download {{modelName}}"
|
||||
},
|
||||
|
||||
@@ -1124,7 +1124,7 @@
|
||||
"m6fKanI": "Nuevo preajuste disperso",
|
||||
"6-gKCU8": "Nuevo preset",
|
||||
"m38OFiM": "Utilice todo el repositorio",
|
||||
"0fqNjoo": "Pago completo",
|
||||
"0fqNjoo": "Checkout completo",
|
||||
"6xj6dHo": "Pago escaso",
|
||||
"uwfc5JU": "Ninguna rama coincide.",
|
||||
"ajFYYlY": "Utilice la base configurada de este repositorio",
|
||||
@@ -1816,7 +1816,7 @@
|
||||
"8Tx_eZw": "No se pudo crear la solicitud de extracción",
|
||||
"DIh5pvA": "No se pudo actualizar la reseña vinculada",
|
||||
"D8-XyhU": "No se pudo actualizar la solicitud de extracción vinculada",
|
||||
"GaTugx8": "Se perderían las commits locales; tirar en su lugar",
|
||||
"GaTugx8": "Los commits locales se perderían; haz pull en su lugar",
|
||||
"qajmB_0": "Nada que adelantar",
|
||||
"fp_5pjo": "avance rápido",
|
||||
"UWyesQ8": "Avance rápido ({{value0}})",
|
||||
@@ -2210,6 +2210,7 @@
|
||||
}
|
||||
},
|
||||
"nativeChat": {
|
||||
"toolResultLabel": "Resultado",
|
||||
"empty": {
|
||||
"title": "Inicia un chat con {{agentLabel}}",
|
||||
"subtitle": "Pide a {{agentLabel}} que inspeccione código, explique resultados o haga un cambio."
|
||||
@@ -2222,5 +2223,29 @@
|
||||
"accountUsage": {
|
||||
"resetNow": "Se restablece ahora",
|
||||
"resetIn": "Se restablece en {{duration}}"
|
||||
},
|
||||
"sourceControl": {
|
||||
"history": {
|
||||
"noCommitMessage": "(sin mensaje de commit)"
|
||||
}
|
||||
},
|
||||
"pullRequest": {
|
||||
"conflicts": {
|
||||
"fileDetailsUnavailable": "Los detalles de los archivos en conflicto no están disponibles",
|
||||
"refreshing": "Actualizando los detalles de los conflictos…",
|
||||
"localMergeClean": "GitHub informa de conflictos, pero Git local no pudo reproducirlos. Actualiza el PR o publica la rama para volver a calcular si se puede fusionar."
|
||||
}
|
||||
},
|
||||
"protocol": {
|
||||
"block": {
|
||||
"appStoreName": "App Store",
|
||||
"githubReleasesName": "GitHub Releases",
|
||||
"mobileTooOldBody": "Este equipo necesita una versión más reciente de la app Orca Mobile. Actualiza Orca Mobile desde {{storeName}} y vuelve a probar este host.",
|
||||
"desktopTooOldBody": "La app de escritorio emparejada es demasiado antigua para tu app Orca Mobile actual. Actualiza Orca en tu equipo y vuelve a probar este host.",
|
||||
"recoveryNote": "¿Ya la actualizaste? Vuelve a Hosts y actualiza la conexión. Si este mensaje sigue apareciendo, elimina este host y vuelve a emparejarlo."
|
||||
}
|
||||
},
|
||||
"filePreview": {
|
||||
"metaFallback": "Vista previa"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1816,7 +1816,7 @@
|
||||
"8Tx_eZw": "PR の作成に失敗しました",
|
||||
"DIh5pvA": "リンクされたレビューを更新できませんでした",
|
||||
"D8-XyhU": "リンクされた PR の更新に失敗しました",
|
||||
"GaTugx8": "ローカル commits は失われます。代わりに引っ張る",
|
||||
"GaTugx8": "ローカルコミットが失われます。代わりにプルしてください",
|
||||
"qajmB_0": "早送りするものはありません",
|
||||
"fp_5pjo": "早送り",
|
||||
"UWyesQ8": "早送り ({{value0}})",
|
||||
@@ -2210,6 +2210,7 @@
|
||||
}
|
||||
},
|
||||
"nativeChat": {
|
||||
"toolResultLabel": "結果",
|
||||
"empty": {
|
||||
"title": "{{agentLabel}} とチャットを開始",
|
||||
"subtitle": "{{agentLabel}} にコードの確認、出力の説明、変更を依頼できます。"
|
||||
@@ -2222,5 +2223,29 @@
|
||||
"accountUsage": {
|
||||
"resetNow": "今すぐリセット",
|
||||
"resetIn": "{{duration}}後にリセット"
|
||||
},
|
||||
"sourceControl": {
|
||||
"history": {
|
||||
"noCommitMessage": "(コミットメッセージなし)"
|
||||
}
|
||||
},
|
||||
"pullRequest": {
|
||||
"conflicts": {
|
||||
"fileDetailsUnavailable": "競合ファイルの詳細を取得できません",
|
||||
"refreshing": "競合の詳細を更新しています…",
|
||||
"localMergeClean": "GitHub は競合を報告していますが、ローカル Git では再現できませんでした。PR を更新するかブランチをプッシュして、マージ可能性を再計算してください。"
|
||||
}
|
||||
},
|
||||
"protocol": {
|
||||
"block": {
|
||||
"appStoreName": "App Store",
|
||||
"githubReleasesName": "GitHub Releases",
|
||||
"mobileTooOldBody": "このデスクトップには、より新しい Orca Mobile アプリが必要です。{{storeName}} から Orca Mobile を更新してから、このホストをもう一度お試しください。",
|
||||
"desktopTooOldBody": "ペアリング済みのデスクトップアプリは、現在の Orca Mobile アプリに対して古すぎます。コンピューター上の Orca を更新してから、このホストをもう一度お試しください。",
|
||||
"recoveryNote": "すでに更新しましたか?ホスト一覧に戻って接続を更新してください。このメッセージが消えない場合は、このホストを削除してもう一度ペアリングしてください。"
|
||||
}
|
||||
},
|
||||
"filePreview": {
|
||||
"metaFallback": "プレビュー"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1124,7 +1124,7 @@
|
||||
"m6fKanI": "새로운 희소 사전 설정",
|
||||
"6-gKCU8": "새로운 사전 설정",
|
||||
"m38OFiM": "전체 저장소 사용",
|
||||
"0fqNjoo": "전체 결제",
|
||||
"0fqNjoo": "전체 체크아웃",
|
||||
"6xj6dHo": "스파스 체크아웃",
|
||||
"uwfc5JU": "일치하는 브랜치가 없습니다.",
|
||||
"ajFYYlY": "이 저장소의 구성된 기반을 사용하십시오.",
|
||||
@@ -1816,7 +1816,7 @@
|
||||
"8Tx_eZw": "PR을 생성하지 못했습니다.",
|
||||
"DIh5pvA": "연결된 리뷰를 업데이트하지 못했습니다.",
|
||||
"D8-XyhU": "연결된 PR을 업데이트하지 못했습니다.",
|
||||
"GaTugx8": "로컬 commits이 손실됩니다. 대신 당겨",
|
||||
"GaTugx8": "로컬 커밋이 손실됩니다. 대신 풀하세요",
|
||||
"qajmB_0": "빨리 감을 항목이 없습니다.",
|
||||
"fp_5pjo": "빨리감기",
|
||||
"UWyesQ8": "빨리 감기({{value0}})",
|
||||
@@ -2210,6 +2210,7 @@
|
||||
}
|
||||
},
|
||||
"nativeChat": {
|
||||
"toolResultLabel": "결과",
|
||||
"empty": {
|
||||
"title": "{{agentLabel}}와 채팅 시작",
|
||||
"subtitle": "{{agentLabel}}에게 코드 검사, 출력 설명 또는 변경 작업을 요청하세요."
|
||||
@@ -2222,5 +2223,29 @@
|
||||
"accountUsage": {
|
||||
"resetNow": "지금 재설정",
|
||||
"resetIn": "{{duration}} 후 재설정"
|
||||
},
|
||||
"sourceControl": {
|
||||
"history": {
|
||||
"noCommitMessage": "(커밋 메시지 없음)"
|
||||
}
|
||||
},
|
||||
"pullRequest": {
|
||||
"conflicts": {
|
||||
"fileDetailsUnavailable": "충돌 파일 세부 정보를 사용할 수 없습니다",
|
||||
"refreshing": "충돌 세부 정보 새로 고치는 중…",
|
||||
"localMergeClean": "GitHub에서는 충돌을 보고하지만 로컬 Git에서는 재현되지 않았습니다. PR을 새로 고치거나 브랜치를 푸시하여 병합 가능 여부를 다시 계산하세요."
|
||||
}
|
||||
},
|
||||
"protocol": {
|
||||
"block": {
|
||||
"appStoreName": "App Store",
|
||||
"githubReleasesName": "GitHub Releases",
|
||||
"mobileTooOldBody": "이 데스크톱에는 최신 Orca Mobile 앱이 필요합니다. {{storeName}}에서 Orca Mobile을 업데이트한 후 이 호스트를 다시 시도하세요.",
|
||||
"desktopTooOldBody": "페어링된 데스크톱 앱이 현재 Orca Mobile 앱에 비해 너무 오래되었습니다. 컴퓨터에서 Orca를 업데이트한 후 이 호스트를 다시 시도하세요.",
|
||||
"recoveryNote": "이미 업데이트했나요? 호스트 목록으로 돌아가 연결을 새로 고치세요. 이 메시지가 계속 표시되면 이 호스트를 삭제하고 다시 페어링하세요."
|
||||
}
|
||||
},
|
||||
"filePreview": {
|
||||
"metaFallback": "미리보기"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1124,7 +1124,7 @@
|
||||
"m6fKanI": "新的稀疏预设",
|
||||
"6-gKCU8": "新预设",
|
||||
"m38OFiM": "使用整个存储库",
|
||||
"0fqNjoo": "全面结帐",
|
||||
"0fqNjoo": "完整检出",
|
||||
"6xj6dHo": "稀疏结帐",
|
||||
"uwfc5JU": "没有分支匹配。",
|
||||
"ajFYYlY": "使用此存储库的配置基础",
|
||||
@@ -1813,7 +1813,7 @@
|
||||
"8Tx_eZw": "无法创建拉取请求",
|
||||
"DIh5pvA": "无法更新链接的评论",
|
||||
"D8-XyhU": "无法更新链接的拉取请求",
|
||||
"GaTugx8": "本地 commits 将会丢失;拉代替",
|
||||
"GaTugx8": "本地提交将丢失;请改用拉取",
|
||||
"qajmB_0": "没有什么可以快进的",
|
||||
"fp_5pjo": "快进",
|
||||
"UWyesQ8": "快进 ({{value0}})",
|
||||
@@ -2207,6 +2207,7 @@
|
||||
}
|
||||
},
|
||||
"nativeChat": {
|
||||
"toolResultLabel": "结果",
|
||||
"empty": {
|
||||
"title": "与 {{agentLabel}} 开始聊天",
|
||||
"subtitle": "让 {{agentLabel}} 检查代码、解释输出或进行更改。"
|
||||
@@ -2219,5 +2220,29 @@
|
||||
"accountUsage": {
|
||||
"resetNow": "立即重置",
|
||||
"resetIn": "{{duration}}后重置"
|
||||
},
|
||||
"sourceControl": {
|
||||
"history": {
|
||||
"noCommitMessage": "(无提交消息)"
|
||||
}
|
||||
},
|
||||
"pullRequest": {
|
||||
"conflicts": {
|
||||
"fileDetailsUnavailable": "无法获取冲突文件详情",
|
||||
"refreshing": "正在刷新冲突详情…",
|
||||
"localMergeClean": "GitHub 报告存在冲突,但本地 Git 未能复现。请刷新 PR 或推送分支,以重新计算可合并状态。"
|
||||
}
|
||||
},
|
||||
"protocol": {
|
||||
"block": {
|
||||
"appStoreName": "App Store",
|
||||
"githubReleasesName": "GitHub Releases",
|
||||
"mobileTooOldBody": "此桌面需要更新版本的 Orca Mobile 应用。请从 {{storeName}} 更新 Orca Mobile,然后重试此主机。",
|
||||
"desktopTooOldBody": "已配对的桌面应用版本太旧,无法与当前 Orca Mobile 应用配合使用。请在电脑上更新 Orca,然后重试此主机。",
|
||||
"recoveryNote": "已经更新?请返回主机列表并刷新连接。如果仍显示此消息,请删除此主机并重新配对。"
|
||||
}
|
||||
},
|
||||
"filePreview": {
|
||||
"metaFallback": "预览"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,19 @@ describe('mobile i18n', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it.each([
|
||||
['es', ['Checkout completo', 'Los commits locales se perderían; haz pull en su lugar']],
|
||||
['ja', ['フルチェックアウト', 'ローカルコミットが失われます。代わりにプルしてください']],
|
||||
['ko', ['전체 체크아웃', '로컬 커밋이 손실됩니다. 대신 풀하세요']],
|
||||
['zh', ['完整检出', '本地提交将丢失;请改用拉取']]
|
||||
] satisfies [MobileUiLocale, string[]][])(
|
||||
'%s uses accurate checkout and pull terminology',
|
||||
async (locale, expected) => {
|
||||
await mobileI18n.changeLanguage(locale)
|
||||
expect([t('m.0fqNjoo'), t('m.GaTugx8')]).toEqual(expected)
|
||||
}
|
||||
)
|
||||
|
||||
it.each([
|
||||
['es', ['Sin comprobaciones', 'En staging', 'Nota de revisión']],
|
||||
['ja', ['チェックなし', 'ステージ済み', 'レビューメモ']],
|
||||
|
||||
@@ -88,7 +88,7 @@ function ToolLine({
|
||||
}): React.JSX.Element {
|
||||
const [expanded, setExpanded] = useState(defaultExpanded)
|
||||
const { call, result } = pair
|
||||
const name = call ? call.name : 'Result'
|
||||
const name = call ? call.name : t('nativeChat.toolResultLabel')
|
||||
const preview = call
|
||||
? summarizeToolInput(call.input)
|
||||
: (result?.output.split('\n')[0]?.slice(0, 80) ?? '')
|
||||
|
||||
@@ -9,10 +9,7 @@ import {
|
||||
markMobileNativeChatInputStale,
|
||||
resetMobileNativeChatStaleInputForTests
|
||||
} from './mobile-native-chat-stale-input'
|
||||
import {
|
||||
MOBILE_DIFF_REVIEW_SEND_TIMEOUT_MS,
|
||||
useMobileDiffReviewSendActions
|
||||
} from './use-mobile-diff-review-send-actions'
|
||||
import { useMobileDiffReviewSendActions } from './use-mobile-diff-review-send-actions'
|
||||
|
||||
type SendActions = ReturnType<typeof useMobileDiffReviewSendActions>
|
||||
|
||||
@@ -173,10 +170,7 @@ describe('useMobileDiffReviewSendActions', () => {
|
||||
expect(sendRequest).toHaveBeenCalledTimes(1)
|
||||
expect(sendRequest.mock.calls[0]?.[0]).toBe('terminal.send')
|
||||
expect(sendRequest.mock.calls[0]?.[1]).toMatchObject({ terminal: 'terminal-1', enter: true })
|
||||
expect(sendRequest.mock.calls[0]?.[2]).toMatchObject({
|
||||
timeoutMs: expect.any(Number),
|
||||
budgetSpansConnect: true
|
||||
})
|
||||
expect(sendRequest.mock.calls[0]?.[2]).toBeUndefined()
|
||||
expect(saveCommentsAndReviewState).toHaveBeenCalledTimes(1)
|
||||
expect(setActionError).toHaveBeenCalledWith('Review notes sent')
|
||||
expect(setSendSheet).toHaveBeenCalledWith(null)
|
||||
@@ -212,38 +206,25 @@ describe('useMobileDiffReviewSendActions', () => {
|
||||
expect(saveCommentsAndReviewState).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('spends one deadline across terminal creation and note delivery', async () => {
|
||||
vi.useFakeTimers()
|
||||
vi.setSystemTime(1_000)
|
||||
it('keeps normal RPC timeouts independent for terminal creation and note delivery', async () => {
|
||||
const sendRequest = vi
|
||||
.fn()
|
||||
.mockImplementationOnce(async () => {
|
||||
vi.setSystemTime(2_500)
|
||||
return {
|
||||
id: 'create',
|
||||
ok: true,
|
||||
result: { tab: { id: 'tab-1', type: 'terminal', terminal: 'terminal-1' } }
|
||||
}
|
||||
.mockResolvedValueOnce({
|
||||
id: 'create',
|
||||
ok: true,
|
||||
result: { tab: { id: 'tab-1', type: 'terminal', terminal: 'terminal-1' } }
|
||||
})
|
||||
.mockResolvedValueOnce(sendResponse(true))
|
||||
try {
|
||||
await mount({ sendRequest } as unknown as RpcClient)
|
||||
await mount({ sendRequest } as unknown as RpcClient)
|
||||
|
||||
await act(async () => {
|
||||
await actions?.createTerminalAndSend([COMMENT])
|
||||
})
|
||||
await act(async () => {
|
||||
await actions?.createTerminalAndSend([COMMENT])
|
||||
})
|
||||
|
||||
expect(sendRequest.mock.calls[0]?.[2]).toEqual({
|
||||
timeoutMs: MOBILE_DIFF_REVIEW_SEND_TIMEOUT_MS,
|
||||
budgetSpansConnect: true
|
||||
})
|
||||
expect(sendRequest.mock.calls[1]?.[2]).toEqual({
|
||||
timeoutMs: MOBILE_DIFF_REVIEW_SEND_TIMEOUT_MS - 1_500,
|
||||
budgetSpansConnect: true
|
||||
})
|
||||
} finally {
|
||||
vi.useRealTimers()
|
||||
}
|
||||
expect(sendRequest.mock.calls[0]?.[0]).toBe('session.tabs.createTerminal')
|
||||
expect(sendRequest.mock.calls[0]?.[2]).toBeUndefined()
|
||||
expect(sendRequest.mock.calls[1]?.[0]).toBe('terminal.send')
|
||||
expect(sendRequest.mock.calls[1]?.[2]).toBeUndefined()
|
||||
})
|
||||
|
||||
it('reports a failed terminal.send response', async () => {
|
||||
|
||||
@@ -28,20 +28,6 @@ type SendActionsInput = {
|
||||
) => Promise<void>
|
||||
}
|
||||
|
||||
export const MOBILE_DIFF_REVIEW_SEND_TIMEOUT_MS = 30_000
|
||||
|
||||
function openMobileDiffReviewSendDeadline(): number {
|
||||
return Date.now() + MOBILE_DIFF_REVIEW_SEND_TIMEOUT_MS
|
||||
}
|
||||
|
||||
function remainingRequestBudget(deadline: number, errorMessage: string) {
|
||||
const timeoutMs = deadline - Date.now()
|
||||
if (timeoutMs <= 0) {
|
||||
throw new Error(errorMessage)
|
||||
}
|
||||
return { timeoutMs, budgetSpansConnect: true as const }
|
||||
}
|
||||
|
||||
export function useMobileDiffReviewSendActions(input: SendActionsInput) {
|
||||
const {
|
||||
client,
|
||||
@@ -86,30 +72,20 @@ export function useMobileDiffReviewSendActions(input: SendActionsInput) {
|
||||
)
|
||||
|
||||
const sendPromptToTerminal = useCallback(
|
||||
async (
|
||||
terminal: string,
|
||||
comments: readonly DiffComment[],
|
||||
deadline = openMobileDiffReviewSendDeadline()
|
||||
) => {
|
||||
async (terminal: string, comments: readonly DiffComment[]) => {
|
||||
if (!client || connState !== 'connected') {
|
||||
throw new Error(t('m.x0Dr_H8'))
|
||||
}
|
||||
// Marked by terminal handle, not by surface, so a paste orphaned here by native
|
||||
// chat would ride along with these notes (#10228). Diff review carries no device token.
|
||||
if (
|
||||
!(await healMobileNativeChatStaleInput({ client, terminal, deviceToken: null, deadline }))
|
||||
) {
|
||||
if (!(await healMobileNativeChatStaleInput({ client, terminal, deviceToken: null }))) {
|
||||
throw new Error(t('m.tpf9SfA'))
|
||||
}
|
||||
const response = await client.sendRequest(
|
||||
'terminal.send',
|
||||
{
|
||||
terminal,
|
||||
text: formatMobileDiffReviewPrompt(comments),
|
||||
enter: true
|
||||
},
|
||||
remainingRequestBudget(deadline, t('m.tpf9SfA'))
|
||||
)
|
||||
const response = await client.sendRequest('terminal.send', {
|
||||
terminal,
|
||||
text: formatMobileDiffReviewPrompt(comments),
|
||||
enter: true
|
||||
})
|
||||
if (!response.ok) {
|
||||
throw new Error(response.error?.message || t('m.tpf9SfA'))
|
||||
}
|
||||
@@ -129,17 +105,12 @@ export function useMobileDiffReviewSendActions(input: SendActionsInput) {
|
||||
if (!client || connState !== 'connected') {
|
||||
throw new Error(t('m.x0Dr_H8'))
|
||||
}
|
||||
const deadline = openMobileDiffReviewSendDeadline()
|
||||
const response = await client.sendRequest(
|
||||
'session.tabs.createTerminal',
|
||||
{
|
||||
worktree: `id:${worktreeId}`,
|
||||
activate: false,
|
||||
select: true,
|
||||
navigation: 'caller'
|
||||
},
|
||||
remainingRequestBudget(deadline, t('m.NhC30K0'))
|
||||
)
|
||||
const response = await client.sendRequest('session.tabs.createTerminal', {
|
||||
worktree: `id:${worktreeId}`,
|
||||
activate: false,
|
||||
select: true,
|
||||
navigation: 'caller'
|
||||
})
|
||||
if (!response.ok) {
|
||||
throw new Error(response.error?.message || t('m.NhC30K0'))
|
||||
}
|
||||
@@ -147,7 +118,7 @@ export function useMobileDiffReviewSendActions(input: SendActionsInput) {
|
||||
if (!created) {
|
||||
throw new Error(t('m.LYAe0FE'))
|
||||
}
|
||||
await sendPromptToTerminal(created.terminal, comments, deadline)
|
||||
await sendPromptToTerminal(created.terminal, comments)
|
||||
},
|
||||
[client, connState, sendPromptToTerminal, worktreeId]
|
||||
)
|
||||
@@ -159,12 +130,9 @@ export function useMobileDiffReviewSendActions(input: SendActionsInput) {
|
||||
}
|
||||
setSendSheet({ kind: 'loading' })
|
||||
try {
|
||||
const deadline = openMobileDiffReviewSendDeadline()
|
||||
const response = await client.sendRequest(
|
||||
'session.tabs.list',
|
||||
{ worktree: `id:${worktreeId}` },
|
||||
remainingRequestBudget(deadline, t('m.vMHt0l8'))
|
||||
)
|
||||
const response = await client.sendRequest('session.tabs.list', {
|
||||
worktree: `id:${worktreeId}`
|
||||
})
|
||||
if (!response.ok) {
|
||||
throw new Error(response.error?.message || t('m.vMHt0l8'))
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export function toMobileCommitRow(item: GitHistoryItem, nowMs: number): MobileCo
|
||||
return {
|
||||
id: item.id,
|
||||
shortId: item.displayId ?? item.id.slice(0, 7),
|
||||
subject: item.subject || '(no commit message)',
|
||||
subject: item.subject || t('sourceControl.history.noCommitMessage'),
|
||||
author: item.author ?? '',
|
||||
parentId: item.parentIds[0] ?? null,
|
||||
relativeTime: formatCommitTime(item.timestamp, nowMs)
|
||||
|
||||
Reference in New Issue
Block a user