mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
Merge origin/main into project grouping rule
This commit is contained in:
@@ -342,8 +342,19 @@ jobs:
|
||||
echo 'should_run=true' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup Bun for tests
|
||||
- name: Find installed Bun
|
||||
id: installed-bun
|
||||
if: steps.test-scope.outputs.should_run != 'false'
|
||||
shell: bash
|
||||
working-directory: .
|
||||
run: |
|
||||
bun="$GITHUB_WORKSPACE/node_modules/.bin/bun"
|
||||
if [ -x "$bun" ] && [ "$("$bun" --version)" = "$(cat config/.bun-version)" ]; then
|
||||
echo "$GITHUB_WORKSPACE/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo 'found=true' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Setup Bun for tests
|
||||
if: steps.test-scope.outputs.should_run != 'false' && steps.installed-bun.outputs.found != 'true'
|
||||
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||
with:
|
||||
bun-version-file: config/.bun-version
|
||||
@@ -474,7 +485,18 @@ jobs:
|
||||
run: node scripts/check-tests-typecheck-ratchet.mjs
|
||||
|
||||
# Run all golden consumers, including mutant/page-bridge suites; failures name the recording and rpc:record command.
|
||||
- name: Find installed Bun
|
||||
id: installed-bun
|
||||
shell: bash
|
||||
working-directory: .
|
||||
run: |
|
||||
bun="$GITHUB_WORKSPACE/node_modules/.bin/bun"
|
||||
if [ -x "$bun" ] && [ "$("$bun" --version)" = "$(cat config/.bun-version)" ]; then
|
||||
echo "$GITHUB_WORKSPACE/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo 'found=true' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Setup Bun for tests
|
||||
if: steps.installed-bun.outputs.found != 'true'
|
||||
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||
with:
|
||||
bun-version-file: config/.bun-version
|
||||
|
||||
@@ -183,8 +183,18 @@ jobs:
|
||||
# Design D7 upgrade and rollback: the last Bun orcad, built from a main commit that shipped
|
||||
# it, using the current Bun pin beside this checkout's Node slot; hand-over skips once PROTOCOL_VERSION
|
||||
# moves past the Bun daemon's. Install its pinned dependencies independently of this checkout.
|
||||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||
- name: Find installed Bun
|
||||
id: installed-bun
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
bun="$GITHUB_WORKSPACE/node_modules/.bin/bun"
|
||||
if [ -x "$bun" ] && [ "$("$bun" --version)" = "$(cat config/.bun-version)" ]; then
|
||||
echo "$GITHUB_WORKSPACE/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo 'found=true' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||
if: runner.os == 'Linux' && steps.installed-bun.outputs.found != 'true'
|
||||
with:
|
||||
bun-version-file: config/.bun-version
|
||||
no-cache: true
|
||||
|
||||
@@ -94,7 +94,17 @@ jobs:
|
||||
run: |
|
||||
ELECTRON_RUN_AS_NODE=1 "$(node -p "require('electron')")" --version
|
||||
|
||||
- name: Find installed Bun
|
||||
id: installed-bun
|
||||
shell: bash
|
||||
run: |
|
||||
bun="$GITHUB_WORKSPACE/node_modules/.bin/bun"
|
||||
if [ -x "$bun" ] && [ "$("$bun" --version)" = "$(cat config/.bun-version)" ]; then
|
||||
echo "$GITHUB_WORKSPACE/node_modules/.bin" >> "$GITHUB_PATH"
|
||||
echo 'found=true' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||
if: steps.installed-bun.outputs.found != 'true'
|
||||
with:
|
||||
bun-version-file: config/.bun-version
|
||||
no-cache: true
|
||||
|
||||
@@ -12,6 +12,9 @@ export const CLI_MAIN_ENTRY_NAMES = [
|
||||
'orcad/orcad-stale-lock-reclaim',
|
||||
'orcad/orcad-host-identity-reset',
|
||||
'plugins/plugin-authoring-checks',
|
||||
// `orca vm env doctor` runs its checks in the CLI process.
|
||||
'environment-doctor/environment-doctor',
|
||||
'environment-doctor/environment-doctor-host',
|
||||
...[
|
||||
'access',
|
||||
'active-location',
|
||||
|
||||
@@ -359,6 +359,8 @@ module.exports = {
|
||||
'out/main/orca-profiles/profile-index-store.js',
|
||||
'out/main/persistence/profile-state/**',
|
||||
'out/main/plugins/plugin-authoring-checks.js',
|
||||
'out/main/environment-doctor/environment-doctor.js',
|
||||
'out/main/environment-doctor/environment-doctor-host.js',
|
||||
// `orca plugin test` and `orca plugin check` load the runtime, kit and hooks in Node.
|
||||
'resources/plugins/declarative/*.mjs',
|
||||
'out/main/skills/bundled-skill-install/bundled-skill-local-host.js',
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
1 src/main/codex-accounts/codex-login-auth-snapshot.ts
|
||||
5 src/main/codex-accounts/codex-managed-home-lifecycle.ts
|
||||
6 src/main/codex-accounts/codex-managed-home-path.ts
|
||||
17 src/main/codex-accounts/fs-utils.ts
|
||||
17 src/main/filesystem/atomic-file-publication.ts
|
||||
1 src/main/codex-accounts/guest-codex-account-homes.ts
|
||||
6 src/main/codex-accounts/host-codex-managed-home-ownership.ts
|
||||
2 src/main/codex-accounts/legacy-shared-auth-migration.ts
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
1 src/main/browser/network/egress/browser-route-egress-electron-launch.ts
|
||||
1 src/main/browser/routing/partitions/browser-route-partition-binding-store.ts
|
||||
1 src/main/claude-accounts/runtime-auth-service.ts
|
||||
3 src/main/codex-accounts/fs-utils.ts
|
||||
3 src/main/filesystem/atomic-file-publication.ts
|
||||
2 src/main/codex-accounts/legacy-wsl-runtime-auth-drain-recovery-script-harness.ts
|
||||
2 src/main/codex-accounts/legacy-wsl-runtime-auth-drain-script-harness.ts
|
||||
1 src/main/codex-accounts/runtime-home-service-home-routing.ts
|
||||
|
||||
@@ -423,15 +423,15 @@
|
||||
1 src/renderer/src/components/settings/privacy/PrivacyPane.tsx
|
||||
1 src/renderer/src/components/settings/quick-commands/QuickCommandsPane.tsx
|
||||
1 src/renderer/src/components/settings/repository/RepositoryFormatterSection.tsx
|
||||
2 src/renderer/src/components/settings/repository/source-control/RepositoryGitHubAccountSection.tsx
|
||||
3 src/renderer/src/components/settings/repository/RepositoryJiraProjectSection.tsx
|
||||
2 src/renderer/src/components/settings/repository/RepositoryRemoveProjectButton.tsx
|
||||
2 src/renderer/src/components/settings/repository/source-control/RepositoryForkSyncSection.tsx
|
||||
3 src/renderer/src/components/settings/repository/hosts/RepositoryHostSetupActions.tsx
|
||||
2 src/renderer/src/components/settings/repository/worktrees/SparsePresetSettingsSection.tsx
|
||||
2 src/renderer/src/components/settings/repository/identity/RepositoryIconPicker.tsx
|
||||
1 src/renderer/src/components/settings/repository/mcp/McpConfigSection.tsx
|
||||
2 src/renderer/src/components/settings/repository/source-control/RepositoryForkSyncSection.tsx
|
||||
2 src/renderer/src/components/settings/repository/source-control/RepositoryGitHubAccountSection.tsx
|
||||
9 src/renderer/src/components/settings/repository/source-control/repository-source-control-ai-global-ux.ts
|
||||
2 src/renderer/src/components/settings/repository/worktrees/SparsePresetSettingsSection.tsx
|
||||
1 src/renderer/src/components/settings/runtime-environments/catalog/use-runtime-environment-catalog.ts
|
||||
3 src/renderer/src/components/settings/runtime-environments/catalog/use-runtime-environment-connection-actions.ts
|
||||
2 src/renderer/src/components/settings/runtime-environments/catalog/use-runtime-environment-mutation-actions.ts
|
||||
@@ -503,7 +503,7 @@
|
||||
2 src/renderer/src/components/sidebar/useRenderedSetupScriptPromptState.ts
|
||||
2 src/renderer/src/components/sidebar/workspace-actions/context-menu/use-worktree-context-menu-commands.ts
|
||||
1 src/renderer/src/components/sidebar/workspace-actions/context-menu/use-worktree-context-menu-secondary-actions.ts
|
||||
2 src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteNestedWorktreesDialog.tsx
|
||||
1 src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteNestedWorktreesDialog.tsx
|
||||
1 src/renderer/src/components/sidebar/workspace-actions/deletion/RemovalUnsavedFilesNotice.tsx
|
||||
1 src/renderer/src/components/sidebar/workspace-actions/deletion/WorktreeForceDeleteButton.tsx
|
||||
1 src/renderer/src/components/sidebar/workspace-actions/deletion/use-delete-worktree-status-hydration.ts
|
||||
|
||||
@@ -4991,7 +4991,7 @@
|
||||
"pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/rpc/methods/browser/browser-client-host-reconciliation.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts",
|
||||
"pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser/browser-client-host.test.ts",
|
||||
"pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts",
|
||||
"pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-network-tunnel-protocol.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts",
|
||||
"pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/network/tunnels/browser-network-tunnel-protocol.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts",
|
||||
"pnpm exec vitest run --config config/vitest.config.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/rpc/methods/browser/browser-network-tunnel.test.ts src/main/runtime/browser/network/browser-network-tunnel-paired-runtime.integration.test.ts",
|
||||
"pnpm exec vitest run --config config/vitest.config.ts src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts",
|
||||
"pnpm exec vitest run --config config/vitest.config.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/server/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser/browser-client-host.test.ts src/main/runtime/rpc/methods/browser/browser-network-tunnel.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser/network/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts",
|
||||
@@ -5013,7 +5013,7 @@
|
||||
"testFiles": [
|
||||
"src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts",
|
||||
"src/main/runtime/browser/client-pages/runtime-browser-client-page-recovery.test.ts",
|
||||
"src/shared/browser-network-tunnel-protocol.test.ts",
|
||||
"src/shared/browser/network/tunnels/browser-network-tunnel-protocol.test.ts",
|
||||
"src/main/runtime/browser-host/reconciliation/browser-host-page-retirement.test.ts",
|
||||
"src/main/runtime/browser-host/reconciliation/browser-host-page-placement-replacement.test.ts",
|
||||
"src/main/runtime/browser-host/reconciliation/browser-host-page-placement.test.ts",
|
||||
@@ -5152,7 +5152,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"file": "src/shared/browser-network-tunnel-protocol.test.ts",
|
||||
"file": "src/shared/browser/network/tunnels/browser-network-tunnel-protocol.test.ts",
|
||||
"assertions": [
|
||||
"remote DNS names round-trip without client resolution",
|
||||
"unknown versions, opcodes, oversized payloads, and length mismatches fail closed"
|
||||
|
||||
@@ -1336,7 +1336,7 @@
|
||||
"src/main/codex-accounts/codex-login-session-wsl-open.test.ts": 184,
|
||||
"src/main/codex-accounts/codex-managed-home-path-wsl-check.test.ts": 71,
|
||||
"src/main/codex-accounts/codex-reset-credit-ledger.test.ts": 283,
|
||||
"src/main/codex-accounts/fs-utils.test.ts": 127,
|
||||
"src/main/filesystem/atomic-file-publication.test.ts": 127,
|
||||
"src/main/codex-accounts/guest-codex-account-homes.test.ts": 86,
|
||||
"src/main/codex-accounts/host-codex-managed-home-ownership.test.ts": 51,
|
||||
"src/main/codex-accounts/legacy-shared-auth-migration.test.ts": 134,
|
||||
@@ -7331,13 +7331,13 @@
|
||||
"src/shared/automation-schedules.test.ts": 174,
|
||||
"src/shared/automation-session-reuse.test.ts": 51,
|
||||
"src/shared/bounded-map.test.ts": 69,
|
||||
"src/shared/browser-annotation-viewport-live-target.test.ts": 259,
|
||||
"src/shared/browser/annotations/browser-annotation-viewport-live-target.test.ts": 259,
|
||||
"src/shared/browser/extensions/browser-extension-permission-warnings.test.ts": 57,
|
||||
"src/shared/browser/extensions/browser-extension-url.test.ts": 278,
|
||||
"src/shared/browser/extensions/browser-extension-webstore.test.ts": 235,
|
||||
"src/shared/browser-load-failure.test.ts": 238,
|
||||
"src/shared/browser-network-tunnel-protocol.test.ts": 47,
|
||||
"src/shared/browser-network-tunnel-stream-framing.test.ts": 1645,
|
||||
"src/shared/browser/network/tunnels/browser-network-tunnel-protocol.test.ts": 47,
|
||||
"src/shared/browser/network/tunnels/browser-network-tunnel-stream-framing.test.ts": 1645,
|
||||
"src/shared/browser-url.test.ts": 268,
|
||||
"src/shared/bundled-web-client-manifest.test.ts": 66,
|
||||
"src/shared/source-control/checks/logs/check-job-log-excerpt.test.ts": 114,
|
||||
|
||||
@@ -4,10 +4,19 @@ import { readFileSync } from 'node:fs'
|
||||
import { stripTypeScriptTypes } from 'node:module'
|
||||
import { performance } from 'node:perf_hooks'
|
||||
|
||||
// Run from the worktree root: node config/scripts/benchmark-browser-tunnel-framing.mjs [base-ref]
|
||||
const path = 'src/shared/browser-network-tunnel-stream-framing.ts'
|
||||
// Run from the worktree root: node config/scripts/performance/transport/benchmark-browser-tunnel-framing.mjs [base-ref]
|
||||
const path = 'src/shared/browser/network/tunnels/browser-network-tunnel-stream-framing.ts'
|
||||
const historicalPath = 'src/shared/browser-network-tunnel-stream-framing.ts'
|
||||
const baselineRef = process.argv[2] ?? 'HEAD'
|
||||
const beforeSource = execFileSync('git', ['show', `${baselineRef}:${path}`], {
|
||||
const baselinePaths = execFileSync(
|
||||
'git',
|
||||
['ls-tree', '--name-only', baselineRef, '--', path, historicalPath],
|
||||
{ encoding: 'utf8' }
|
||||
)
|
||||
.trim()
|
||||
.split('\n')
|
||||
const baselinePath = baselinePaths.includes(path) ? path : historicalPath
|
||||
const beforeSource = execFileSync('git', ['show', `${baselineRef}:${baselinePath}`], {
|
||||
encoding: 'utf8'
|
||||
})
|
||||
const afterSource = readFileSync(path, 'utf8')
|
||||
|
||||
@@ -209,7 +209,7 @@ const CROSS_VERSION_WIRE_PREFIXES = [
|
||||
'src/shared/protocol-version',
|
||||
'src/shared/terminal/stream/terminal-stream-protocol',
|
||||
'src/shared/browser/client-hosting/browser-client-host-protocol',
|
||||
'src/shared/browser-network-tunnel-protocol',
|
||||
'src/shared/browser/network/tunnels/browser-network-tunnel-protocol',
|
||||
// Both released/current WebSocket transports must accept web upgrade marker (cross-version-web-upgrade-marker).
|
||||
'src/main/runtime/rpc/ws-transport.ts',
|
||||
'src/shared/web-origin-security.ts',
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
# Hand-built worktree ids (`${repoId}::${path}`) per file, outside src/shared/worktree/id.ts.
|
||||
# This is a RATCHET: counts may only go DOWN. Compose ids with composeWorktreeId or
|
||||
# getRepoMainWorktreeId instead. Prune after a fix: pnpm check:worktree-id-composer-ratchet --prune
|
||||
1 src/main/git/remotes/worktree-push-target-reconciliation.ts
|
||||
1 src/main/ipc/workspace-cleanup/workspace-cleanup-scan.ts
|
||||
1 src/main/ipc/worktree-folder-rename-target.ts
|
||||
1 src/main/ipc/worktree-metadata-merge.ts
|
||||
1 src/main/git/remotes/worktree-push-target-reconciliation.ts
|
||||
2 src/main/ipc/worktree-remote.ts
|
||||
1 src/main/ipc/worktrees/listing/detected-provider-listing.ts
|
||||
1 src/main/ipc/worktrees/listing/ssh-worktree-fallback.ts
|
||||
2 src/main/ipc/worktrees/removal/nested-worktree-removal.ts
|
||||
1 src/main/memory/hydrate-local-pty-registry.ts
|
||||
1 src/main/runtime/workspaces/catalog/repo-worktree-row-resolution.ts
|
||||
1 src/main/runtime/workspaces/creation/runtime-local-worktree-materialization.ts
|
||||
1 src/main/runtime/workspaces/catalog/runtime-managed-worktree-queries.ts
|
||||
1 src/main/runtime/workspaces/creation/runtime-local-worktree-materialization.ts
|
||||
1 src/main/runtime/workspaces/creation/runtime-provisioned-root-adoption.ts
|
||||
1 src/main/workspaces/space-analysis/workspace-space-repo-scan.ts
|
||||
1 src/main/workspaces/catalog/worktree-lineage-pruning.ts
|
||||
1 src/main/workspaces/space-analysis/workspace-space-repo-scan.ts
|
||||
1 src/renderer/src/components/sidebar/workspace-actions/deletion/DeleteNestedWorktreesDialog.tsx
|
||||
|
||||
@@ -4,10 +4,8 @@ import { join } from 'node:path'
|
||||
import type { WebSocket } from 'ws'
|
||||
import type { AgentStatusEntry } from '../../src/shared/agent-status/contracts/agent-status-types'
|
||||
import type { NativeChatMessage } from '../../src/shared/native-chat/native-chat-types'
|
||||
import type {
|
||||
RuntimeMobileSessionTabsResult,
|
||||
RuntimeMobileSessionTerminalClientTab
|
||||
} from '../../src/shared/runtime-types'
|
||||
import type { RuntimeMobileSessionTabsResult } from '../../src/shared/runtime-types'
|
||||
import type { RuntimeMobileSessionTerminalClientTab } from '../../src/shared/runtime-mobile-session-tab-contracts'
|
||||
import type { RpcRequest, RpcResponse } from './mock-server-rpc-handlers'
|
||||
|
||||
// Read send behavior from control file per request: restarting mock rekeys E2EE and forces re-pair, preventing mid-session native chat repros.
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
import { useEffect, useMemo, useState, type Ref } from 'react'
|
||||
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
|
||||
import { Laptop, Mic, Smartphone, Square, X } from 'lucide-react-native'
|
||||
import type { MobileDictationMeter } from '../hooks/mobile-dictation-meter'
|
||||
import type { MobileDictationEngineShown } from '../hooks/mobile-dictation-session-state'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
import {
|
||||
COMPOSER_CONTROL_HIT_SLOP,
|
||||
composerInputStyles
|
||||
} from '../components/composer-input/composer-input-styles'
|
||||
import { colors, spacing, typography } from '../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../theme/themed-styles'
|
||||
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
|
||||
import {
|
||||
MobileDictationGrapes,
|
||||
MobileDictationTimer,
|
||||
useMobileDictationElapsed
|
||||
} from './MobileDictationMeter'
|
||||
import { dictationControlsCopy, dictationMeterLabel } from './mobile-dictation-controls-copy'
|
||||
|
||||
// Automatic's move from the phone to the computer is named in words this long, then the icon returns.
|
||||
const MOVED_NOTE_MS = 3000
|
||||
// A computer finish that lands within this shows no note, so a fast finish never flashes one.
|
||||
const FINISHING_NOTE_DELAY_MS = 300
|
||||
|
||||
// Cancel sits where attach was, far from Stop; a hold released over it cancels too.
|
||||
export function MobileDictationCancelButton({
|
||||
onCancel,
|
||||
targetRef,
|
||||
compact = false
|
||||
}: {
|
||||
onCancel: () => void
|
||||
targetRef?: Ref<View>
|
||||
compact?: boolean
|
||||
}): React.JSX.Element {
|
||||
useMobileColorScheme()
|
||||
useMobileTranslation()
|
||||
return (
|
||||
<Pressable
|
||||
ref={targetRef}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={dictationControlsCopy.cancel()}
|
||||
style={({ pressed }) => [
|
||||
composerInputStyles.controlButton,
|
||||
compact && styles.compactCancel,
|
||||
pressed && composerInputStyles.pressed
|
||||
]}
|
||||
hitSlop={COMPOSER_CONTROL_HIT_SLOP}
|
||||
onPress={onCancel}
|
||||
>
|
||||
<X
|
||||
pointerEvents="none"
|
||||
size={compact ? 16 : 18}
|
||||
color={colors.textPrimary}
|
||||
strokeWidth={2.4}
|
||||
/>
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
|
||||
// The mic's face: a spinner while finishing, a red Stop while live, else the mic. Icons ignore touches, so a swap mid-hold keeps the press.
|
||||
export function MobileDictationMicIcon({
|
||||
active,
|
||||
processing,
|
||||
micSize,
|
||||
micStroke
|
||||
}: {
|
||||
active: boolean
|
||||
processing: boolean
|
||||
micSize: number
|
||||
micStroke: number
|
||||
}): React.JSX.Element {
|
||||
useMobileColorScheme()
|
||||
return processing ? (
|
||||
<ActivityIndicator pointerEvents="none" size="small" color={colors.textSecondary} />
|
||||
) : active ? (
|
||||
<Square
|
||||
pointerEvents="none"
|
||||
size={16}
|
||||
color={colors.statusRed}
|
||||
strokeWidth={2.4}
|
||||
fill={colors.statusRed}
|
||||
/>
|
||||
) : (
|
||||
<Mic pointerEvents="none" size={micSize} color={colors.textSecondary} strokeWidth={micStroke} />
|
||||
)
|
||||
}
|
||||
|
||||
function EngineIcon({ kind, color }: { kind: MobileDictationEngineShown['kind']; color: string }) {
|
||||
return kind === 'phone' ? (
|
||||
<Smartphone pointerEvents="none" size={15} color={color} strokeWidth={2} />
|
||||
) : (
|
||||
<Laptop pointerEvents="none" size={16} color={color} strokeWidth={2} />
|
||||
)
|
||||
}
|
||||
|
||||
// Dots, timer and the engine's icon; words only for the few seconds after Automatic moves to the computer.
|
||||
export function MobileDictationRecordingMeter({
|
||||
meter,
|
||||
engine,
|
||||
computerName,
|
||||
dotSize
|
||||
}: {
|
||||
meter: MobileDictationMeter
|
||||
engine: MobileDictationEngineShown | null
|
||||
computerName: string | null
|
||||
dotSize: number
|
||||
}): React.JSX.Element {
|
||||
useMobileColorScheme()
|
||||
useMobileTranslation()
|
||||
const { now, elapsedSeconds } = useMobileDictationElapsed(meter)
|
||||
const kind = engine?.kind ?? null
|
||||
// The clock ticks four times a second; the spoken label changes once.
|
||||
const label = useMemo(
|
||||
() => dictationMeterLabel(elapsedSeconds, kind, computerName),
|
||||
[elapsedSeconds, kind, computerName]
|
||||
)
|
||||
if (engine?.movedAt != null && now - engine.movedAt < MOVED_NOTE_MS) {
|
||||
return (
|
||||
<View style={styles.row}>
|
||||
<EngineIcon kind="computer" color={colors.textPrimary} />
|
||||
<Text style={styles.moved} numberOfLines={1}>
|
||||
{dictationControlsCopy.movedTo(computerName)}
|
||||
</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<View style={styles.row} role="timer" aria-label={label}>
|
||||
<View style={styles.row} importantForAccessibility="no-hide-descendants" aria-hidden>
|
||||
<MobileDictationGrapes meter={meter} dotSize={dotSize} />
|
||||
<MobileDictationTimer elapsedSeconds={elapsedSeconds} />
|
||||
{engine ? <EngineIcon kind={engine.kind} color={colors.textMuted} /> : null}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
// Says where a slow finish is happening; the phone finishes at once, so it never needs this. Mounted only while finishing.
|
||||
export function MobileDictationFinishingNote({
|
||||
engine,
|
||||
computerName
|
||||
}: {
|
||||
engine: MobileDictationEngineShown | null
|
||||
computerName: string | null
|
||||
}): React.JSX.Element | null {
|
||||
useMobileColorScheme()
|
||||
useMobileTranslation()
|
||||
const onComputer = engine?.kind === 'computer'
|
||||
const [slow, setSlow] = useState(false)
|
||||
useEffect(() => {
|
||||
if (!onComputer) {
|
||||
return
|
||||
}
|
||||
const timer = setTimeout(() => setSlow(true), FINISHING_NOTE_DELAY_MS)
|
||||
return () => clearTimeout(timer)
|
||||
}, [onComputer])
|
||||
if (!onComputer || !slow) {
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<View style={styles.row}>
|
||||
<EngineIcon kind="computer" color={colors.textSecondary} />
|
||||
<Text style={styles.finishing} numberOfLines={1}>
|
||||
{dictationControlsCopy.finishingOn(computerName)}
|
||||
</Text>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: spacing.sm,
|
||||
minWidth: 0,
|
||||
flexShrink: 1
|
||||
},
|
||||
compactCancel: {
|
||||
width: 36,
|
||||
height: 36
|
||||
},
|
||||
moved: {
|
||||
flexShrink: 1,
|
||||
color: colors.textPrimary,
|
||||
fontSize: typography.metaSize + 1,
|
||||
fontWeight: '500'
|
||||
},
|
||||
finishing: {
|
||||
flexShrink: 1,
|
||||
color: colors.textSecondary,
|
||||
fontSize: typography.metaSize + 1
|
||||
}
|
||||
}))
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useSyncExternalStore } from 'react'
|
||||
import { memo, useSyncExternalStore } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
import { DICTATION_GRAPES } from '../../../src/shared/dictation-audio-meter'
|
||||
import {
|
||||
@@ -20,8 +20,11 @@ function useMeterEnergy(meter: MobileDictationMeter): { energy: number; isClippi
|
||||
return { energy: useReducedMotionEnabled() === false ? level : 0, isClipping }
|
||||
}
|
||||
|
||||
// Desktop's nine dots, red while the mic clips.
|
||||
export function MobileDictationGrapes({ meter, dotSize }: MeterProps & { dotSize: number }) {
|
||||
// Desktop's nine dots, red while the mic clips. Memoized: its parent re-renders on the timer's clock, the dots on the meter.
|
||||
export const MobileDictationGrapes = memo(function MobileDictationGrapes({
|
||||
meter,
|
||||
dotSize
|
||||
}: MeterProps & { dotSize: number }) {
|
||||
const { energy, isClipping } = useMeterEnergy(meter)
|
||||
return (
|
||||
<View
|
||||
@@ -48,14 +51,21 @@ export function MobileDictationGrapes({ meter, dotSize }: MeterProps & { dotSize
|
||||
))}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
export function MobileDictationTimer({ meter }: MeterProps) {
|
||||
useMobileColorScheme()
|
||||
export function useMobileDictationElapsed(meter: MobileDictationMeter): {
|
||||
now: number
|
||||
elapsedSeconds: number
|
||||
} {
|
||||
const startedAt = useSyncExternalStore(meter.subscribe, () => meter.getSnapshot().startedAt)
|
||||
const now = useNow(250)
|
||||
// The hook starts the meter in an effect, so the first recording frame may still read 0.
|
||||
const elapsedSeconds = startedAt === 0 ? 0 : Math.max(0, Math.floor((now - startedAt) / 1000))
|
||||
return { now, elapsedSeconds }
|
||||
}
|
||||
|
||||
export function MobileDictationTimer({ elapsedSeconds }: { readonly elapsedSeconds: number }) {
|
||||
useMobileColorScheme()
|
||||
const minutes = Math.floor(elapsedSeconds / 60)
|
||||
const seconds = String(elapsedSeconds % 60).padStart(2, '0')
|
||||
return <Text style={styles.timer}>{`${minutes}:${seconds}`}</Text>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import { translate } from '../i18n/mobile-i18n'
|
||||
import type { MobileDictationEngineShown } from '../hooks/mobile-dictation-session-state'
|
||||
|
||||
// Active: starting or recording, so the mic is a Stop.
|
||||
export type MobileDictationMicState = { starting: boolean; active: boolean; processing: boolean }
|
||||
|
||||
// One set of dictation labels for the chat composer, the terminal and the pill.
|
||||
export const dictationControlsCopy = {
|
||||
start: () => translate('dictation.controls.start', 'Dictate'),
|
||||
starting: () => translate('dictation.controls.starting', 'Starting dictation'),
|
||||
stop: () => translate('dictation.controls.stop', 'Stop and insert'),
|
||||
finishing: () => translate('dictation.controls.finishing', 'Finishing dictation'),
|
||||
cancel: () => translate('dictation.controls.cancel', 'Cancel dictation'),
|
||||
mic: ({ starting, active, processing }: MobileDictationMicState) =>
|
||||
starting
|
||||
? dictationControlsCopy.starting()
|
||||
: active
|
||||
? dictationControlsCopy.stop()
|
||||
: processing
|
||||
? dictationControlsCopy.finishing()
|
||||
: dictationControlsCopy.start(),
|
||||
finishingOn: (computer: string | null) =>
|
||||
computer
|
||||
? translate('dictation.status.finishingOn', 'Finishing on {{computer}}', { computer })
|
||||
: translate('dictation.status.finishingOnComputer', 'Finishing on the computer'),
|
||||
movedTo: (computer: string | null) =>
|
||||
computer
|
||||
? translate('dictation.status.movedTo', 'Moved to {{computer}}', { computer })
|
||||
: translate('dictation.status.movedToComputer', 'Moved to the computer')
|
||||
}
|
||||
|
||||
function spokenDuration(elapsedSeconds: number): string {
|
||||
const minutes = Math.floor(elapsedSeconds / 60)
|
||||
const count = elapsedSeconds % 60
|
||||
const seconds =
|
||||
count === 1
|
||||
? translate('dictation.controls.durationSeconds_one', '{{count}} second', { count })
|
||||
: translate('dictation.controls.durationSeconds_other', '{{count}} seconds', { count })
|
||||
if (minutes === 0) {
|
||||
return seconds
|
||||
}
|
||||
const minuteText =
|
||||
minutes === 1
|
||||
? translate('dictation.controls.durationMinutes_one', '{{count}} minute', { count: minutes })
|
||||
: translate('dictation.controls.durationMinutes_other', '{{count}} minutes', {
|
||||
count: minutes
|
||||
})
|
||||
return translate('dictation.controls.durationMinutesSeconds', '{{minutes}} {{seconds}}', {
|
||||
minutes: minuteText,
|
||||
seconds
|
||||
})
|
||||
}
|
||||
|
||||
// What a screen reader hears on the meter, which shows only dots, a timer and an icon.
|
||||
export function dictationMeterLabel(
|
||||
elapsedSeconds: number,
|
||||
engine: MobileDictationEngineShown['kind'] | null,
|
||||
computer: string | null
|
||||
): string {
|
||||
const duration = spokenDuration(elapsedSeconds)
|
||||
if (engine === 'phone') {
|
||||
return translate('dictation.controls.meterOnPhone', 'Recording, {{duration}}, on this phone', {
|
||||
duration
|
||||
})
|
||||
}
|
||||
if (engine === 'computer') {
|
||||
return computer
|
||||
? translate('dictation.controls.meterOn', 'Recording, {{duration}}, on {{computer}}', {
|
||||
duration,
|
||||
computer
|
||||
})
|
||||
: translate(
|
||||
'dictation.controls.meterOnComputer',
|
||||
'Recording, {{duration}}, on the computer',
|
||||
{
|
||||
duration
|
||||
}
|
||||
)
|
||||
}
|
||||
return translate('dictation.controls.meter', 'Recording, {{duration}}', { duration })
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { createContext } from 'react'
|
||||
import type { MobileDictationMeter } from '../hooks/mobile-dictation-meter'
|
||||
import type { MobileDictationEngineShown } from '../hooks/mobile-dictation-session-state'
|
||||
|
||||
export type MobileDictationLive = {
|
||||
readonly meter: MobileDictationMeter
|
||||
readonly engine: MobileDictationEngineShown | null
|
||||
// The paired computer's name; null when another server runs the workspace and the phone lacks its name.
|
||||
readonly computerName: string | null
|
||||
readonly cancel: () => void
|
||||
}
|
||||
|
||||
// The chat mic sits several composers deep (overlay, queued edits); it reads the live dictation from here.
|
||||
export const MobileDictationLiveContext = createContext<MobileDictationLive | null>(null)
|
||||
@@ -1,5 +0,0 @@
|
||||
import { createContext } from 'react'
|
||||
import type { MobileDictationMeter } from '../hooks/mobile-dictation-meter'
|
||||
|
||||
// The chat mic sits several composers deep (overlay, queued edits); it reads the live recording's meter from here.
|
||||
export const MobileDictationMeterContext = createContext<MobileDictationMeter | null>(null)
|
||||
@@ -0,0 +1,41 @@
|
||||
import { useCallback, type RefObject } from 'react'
|
||||
import type { GestureResponderEvent, View } from 'react-native'
|
||||
import { measurePageBox, type PageBox } from '../platform/page-box'
|
||||
|
||||
// A dragging finger lands less precisely than a tap, so the drop zone reaches past ✕.
|
||||
const DROP_SLOP = 12
|
||||
|
||||
function contains(box: PageBox, x: number, y: number): boolean {
|
||||
return (
|
||||
x >= box.left - DROP_SLOP &&
|
||||
x <= box.left + box.width + DROP_SLOP &&
|
||||
y >= box.top - DROP_SLOP &&
|
||||
y <= box.top + box.height + DROP_SLOP
|
||||
)
|
||||
}
|
||||
|
||||
// Hold mode: letting go of the mic over ✕ cancels instead of inserting, like a voice note.
|
||||
export function useMobileDictationCancelDrop(
|
||||
cancelRef: RefObject<View | null> | undefined,
|
||||
onCancel: (() => void) | undefined,
|
||||
onRelease: (() => void) | undefined
|
||||
): (event: GestureResponderEvent) => void {
|
||||
return useCallback(
|
||||
(event: GestureResponderEvent) => {
|
||||
const target = cancelRef?.current
|
||||
const { pageX, pageY } = event.nativeEvent
|
||||
if (!target || !onCancel || typeof pageX !== 'number' || typeof pageY !== 'number') {
|
||||
onRelease?.()
|
||||
return
|
||||
}
|
||||
measurePageBox(target, (box) => {
|
||||
if (box && contains(box, pageX, pageY)) {
|
||||
onCancel()
|
||||
} else {
|
||||
onRelease?.()
|
||||
}
|
||||
})
|
||||
},
|
||||
[cancelRef, onCancel, onRelease]
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { useCallback, useLayoutEffect, useMemo, useRef } from 'react'
|
||||
import type { UseMobileDictationResult } from '../hooks/mobile-dictation-session-state'
|
||||
import { useWorkspaceExecutionHost } from '../navigation/workspace-execution-host'
|
||||
import { useHostDisplay } from '../transport/hosts/use-host-display'
|
||||
import { useHostProfile } from '../transport/hosts/use-host-profile'
|
||||
import type { MobileDictationLive } from './mobile-dictation-live-context'
|
||||
|
||||
// What every dictation control reads while one runs: meter, engine, the computer's name and cancel.
|
||||
export function useMobileDictationLive(
|
||||
dictation: Pick<UseMobileDictationResult, 'meter' | 'engine'>,
|
||||
cancel: () => void,
|
||||
hostId: string
|
||||
): MobileDictationLive {
|
||||
const cancelLatest = useRef(cancel)
|
||||
useLayoutEffect(() => {
|
||||
cancelLatest.current = cancel
|
||||
}, [cancel])
|
||||
const stableCancel = useCallback(() => cancelLatest.current(), [])
|
||||
const hostProfile = useHostProfile(hostId)
|
||||
const hostTitle = useHostDisplay(hostProfile).title
|
||||
// A workspace routed to another server transcribes there, and the phone lacks that server's name.
|
||||
const computerName = useWorkspaceExecutionHost() === undefined && hostProfile ? hostTitle : null
|
||||
const { meter, engine } = dictation
|
||||
return useMemo(
|
||||
() => ({ meter, engine, computerName, cancel: stableCancel }),
|
||||
[meter, engine, computerName, stableCancel]
|
||||
)
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
} from './mobile-dictation-device-engine'
|
||||
import type { MobileDictationPendingAudioBudget } from './mobile-dictation-pending-audio-budget'
|
||||
import type { MobileDictationHeldAudio } from './mobile-dictation-held-audio'
|
||||
import type { ShowMobileDictationEngine } from './mobile-dictation-engine-shown'
|
||||
|
||||
// What the engines share with useMobileDictation: its refs (read at call time) and its state transitions.
|
||||
export type MobileDictationRun = {
|
||||
@@ -46,6 +47,7 @@ export type MobileDictationRun = {
|
||||
readonly onTranscript: RefObject<(text: string) => void>
|
||||
readonly keptTranscript: MobileDictationTranscriptSoFar
|
||||
readonly applyStatus: (next: DictationStatus) => void
|
||||
readonly showEngine: ShowMobileDictationEngine
|
||||
readonly closeDictationAudio: () => void
|
||||
readonly reportError: (err: unknown) => void
|
||||
readonly failActiveDictation: (dictationId: string, err: unknown) => void
|
||||
@@ -118,6 +120,7 @@ export async function startMobileDictationOnHost(
|
||||
if (run.status.current !== 'processing') {
|
||||
run.applyStatus('recording')
|
||||
}
|
||||
run.showEngine('computer')
|
||||
run.sendHeldAudio.current()
|
||||
if (run.stopWhenStarted.current) {
|
||||
void run.finish.current(dictationSessionErrorMessage('no-speech'))
|
||||
@@ -151,6 +154,7 @@ export async function fallBackMobileDictationToHost(
|
||||
return
|
||||
}
|
||||
run.engine.current = { kind: 'host' }
|
||||
run.showEngine('computer', true)
|
||||
// A stop that began while the phone was still live is already processing; the computer must finish it too.
|
||||
run.stopWhenStarted.current = finishing || run.status.current === 'processing'
|
||||
try {
|
||||
@@ -229,6 +233,7 @@ export function commitMobileDictationOnDevice(
|
||||
run.audioPhase.current = 'closed'
|
||||
}
|
||||
run.applyStatus('recording')
|
||||
run.showEngine('phone')
|
||||
if (run.stopWhenStarted.current) {
|
||||
void run.finish.current(dictationSessionErrorMessage('no-speech'))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { useState } from 'react'
|
||||
import type { MobileDictationEngineShown } from './mobile-dictation-session-state'
|
||||
|
||||
export type ShowMobileDictationEngine = (
|
||||
kind: MobileDictationEngineShown['kind'],
|
||||
moved?: boolean
|
||||
) => void
|
||||
|
||||
// The engine the UI shows by the timer: set when an engine starts hearing, cleared when the dictation ends.
|
||||
export function useMobileDictationEngineShown() {
|
||||
const [shown, setShown] = useState<MobileDictationEngineShown | null>(null)
|
||||
const [show] = useState(
|
||||
(): ShowMobileDictationEngine =>
|
||||
(kind, moved = false) =>
|
||||
setShown((current) =>
|
||||
moved
|
||||
? { kind, movedAt: Date.now() }
|
||||
: current?.kind === kind
|
||||
? current
|
||||
: { kind, movedAt: null }
|
||||
)
|
||||
)
|
||||
const [clear] = useState(() => () => setShown(null))
|
||||
return { shown, show, clear }
|
||||
}
|
||||
@@ -6,6 +6,9 @@ import type { MobileDictationMeter } from './mobile-dictation-meter'
|
||||
|
||||
export type DictationStatus = 'idle' | 'starting' | 'recording' | 'processing' | 'error'
|
||||
|
||||
// Who is transcribing, for the icon by the timer; movedAt marks when Automatic moved from the phone to the computer.
|
||||
export type MobileDictationEngineShown = { kind: 'phone' | 'computer'; movedAt: number | null }
|
||||
|
||||
export type UseMobileDictationOptions = {
|
||||
client: RpcClient | null
|
||||
enabled: boolean
|
||||
@@ -23,6 +26,8 @@ export type UseMobileDictationResult = {
|
||||
// Empty until a newer host reports words; older hosts never do.
|
||||
transcriptSoFar: string
|
||||
error: string | null
|
||||
// Null until recording starts on an engine.
|
||||
engine: MobileDictationEngineShown | null
|
||||
start: () => Promise<void>
|
||||
stop: () => Promise<void>
|
||||
cancel: () => Promise<void>
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import { useEffect, type RefObject } from 'react'
|
||||
import { AppState } from 'react-native'
|
||||
import { dictationSessionErrorMessage } from '../dictation/mobile-dictation-setup'
|
||||
import type { DictationCapture } from '../platform/dictation-capture-contract'
|
||||
import type { MobileDictationAudioPhase } from './mobile-dictation-audio-chunk'
|
||||
import type { DictationStatus } from './mobile-dictation-session-state'
|
||||
|
||||
// Calls, Siri, mic dropouts and leaving the app finish what was already heard; only the user's own cancel may discard it.
|
||||
export function useMobileDictationInterruptions({
|
||||
capture,
|
||||
status,
|
||||
audioPhase,
|
||||
stopWhenStarted,
|
||||
applyStatus,
|
||||
finish,
|
||||
abandon
|
||||
}: {
|
||||
capture: DictationCapture
|
||||
status: RefObject<DictationStatus>
|
||||
audioPhase: RefObject<MobileDictationAudioPhase>
|
||||
stopWhenStarted: RefObject<boolean>
|
||||
applyStatus: (next: DictationStatus) => void
|
||||
finish: (emptyTranscriptMessage: string) => Promise<void>
|
||||
abandon: (reason: string | null) => Promise<void>
|
||||
}): void {
|
||||
useEffect(() => {
|
||||
const interrupted = () => {
|
||||
if (status.current === 'recording') {
|
||||
void finish(dictationSessionErrorMessage('interrupted'))
|
||||
} else if (audioPhase.current === 'holding') {
|
||||
// The mic is live while the host start is pending: close it now, and finish with what it heard once the start commits.
|
||||
stopWhenStarted.current = true
|
||||
applyStatus('processing')
|
||||
void capture.end()
|
||||
} else if (status.current === 'starting') {
|
||||
void abandon(dictationSessionErrorMessage('interrupted'))
|
||||
}
|
||||
}
|
||||
const sub = capture.onInterruption(interrupted)
|
||||
// A backgrounded app loses the microphone, so leaving finishes. Not before the mic opens: Android's permission prompt reports background.
|
||||
const appState = AppState.addEventListener('change', (state) => {
|
||||
if (
|
||||
state === 'background' &&
|
||||
(status.current === 'recording' || audioPhase.current === 'holding')
|
||||
) {
|
||||
interrupted()
|
||||
}
|
||||
})
|
||||
return () => {
|
||||
sub.remove()
|
||||
appState.remove()
|
||||
}
|
||||
}, [abandon, applyStatus, audioPhase, capture, finish, status, stopWhenStarted])
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import { AppState } from 'react-native'
|
||||
import { useDictationCapture } from '../platform/dictation-capture'
|
||||
import { useOnDeviceSpeech } from '../platform/on-device-speech'
|
||||
import { dictationSessionErrorMessage } from '../dictation/mobile-dictation-setup'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
import { useMobileDictationMeter } from './mobile-dictation-meter'
|
||||
import { useMobileDictationEngineShown } from './mobile-dictation-engine-shown'
|
||||
import { useMobileDictationInterruptions } from './use-mobile-dictation-interruptions'
|
||||
import { MobileDictationPendingAudioBudget } from './mobile-dictation-pending-audio-budget'
|
||||
import {
|
||||
useMobileDictationTranscriptSoFar,
|
||||
@@ -40,6 +41,11 @@ export function useMobileDictation(options: UseMobileDictationOptions): UseMobil
|
||||
const [status, setStatus] = useState<DictationStatus>('idle')
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [transcriptSoFar, setTranscriptSoFar, keptTranscript] = useMobileDictationTranscriptSoFar()
|
||||
const {
|
||||
shown: shownEngine,
|
||||
show: showEngine,
|
||||
clear: clearEngine
|
||||
} = useMobileDictationEngineShown()
|
||||
// Read from an abort that may run between a commit and its passive Effects, where state is stale.
|
||||
const statusRef = useRef<DictationStatus>('idle')
|
||||
const activeIdRef = useRef<string | null>(null)
|
||||
@@ -68,12 +74,19 @@ export function useMobileDictation(options: UseMobileDictationOptions): UseMobil
|
||||
onErrorRef.current = onError
|
||||
}, [client, speech, enabled, onTranscript, onError])
|
||||
|
||||
const applyStatus = useCallback((next: DictationStatus) => {
|
||||
statusRef.current = next
|
||||
setStatus(next)
|
||||
// Kept through processing so the text so far stays in place until the final transcript replaces it in the same render.
|
||||
setTranscriptSoFar((text) => (next === 'recording' || next === 'processing' ? text : ''))
|
||||
}, [])
|
||||
const applyStatus = useCallback(
|
||||
(next: DictationStatus) => {
|
||||
statusRef.current = next
|
||||
setStatus(next)
|
||||
// Kept through processing so the text so far stays in place until the final transcript replaces it in the same render.
|
||||
const live = next === 'recording' || next === 'processing'
|
||||
setTranscriptSoFar((text) => (live ? text : ''))
|
||||
if (!live) {
|
||||
clearEngine()
|
||||
}
|
||||
},
|
||||
[clearEngine]
|
||||
)
|
||||
|
||||
const reportError = useCallback(
|
||||
(err: unknown) => {
|
||||
@@ -138,11 +151,12 @@ export function useMobileDictation(options: UseMobileDictationOptions): UseMobil
|
||||
onTranscript: onTranscriptRef,
|
||||
keptTranscript,
|
||||
applyStatus,
|
||||
showEngine,
|
||||
closeDictationAudio,
|
||||
reportError,
|
||||
failActiveDictation
|
||||
}),
|
||||
[applyStatus, closeDictationAudio, failActiveDictation, keptTranscript, reportError]
|
||||
[applyStatus, closeDictationAudio, failActiveDictation, keptTranscript, reportError, showEngine]
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
@@ -270,35 +284,15 @@ export function useMobileDictation(options: UseMobileDictationOptions): UseMobil
|
||||
|
||||
const cancel = useCallback(() => abandonDictation(null), [abandonDictation])
|
||||
|
||||
useEffect(() => {
|
||||
// Finish what was already streamed; only the user's own cancel may discard it.
|
||||
const interrupted = () => {
|
||||
if (statusRef.current === 'recording') {
|
||||
void finishDictation(dictationSessionErrorMessage('interrupted'))
|
||||
} else if (audioPhaseRef.current === 'holding') {
|
||||
// The mic is live while the host start is pending: close it now, and finish with what it heard once the start commits.
|
||||
stopWhenStartedRef.current = true
|
||||
applyStatus('processing')
|
||||
void capture.end()
|
||||
} else if (statusRef.current === 'starting') {
|
||||
void abandonDictation(dictationSessionErrorMessage('interrupted'))
|
||||
}
|
||||
}
|
||||
const sub = capture.onInterruption(interrupted)
|
||||
// A backgrounded app loses the microphone, so leaving finishes. Not before the mic opens: Android's permission prompt reports background.
|
||||
const appState = AppState.addEventListener('change', (state) => {
|
||||
if (
|
||||
state === 'background' &&
|
||||
(statusRef.current === 'recording' || audioPhaseRef.current === 'holding')
|
||||
) {
|
||||
interrupted()
|
||||
}
|
||||
})
|
||||
return () => {
|
||||
sub.remove()
|
||||
appState.remove()
|
||||
}
|
||||
}, [abandonDictation, applyStatus, capture, finishDictation])
|
||||
useMobileDictationInterruptions({
|
||||
capture,
|
||||
status: statusRef,
|
||||
audioPhase: audioPhaseRef,
|
||||
stopWhenStarted: stopWhenStartedRef,
|
||||
applyStatus,
|
||||
finish: finishDictation,
|
||||
abandon: abandonDictation
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (!enabled) {
|
||||
@@ -324,6 +318,7 @@ export function useMobileDictation(options: UseMobileDictationOptions): UseMobil
|
||||
isProcessing: status === 'processing',
|
||||
transcriptSoFar,
|
||||
error,
|
||||
engine: shownEngine,
|
||||
start,
|
||||
stop,
|
||||
cancel,
|
||||
|
||||
@@ -183,6 +183,12 @@
|
||||
}
|
||||
},
|
||||
"dictation": {
|
||||
"controls": {
|
||||
"durationMinutes_one": "{{count}} minute",
|
||||
"durationMinutes_other": "{{count}} minutes",
|
||||
"durationSeconds_one": "{{count}} second",
|
||||
"durationSeconds_other": "{{count}} seconds"
|
||||
},
|
||||
"setup": {
|
||||
"alreadyActive": "Dictation is already in use on the computer or another phone. Update Orca on the computer to dictate from several devices at once.",
|
||||
"modelBusy": "Another device is dictating with a different speech model. Try again when it finishes.",
|
||||
@@ -303,12 +309,12 @@
|
||||
"uncommittedFiles_other": "{{count}} uncommitted"
|
||||
},
|
||||
"failure": {
|
||||
"forkOriginalMissing": "{{agent}} could not find this response in the original chat. Open it and fork from there.",
|
||||
"forkOriginalUnavailable": "{{agent}} cannot fork this response in the original chat. Open it and fork from there.",
|
||||
"forkOriginalMissingNamed": "{{agent}} could not find this response in \"{{detail}}\". Open that chat and fork from there.",
|
||||
"forkOriginalUnavailableNamed": "{{agent}} cannot fork this response in \"{{detail}}\". Open that chat and fork from there.",
|
||||
"forkOriginalLatestOnly": "{{agent}} can only fork the latest response in the original chat. Open that chat and fork its latest response once it has finished.",
|
||||
"forkOriginalLatestOnlyNamed": "{{agent}} can only fork the latest response in \"{{detail}}\". Open that chat and fork its latest response once it has finished.",
|
||||
"forkOriginalMissing": "{{agent}} could not find this response in the original chat. Open it and fork from there.",
|
||||
"forkOriginalMissingNamed": "{{agent}} could not find this response in \"{{detail}}\". Open that chat and fork from there.",
|
||||
"forkOriginalUnavailable": "{{agent}} cannot fork this response in the original chat. Open it and fork from there.",
|
||||
"forkOriginalUnavailableNamed": "{{agent}} cannot fork this response in \"{{detail}}\". Open that chat and fork from there.",
|
||||
"pluginInputRequired": "{{agent}} stopped because the \"{{plugin}}\" plugin is waiting for input in a terminal pane. Disable the plugin for chat sessions, or run the task in a {{agent}} terminal."
|
||||
},
|
||||
"fileReader": {
|
||||
|
||||
@@ -1302,6 +1302,28 @@
|
||||
"sessionLimit": "Auf diesem Computer diktieren zu viele Geräte. Erneut versuchen, sobald eines fertig ist.",
|
||||
"sessionLost": "Die Verbindung zum Computer wurde beim Diktat unterbrochen. Erneut versuchen.",
|
||||
"updateFailed": "Diktateinstellungen konnten nicht aktualisiert werden"
|
||||
},
|
||||
"controls": {
|
||||
"start": "Diktieren",
|
||||
"starting": "Diktat wird gestartet",
|
||||
"stop": "Stoppen und einfügen",
|
||||
"finishing": "Diktat wird abgeschlossen",
|
||||
"cancel": "Diktat abbrechen",
|
||||
"meterOnPhone": "Aufnahme, {{duration}}, auf diesem Telefon",
|
||||
"meterOn": "Aufnahme, {{duration}}, auf {{computer}}",
|
||||
"meterOnComputer": "Aufnahme, {{duration}}, auf dem Computer",
|
||||
"meter": "Aufnahme, {{duration}}",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"durationSeconds_one": "{{count}} Sekunde",
|
||||
"durationSeconds_other": "{{count}} Sekunden",
|
||||
"durationMinutes_one": "{{count}} Minute",
|
||||
"durationMinutes_other": "{{count}} Minuten"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "Wird auf {{computer}} abgeschlossen",
|
||||
"finishingOnComputer": "Wird auf dem Computer abgeschlossen",
|
||||
"movedTo": "Zu {{computer}} gewechselt",
|
||||
"movedToComputer": "Zum Computer gewechselt"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
@@ -2402,11 +2424,7 @@
|
||||
"terminalInputActions": {
|
||||
"attachFileHint": "Lange drücken, um stattdessen eine Datei anzuhängen",
|
||||
"attachPhoto": "Foto anhängen",
|
||||
"sendingImage": "Bild wird gesendet",
|
||||
"startDictation": "Diktat starten",
|
||||
"startingDictation": "Diktat wird gestartet",
|
||||
"stopDictation": "Diktat beenden",
|
||||
"transcribingDictation": "Diktat wird transkribiert"
|
||||
"sendingImage": "Bild wird gesendet"
|
||||
},
|
||||
"terminalLiveInputStatus": {
|
||||
"listening": "Hört zu",
|
||||
@@ -2415,8 +2433,6 @@
|
||||
"processing": "Wird verarbeitet",
|
||||
"releaseMicHint": "Zum Stoppen Mikrofon loslassen",
|
||||
"startingMic": "Mikrofon wird gestartet",
|
||||
"stopHint": "Zum Stoppen Mikrofon antippen",
|
||||
"transcribing": "Transkription auf dem Desktop",
|
||||
"uploadingImage": "Bild wird auf den Host hochgeladen",
|
||||
"uploadingImageTitle": "Bild wird hochgeladen"
|
||||
},
|
||||
|
||||
@@ -517,6 +517,28 @@
|
||||
"deleteFailed": "Failed to delete model",
|
||||
"updateFailed": "Failed to update dictation settings",
|
||||
"cloudModelNeedsKey": "Needs an OpenAI key"
|
||||
},
|
||||
"controls": {
|
||||
"start": "Dictate",
|
||||
"starting": "Starting dictation",
|
||||
"stop": "Stop and insert",
|
||||
"finishing": "Finishing dictation",
|
||||
"cancel": "Cancel dictation",
|
||||
"durationSeconds_one": "{{count}} second",
|
||||
"durationSeconds_other": "{{count}} seconds",
|
||||
"durationMinutes_one": "{{count}} minute",
|
||||
"durationMinutes_other": "{{count}} minutes",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"meterOnPhone": "Recording, {{duration}}, on this phone",
|
||||
"meterOn": "Recording, {{duration}}, on {{computer}}",
|
||||
"meterOnComputer": "Recording, {{duration}}, on the computer",
|
||||
"meter": "Recording, {{duration}}"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "Finishing on {{computer}}",
|
||||
"finishingOnComputer": "Finishing on the computer",
|
||||
"movedTo": "Moved to {{computer}}",
|
||||
"movedToComputer": "Moved to the computer"
|
||||
}
|
||||
},
|
||||
"home": {
|
||||
@@ -1958,8 +1980,6 @@
|
||||
"liveInput": "Live input",
|
||||
"uploadingImageTitle": "Uploading image",
|
||||
"releaseMicHint": "Release mic to stop",
|
||||
"stopHint": "Tap mic to stop",
|
||||
"transcribing": "Transcribing on desktop",
|
||||
"preparingMic": "Preparing microphone",
|
||||
"uploadingImage": "Uploading image to host"
|
||||
},
|
||||
@@ -2130,11 +2150,7 @@
|
||||
"terminalInputActions": {
|
||||
"sendingImage": "Sending image",
|
||||
"attachPhoto": "Attach a photo",
|
||||
"attachFileHint": "Long press to attach a file instead",
|
||||
"stopDictation": "Stop voice dictation",
|
||||
"transcribingDictation": "Transcribing voice dictation",
|
||||
"startingDictation": "Starting voice dictation",
|
||||
"startDictation": "Start voice dictation"
|
||||
"attachFileHint": "Long press to attach a file instead"
|
||||
},
|
||||
"quickCommandEditorForm": {
|
||||
"terminalCommand": "Terminal Command",
|
||||
|
||||
@@ -1341,6 +1341,30 @@
|
||||
"sessionLimit": "Hay demasiados dispositivos dictando en este ordenador. Inténtalo de nuevo cuando termine uno.",
|
||||
"sessionLost": "El dictado perdió la conexión con el ordenador. Inténtalo de nuevo.",
|
||||
"updateFailed": "No se pudieron actualizar los ajustes de dictado"
|
||||
},
|
||||
"controls": {
|
||||
"start": "Dictar",
|
||||
"starting": "Iniciando el dictado",
|
||||
"stop": "Detener e insertar",
|
||||
"finishing": "Terminando el dictado",
|
||||
"cancel": "Cancelar dictado",
|
||||
"meterOnPhone": "Grabando, {{duration}}, en este teléfono",
|
||||
"meterOn": "Grabando, {{duration}}, en {{computer}}",
|
||||
"meterOnComputer": "Grabando, {{duration}}, en el ordenador",
|
||||
"meter": "Grabando, {{duration}}",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"durationSeconds_one": "{{count}} segundo",
|
||||
"durationSeconds_other": "{{count}} segundos",
|
||||
"durationSeconds_many": "{{count}} segundos",
|
||||
"durationMinutes_one": "{{count}} minuto",
|
||||
"durationMinutes_other": "{{count}} minutos",
|
||||
"durationMinutes_many": "{{count}} minutos"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "Terminando en {{computer}}",
|
||||
"finishingOnComputer": "Terminando en el ordenador",
|
||||
"movedTo": "Pasado a {{computer}}",
|
||||
"movedToComputer": "Pasado al ordenador"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
@@ -2470,11 +2494,7 @@
|
||||
"terminalInputActions": {
|
||||
"attachFileHint": "Mantén pulsado para adjuntar un archivo en su lugar.",
|
||||
"attachPhoto": "Adjuntar una foto",
|
||||
"sendingImage": "Enviando imagen",
|
||||
"startDictation": "Iniciar dictado de voz",
|
||||
"startingDictation": "Iniciando dictado de voz",
|
||||
"stopDictation": "Detener dictado de voz",
|
||||
"transcribingDictation": "Transcribiendo dictado de voz"
|
||||
"sendingImage": "Enviando imagen"
|
||||
},
|
||||
"terminalLiveInputStatus": {
|
||||
"listening": "Escuchando",
|
||||
@@ -2483,8 +2503,6 @@
|
||||
"processing": "Procesando",
|
||||
"releaseMicHint": "Suelta el micrófono para detener la grabación",
|
||||
"startingMic": "Iniciando micrófono",
|
||||
"stopHint": "Toca el micrófono para parar",
|
||||
"transcribing": "Transcribiendo en el escritorio",
|
||||
"uploadingImage": "Subiendo imagen al host",
|
||||
"uploadingImageTitle": "Subiendo imagen"
|
||||
},
|
||||
|
||||
@@ -1341,6 +1341,30 @@
|
||||
"sessionLimit": "Trop d'appareils dictent sur cet ordinateur. Réessayez quand l'un d'eux aura terminé.",
|
||||
"sessionLost": "La dictée a perdu sa connexion à l'ordinateur. Réessayez.",
|
||||
"updateFailed": "Impossible de mettre à jour les paramètres de dictée"
|
||||
},
|
||||
"controls": {
|
||||
"start": "Dicter",
|
||||
"starting": "Démarrage de la dictée",
|
||||
"stop": "Arrêter et insérer",
|
||||
"finishing": "Finalisation de la dictée",
|
||||
"cancel": "Annuler la dictée",
|
||||
"meterOnPhone": "Enregistrement, {{duration}}, sur ce téléphone",
|
||||
"meterOn": "Enregistrement, {{duration}}, sur {{computer}}",
|
||||
"meterOnComputer": "Enregistrement, {{duration}}, sur l’ordinateur",
|
||||
"meter": "Enregistrement, {{duration}}",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"durationSeconds_one": "{{count}} seconde",
|
||||
"durationSeconds_other": "{{count}} secondes",
|
||||
"durationSeconds_many": "{{count}} secondes",
|
||||
"durationMinutes_one": "{{count}} minute",
|
||||
"durationMinutes_other": "{{count}} minutes",
|
||||
"durationMinutes_many": "{{count}} minutes"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "Finalisation sur {{computer}}",
|
||||
"finishingOnComputer": "Finalisation sur l’ordinateur",
|
||||
"movedTo": "Passé sur {{computer}}",
|
||||
"movedToComputer": "Passé sur l’ordinateur"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
@@ -2470,11 +2494,7 @@
|
||||
"terminalInputActions": {
|
||||
"attachFileHint": "Appuyez longuement pour joindre un fichier à la place.",
|
||||
"attachPhoto": "Joindre une photo",
|
||||
"sendingImage": "Envoi de l'image",
|
||||
"startDictation": "Démarrer la dictée vocale",
|
||||
"startingDictation": "Démarrage de la dictée vocale",
|
||||
"stopDictation": "Arrêter la dictée vocale",
|
||||
"transcribingDictation": "Transcription de la dictée vocale"
|
||||
"sendingImage": "Envoi de l'image"
|
||||
},
|
||||
"terminalLiveInputStatus": {
|
||||
"listening": "Écoute en cours",
|
||||
@@ -2483,8 +2503,6 @@
|
||||
"processing": "Traitement en cours",
|
||||
"releaseMicHint": "Relâchez le micro pour arrêter",
|
||||
"startingMic": "Démarrage du micro",
|
||||
"stopHint": "Touchez le micro pour arrêter",
|
||||
"transcribing": "Transcription sur l'ordinateur",
|
||||
"uploadingImage": "Envoi de l'image à l'hôte",
|
||||
"uploadingImageTitle": "Envoi de l'image"
|
||||
},
|
||||
|
||||
@@ -1298,6 +1298,28 @@
|
||||
"sessionLimit": "このコンピュータでディクテーション中のデバイスが多すぎます。いずれかが終わってから、もう一度お試しください。",
|
||||
"sessionLost": "ディクテーション中にコンピュータとの接続が切れました。再試行してください。",
|
||||
"updateFailed": "ディクテーション設定の更新に失敗しました。"
|
||||
},
|
||||
"controls": {
|
||||
"start": "音声入力",
|
||||
"starting": "音声入力を開始しています",
|
||||
"stop": "停止して挿入",
|
||||
"finishing": "音声入力を仕上げています",
|
||||
"cancel": "音声入力をキャンセル",
|
||||
"meterOnPhone": "録音中、{{duration}}、このスマートフォンで処理",
|
||||
"meterOn": "録音中、{{duration}}、{{computer}} で処理",
|
||||
"meterOnComputer": "録音中、{{duration}}、コンピュータで処理",
|
||||
"meter": "録音中、{{duration}}",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"durationSeconds_one": "{{count}} 秒",
|
||||
"durationSeconds_other": "{{count}} 秒",
|
||||
"durationMinutes_one": "{{count}} 分",
|
||||
"durationMinutes_other": "{{count}} 分"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "{{computer}} で仕上げています",
|
||||
"finishingOnComputer": "コンピュータで仕上げています",
|
||||
"movedTo": "{{computer}} に切り替えました",
|
||||
"movedToComputer": "コンピュータに切り替えました"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
@@ -2398,11 +2420,7 @@
|
||||
"terminalInputActions": {
|
||||
"attachFileHint": "長押しすると、写真の代わりにファイルを添付できます。",
|
||||
"attachPhoto": "写真を添付",
|
||||
"sendingImage": "画像を送信中…",
|
||||
"startDictation": "音声ディクテーションを開始",
|
||||
"startingDictation": "音声ディクテーションを開始中",
|
||||
"stopDictation": "音声ディクテーションを停止",
|
||||
"transcribingDictation": "音声ディクテーションを文字起こし中"
|
||||
"sendingImage": "画像を送信中…"
|
||||
},
|
||||
"terminalLiveInputStatus": {
|
||||
"listening": "聞き取り中",
|
||||
@@ -2411,8 +2429,6 @@
|
||||
"processing": "処理中",
|
||||
"releaseMicHint": "マイクボタンから指を離すと停止",
|
||||
"startingMic": "マイクを起動中",
|
||||
"stopHint": "マイクをタップして停止",
|
||||
"transcribing": "デスクトップで文字起こし中",
|
||||
"uploadingImage": "ホストに画像をアップロード中",
|
||||
"uploadingImageTitle": "画像をアップロード中"
|
||||
},
|
||||
|
||||
@@ -1298,6 +1298,28 @@
|
||||
"sessionLimit": "이 컴퓨터에서 받아쓰기 중인 기기가 너무 많습니다. 하나가 끝나면 다시 시도하세요.",
|
||||
"sessionLost": "받아쓰기 중 컴퓨터와의 연결이 끊어졌습니다. 다시 시도하세요.",
|
||||
"updateFailed": "받아쓰기 설정을 업데이트하지 못했습니다."
|
||||
},
|
||||
"controls": {
|
||||
"start": "받아쓰기",
|
||||
"starting": "받아쓰기 시작 중",
|
||||
"stop": "중지하고 삽입",
|
||||
"finishing": "받아쓰기 마무리 중",
|
||||
"cancel": "받아쓰기 취소",
|
||||
"meterOnPhone": "녹음 중, {{duration}}, 이 휴대폰에서",
|
||||
"meterOn": "녹음 중, {{duration}}, {{computer}}에서",
|
||||
"meterOnComputer": "녹음 중, {{duration}}, 컴퓨터에서",
|
||||
"meter": "녹음 중, {{duration}}",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"durationSeconds_one": "{{count}}초",
|
||||
"durationSeconds_other": "{{count}}초",
|
||||
"durationMinutes_one": "{{count}}분",
|
||||
"durationMinutes_other": "{{count}}분"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "{{computer}}에서 마무리 중",
|
||||
"finishingOnComputer": "컴퓨터에서 마무리 중",
|
||||
"movedTo": "{{computer}}(으)로 전환됨",
|
||||
"movedToComputer": "컴퓨터로 전환됨"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
@@ -2398,11 +2420,7 @@
|
||||
"terminalInputActions": {
|
||||
"attachFileHint": "사진 대신 파일을 첨부하려면 길게 누르세요.",
|
||||
"attachPhoto": "사진 첨부",
|
||||
"sendingImage": "이미지 전송 중",
|
||||
"startDictation": "음성 받아쓰기 시작",
|
||||
"startingDictation": "음성 받아쓰기 시작 중",
|
||||
"stopDictation": "음성 받아쓰기 중지",
|
||||
"transcribingDictation": "음성 받아쓰기를 텍스트로 변환 중"
|
||||
"sendingImage": "이미지 전송 중"
|
||||
},
|
||||
"terminalLiveInputStatus": {
|
||||
"listening": "듣는 중",
|
||||
@@ -2411,8 +2429,6 @@
|
||||
"processing": "처리 중",
|
||||
"releaseMicHint": "중지하려면 마이크에서 손을 떼세요",
|
||||
"startingMic": "마이크 시작 중",
|
||||
"stopHint": "중지하려면 마이크를 탭하세요",
|
||||
"transcribing": "데스크톱에서 텍스트로 변환 중",
|
||||
"uploadingImage": "호스트에 이미지 업로드 중",
|
||||
"uploadingImageTitle": "이미지 업로드 중"
|
||||
},
|
||||
|
||||
@@ -1341,6 +1341,30 @@
|
||||
"sessionLimit": "Há dispositivos demais ditando neste computador. Tente de novo quando um deles terminar.",
|
||||
"sessionLost": "O ditado perdeu a conexão com o computador. Tente novamente.",
|
||||
"updateFailed": "Falha ao atualizar as configurações de ditado"
|
||||
},
|
||||
"controls": {
|
||||
"start": "Ditar",
|
||||
"starting": "Iniciando o ditado",
|
||||
"stop": "Parar e inserir",
|
||||
"finishing": "Finalizando o ditado",
|
||||
"cancel": "Cancelar ditado",
|
||||
"meterOnPhone": "Gravando, {{duration}}, neste telefone",
|
||||
"meterOn": "Gravando, {{duration}}, em {{computer}}",
|
||||
"meterOnComputer": "Gravando, {{duration}}, no computador",
|
||||
"meter": "Gravando, {{duration}}",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"durationSeconds_one": "{{count}} segundo",
|
||||
"durationSeconds_other": "{{count}} segundos",
|
||||
"durationSeconds_many": "{{count}} segundos",
|
||||
"durationMinutes_one": "{{count}} minuto",
|
||||
"durationMinutes_other": "{{count}} minutos",
|
||||
"durationMinutes_many": "{{count}} minutos"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "Finalizando em {{computer}}",
|
||||
"finishingOnComputer": "Finalizando no computador",
|
||||
"movedTo": "Passou para {{computer}}",
|
||||
"movedToComputer": "Passou para o computador"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
@@ -2470,11 +2494,7 @@
|
||||
"terminalInputActions": {
|
||||
"attachFileHint": "Mantenha pressionado para anexar um arquivo em vez de uma foto",
|
||||
"attachPhoto": "Anexar uma foto",
|
||||
"sendingImage": "Enviando imagem",
|
||||
"startDictation": "Iniciar ditado por voz",
|
||||
"startingDictation": "Iniciando ditado por voz",
|
||||
"stopDictation": "Parar ditado por voz",
|
||||
"transcribingDictation": "Transcrevendo ditado por voz"
|
||||
"sendingImage": "Enviando imagem"
|
||||
},
|
||||
"terminalLiveInputStatus": {
|
||||
"listening": "Ouvindo",
|
||||
@@ -2483,8 +2503,6 @@
|
||||
"processing": "Processando",
|
||||
"releaseMicHint": "Solte o microfone para parar",
|
||||
"startingMic": "Ativando microfone",
|
||||
"stopHint": "Toque no microfone para parar",
|
||||
"transcribing": "Transcrevendo no desktop",
|
||||
"uploadingImage": "Enviando imagem para o host",
|
||||
"uploadingImageTitle": "Enviando imagem"
|
||||
},
|
||||
|
||||
@@ -1380,6 +1380,32 @@
|
||||
"sessionLimit": "На этом компьютере диктует слишком много устройств. Повторите попытку, когда одно из них закончит.",
|
||||
"sessionLost": "Во время диктовки потеряно соединение с компьютером. Попробуйте ещё раз.",
|
||||
"updateFailed": "Не удалось обновить настройки диктовки"
|
||||
},
|
||||
"controls": {
|
||||
"start": "Диктовать",
|
||||
"starting": "Диктовка запускается",
|
||||
"stop": "Остановить и вставить",
|
||||
"finishing": "Диктовка завершается",
|
||||
"cancel": "Отменить диктовку",
|
||||
"meterOnPhone": "Запись, {{duration}}, на этом телефоне",
|
||||
"meterOn": "Запись, {{duration}}, на {{computer}}",
|
||||
"meterOnComputer": "Запись, {{duration}}, на компьютере",
|
||||
"meter": "Запись, {{duration}}",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"durationSeconds_one": "{{count}} секунда",
|
||||
"durationSeconds_other": "{{count}} секунды",
|
||||
"durationSeconds_few": "{{count}} секунды",
|
||||
"durationSeconds_many": "{{count}} секунд",
|
||||
"durationMinutes_one": "{{count}} минута",
|
||||
"durationMinutes_other": "{{count}} минуты",
|
||||
"durationMinutes_few": "{{count}} минуты",
|
||||
"durationMinutes_many": "{{count}} минут"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "Завершается на {{computer}}",
|
||||
"finishingOnComputer": "Завершается на компьютере",
|
||||
"movedTo": "Перешло на {{computer}}",
|
||||
"movedToComputer": "Перешло на компьютер"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
@@ -2538,11 +2564,7 @@
|
||||
"terminalInputActions": {
|
||||
"attachFileHint": "Нажмите и удерживайте, чтобы прикрепить файл вместо фото",
|
||||
"attachPhoto": "Прикрепить фото",
|
||||
"sendingImage": "Отправка изображения",
|
||||
"startDictation": "Начать диктовку",
|
||||
"startingDictation": "Запуск диктовки",
|
||||
"stopDictation": "Остановить диктовку",
|
||||
"transcribingDictation": "Распознавание диктовки"
|
||||
"sendingImage": "Отправка изображения"
|
||||
},
|
||||
"terminalLiveInputStatus": {
|
||||
"listening": "Прослушивание",
|
||||
@@ -2551,8 +2573,6 @@
|
||||
"processing": "Обработка",
|
||||
"releaseMicHint": "Отпустите кнопку микрофона, чтобы остановить запись",
|
||||
"startingMic": "Включение микрофона",
|
||||
"stopHint": "Нажмите на микрофон, чтобы остановить",
|
||||
"transcribing": "Распознавание на компьютере",
|
||||
"uploadingImage": "Загрузка изображения на сервер",
|
||||
"uploadingImageTitle": "Загрузка изображения"
|
||||
},
|
||||
|
||||
@@ -1302,6 +1302,28 @@
|
||||
"sessionLimit": "Bu bilgisayarda çok fazla cihaz dikte ediyor. Biri bitince tekrar deneyin.",
|
||||
"sessionLost": "Diktenin bilgisayarla bağlantısı kesildi. Yeniden deneyin.",
|
||||
"updateFailed": "Dikte ayarları güncellenemedi"
|
||||
},
|
||||
"controls": {
|
||||
"start": "Dikte et",
|
||||
"starting": "Dikte başlatılıyor",
|
||||
"stop": "Durdur ve ekle",
|
||||
"finishing": "Dikte tamamlanıyor",
|
||||
"cancel": "Dikteyi iptal et",
|
||||
"meterOnPhone": "Kaydediliyor, {{duration}}, bu telefonda",
|
||||
"meterOn": "Kaydediliyor, {{duration}}, {{computer}} üzerinde",
|
||||
"meterOnComputer": "Kaydediliyor, {{duration}}, bilgisayarda",
|
||||
"meter": "Kaydediliyor, {{duration}}",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"durationSeconds_one": "{{count}} saniye",
|
||||
"durationSeconds_other": "{{count}} saniye",
|
||||
"durationMinutes_one": "{{count}} dakika",
|
||||
"durationMinutes_other": "{{count}} dakika"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "{{computer}} üzerinde tamamlanıyor",
|
||||
"finishingOnComputer": "Bilgisayarda tamamlanıyor",
|
||||
"movedTo": "{{computer}} cihazına geçildi",
|
||||
"movedToComputer": "Bilgisayara geçildi"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
@@ -2402,11 +2424,7 @@
|
||||
"terminalInputActions": {
|
||||
"attachFileHint": "Fotoğraf yerine dosya eklemek için basılı tutun",
|
||||
"attachPhoto": "Fotoğraf ekle",
|
||||
"sendingImage": "Görsel gönderiliyor",
|
||||
"startDictation": "Sesli dikteyi başlat",
|
||||
"startingDictation": "Sesli dikte başlatılıyor",
|
||||
"stopDictation": "Sesli dikteyi durdur",
|
||||
"transcribingDictation": "Sesli dikte yazıya dökülüyor"
|
||||
"sendingImage": "Görsel gönderiliyor"
|
||||
},
|
||||
"terminalLiveInputStatus": {
|
||||
"listening": "Dinliyor",
|
||||
@@ -2415,8 +2433,6 @@
|
||||
"processing": "İşleniyor",
|
||||
"releaseMicHint": "Durdurmak için mikrofonu bırakın",
|
||||
"startingMic": "Mikrofon başlatılıyor",
|
||||
"stopHint": "Durdurmak için mikrofona dokunun",
|
||||
"transcribing": "Masaüstünde yazıya dökülüyor",
|
||||
"uploadingImage": "Görsel sunucuya yükleniyor",
|
||||
"uploadingImageTitle": "Görsel yükleniyor"
|
||||
},
|
||||
|
||||
@@ -1298,6 +1298,28 @@
|
||||
"sessionLimit": "這台電腦上正在聽寫的裝置過多。請等其中一台結束後再試。",
|
||||
"sessionLost": "聽寫功能與電腦的連線已中斷。請再試一次。",
|
||||
"updateFailed": "無法更新聽寫設定"
|
||||
},
|
||||
"controls": {
|
||||
"start": "聽寫",
|
||||
"starting": "正在開始聽寫",
|
||||
"stop": "停止並插入",
|
||||
"finishing": "正在完成聽寫",
|
||||
"cancel": "取消聽寫",
|
||||
"meterOnPhone": "正在錄音,{{duration}},在此手機上",
|
||||
"meterOn": "正在錄音,{{duration}},在 {{computer}} 上",
|
||||
"meterOnComputer": "正在錄音,{{duration}},在電腦上",
|
||||
"meter": "正在錄音,{{duration}}",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"durationSeconds_one": "{{count}} 秒",
|
||||
"durationSeconds_other": "{{count}} 秒",
|
||||
"durationMinutes_one": "{{count}} 分鐘",
|
||||
"durationMinutes_other": "{{count}} 分鐘"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "正在 {{computer}} 上完成",
|
||||
"finishingOnComputer": "正在電腦上完成",
|
||||
"movedTo": "已轉到 {{computer}}",
|
||||
"movedToComputer": "已轉到電腦"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
@@ -2398,11 +2420,7 @@
|
||||
"terminalInputActions": {
|
||||
"attachFileHint": "長按可改為附加檔案",
|
||||
"attachPhoto": "附加照片",
|
||||
"sendingImage": "正在傳送圖片",
|
||||
"startDictation": "開始語音聽寫",
|
||||
"startingDictation": "正在啟動語音聽寫",
|
||||
"stopDictation": "停止語音聽寫",
|
||||
"transcribingDictation": "正在轉錄語音聽寫內容"
|
||||
"sendingImage": "正在傳送圖片"
|
||||
},
|
||||
"terminalLiveInputStatus": {
|
||||
"listening": "正在聆聽",
|
||||
@@ -2411,8 +2429,6 @@
|
||||
"processing": "處理中",
|
||||
"releaseMicHint": "放開按鈕即可停止錄音",
|
||||
"startingMic": "正在啟動麥克風",
|
||||
"stopHint": "點一下麥克風即可停止",
|
||||
"transcribing": "正在電腦上轉錄",
|
||||
"uploadingImage": "正在將圖片上傳至主機",
|
||||
"uploadingImageTitle": "正在上傳圖片"
|
||||
},
|
||||
|
||||
@@ -1298,6 +1298,28 @@
|
||||
"sessionLimit": "这台电脑上正在听写的设备过多。请等其中一台结束后再试。",
|
||||
"sessionLost": "听写与电脑的连接已断开。请重试。",
|
||||
"updateFailed": "更新听写设置失败"
|
||||
},
|
||||
"controls": {
|
||||
"start": "听写",
|
||||
"starting": "正在开始听写",
|
||||
"stop": "停止并插入",
|
||||
"finishing": "正在完成听写",
|
||||
"cancel": "取消听写",
|
||||
"meterOnPhone": "正在录音,{{duration}},在此手机上",
|
||||
"meterOn": "正在录音,{{duration}},在 {{computer}} 上",
|
||||
"meterOnComputer": "正在录音,{{duration}},在电脑上",
|
||||
"meter": "正在录音,{{duration}}",
|
||||
"durationMinutesSeconds": "{{minutes}} {{seconds}}",
|
||||
"durationSeconds_one": "{{count}} 秒",
|
||||
"durationSeconds_other": "{{count}} 秒",
|
||||
"durationMinutes_one": "{{count}} 分钟",
|
||||
"durationMinutes_other": "{{count}} 分钟"
|
||||
},
|
||||
"status": {
|
||||
"finishingOn": "正在 {{computer}} 上完成",
|
||||
"finishingOnComputer": "正在电脑上完成",
|
||||
"movedTo": "已转到 {{computer}}",
|
||||
"movedToComputer": "已转到电脑"
|
||||
}
|
||||
},
|
||||
"files": {
|
||||
@@ -2398,11 +2420,7 @@
|
||||
"terminalInputActions": {
|
||||
"attachFileHint": "长按可改为附加文件",
|
||||
"attachPhoto": "附加照片",
|
||||
"sendingImage": "正在发送图片",
|
||||
"startDictation": "开始语音听写",
|
||||
"startingDictation": "正在启动语音听写",
|
||||
"stopDictation": "停止语音听写",
|
||||
"transcribingDictation": "正在转写语音听写内容"
|
||||
"sendingImage": "正在发送图片"
|
||||
},
|
||||
"terminalLiveInputStatus": {
|
||||
"listening": "正在聆听",
|
||||
@@ -2411,8 +2429,6 @@
|
||||
"processing": "处理中",
|
||||
"releaseMicHint": "松开麦克风按钮即可停止",
|
||||
"startingMic": "正在启动麦克风",
|
||||
"stopHint": "点按麦克风停止",
|
||||
"transcribing": "正在桌面上转写",
|
||||
"uploadingImage": "正在将图片上传到主机",
|
||||
"uploadingImageTitle": "正在上传图片"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { View } from 'react-native'
|
||||
|
||||
export type PageBox = { left: number; top: number; width: number; height: number }
|
||||
|
||||
// A view's box in page coordinates, the space touch events report pageX/pageY in; null when it has none.
|
||||
export function measurePageBox(target: View, onBox: (box: PageBox | null) => void): void {
|
||||
target.measure((_x, _y, width, height, left, top) => onBox({ left, top, width, height }))
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import type { View } from 'react-native'
|
||||
import type { PageBox } from './page-box'
|
||||
|
||||
export type { PageBox } from './page-box'
|
||||
|
||||
function hasClientRect(node: unknown): node is { getBoundingClientRect: () => DOMRect } {
|
||||
return (
|
||||
typeof node === 'object' &&
|
||||
node !== null &&
|
||||
'getBoundingClientRect' in node &&
|
||||
typeof node.getBoundingClientRect === 'function'
|
||||
)
|
||||
}
|
||||
|
||||
// Read the DOM node now: RNW's measure is async and skips its callback for a detached node, which would lose a release.
|
||||
export function measurePageBox(target: View, onBox: (box: PageBox | null) => void): void {
|
||||
if (!hasClientRect(target)) {
|
||||
onBox(null)
|
||||
return
|
||||
}
|
||||
const rect = target.getBoundingClientRect()
|
||||
onBox({
|
||||
left: rect.left + window.scrollX,
|
||||
top: rect.top + window.scrollY,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
})
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import { MobileAgentMessageProvider } from './native-chat/transcript/MobileAgent
|
||||
import { MobileNativeChatForkProvider } from './MobileNativeChatForkProvider'
|
||||
import { useMobileAgentMessageNavigation } from './use-mobile-agent-message-navigation'
|
||||
import { MobileNativeChatDictationPreviewContext } from './native-chat/composer/mobile-native-chat-dictation-preview-context'
|
||||
import { MobileDictationMeterContext } from '../dictation/mobile-dictation-meter-context'
|
||||
import { resolveMobileNativeChatSessionId } from './native-chat/mobile-native-chat-eligibility'
|
||||
import { colors } from '../theme/mobile-theme'
|
||||
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
|
||||
@@ -322,55 +321,53 @@ export function MobileSessionActiveContent({
|
||||
/>
|
||||
))}
|
||||
<MobileNativeChatDictationPreviewContext.Provider value={chatDictationPreview}>
|
||||
<MobileDictationMeterContext.Provider value={dictation.meter}>
|
||||
<MobileAgentMessageProvider
|
||||
key={JSON.stringify([hostId, executionHost, worktreeId])}
|
||||
tabs={controller.sessionTabs}
|
||||
terminals={controller.terminals}
|
||||
scopeKey={nativeChatImageSource}
|
||||
open={openSender}
|
||||
>
|
||||
<MobileNativeChatForkProvider controller={controller}>
|
||||
<MobileNativeChatOverlay
|
||||
controller={nativeChatController}
|
||||
imageSource={nativeChatImageSource}
|
||||
worktreePath={controller.worktreePath}
|
||||
connState={controller.connState}
|
||||
activeSessionTabId={controller.activeSessionTab?.id}
|
||||
onOpenFile={handleNativeChatFileTap}
|
||||
images={nativeChatImages}
|
||||
structuredComposer={nativeChatStructuredComposer}
|
||||
onMicPress={dictationEnabled ? handleDictationToggle : undefined}
|
||||
micActive={dictation.isStarting || dictation.isRecording}
|
||||
micStarting={dictation.isStarting}
|
||||
micProcessing={dictation.isProcessing}
|
||||
dictationMode={dictationMode}
|
||||
onMicPressIn={handleDictationPressIn}
|
||||
onMicPressOut={handleDictationPressOut}
|
||||
inputLockReason={nativeChatOverlayInputLockReason}
|
||||
sendErrorMessage={nativeChatSendError.message}
|
||||
onClearSendError={nativeChatSendError.clear}
|
||||
sendSurfaceId={controller.nativeChatScopeKey ?? ''}
|
||||
sessionId={resolveMobileNativeChatSessionId(controller.activeSessionTab)}
|
||||
getSendCompletionGeneration={controller.getSendCompletionGeneration}
|
||||
keyboardInset={keyboardLift}
|
||||
// A workspace routed to another server stops with that server, whose name the phone lacks.
|
||||
hostName={executionHost === undefined && hostProfile ? hostTitle : null}
|
||||
onOpenUrlInOrca={openUrlInOrca}
|
||||
hostOutage={nativeChatHostOutage}
|
||||
onRunInTerminal={(command) =>
|
||||
void controller.handleCreateTerminal(undefined, {
|
||||
startupCommand: command,
|
||||
startupCommandDelivery: 'shell-ready',
|
||||
terminalView: true
|
||||
})
|
||||
}
|
||||
// Accounts open on the paired host, so a chat another server runs offers none.
|
||||
onOpenAccounts={executionHost === undefined ? openNativeChatAccounts : undefined}
|
||||
/>
|
||||
</MobileNativeChatForkProvider>
|
||||
</MobileAgentMessageProvider>
|
||||
</MobileDictationMeterContext.Provider>
|
||||
<MobileAgentMessageProvider
|
||||
key={JSON.stringify([hostId, executionHost, worktreeId])}
|
||||
tabs={controller.sessionTabs}
|
||||
terminals={controller.terminals}
|
||||
scopeKey={nativeChatImageSource}
|
||||
open={openSender}
|
||||
>
|
||||
<MobileNativeChatForkProvider controller={controller}>
|
||||
<MobileNativeChatOverlay
|
||||
controller={nativeChatController}
|
||||
imageSource={nativeChatImageSource}
|
||||
worktreePath={controller.worktreePath}
|
||||
connState={controller.connState}
|
||||
activeSessionTabId={controller.activeSessionTab?.id}
|
||||
onOpenFile={handleNativeChatFileTap}
|
||||
images={nativeChatImages}
|
||||
structuredComposer={nativeChatStructuredComposer}
|
||||
onMicPress={dictationEnabled ? handleDictationToggle : undefined}
|
||||
micActive={dictation.isStarting || dictation.isRecording}
|
||||
micStarting={dictation.isStarting}
|
||||
micProcessing={dictation.isProcessing}
|
||||
dictationMode={dictationMode}
|
||||
onMicPressIn={handleDictationPressIn}
|
||||
onMicPressOut={handleDictationPressOut}
|
||||
inputLockReason={nativeChatOverlayInputLockReason}
|
||||
sendErrorMessage={nativeChatSendError.message}
|
||||
onClearSendError={nativeChatSendError.clear}
|
||||
sendSurfaceId={controller.nativeChatScopeKey ?? ''}
|
||||
sessionId={resolveMobileNativeChatSessionId(controller.activeSessionTab)}
|
||||
getSendCompletionGeneration={controller.getSendCompletionGeneration}
|
||||
keyboardInset={keyboardLift}
|
||||
// A workspace routed to another server stops with that server, whose name the phone lacks.
|
||||
hostName={executionHost === undefined && hostProfile ? hostTitle : null}
|
||||
onOpenUrlInOrca={openUrlInOrca}
|
||||
hostOutage={nativeChatHostOutage}
|
||||
onRunInTerminal={(command) =>
|
||||
void controller.handleCreateTerminal(undefined, {
|
||||
startupCommand: command,
|
||||
startupCommandDelivery: 'shell-ready',
|
||||
terminalView: true
|
||||
})
|
||||
}
|
||||
// Accounts open on the paired host, so a chat another server runs offers none.
|
||||
onOpenAccounts={executionHost === undefined ? openNativeChatAccounts : undefined}
|
||||
/>
|
||||
</MobileNativeChatForkProvider>
|
||||
</MobileAgentMessageProvider>
|
||||
</MobileNativeChatDictationPreviewContext.Provider>
|
||||
{toast}
|
||||
</View>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { useRef, type ReactNode } from 'react'
|
||||
import { View } from 'react-native'
|
||||
import { Keyboard as KeyboardIcon } from 'lucide-react-native'
|
||||
import { composerInputStyles as inputStyles } from '../components/composer-input/composer-input-styles'
|
||||
@@ -13,7 +13,6 @@ import { terminalDockStyles as dockStyles } from '../terminal/session/terminal-d
|
||||
import { colors } from '../theme/mobile-theme'
|
||||
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
import { styles } from './mobile-session-styles'
|
||||
import type { MobileSessionController } from './use-mobile-session-controller'
|
||||
import { useMobileSessionKeyboardLift } from '../terminal/session/use-mobile-session-keyboard-lift'
|
||||
import { useLiveInputCaptureText } from '../terminal/session/live-input-capture'
|
||||
@@ -23,6 +22,8 @@ export function MobileSessionCommandDock({ controller }: { controller: MobileSes
|
||||
useMobileColorScheme()
|
||||
const rail = useSessionTerminalKeyRail(controller)
|
||||
const keyboardLift = useMobileSessionKeyboardLift(controller.dockBottomInset)
|
||||
// The field's ✕, which the held mic may be released over.
|
||||
const dictationCancelRef = useRef<View>(null)
|
||||
const {
|
||||
insets,
|
||||
dictationMode,
|
||||
@@ -63,6 +64,7 @@ export function MobileSessionCommandDock({ controller }: { controller: MobileSes
|
||||
trailing={
|
||||
<MobileTerminalLiveInputStatus
|
||||
dictation={dictation}
|
||||
cancelRef={dictationCancelRef}
|
||||
dictationMode={dictationMode}
|
||||
heard={liveDictationText}
|
||||
isAttaching={isAttaching}
|
||||
@@ -76,7 +78,7 @@ export function MobileSessionCommandDock({ controller }: { controller: MobileSes
|
||||
dictationMode={dictationMode}
|
||||
dictationEnabled={dictationEnabled}
|
||||
buttonStyle={inputStyles.controlButton}
|
||||
activeButtonStyle={styles.dictationButtonActive}
|
||||
dictationCancelRef={dictationCancelRef}
|
||||
disabledButtonStyle={inputStyles.disabled}
|
||||
onAttachImage={() => void attachImage('library')}
|
||||
onAttachFile={() => void attachImage('files')}
|
||||
|
||||
@@ -10,6 +10,8 @@ import type { MobileSessionController } from './use-mobile-session-controller'
|
||||
import { MobileSessionActiveContent } from './MobileSessionActiveContent'
|
||||
import { MobileSessionCommandDock } from './MobileSessionCommandDock'
|
||||
import { MobileDictationStatusAnnouncement } from '../dictation/MobileDictationStatusAnnouncement'
|
||||
import { MobileDictationLiveContext } from '../dictation/mobile-dictation-live-context'
|
||||
import { useMobileDictationLive } from '../dictation/use-mobile-dictation-live'
|
||||
|
||||
export function MobileSessionContentRow({ controller }: { controller: MobileSessionController }) {
|
||||
useMobileColorScheme()
|
||||
@@ -25,8 +27,10 @@ export function MobileSessionContentRow({ controller }: { controller: MobileSess
|
||||
setCreateWarningState,
|
||||
createWarning,
|
||||
dictation,
|
||||
cancelDictation,
|
||||
handleSessionContentRowLayout
|
||||
} = controller
|
||||
const dictationLive = useMobileDictationLive(dictation, cancelDictation, hostId)
|
||||
return (
|
||||
<View style={styles.sessionContentRow} onLayout={handleSessionContentRowLayout}>
|
||||
<View style={styles.sessionContentMain}>
|
||||
@@ -47,9 +51,11 @@ export function MobileSessionContentRow({ controller }: { controller: MobileSess
|
||||
</Pressable>
|
||||
</View>
|
||||
) : null}
|
||||
<MobileSessionActiveContent controller={controller} />
|
||||
{/* Why: translate instead of resize so keyboard toggles don't trigger a server-side PTY viewport change. */}
|
||||
<MobileSessionCommandDock controller={controller} />
|
||||
<MobileDictationLiveContext.Provider value={dictationLive}>
|
||||
<MobileSessionActiveContent controller={controller} />
|
||||
{/* Why: translate instead of resize so keyboard toggles don't trigger a server-side PTY viewport change. */}
|
||||
<MobileSessionCommandDock controller={controller} />
|
||||
</MobileDictationLiveContext.Provider>
|
||||
<MobileDictationStatusAnnouncement dictation={dictation} />
|
||||
</View>
|
||||
{canDockPanel && activePanel !== null && (
|
||||
|
||||
@@ -42,6 +42,7 @@ import { useMobileNativeChatContextRing } from './MobileNativeChatContextUsageRi
|
||||
import type { MobileNativeChatSendIntent } from '../mobile-native-chat-send'
|
||||
import { MobileNativeChatComposerMic } from './MobileNativeChatComposerMic'
|
||||
import type { MobileNativeChatMicProps } from './MobileNativeChatComposerMic'
|
||||
import { MobileNativeChatDictationLeading } from './MobileNativeChatDictationLeading'
|
||||
import type { MobileNativeChatStructuredComposer } from './mobile-native-chat-structured-composer'
|
||||
import { useMobileNativeChatComposerGoalMode } from './use-mobile-native-chat-composer-goal-mode'
|
||||
import { MobileNativeChatComposerPlanChip } from './MobileNativeChatComposerPlanChip'
|
||||
@@ -151,6 +152,8 @@ export function MobileNativeChatComposer({
|
||||
const fallbackInputRef = useRef<TextInput>(null)
|
||||
const fieldRef = inputRef ?? fallbackInputRef
|
||||
const groupRef = useRef<View>(null)
|
||||
// This composer's ✕, which its own held mic may be released over.
|
||||
const cancelRef = useRef<View>(null)
|
||||
const [focused, setFocused] = useState(false)
|
||||
const [picker, setPicker] = useMobileNativeChatPickerPresentation(
|
||||
sessionOptions?.controller.optionPickerRequest
|
||||
@@ -341,7 +344,9 @@ export function MobileNativeChatComposer({
|
||||
textAlignVertical="top"
|
||||
/>
|
||||
<View style={inputStyles.actionRow} testID="native-chat-composer-actions">
|
||||
<View style={styles.leadingControls}>
|
||||
<MobileNativeChatDictationLeading
|
||||
{...{ micActive, micStarting, micProcessing, cancelRef }}
|
||||
>
|
||||
<MobileNativeChatComposerAttachButton
|
||||
onAttachImage={onAttachImage}
|
||||
onAttachFiles={structured?.onAttachFiles}
|
||||
@@ -367,17 +372,12 @@ export function MobileNativeChatComposer({
|
||||
) : null}
|
||||
<MobileNativeChatComposerPlanChip options={sessionOptions} inputRef={fieldRef} />
|
||||
{goal.chip}
|
||||
</View>
|
||||
{contextRing.ring}
|
||||
</MobileNativeChatDictationLeading>
|
||||
{micActive || micProcessing ? null : contextRing.ring}
|
||||
{onMicPress ? (
|
||||
<MobileNativeChatComposerMic
|
||||
onMicPress={onMicPress}
|
||||
micActive={micActive}
|
||||
micStarting={micStarting}
|
||||
micProcessing={micProcessing}
|
||||
dictationMode={dictationMode}
|
||||
onMicPressIn={onMicPressIn}
|
||||
onMicPressOut={onMicPressOut}
|
||||
{...{ onMicPress, micActive, micStarting, micProcessing, dictationMode }}
|
||||
{...{ onMicPressIn, onMicPressOut, cancelRef }}
|
||||
disabled={disabled || offline}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
import { ActivityIndicator, Pressable, View } from 'react-native'
|
||||
import { Mic, Square } from 'lucide-react-native'
|
||||
import { useContext } from 'react'
|
||||
import { colors } from '../../../theme/mobile-theme'
|
||||
import {
|
||||
MobileDictationGrapes,
|
||||
MobileDictationTimer
|
||||
} from '../../../dictation/MobileDictationMeter'
|
||||
import { MobileDictationMeterContext } from '../../../dictation/mobile-dictation-meter-context'
|
||||
import { Pressable, type View } from 'react-native'
|
||||
import { useContext, type RefObject } from 'react'
|
||||
import { MobileDictationLiveContext } from '../../../dictation/mobile-dictation-live-context'
|
||||
import { dictationControlsCopy } from '../../../dictation/mobile-dictation-controls-copy'
|
||||
import { MobileDictationMicIcon } from '../../../dictation/MobileDictationLiveControls'
|
||||
import { useMobileDictationCancelDrop } from '../../../dictation/use-mobile-dictation-cancel-drop'
|
||||
import { useMobileTranslation } from '../../../i18n/use-mobile-translation'
|
||||
import { keepHeldPressThroughLongPress } from '../../../platform/held-press-long-press'
|
||||
import {
|
||||
COMPOSER_CONTROL_HIT_SLOP,
|
||||
composerInputStyles as inputStyles
|
||||
} from '../../../components/composer-input/composer-input-styles'
|
||||
import { mobileNativeChatComposerStyles as styles } from './mobile-native-chat-composer-styles'
|
||||
import { MobileNativeChatControlSwap } from '../input/mobile-native-chat-control-swap'
|
||||
|
||||
export type MobileNativeChatMicProps = {
|
||||
@@ -36,61 +33,47 @@ export function MobileNativeChatComposerMic({
|
||||
dictationMode = 'toggle',
|
||||
onMicPressIn,
|
||||
onMicPressOut,
|
||||
cancelRef,
|
||||
disabled
|
||||
}: MobileNativeChatMicProps & { disabled: boolean }): React.JSX.Element {
|
||||
const meter = useContext(MobileDictationMeterContext)
|
||||
const recordingMeter = micActive && !micStarting ? meter : null
|
||||
// Keep the mic at the same fragment slot: remounting it mid-hold would lose the release.
|
||||
}: MobileNativeChatMicProps & {
|
||||
disabled: boolean
|
||||
// The composer's ✕ that a held mic may be released over.
|
||||
cancelRef?: RefObject<View | null>
|
||||
}): React.JSX.Element {
|
||||
useMobileTranslation()
|
||||
const live = useContext(MobileDictationLiveContext)
|
||||
const release = useMobileDictationCancelDrop(cancelRef, live?.cancel, onMicPressOut)
|
||||
return (
|
||||
<>
|
||||
{recordingMeter ? (
|
||||
<View style={styles.dictationMeter}>
|
||||
<MobileDictationGrapes meter={recordingMeter} dotSize={5} />
|
||||
<MobileDictationTimer meter={recordingMeter} />
|
||||
</View>
|
||||
) : null}
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
aria-busy={micStarting || micProcessing}
|
||||
accessibilityLabel={
|
||||
micStarting
|
||||
? 'Starting dictation'
|
||||
: micActive
|
||||
? 'Stop dictation'
|
||||
: micProcessing
|
||||
? 'Transcribing dictation'
|
||||
: 'Dictate'
|
||||
}
|
||||
style={({ pressed }) => [inputStyles.ghostButton, pressed && inputStyles.pressed]}
|
||||
// Hold mode is walkie-talkie (press-in/out); toggle mode taps.
|
||||
onPress={dictationMode === 'hold' ? undefined : onMicPress}
|
||||
onPressIn={dictationMode === 'hold' ? onMicPressIn : undefined}
|
||||
onPressOut={dictationMode === 'hold' ? onMicPressOut : undefined}
|
||||
onLongPress={dictationMode === 'hold' ? keepHeldPressThroughLongPress : undefined}
|
||||
disabled={disabled && !micActive}
|
||||
hitSlop={COMPOSER_CONTROL_HIT_SLOP}
|
||||
>
|
||||
{/* The icon swaps on press; as the page's touch target, its removal would send
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
aria-busy={micStarting || micProcessing}
|
||||
accessibilityLabel={dictationControlsCopy.mic({
|
||||
starting: micStarting,
|
||||
active: micActive,
|
||||
processing: micProcessing
|
||||
})}
|
||||
style={({ pressed }) => [inputStyles.ghostButton, pressed && inputStyles.pressed]}
|
||||
// Hold mode is walkie-talkie (press-in/out); toggle mode taps.
|
||||
onPress={dictationMode === 'hold' ? undefined : onMicPress}
|
||||
onPressIn={dictationMode === 'hold' ? onMicPressIn : undefined}
|
||||
onPressOut={dictationMode === 'hold' ? release : undefined}
|
||||
onLongPress={dictationMode === 'hold' ? keepHeldPressThroughLongPress : undefined}
|
||||
disabled={disabled && !micActive}
|
||||
hitSlop={COMPOSER_CONTROL_HIT_SLOP}
|
||||
>
|
||||
{/* The icon swaps on press; as the page's touch target, its removal would send
|
||||
touchend to a detached node and lose the release. */}
|
||||
<MobileNativeChatControlSwap
|
||||
swapKey={micProcessing ? 'processing' : micActive ? 'active' : 'idle'}
|
||||
icon
|
||||
>
|
||||
{micProcessing ? (
|
||||
<ActivityIndicator pointerEvents="none" size="small" color={colors.textSecondary} />
|
||||
) : micActive ? (
|
||||
<Square
|
||||
pointerEvents="none"
|
||||
size={16}
|
||||
color={colors.statusRed}
|
||||
strokeWidth={2.4}
|
||||
fill={colors.statusRed}
|
||||
/>
|
||||
) : (
|
||||
<Mic pointerEvents="none" size={19} color={colors.textSecondary} strokeWidth={2} />
|
||||
)}
|
||||
</MobileNativeChatControlSwap>
|
||||
</Pressable>
|
||||
</>
|
||||
<MobileNativeChatControlSwap
|
||||
swapKey={micProcessing ? 'processing' : micActive ? 'active' : 'idle'}
|
||||
icon
|
||||
>
|
||||
<MobileDictationMicIcon
|
||||
active={micActive}
|
||||
processing={micProcessing}
|
||||
micSize={19}
|
||||
micStroke={2}
|
||||
/>
|
||||
</MobileNativeChatControlSwap>
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { useContext, type ReactNode, type RefObject } from 'react'
|
||||
import { View } from 'react-native'
|
||||
import { MobileDictationLiveContext } from '../../../dictation/mobile-dictation-live-context'
|
||||
import {
|
||||
MobileDictationCancelButton,
|
||||
MobileDictationFinishingNote,
|
||||
MobileDictationRecordingMeter
|
||||
} from '../../../dictation/MobileDictationLiveControls'
|
||||
import { mobileNativeChatComposerStyles as styles } from './mobile-native-chat-composer-styles'
|
||||
|
||||
// While dictating, the row's leading side swaps attach and the pickers for ✕ and the meter, so the composer keeps its height.
|
||||
export function MobileNativeChatDictationLeading({
|
||||
micActive,
|
||||
micStarting = false,
|
||||
micProcessing = false,
|
||||
cancelRef,
|
||||
children
|
||||
}: {
|
||||
micActive: boolean
|
||||
micStarting?: boolean
|
||||
micProcessing?: boolean
|
||||
cancelRef: RefObject<View | null>
|
||||
children: ReactNode
|
||||
}): React.JSX.Element {
|
||||
const live = useContext(MobileDictationLiveContext)
|
||||
if (!live || (!micActive && !micProcessing)) {
|
||||
return <View style={styles.leadingControls}>{children}</View>
|
||||
}
|
||||
return (
|
||||
<View style={[styles.leadingControls, styles.dictationLeading]}>
|
||||
<MobileDictationCancelButton onCancel={live.cancel} targetRef={cancelRef} />
|
||||
{micProcessing ? (
|
||||
<MobileDictationFinishingNote engine={live.engine} computerName={live.computerName} />
|
||||
) : micStarting ? null : (
|
||||
<MobileDictationRecordingMeter
|
||||
meter={live.meter}
|
||||
engine={live.engine}
|
||||
computerName={live.computerName}
|
||||
dotSize={5}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -22,12 +22,8 @@ export const mobileNativeChatComposerStyles = themedStyleSheet(() => ({
|
||||
alignItems: 'center',
|
||||
gap: spacing.sm
|
||||
},
|
||||
dictationMeter: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-end',
|
||||
gap: spacing.sm,
|
||||
flexGrow: 6,
|
||||
flexShrink: 0
|
||||
// One line while dictating: a long computer name truncates instead of wrapping and growing the composer.
|
||||
dictationLeading: {
|
||||
flexWrap: 'nowrap'
|
||||
}
|
||||
}))
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { ActivityIndicator, Pressable, type StyleProp, type ViewStyle } from 'react-native'
|
||||
import { ImagePlus, Mic } from 'lucide-react-native'
|
||||
import type { RefObject } from 'react'
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Pressable,
|
||||
type StyleProp,
|
||||
type View,
|
||||
type ViewStyle
|
||||
} from 'react-native'
|
||||
import { ImagePlus } from 'lucide-react-native'
|
||||
import { colors } from '../../theme/mobile-theme'
|
||||
import {
|
||||
COMPOSER_CONTROL_HIT_SLOP,
|
||||
@@ -8,6 +15,9 @@ import {
|
||||
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import { keepHeldPressThroughLongPress } from '../../platform/held-press-long-press'
|
||||
import { dictationControlsCopy } from '../../dictation/mobile-dictation-controls-copy'
|
||||
import { useMobileDictationCancelDrop } from '../../dictation/use-mobile-dictation-cancel-drop'
|
||||
import { MobileDictationMicIcon } from '../../dictation/MobileDictationLiveControls'
|
||||
|
||||
type DictationState = {
|
||||
readonly isStarting: boolean
|
||||
@@ -21,8 +31,9 @@ type MobileTerminalDictationButtonProps = {
|
||||
readonly dictationMode: string | undefined
|
||||
readonly dictationEnabled?: boolean
|
||||
readonly buttonStyle: StyleProp<ViewStyle>
|
||||
readonly activeButtonStyle: StyleProp<ViewStyle>
|
||||
readonly disabledButtonStyle: StyleProp<ViewStyle>
|
||||
// The ✕ on the field that a held mic may be released over.
|
||||
readonly dictationCancelRef: RefObject<View | null>
|
||||
readonly onDictationToggle: () => void
|
||||
readonly onDictationPressIn: () => void
|
||||
readonly onDictationPressOut: () => void
|
||||
@@ -42,9 +53,11 @@ type MobileTerminalInputActionsProps = MobileTerminalDictationButtonProps &
|
||||
MobileTerminalAttachButtonProps
|
||||
|
||||
export function MobileTerminalInputActions(props: MobileTerminalInputActionsProps) {
|
||||
const { isStarting, isRecording, isProcessing } = props.dictation
|
||||
// Attach steps aside while dictating so the words get the field's room.
|
||||
return (
|
||||
<>
|
||||
<MobileTerminalAttachButton {...props} />
|
||||
{isStarting || isRecording || isProcessing ? null : <MobileTerminalAttachButton {...props} />}
|
||||
<MobileTerminalDictationButton {...props} />
|
||||
</>
|
||||
)
|
||||
@@ -98,15 +111,20 @@ function MobileTerminalDictationButton({
|
||||
dictationMode,
|
||||
dictationEnabled = true,
|
||||
buttonStyle,
|
||||
activeButtonStyle,
|
||||
disabledButtonStyle,
|
||||
dictationCancelRef,
|
||||
onDictationToggle,
|
||||
onDictationPressIn,
|
||||
onDictationPressOut,
|
||||
onDictationCancel
|
||||
}: MobileTerminalDictationButtonProps) {
|
||||
useMobileColorScheme()
|
||||
const t = useMobileTranslation()
|
||||
useMobileTranslation()
|
||||
const release = useMobileDictationCancelDrop(
|
||||
dictationCancelRef,
|
||||
onDictationCancel,
|
||||
onDictationPressOut
|
||||
)
|
||||
if (!dictationEnabled) {
|
||||
return null
|
||||
}
|
||||
@@ -117,7 +135,6 @@ function MobileTerminalDictationButton({
|
||||
<Pressable
|
||||
style={({ pressed }) => [
|
||||
buttonStyle,
|
||||
dictationActive && activeButtonStyle,
|
||||
pressed && composerInputStyles.pressed,
|
||||
micDisabled && disabledButtonStyle
|
||||
]}
|
||||
@@ -125,7 +142,7 @@ function MobileTerminalDictationButton({
|
||||
hitSlop={COMPOSER_CONTROL_HIT_SLOP}
|
||||
onPress={dictationMode === 'toggle' ? onDictationToggle : undefined}
|
||||
onPressIn={dictationMode === 'hold' ? onDictationPressIn : undefined}
|
||||
onPressOut={dictationMode === 'hold' ? onDictationPressOut : undefined}
|
||||
onPressOut={dictationMode === 'hold' ? release : undefined}
|
||||
onLongPress={
|
||||
dictationMode === 'toggle'
|
||||
? () => {
|
||||
@@ -137,28 +154,18 @@ function MobileTerminalDictationButton({
|
||||
}
|
||||
accessibilityRole="button"
|
||||
aria-busy={dictation.isStarting || dictation.isProcessing}
|
||||
accessibilityLabel={
|
||||
dictation.isRecording
|
||||
? t('session.terminalInputActions.stopDictation', 'Stop voice dictation')
|
||||
: dictation.isProcessing
|
||||
? t(
|
||||
'session.terminalInputActions.transcribingDictation',
|
||||
'Transcribing voice dictation'
|
||||
)
|
||||
: dictation.isStarting
|
||||
? t('session.terminalInputActions.startingDictation', 'Starting voice dictation')
|
||||
: t('session.terminalInputActions.startDictation', 'Start voice dictation')
|
||||
}
|
||||
accessibilityLabel={dictationControlsCopy.mic({
|
||||
starting: dictation.isStarting,
|
||||
active: dictationActive,
|
||||
processing: dictation.isProcessing
|
||||
})}
|
||||
>
|
||||
{dictation.isProcessing ? (
|
||||
<ActivityIndicator size="small" color={colors.textSecondary} />
|
||||
) : (
|
||||
<Mic
|
||||
size={17}
|
||||
color={dictationActive ? colors.textPrimary : colors.textSecondary}
|
||||
strokeWidth={2.4}
|
||||
/>
|
||||
)}
|
||||
<MobileDictationMicIcon
|
||||
active={dictationActive}
|
||||
processing={dictation.isProcessing}
|
||||
micSize={17}
|
||||
micStroke={2.4}
|
||||
/>
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useContext, type RefObject } from 'react'
|
||||
import { Text, View } from 'react-native'
|
||||
import type { UseMobileDictationResult } from '../../hooks/mobile-dictation-session-state'
|
||||
import { colors, radii, spacing, typography } from '../../theme/mobile-theme'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
|
||||
@@ -9,58 +9,80 @@ import {
|
||||
mobileDictationStatusTitle,
|
||||
type MobileDictationStatusFlags
|
||||
} from '../../dictation/MobileDictationStatusAnnouncement'
|
||||
import { MobileDictationGrapes, MobileDictationTimer } from '../../dictation/MobileDictationMeter'
|
||||
import { MobileDictationLiveContext } from '../../dictation/mobile-dictation-live-context'
|
||||
import {
|
||||
MobileDictationCancelButton,
|
||||
MobileDictationFinishingNote,
|
||||
MobileDictationRecordingMeter
|
||||
} from '../../dictation/MobileDictationLiveControls'
|
||||
|
||||
type MobileTerminalLiveInputStatusProps = {
|
||||
readonly dictation: MobileDictationStatusFlags & Pick<UseMobileDictationResult, 'meter'>
|
||||
readonly dictation: MobileDictationStatusFlags
|
||||
readonly cancelRef: RefObject<View | null>
|
||||
readonly dictationMode: string | undefined
|
||||
readonly isAttaching: boolean
|
||||
// Words heard so far that will be typed into this terminal.
|
||||
readonly heard: string
|
||||
}
|
||||
|
||||
/** Shows transient recording/upload status over the field without intercepting its touches. */
|
||||
/** Shows transient recording/upload status over the field; only its ✕ takes touches. */
|
||||
export function MobileTerminalLiveInputStatus({
|
||||
dictation,
|
||||
cancelRef,
|
||||
dictationMode,
|
||||
isAttaching,
|
||||
heard
|
||||
}: MobileTerminalLiveInputStatusProps) {
|
||||
useMobileColorScheme()
|
||||
const t = useMobileTranslation()
|
||||
const live = useContext(MobileDictationLiveContext)
|
||||
const dictationTitle = mobileDictationStatusTitle(dictation)
|
||||
if (!dictationTitle && !isAttaching) {
|
||||
return null
|
||||
if (!dictationTitle) {
|
||||
return isAttaching ? (
|
||||
<View style={styles.status} pointerEvents="none">
|
||||
<Text style={styles.title} numberOfLines={1}>
|
||||
{t('session.terminalLiveInputStatus.uploadingImageTitle', 'Uploading image')}
|
||||
</Text>
|
||||
<View style={styles.detailLine}>
|
||||
<TailClippedText style={styles.detail}>
|
||||
{t('session.terminalLiveInputStatus.uploadingImage', 'Uploading image to host')}
|
||||
</TailClippedText>
|
||||
</View>
|
||||
</View>
|
||||
) : null
|
||||
}
|
||||
const title =
|
||||
dictationTitle ?? t('session.terminalLiveInputStatus.uploadingImageTitle', 'Uploading image')
|
||||
// Live input can't type into the terminal until the text is final, so the newest words show here.
|
||||
const detail =
|
||||
heard ||
|
||||
(dictation.isRecording
|
||||
? dictationMode === 'hold'
|
||||
? t('session.terminalLiveInputStatus.releaseMicHint', 'Release mic to stop')
|
||||
: t('session.terminalLiveInputStatus.stopHint', 'Tap mic to stop')
|
||||
: dictation.isProcessing
|
||||
? t('session.terminalLiveInputStatus.transcribing', 'Transcribing on desktop')
|
||||
: dictation.isStarting
|
||||
? t('session.terminalLiveInputStatus.preparingMic', 'Preparing microphone')
|
||||
: t('session.terminalLiveInputStatus.uploadingImage', 'Uploading image to host'))
|
||||
|
||||
: dictationTitle
|
||||
: dictation.isStarting
|
||||
? t('session.terminalLiveInputStatus.preparingMic', 'Preparing microphone')
|
||||
: '')
|
||||
return (
|
||||
<View style={styles.status} pointerEvents="none">
|
||||
<Text style={styles.title} numberOfLines={1}>
|
||||
{title}
|
||||
</Text>
|
||||
{dictation.isRecording ? <MobileDictationTimer meter={dictation.meter} /> : null}
|
||||
<View style={styles.detailLine}>
|
||||
<TailClippedText style={heard ? [styles.detail, styles.heard] : styles.detail}>
|
||||
{detail}
|
||||
</TailClippedText>
|
||||
</View>
|
||||
{dictation.isRecording ? (
|
||||
<MobileDictationGrapes meter={dictation.meter} dotSize={3.5} />
|
||||
<View style={[styles.status, styles.dictating]} pointerEvents="box-none">
|
||||
{live ? (
|
||||
<MobileDictationCancelButton onCancel={live.cancel} targetRef={cancelRef} compact />
|
||||
) : null}
|
||||
<View style={styles.dictationLine} pointerEvents="none">
|
||||
<View style={styles.detailLine}>
|
||||
<TailClippedText style={heard ? [styles.detail, styles.heard] : styles.detail}>
|
||||
{detail}
|
||||
</TailClippedText>
|
||||
</View>
|
||||
{live === null ? null : dictation.isRecording ? (
|
||||
<MobileDictationRecordingMeter
|
||||
meter={live.meter}
|
||||
engine={live.engine}
|
||||
computerName={live.computerName}
|
||||
dotSize={3.5}
|
||||
/>
|
||||
) : dictation.isProcessing ? (
|
||||
<MobileDictationFinishingNote engine={live.engine} computerName={live.computerName} />
|
||||
) : null}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -80,6 +102,17 @@ const styles = themedStyleSheet(() => ({
|
||||
borderRadius: radii.pill,
|
||||
backgroundColor: colors.bgRaised
|
||||
},
|
||||
// The ✕ hugs the field's left edge, the way the mock's cancel sits in the pill.
|
||||
dictating: {
|
||||
paddingLeft: 4
|
||||
},
|
||||
dictationLine: {
|
||||
flex: 1,
|
||||
minWidth: 0,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
gap: spacing.sm
|
||||
},
|
||||
title: {
|
||||
color: colors.textPrimary,
|
||||
fontSize: typography.metaSize,
|
||||
|
||||
@@ -10,12 +10,12 @@ import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import type { TerminalFrame } from '../terminal-webview-messages'
|
||||
import { TerminalWebView } from '../TerminalWebView'
|
||||
import type {
|
||||
MobileTerminalTheme,
|
||||
TerminalKeyboardAvoidanceMetrics,
|
||||
TerminalModes,
|
||||
TerminalPointerInput,
|
||||
TerminalWebViewHandle
|
||||
} from '../terminal-webview-contract'
|
||||
import type { RuntimeMobileTerminalTheme } from '../../../../src/shared/runtime-mobile-session-tab-contracts'
|
||||
|
||||
type TerminalPaneViewProps = {
|
||||
handle: string
|
||||
@@ -28,7 +28,7 @@ type TerminalPaneViewProps = {
|
||||
title?: string
|
||||
onFrame?: (handle: string, frame: TerminalFrame) => void
|
||||
keyboardLift: number
|
||||
terminalTheme?: MobileTerminalTheme
|
||||
terminalTheme?: RuntimeMobileTerminalTheme
|
||||
textScale: number
|
||||
onRef: (handle: string, ref: TerminalWebViewHandle | null) => void
|
||||
onWebReady: (handle: string) => void
|
||||
|
||||
@@ -75,9 +75,5 @@ export const mobileSessionCommandInputStyles = themedStyleSheet(() => ({
|
||||
keyboardDismissChevron: {
|
||||
bottom: -2,
|
||||
position: 'absolute'
|
||||
},
|
||||
dictationButtonActive: {
|
||||
borderWidth: 1,
|
||||
borderColor: colors.textSecondary
|
||||
}
|
||||
}))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RuntimeMobileTerminalTheme as MobileTerminalTheme } from '../../../../src/shared/runtime-mobile-session-tab-contracts'
|
||||
import type { RuntimeMobileTerminalTheme } from '../../../../src/shared/runtime-mobile-session-tab-contracts'
|
||||
import type { AgentStatusEntry } from '../../../../src/shared/agent-status/contracts/agent-status-types'
|
||||
import type { BrowserLoadError } from '../../../../src/shared/browser-workspace-types'
|
||||
import { browserLoadErrorsEqual } from '../../../../src/shared/browser-load-failure'
|
||||
@@ -7,7 +7,7 @@ import { translate } from '../../i18n/mobile-i18n'
|
||||
export type TerminalRecord = {
|
||||
handle: string
|
||||
title: string
|
||||
terminalTheme?: MobileTerminalTheme
|
||||
terminalTheme?: RuntimeMobileTerminalTheme
|
||||
isActive: boolean
|
||||
/** From `terminal.list`; parked and proven-absent leaves report false. */
|
||||
connected?: boolean
|
||||
@@ -30,7 +30,7 @@ export type MobileTerminalSessionTab = {
|
||||
/** Host-provided launch context still parked as an unsent TUI-input draft. */
|
||||
launchDraft?: string
|
||||
launchDraftCreatedAt?: number
|
||||
terminalTheme?: MobileTerminalTheme
|
||||
terminalTheme?: RuntimeMobileTerminalTheme
|
||||
isActive: boolean
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ type MobileSessionTabLike =
|
||||
}
|
||||
|
||||
export function mobileTerminalThemesEqual(
|
||||
left: MobileTerminalTheme | null | undefined,
|
||||
right: MobileTerminalTheme | null | undefined
|
||||
left: RuntimeMobileTerminalTheme | null | undefined,
|
||||
right: RuntimeMobileTerminalTheme | null | undefined
|
||||
): boolean {
|
||||
if (left === right) {
|
||||
return true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ParsedFileLinkLocation } from '../../../src/shared/file-links/file-link-location'
|
||||
import type { RuntimeMobileTerminalTheme } from '../../../src/shared/runtime-types'
|
||||
import type { RuntimeMobileTerminalTheme } from '../../../src/shared/runtime-mobile-session-tab-contracts'
|
||||
import type { TerminalOscLinkRange } from '../../../src/shared/terminal/links/terminal-osc-link-ranges'
|
||||
import type { StyleProp, ViewStyle } from 'react-native'
|
||||
import type { TerminalFitDimensions } from './terminal-grid-fit'
|
||||
@@ -61,8 +61,6 @@ function toNonNegativeInteger(value: unknown): number {
|
||||
return typeof value === 'number' && Number.isFinite(value) && value > 0 ? Math.floor(value) : 0
|
||||
}
|
||||
|
||||
export type MobileTerminalTheme = RuntimeMobileTerminalTheme
|
||||
|
||||
export type TerminalPointerInput = {
|
||||
readonly click: boolean
|
||||
}
|
||||
@@ -89,7 +87,7 @@ export type TerminalSelectionEvents = {
|
||||
|
||||
export type TerminalWebViewProps = {
|
||||
style?: StyleProp<ViewStyle>
|
||||
terminalTheme?: MobileTerminalTheme
|
||||
terminalTheme?: RuntimeMobileTerminalTheme
|
||||
// Persistent font-size preset; transient CSS pinch zoom is committed into it on release.
|
||||
textScale?: number
|
||||
// Only initially shown views build pre-ready engines, limiting WebGL context use.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RuntimeMobileTerminalTheme } from '../../../../src/shared/runtime-types'
|
||||
import type { RuntimeMobileTerminalTheme } from '../../../../src/shared/runtime-mobile-session-tab-contracts'
|
||||
import { colors } from '../../theme/mobile-theme'
|
||||
|
||||
export const DEFAULT_TERMINAL_THEME: RuntimeMobileTerminalTheme['theme'] = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RuntimeMobileTerminalTheme } from '../../../src/shared/runtime-types'
|
||||
import type { RuntimeMobileTerminalTheme } from '../../../src/shared/runtime-mobile-session-tab-contracts'
|
||||
import type { TerminalOscLinkRange } from '../../../src/shared/terminal/links/terminal-osc-link-ranges'
|
||||
|
||||
export type TerminalFrame = { width: number; height: number }
|
||||
|
||||
@@ -240,6 +240,10 @@
|
||||
{
|
||||
"file": "src/session/native-chat/MobileNativeChatLowerRegion.web.tsx",
|
||||
"reason": "The shipping web session owns DOM scroll anchoring and reveals focused lower controls inside the keyboard-safe viewport. Native rendering keeps its existing scroll behavior."
|
||||
},
|
||||
{
|
||||
"file": "src/platform/page-box.web.ts",
|
||||
"reason": "RNW's measure() is asynchronous and drops its callback for a detached node, so a held mic released over the dictation cancel button would never stop. The page reads the DOM box synchronously; native keeps measure()."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -374,6 +374,12 @@ Run it as a loop: read the `provisionTranscript` in the failed result, fix the s
|
||||
`ok` is `true`. Do not wait for the user to paste errors. How to read the transcript is in
|
||||
`references/failure-modes.md`.
|
||||
|
||||
Once a workspace runs on the environment, check the environment itself from a terminal inside it:
|
||||
`ORCA vm env doctor --json` reports required CLIs (git plus what the repo manifests imply), agent
|
||||
CLIs and their sign-in, Git fetch and a dry-run push, the `orca.yaml` setup script, and free disk.
|
||||
Add `--run-setup` to re-run `scripts.setup` and gate on its exit code. Loop on it the same way: fix
|
||||
`orca.yaml` or the image, re-run, until no check fails and every `warn` is resolved or explained.
|
||||
|
||||
The self-test sees only what the scripts print, so confirm separately that state holds an
|
||||
**authenticated** `snapshotId` and that `destroy` is implemented and tested. With `destroy: none`
|
||||
the self-test tears nothing down and you must clean up by hand.
|
||||
|
||||
@@ -36,7 +36,8 @@ ORCA orchestration worker-start --spec "<task>" --worktree current --agent codex
|
||||
- If a receipt has `next`, follow it. When Orca has nothing for you, end your
|
||||
turn.
|
||||
- `--worktree current` uses your workspace. Use a new one only when the user
|
||||
asks or sharing would conflict:
|
||||
asks or sharing would conflict: `--worktree new-child --name <short-name>`
|
||||
nests it under yours. For one with no parent, use
|
||||
`--worktree new-top-level --repo id:<repoId> --name <short-name>`
|
||||
(`ORCA repo list --json` gives the id). If nothing needs to come back to you
|
||||
(the user will work in those chats), don't start workers; per workspace run
|
||||
|
||||
@@ -17,11 +17,11 @@ when requesting a child of the current workspace.
|
||||
# Child of the current worktree.
|
||||
ORCA orchestration worker-start --task <task_id> --worktree new-child --agent codex --setup run
|
||||
|
||||
# On a connected server; the Run stays on yours.
|
||||
ORCA orchestration worker-start --task <task_id> --on <environment> --worktree new-top-level --repo <exact_remote_repo_selector> --name <name> --agent codex --setup run
|
||||
# On a connected server, nested under your workspace; the Run stays on yours.
|
||||
ORCA orchestration worker-start --task <task_id> --on <server> --worktree new-child --repo <exact_remote_repo_selector> --name <name> --agent codex --setup run
|
||||
|
||||
# On a connected server, nested under your workspace in the sidebar.
|
||||
ORCA orchestration worker-start --task <task_id> --on <environment> --worktree new-child --repo <exact_remote_repo_selector> --name <name> --agent codex --setup run
|
||||
# On a connected server, with no parent.
|
||||
ORCA orchestration worker-start --task <task_id> --on <server> --worktree new-top-level --repo <exact_remote_repo_selector> --name <name> --agent codex --setup run
|
||||
```
|
||||
|
||||
With `--on`, both `new-child` and `new-top-level` need `--repo` naming a
|
||||
|
||||
@@ -6,7 +6,7 @@ import type {
|
||||
BrowserInterceptEnableResult,
|
||||
BrowserInterceptedRequest,
|
||||
BrowserNetworkLogResult
|
||||
} from '../../shared/runtime-browser-contracts'
|
||||
} from '../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { CommandHandler } from '../dispatch'
|
||||
import { printResult } from '../format'
|
||||
import { getOptionalPositiveIntegerFlag, getOptionalStringFlag } from '../flags'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BROWSER_EXPECT_URL_RUNTIME_CAPABILITY } from '../../shared/browser-runtime-capabilities'
|
||||
import { BROWSER_EXPECT_URL_RUNTIME_CAPABILITY } from '../../shared/browser/runtime/browser-runtime-capabilities'
|
||||
import type { RuntimeStatus } from '../../shared/runtime-types'
|
||||
import { getOptionalStringFlag, getPresentStringFlag } from '../flags'
|
||||
import type { RuntimeClient } from '../runtime-client'
|
||||
|
||||
@@ -2,7 +2,7 @@ import type {
|
||||
BrowserCookieDeleteResult,
|
||||
BrowserCookieGetResult,
|
||||
BrowserCookieSetResult
|
||||
} from '../../shared/runtime-browser-contracts'
|
||||
} from '../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { CommandHandler } from '../dispatch'
|
||||
import { printResult } from '../format'
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type {
|
||||
BrowserGeolocationResult,
|
||||
BrowserViewportResult
|
||||
} from '../../shared/runtime-browser-contracts'
|
||||
} from '../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { CommandHandler } from '../dispatch'
|
||||
import { printResult } from '../format'
|
||||
import {
|
||||
|
||||
@@ -18,7 +18,7 @@ vi.mock('../runtime-client', async () => {
|
||||
})
|
||||
})
|
||||
|
||||
import { BROWSER_EXPECT_URL_RUNTIME_CAPABILITY } from '../../shared/browser-runtime-capabilities'
|
||||
import { BROWSER_EXPECT_URL_RUNTIME_CAPABILITY } from '../../shared/browser/runtime/browser-runtime-capabilities'
|
||||
import { RPC_PARAMS_BY_METHOD } from '../../shared/rpc-contract/rpc-params-catalog.generated'
|
||||
import { main } from '../index'
|
||||
import { okFixture } from '../test-fixtures'
|
||||
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
BrowserTabProfileCloneResult,
|
||||
BrowserTabProfileShowResult,
|
||||
BrowserTabShowResult
|
||||
} from '../../shared/runtime-browser-contracts'
|
||||
} from '../../shared/browser/runtime/runtime-browser-contracts'
|
||||
|
||||
export function formatSnapshot(result: BrowserSnapshotResult): string {
|
||||
// Older runtimes leave url and title unset.
|
||||
|
||||
@@ -3,7 +3,7 @@ import type {
|
||||
BrowserIdentityModeStatus,
|
||||
BrowserUserAgentMode
|
||||
} from '../../shared/browser-user-agent-mode'
|
||||
import { BROWSER_IDENTITY_RUNTIME_CAPABILITY } from '../../shared/browser-runtime-capabilities'
|
||||
import { BROWSER_IDENTITY_RUNTIME_CAPABILITY } from '../../shared/browser/runtime/browser-runtime-capabilities'
|
||||
import type { RuntimeStatus } from '../../shared/runtime-session-contracts'
|
||||
import type { CommandHandler, HandlerContext } from '../dispatch'
|
||||
import { getRequiredStringFlag } from '../flags'
|
||||
|
||||
@@ -11,7 +11,7 @@ import type {
|
||||
BrowserSelectResult,
|
||||
BrowserTypeResult,
|
||||
BrowserUploadResult
|
||||
} from '../../shared/runtime-browser-contracts'
|
||||
} from '../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { CommandHandler } from '../dispatch'
|
||||
import { resolveRepoPathArgument } from '../repo-path-arguments'
|
||||
import { printResult } from '../format'
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
BrowserScrollResult,
|
||||
BrowserSnapshotResult,
|
||||
BrowserWaitResult
|
||||
} from '../../shared/runtime-browser-contracts'
|
||||
} from '../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { CommandHandler } from '../dispatch'
|
||||
import { formatScreenshot, formatSnapshot, saveBrowserScreenshot } from './browser-format'
|
||||
import { printResult } from '../format'
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
BrowserTabProfileCloneResult,
|
||||
BrowserTabProfileShowResult,
|
||||
BrowserTabSetProfileResult
|
||||
} from '../../shared/runtime-browser-contracts'
|
||||
} from '../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { CommandHandler } from '../dispatch'
|
||||
import { getOptionalStringFlag, getRequiredStringFlag } from '../flags'
|
||||
import {
|
||||
|
||||
@@ -3,7 +3,7 @@ import type {
|
||||
BrowserTabListResult,
|
||||
BrowserTabShowResult,
|
||||
BrowserTabSwitchResult
|
||||
} from '../../shared/runtime-browser-contracts'
|
||||
} from '../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { CommandHandler } from '../dispatch'
|
||||
import { formatTabList, formatTabListWithProfiles, formatTabShow } from './browser-format'
|
||||
import { printResult } from '../format'
|
||||
|
||||
@@ -2158,6 +2158,12 @@ const ORCA_PER_WORKSPACE_ENV_MARKDOWN = [
|
||||
"`ok` is `true`. Do not wait for the user to paste errors. How to read the transcript is in",
|
||||
"`references/failure-modes.md`.",
|
||||
"",
|
||||
"Once a workspace runs on the environment, check the environment itself from a terminal inside it:",
|
||||
"`ORCA vm env doctor --json` reports required CLIs (git plus what the repo manifests imply), agent",
|
||||
"CLIs and their sign-in, Git fetch and a dry-run push, the `orca.yaml` setup script, and free disk.",
|
||||
"Add `--run-setup` to re-run `scripts.setup` and gate on its exit code. Loop on it the same way: fix",
|
||||
"`orca.yaml` or the image, re-run, until no check fails and every `warn` is resolved or explained.",
|
||||
"",
|
||||
"The self-test sees only what the scripts print, so confirm separately that state holds an",
|
||||
"**authenticated** `snapshotId` and that `destroy` is implemented and tested. With `destroy: none`",
|
||||
"the self-test tears nothing down and you must clean up by hand.",
|
||||
@@ -3959,7 +3965,8 @@ const ORCHESTRATION_MARKDOWN = [
|
||||
"- If a receipt has `next`, follow it. When Orca has nothing for you, end your",
|
||||
" turn.",
|
||||
"- `--worktree current` uses your workspace. Use a new one only when the user",
|
||||
" asks or sharing would conflict:",
|
||||
" asks or sharing would conflict: `--worktree new-child --name <short-name>`",
|
||||
" nests it under yours. For one with no parent, use",
|
||||
" `--worktree new-top-level --repo id:<repoId> --name <short-name>`",
|
||||
" (`ORCA repo list --json` gives the id). If nothing needs to come back to you",
|
||||
" (the user will work in those chats), don't start workers; per workspace run",
|
||||
@@ -4115,11 +4122,11 @@ const ORCHESTRATION_PLACEMENT_AND_REMOTE_REFERENCE_MARKDOWN = [
|
||||
"# Child of the current worktree.",
|
||||
"ORCA orchestration worker-start --task <task_id> --worktree new-child --agent codex --setup run",
|
||||
"",
|
||||
"# On a connected server; the Run stays on yours.",
|
||||
"ORCA orchestration worker-start --task <task_id> --on <environment> --worktree new-top-level --repo <exact_remote_repo_selector> --name <name> --agent codex --setup run",
|
||||
"# On a connected server, nested under your workspace; the Run stays on yours.",
|
||||
"ORCA orchestration worker-start --task <task_id> --on <server> --worktree new-child --repo <exact_remote_repo_selector> --name <name> --agent codex --setup run",
|
||||
"",
|
||||
"# On a connected server, nested under your workspace in the sidebar.",
|
||||
"ORCA orchestration worker-start --task <task_id> --on <environment> --worktree new-child --repo <exact_remote_repo_selector> --name <name> --agent codex --setup run",
|
||||
"# On a connected server, with no parent.",
|
||||
"ORCA orchestration worker-start --task <task_id> --on <server> --worktree new-top-level --repo <exact_remote_repo_selector> --name <name> --agent codex --setup run",
|
||||
"```",
|
||||
"",
|
||||
"With `--on`, both `new-child` and `new-top-level` need `--repo` naming a",
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { resolve } from 'node:path'
|
||||
import type { CommandHandler } from '../dispatch'
|
||||
import {
|
||||
formatEnvironmentDoctorChecks,
|
||||
type EnvironmentDoctorResult
|
||||
} from '../../shared/environment-doctor-types'
|
||||
import { runEnvironmentDoctor } from '../../main/environment-doctor/environment-doctor'
|
||||
import { createHostEnvironmentDoctorDeps } from '../../main/environment-doctor/environment-doctor-host'
|
||||
|
||||
export const VM_ENV_HANDLERS: Record<string, CommandHandler> = {
|
||||
'vm env doctor': async ({ flags, cwd, json }) => {
|
||||
const pathFlag = flags.get('path')
|
||||
const worktreePath = resolve(cwd, typeof pathFlag === 'string' && pathFlag ? pathFlag : '.')
|
||||
const result = await runEnvironmentDoctor(
|
||||
{ worktreePath, runSetup: flags.get('run-setup') === true },
|
||||
createHostEnvironmentDoctorDeps()
|
||||
)
|
||||
console.log(json ? JSON.stringify(result, null, 2) : formatEnvironmentDoctorResult(result))
|
||||
if (!result.ok) {
|
||||
process.exitCode = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function formatEnvironmentDoctorResult(result: EnvironmentDoctorResult): string {
|
||||
const counts = { pass: 0, warn: 0, fail: 0 }
|
||||
for (const check of result.checks) {
|
||||
counts[check.status] += 1
|
||||
}
|
||||
const lines = [`path: ${result.worktreePath}`, ...formatEnvironmentDoctorChecks(result.checks)]
|
||||
lines.push(`${counts.pass} passed, ${counts.warn} warnings, ${counts.fail} failed`)
|
||||
return lines.join('\n')
|
||||
}
|
||||
@@ -33,5 +33,10 @@ export const HOST_HANDLER_GROUPS: readonly HandlerGroup[] = [
|
||||
name: 'vm',
|
||||
keys: ['vm recipe doctor'],
|
||||
load: async () => (await import('./handlers/vm.js')).VM_HANDLERS
|
||||
},
|
||||
{
|
||||
name: 'vm-env',
|
||||
keys: ['vm env doctor'],
|
||||
load: async () => (await import('./handlers/vm-env.js')).VM_ENV_HANDLERS
|
||||
}
|
||||
]
|
||||
|
||||
@@ -78,6 +78,7 @@ export const ROOT_HELP_TEXT_PRIMARY = [
|
||||
'',
|
||||
'Environment Recipes:',
|
||||
' vm recipe doctor Validate a per-workspace environment recipe',
|
||||
' vm env doctor Check that this environment can run agents',
|
||||
'',
|
||||
'Automations:',
|
||||
' automations list List scheduled Orca automations',
|
||||
|
||||
@@ -23,6 +23,7 @@ import { INTROSPECTION_COMMAND_SPECS } from './introspection'
|
||||
import { JIRA_COMMAND_SPECS } from './jira'
|
||||
import { LINEAR_COMMAND_SPECS } from './linear'
|
||||
import { VM_COMMAND_SPECS } from './vm'
|
||||
import { VM_ENV_COMMAND_SPECS } from './vm-env'
|
||||
import { SKILL_COMMAND_SPECS } from './skills'
|
||||
import { ARTIFACT_COMMAND_SPECS } from './artifacts'
|
||||
import { SEARCH_COMMAND_SPECS } from './search'
|
||||
@@ -59,6 +60,7 @@ export const COMMAND_SPECS: CommandSpec[] = [
|
||||
...JIRA_COMMAND_SPECS,
|
||||
...LINEAR_COMMAND_SPECS,
|
||||
...VM_COMMAND_SPECS,
|
||||
...VM_ENV_COMMAND_SPECS,
|
||||
...EMULATOR_COMMAND_SPECS,
|
||||
...SKILL_COMMAND_SPECS,
|
||||
...SEARCH_COMMAND_SPECS,
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import type { CommandSpec } from '../args'
|
||||
import { LOCAL_COMMAND_FLAGS } from '../args'
|
||||
|
||||
export const VM_ENV_COMMAND_SPECS: CommandSpec[] = [
|
||||
{
|
||||
path: ['vm', 'env', 'doctor'],
|
||||
summary: 'Check that this environment can run agents on the workspace',
|
||||
usage: 'orca vm env doctor [--path <worktree>] [--run-setup] [--json]',
|
||||
allowedFlags: [...LOCAL_COMMAND_FLAGS, 'path', 'run-setup'],
|
||||
notes: [
|
||||
'Runs on the machine you call it from, against the checkout at --path (default: the current directory).',
|
||||
'Checks required CLIs (git plus what the repo manifests imply), coding-agent CLIs and their sign-in, that the Git remote is reachable and a dry-run push is authorized, the orca.yaml setup script, and free disk space.',
|
||||
'Without --run-setup it only reports whether setup has run here. --run-setup runs scripts.setup again and fails on a nonzero exit; it can take minutes and changes the checkout like a normal setup run.',
|
||||
'Exits 1 when any check fails. Warnings keep ok: true, so read every check before calling the environment clean.'
|
||||
],
|
||||
examples: [
|
||||
'orca vm env doctor',
|
||||
'orca vm env doctor --json',
|
||||
'orca vm env doctor --path /workspace/repo --run-setup --json'
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1,7 +1,7 @@
|
||||
import { mkdirSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { readAgentStateJsonFileSync } from '../../codex/configuration/agent-state-file-reader'
|
||||
import { writeFileAtomically } from '../../codex-accounts/fs-utils'
|
||||
import { writeFileAtomically } from '../../filesystem/atomic-file-publication'
|
||||
import { getOrcaUserDataPath } from '../../codex/configuration/homes/codex-home-paths'
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createHash } from 'node:crypto'
|
||||
import { existsSync, mkdirSync, readFileSync, realpathSync } from 'node:fs'
|
||||
import { dirname, join, resolve } from 'node:path'
|
||||
import { writeFileAtomically } from '../../codex-accounts/fs-utils'
|
||||
import { writeFileAtomically } from '../../filesystem/atomic-file-publication'
|
||||
import { upsertOrcaCreatedProjectTrustLevel } from '../../codex/trust/toml/config-toml-trust'
|
||||
import { runExclusivelyForCodexTrustConfig } from '../../codex/trust/toml/codex-trust-config-mutation-queue'
|
||||
import { recordOrcaCreatedAntigravityTrust } from './antigravity-workspace-trust-ownership'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { existsSync, readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { writeFileAtomically } from '../../codex-accounts/fs-utils'
|
||||
import { writeFileAtomically } from '../../filesystem/atomic-file-publication'
|
||||
import { createAgentTrustOwnershipLedger } from './agent-trust-ownership-ledger'
|
||||
|
||||
// Why resolve, not realpath: removal runs after the worktree directory is gone.
|
||||
|
||||
@@ -11,7 +11,7 @@ import type {
|
||||
BrowserCaptureStopResult,
|
||||
BrowserConsoleResult,
|
||||
BrowserNetworkLogResult
|
||||
} from '../../../shared/runtime-browser-contracts'
|
||||
} from '../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { BrowserError } from '../browser-error'
|
||||
import {
|
||||
parseShellArgs,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BrowserTabSwitchResult } from '../../../../shared/runtime-browser-contracts'
|
||||
import type { BrowserTabSwitchResult } from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { BrowserError } from '../../browser-error'
|
||||
import { AgentBrowserBridgeActionEffects } from './agent-browser-bridge-action-effects'
|
||||
import { ORCA_TAB_SESSION_PREFIX } from '../session-lifecycle/agent-browser-session-name'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BrowserError } from '../../browser-error'
|
||||
import { getBrowserJavaScriptDialog } from '../../guest-lifecycle/prompts/browser-javascript-dialogs'
|
||||
import type { BrowserJavaScriptDialog } from '../../../../shared/browser-javascript-dialog'
|
||||
import type { BrowserJavaScriptDialog } from '../../../../shared/browser/prompts/browser-javascript-dialog'
|
||||
|
||||
const DIALOG_MESSAGE_QUOTE_MAX_CHARS = 500
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { app, nativeImage, type WebContents } from 'electron'
|
||||
import type {
|
||||
BrowserScreenshotResult,
|
||||
BrowserEvalResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { BrowserError } from '../../browser-error'
|
||||
import {
|
||||
captureFullPageScreenshot,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
BrowserClickResult,
|
||||
BrowserGotoResult,
|
||||
BrowserFillResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { assertClipboardTextWriteWithinLimitWithYield } from '../../../../shared/clipboard-text'
|
||||
import { normalizeBrowserNavigationUrl } from '../../../../shared/browser-url'
|
||||
import { BrowserError } from '../../browser-error'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type {
|
||||
BrowserSelectResult,
|
||||
BrowserScrollResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { assertClipboardTextWriteWithinLimitWithYield } from '../../../../shared/clipboard-text'
|
||||
import { iterateBrowserTextInsertionChunks } from '../../../../shared/browser-text-insertion-chunks'
|
||||
import { AGENT_BROWSER_TEXT_ARGUMENT_MAX_BYTES } from '../protocol/agent-browser-text-argument-budget'
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import type {
|
||||
BrowserClearResult,
|
||||
BrowserSelectAllResult,
|
||||
BrowserPdfResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { BrowserError } from '../../browser-error'
|
||||
import {
|
||||
FILE_INPUT_FRAME_URL_FUNCTION,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type {
|
||||
BrowserKeypressResult,
|
||||
BrowserTypeResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { assertClipboardTextWriteWithinLimitWithYield } from '../../../../shared/clipboard-text'
|
||||
import { BrowserError } from '../../browser-error'
|
||||
import { acquireElectronDebugger } from '../../cdp/debugger/electron-debugger-lease'
|
||||
|
||||
@@ -7,7 +7,7 @@ import { AGENT_BROWSER_CLIPBOARD_WRITE_MAX_BYTES } from '../protocol/agent-brows
|
||||
import type {
|
||||
BrowserBackResult,
|
||||
BrowserReloadResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { AgentBrowserBridgeMouseCommands } from './agent-browser-bridge-mouse-commands'
|
||||
import {
|
||||
answerBrowserJavaScriptDialog,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { setTimeout as delay } from 'node:timers/promises'
|
||||
import type { WebContents } from 'electron'
|
||||
import type { BrowserActionEffects } from '../../../../shared/runtime-browser-contracts'
|
||||
import type { BrowserActionEffects } from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { isRecord } from '../../../../shared/agent-status/child-work/agent-status-child-work-value-guards'
|
||||
import { withTimeout } from '../../../../shared/promise-timeout-fallback'
|
||||
import type { BrowserPageEvent } from '../../guest-lifecycle/page-activity/browser-page-events'
|
||||
|
||||
@@ -3,7 +3,7 @@ import type {
|
||||
BrowserConsoleResult,
|
||||
BrowserNetworkEntry,
|
||||
BrowserNetworkLogResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
|
||||
// Shapes agent-browser prints for `console --json` and `network requests --json` (0.27 and 0.41).
|
||||
export type AgentBrowserConsoleOutput = { messages: { type: string; text: string }[] }
|
||||
|
||||
@@ -6,7 +6,7 @@ import { z } from 'zod'
|
||||
import type {
|
||||
BrowserScreenshotAnnotation,
|
||||
BrowserScreenshotResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { BrowserError } from '../../browser-error'
|
||||
|
||||
const Annotation: z.ZodType<BrowserScreenshotAnnotation> = z.object({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BrowserActionEffects } from '../../../../shared/runtime-browser-contracts'
|
||||
import type { BrowserActionEffects } from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { isRecord } from '../../../../shared/agent-status/child-work/agent-status-child-work-value-guards'
|
||||
|
||||
// Results travel to remote clients with a 768 KB budget; agents read them in their context.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type {
|
||||
BrowserTabInfo,
|
||||
BrowserTabListResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { BrowserError } from '../../browser-error'
|
||||
import type { ResolvedBrowserCommandTarget } from './agent-browser-command-target'
|
||||
import { AgentBrowserBridgeState } from './agent-browser-bridge-state'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto'
|
||||
import { BrowserWindow } from 'electron'
|
||||
import '../../../shared/constants'
|
||||
import { ORCA_BROWSER_PARTITION } from '../../../shared/browser/browser-session-partition'
|
||||
import { ORCA_BROWSER_GUEST_WEB_PREFERENCES } from '../../../shared/browser-guest-web-preferences'
|
||||
import { ORCA_BROWSER_GUEST_WEB_PREFERENCES } from '../../../shared/browser/guest-lifecycle/browser-guest-web-preferences'
|
||||
import { mapSettledWithConcurrency } from '../../../shared/map-with-concurrency'
|
||||
import type { BrowserBackend, BrowserBackendCreateTab } from '../browser-backend'
|
||||
import type { BrowserManager } from '../guest-lifecycle/manager/browser-manager'
|
||||
|
||||
@@ -14,7 +14,7 @@ import type {
|
||||
BrowserInterceptedRequest,
|
||||
BrowserNetworkLogResult,
|
||||
BrowserViewportResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { CdpCommandSender } from '../debugger/cdp-command-sender'
|
||||
|
||||
type ActiveCdpContext = {
|
||||
|
||||
@@ -32,7 +32,7 @@ import type {
|
||||
BrowserUploadResult,
|
||||
BrowserViewportResult,
|
||||
BrowserWaitResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { BrowserManager } from '../../guest-lifecycle/manager/browser-manager'
|
||||
import type { CdpAuxiliaryCommands } from './cdp-auxiliary-commands'
|
||||
import type { CdpTabState } from './cdp-tab-state'
|
||||
|
||||
@@ -2,7 +2,7 @@ import type {
|
||||
BrowserCheckResult,
|
||||
BrowserSelectResult,
|
||||
BrowserUploadResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { CdpBridgeState } from './cdp-bridge-state'
|
||||
import type { CdpDebuggerLifecycle } from '../debugger/cdp-debugger-lifecycle'
|
||||
import type { CdpRefResolution } from './cdp-ref-resolution'
|
||||
|
||||
@@ -6,7 +6,7 @@ import type {
|
||||
BrowserScrollResult,
|
||||
BrowserSnapshotResult,
|
||||
BrowserWaitResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { BrowserError } from '../../browser-error'
|
||||
import type { CdpBridgeState } from './cdp-bridge-state'
|
||||
import type { CdpDebuggerLifecycle } from '../debugger/cdp-debugger-lifecycle'
|
||||
|
||||
@@ -3,7 +3,7 @@ import type {
|
||||
BrowserTabInfo,
|
||||
BrowserTabListResult,
|
||||
BrowserTabSwitchResult
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import { BrowserError } from '../../browser-error'
|
||||
import type { CdpBridgeState } from './cdp-bridge-state'
|
||||
import type { CdpDebuggerLifecycle } from '../debugger/cdp-debugger-lifecycle'
|
||||
|
||||
@@ -2,7 +2,7 @@ import type {
|
||||
BrowserConsoleEntry,
|
||||
BrowserInterceptedRequest,
|
||||
BrowserNetworkEntry
|
||||
} from '../../../../shared/runtime-browser-contracts'
|
||||
} from '../../../../shared/browser/runtime/runtime-browser-contracts'
|
||||
import type { SnapshotResult } from '../snapshots/snapshot-engine'
|
||||
|
||||
export type CdpTabState = {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user