返回 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 | { kind: 'image-fulfillment'; id: string }
9
10 export type JobLease = {
11 jobId: string
12 signal: AbortSignal
13 release: ReleaseFunc
14 }
15
16 export type ActiveJob = {
17 jobId: string
18 domain: RuntimeDomain
19 owner: JobOwner
20 state: 'waiting' | 'active'
21 claims: ResourceClaims
22 }
23
24 export type JobReservationArgs = {
25 jobId: string
26 domain: RuntimeDomain
27 owner: JobOwner
28 claims: ResourceClaims
29 wait: ResourceLockWaitPolicy
30 signal?: AbortSignal
31 }
32
33 export type JobReservationResult =
34 | { status: 'acquired'; lease: JobLease }
35 | { status: 'busy'; conflictingJobId: string }
36
36 lines TYPESCRIPT