mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
* Improve mobile terminal streaming performance Co-authored-by: Orca <help@stably.ai> * Add mobile clear terminal action Co-authored-by: Orca <help@stably.ai> * Fix terminal connection test mock Co-authored-by: Orca <help@stably.ai> * WIP: mobile markdown tabs before rebase Co-authored-by: Orca <help@stably.ai> * Add mobile markdown editing Co-authored-by: Orca <help@stably.ai> * Harden mobile tab and markdown sync Co-authored-by: Orca <help@stably.ai> * Fix mobile terminal reconnect loading race Co-authored-by: Orca <help@stably.ai> * Polish mobile terminal keyboard behavior Co-authored-by: Orca <help@stably.ai> * Simplify mobile markdown editor chrome Co-authored-by: Orca <help@stably.ai> * Move mobile markdown actions to top Co-authored-by: Orca <help@stably.ai> * Use app modals for markdown discard Co-authored-by: Orca <help@stably.ai> * Dismiss keyboard before markdown confirmations Co-authored-by: Orca <help@stably.ai> * Add mobile file explorer Co-authored-by: Orca <help@stably.ai> * Fix mobile file explorer type narrowing Co-authored-by: Orca <help@stably.ai> * Fix mobile files navigation param Co-authored-by: Orca <help@stably.ai> * Show mobile files connection wait state Co-authored-by: Orca <help@stably.ai> * Preview text files on mobile Co-authored-by: Orca <help@stably.ai> * Simplify mobile file previews Co-authored-by: Orca <help@stably.ai> * Clarify unavailable mobile file types Co-authored-by: Orca <help@stably.ai> * Fix mobile subscription and preview review issues Co-authored-by: Orca <help@stably.ai> * Keep fallback terminals visible on mobile Co-authored-by: Orca <help@stably.ai> * Keep mobile terminal tap active Co-authored-by: Orca <help@stably.ai> * Preserve mobile terminal fallback order Co-authored-by: Orca <help@stably.ai> * Fix mobile session tab authority Co-authored-by: Orca <help@stably.ai> * Run mobile tests in mobile CI lane Co-authored-by: Orca <help@stably.ai> * Bump mobile app version to 0.0.7 Co-authored-by: Orca <help@stably.ai> * Allow main window IPC wiring size Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
68 lines
1.5 KiB
TypeScript
68 lines
1.5 KiB
TypeScript
export const MOBILE_MARKDOWN_EDIT_MAX_BYTES = 256 * 1024
|
|
|
|
export type RuntimeMarkdownReadOnlyReason =
|
|
| 'unsupported_preview'
|
|
| 'unsupported_tab'
|
|
| 'unsupported_untitled'
|
|
| 'file_too_large'
|
|
|
|
export type RuntimeMobileMarkdownRequest =
|
|
| {
|
|
id: string
|
|
operation: 'read'
|
|
worktreeId: string
|
|
tabId: string
|
|
}
|
|
| {
|
|
id: string
|
|
operation: 'save'
|
|
worktreeId: string
|
|
tabId: string
|
|
baseVersion: string
|
|
content: string
|
|
}
|
|
|
|
export type RuntimeMobileMarkdownResponse =
|
|
| {
|
|
id: string
|
|
ok: true
|
|
result: RuntimeMarkdownReadTabResult | RuntimeMarkdownSaveTabResult
|
|
}
|
|
| {
|
|
id: string
|
|
ok: false
|
|
error: string
|
|
}
|
|
|
|
export type RuntimeMarkdownReadTabResult = {
|
|
tabId: string
|
|
filePath: string
|
|
relativePath: string
|
|
content: string
|
|
isDirty: boolean
|
|
version: string
|
|
source: 'draft' | 'file'
|
|
editable: boolean
|
|
readOnlyReason?: RuntimeMarkdownReadOnlyReason
|
|
}
|
|
|
|
export type RuntimeMarkdownSaveTabResult = {
|
|
tabId: string
|
|
version: string
|
|
isDirty: false
|
|
content: string
|
|
}
|
|
|
|
export function hashMarkdownContent(content: string): string {
|
|
let hash = 0xcbf29ce484222325n
|
|
for (let i = 0; i < content.length; i += 1) {
|
|
hash ^= BigInt(content.charCodeAt(i))
|
|
hash = BigInt.asUintN(64, hash * 0x100000001b3n)
|
|
}
|
|
return `content:${utf8ByteLength(content)}:${hash.toString(16).padStart(16, '0')}`
|
|
}
|
|
|
|
export function utf8ByteLength(content: string): number {
|
|
return new TextEncoder().encode(content).byteLength
|
|
}
|