返回 oh-my-ppt
types.ts
根目录 / src / main / agent-runtime / job / types.ts
1 import type { RuntimeDomain } from '../types'
2 import type { ReleaseFunc, ResourceClaims, ResourceLockWaitPolicy } from '../lock/resource-lock'
3
4 export type JobOwner =
5 | { kind: 'session'; id: string }
6 | { kind: 'style'; id: string }
7 | { kind: 'image-history'; id: string }
8
9 export type JobLease = {
10 jobId: string
11 signal: AbortSignal
12 release: ReleaseFunc
13 }
14
15 export type ActiveJob = {
16 jobId: string
17 domain: RuntimeDomain
18 owner: JobOwner
19 state: 'waiting' | 'active'
20 claims: ResourceClaims
21 }
22
23 export type JobReservationArgs = {
24 jobId: string
25 domain: RuntimeDomain
26 owner: JobOwner
27 claims: ResourceClaims
28 wait: ResourceLockWaitPolicy
29 signal?: AbortSignal
30 }
31
32 export type JobReservationResult =
33 | { status: 'acquired'; lease: JobLease }
34 | { status: 'busy'; conflictingJobId: string }
35
35 lines TYPESCRIPT