mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 08:03:20 +00:00
chore(mobile): remove confirmed unreachable code
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/knip@5/schema.json",
|
||||
"include": ["files"],
|
||||
"entry": [
|
||||
"app/**/*.{js,jsx,ts,tsx}",
|
||||
"host-web-app/**/*.{js,jsx,ts,tsx}",
|
||||
"src/**/*.test.{ts,tsx}",
|
||||
"src/**/*.{ios,android,native,web}.{js,jsx,ts,tsx}",
|
||||
"src/mobile-web/disabled-page-async-storage.ts",
|
||||
"src/mobile-web/disabled-page-client-context.tsx",
|
||||
"src/mobile-web/disabled-page-host-store.ts",
|
||||
"packages/*/src/index.ts",
|
||||
"packages/*/src/**/*.{ios,android,native,web}.{js,jsx,ts,tsx}",
|
||||
"plugins/*.js",
|
||||
"metro.config.js",
|
||||
"scripts/prepare-android-release.mjs",
|
||||
"scripts/test-subscribe.ts",
|
||||
"scripts/repro-terminal-colors.ts",
|
||||
"scripts/repro-worktree-startup-stream.ts"
|
||||
],
|
||||
"project": [
|
||||
"{app,host-web-app,src,scripts,plugins}/**/*.{js,jsx,mjs,cjs,ts,tsx}",
|
||||
"packages/*/src/**/*.{js,jsx,ts,tsx}",
|
||||
"*.{js,ts}"
|
||||
],
|
||||
"ignoreFiles": [
|
||||
"src/accounts/use-open-mobile-accounts.ts",
|
||||
"src/components/mobile-pr-url.ts",
|
||||
"src/notifications/use-open-notification-route.ts",
|
||||
"src/session/mobile-native-chat-message-occurrences.ts",
|
||||
"src/session/use-mobile-native-chat-cancel-ask.ts",
|
||||
"src/session/use-open-mobile-session.ts",
|
||||
"src/tasks/use-open-mobile-tasks.ts"
|
||||
],
|
||||
"ignoreExportsUsedInFile": true,
|
||||
"includeEntryExports": false
|
||||
}
|
||||
@@ -193,50 +193,9 @@ export function taskRoundtripHostResponse(method: string): { ok: true; result: u
|
||||
}
|
||||
}
|
||||
}
|
||||
if (method === 'github.prChecks') {
|
||||
return {
|
||||
ok: true,
|
||||
result: [
|
||||
{
|
||||
name: 'Mobile checks',
|
||||
status: 'completed',
|
||||
conclusion: 'success',
|
||||
url: 'https://github.com/stablyai/orca/actions/runs/1'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
if (method === 'github.rerunPRChecks') {
|
||||
return { ok: true, result: { ok: true } }
|
||||
}
|
||||
if (method === 'github.setPRFileViewed') {
|
||||
return { ok: true, result: true }
|
||||
}
|
||||
if (method === 'github.prFileContents') {
|
||||
return {
|
||||
ok: true,
|
||||
result: {
|
||||
original: 'before\n',
|
||||
modified: 'after\n',
|
||||
originalIsBinary: false,
|
||||
modifiedIsBinary: false
|
||||
}
|
||||
}
|
||||
}
|
||||
if (method === 'github.addPRReviewComment') {
|
||||
return {
|
||||
ok: true,
|
||||
result: {
|
||||
ok: true,
|
||||
comment: {
|
||||
id: 24,
|
||||
body: 'Inline comment',
|
||||
path: 'src/file.ts',
|
||||
line: 7
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (method === 'gitlab.workItemDetails') {
|
||||
return {
|
||||
ok: true,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import type { HostSessionTerminalFileTarget } from './host-session-terminal-file-operations'
|
||||
import { openMobileTerminalFileTap } from './mobile-terminal-file-tap-open'
|
||||
import { openMobileFileTap as openMobileTerminalFileTap } from './mobile-file-tap-open'
|
||||
|
||||
function createOperations(targets: (HostSessionTerminalFileTarget | null)[]) {
|
||||
return {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export { openMobileFileTap as openMobileTerminalFileTap } from './mobile-file-tap-open'
|
||||
@@ -17,6 +17,7 @@
|
||||
"audit:code-quality:type-aware": "oxlint --type-aware --config config/oxlint-code-quality-type-aware.json src config tests --deny-warnings",
|
||||
"audit:react-doctor": "pnpm dlx react-doctor@0.9.1 . --yes --no-supply-chain --no-telemetry --blocking none",
|
||||
"audit:dead-code": "pnpm dlx knip@5.88.1 --config config/knip.json",
|
||||
"audit:dead-code:mobile": "pnpm dlx knip@5.88.1 --directory mobile --config ../config/knip.mobile.json",
|
||||
"check:code-quality:changed": "node config/scripts/check-changed-code-quality.mjs",
|
||||
"check:react-doctor:changed": "node config/scripts/check-react-doctor-changed.mjs",
|
||||
"check:zustand-selector-fanout": "node config/scripts/zustand-selector-fanout-benchmark.mjs --check",
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
export type FilesystemPathListingProvider = {
|
||||
listFiles(
|
||||
rootPath: string,
|
||||
options?: { excludePaths?: string[]; signal?: AbortSignal; maxResults?: number }
|
||||
): Promise<string[]>
|
||||
listMarkdownDocuments?(rootPath: string): Promise<string[]>
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import type { IFilesystemProvider, IGitProvider, IPtyProvider } from './types'
|
||||
|
||||
/** Routes operations by connectionId; null/undefined selects the local provider. */
|
||||
export type IProviderRegistry = {
|
||||
getPtyProvider(connectionId: string | null | undefined): IPtyProvider
|
||||
getFilesystemProvider(connectionId: string | null | undefined): IFilesystemProvider
|
||||
getGitProvider(connectionId: string | null | undefined): IGitProvider
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import type { SshChannelMultiplexer } from '../ssh/ssh-channel-multiplexer'
|
||||
import { isMethodNotFoundError } from '../ssh/ssh-filesystem-stream-reader'
|
||||
import type { FileStat, TerminalArtifactAccessOptions } from './types'
|
||||
|
||||
export async function writeSshTerminalArtifact(
|
||||
mux: SshChannelMultiplexer,
|
||||
filePath: string,
|
||||
content: string,
|
||||
options: TerminalArtifactAccessOptions
|
||||
): Promise<FileStat> {
|
||||
let result: { stat?: FileStat }
|
||||
try {
|
||||
result = (await mux.request('fs.writeTerminalArtifact', {
|
||||
filePath,
|
||||
content,
|
||||
expectedRealPath: options.expectedRealPath,
|
||||
expectedStatIdentity: options.expectedStatIdentity,
|
||||
maxBytes: options.maxBytes
|
||||
})) as { stat?: FileStat }
|
||||
} catch (error) {
|
||||
if (isMethodNotFoundError(error)) {
|
||||
throw new Error(
|
||||
'Remote terminal artifact access is unavailable. Reconnect the SSH target before retrying.'
|
||||
)
|
||||
}
|
||||
throw error
|
||||
}
|
||||
if (!result.stat) {
|
||||
throw new Error('terminal_file_grant_stale')
|
||||
}
|
||||
return result.stat
|
||||
}
|
||||
@@ -1,26 +1,4 @@
|
||||
import { sha256 } from '@noble/hashes/sha256'
|
||||
import { MOBILE_WEB_FILE_EDIT_MAX_BYTES } from '../../shared/mobile-web/file-edit-contract'
|
||||
import { MobileWebBridgeClientError } from './mobile-web-bridge-client-error'
|
||||
|
||||
export function encodeMobileWebFileEdit(content: string): {
|
||||
contentBase64: string
|
||||
revision: string
|
||||
byteLength: number
|
||||
} {
|
||||
const bytes = new TextEncoder().encode(content)
|
||||
if (bytes.byteLength > MOBILE_WEB_FILE_EDIT_MAX_BYTES) {
|
||||
throw new MobileWebBridgeClientError('too_large', false)
|
||||
}
|
||||
let binary = ''
|
||||
for (let offset = 0; offset < bytes.byteLength; offset += 32 * 1024) {
|
||||
binary += String.fromCharCode(...bytes.subarray(offset, offset + 32 * 1024))
|
||||
}
|
||||
return {
|
||||
contentBase64: btoa(binary),
|
||||
revision: mobileWebFileRevision(bytes),
|
||||
byteLength: bytes.byteLength
|
||||
}
|
||||
}
|
||||
|
||||
export function mobileWebFileRevision(bytes: Uint8Array): string {
|
||||
return Array.from(sha256(bytes), (value) => value.toString(16).padStart(2, '0')).join('')
|
||||
|
||||
@@ -125,6 +125,3 @@ function validateUniquePaths(
|
||||
paths.add(entry.relativePath)
|
||||
})
|
||||
}
|
||||
|
||||
export type MobileWebSourceControlMutationStatus = MobileWebSourceControlMutationEntry['status']
|
||||
export type MobileWebSourceControlMutationArea = MobileWebSourceControlMutationEntry['area']
|
||||
|
||||
Reference in New Issue
Block a user