feat: add computer control and managed browser

This commit is contained in:
lofyer
2026-08-05 12:55:24 +08:00
parent 2f549387a6
commit 38ac2206f2
92 changed files with 21028 additions and 766 deletions
+31
View File
@@ -0,0 +1,31 @@
import type {
ComputerControlError,
ComputerControlErrorCode
} from '../../shared/computer-control-contracts'
export class ComputerControlFailure extends Error {
readonly code: ComputerControlErrorCode
readonly retryable: boolean
constructor(
code: ComputerControlErrorCode,
message: string,
retryable = false
) {
super(message)
this.name = 'ComputerControlFailure'
this.code = code
this.retryable = retryable
}
toContract(): ComputerControlError {
return {
code: this.code,
message: this.message.slice(0, 256) || 'Computer control failed',
retryable: this.retryable
}
}
}
export const cancellationFailure = (): ComputerControlFailure =>
new ComputerControlFailure('cancelled', 'Computer control was cancelled')