pi-oracle 0.3.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +27 -8
- package/docs/ORACLE_DESIGN.md +14 -8
- package/docs/ORACLE_ISOLATED_PI_VALIDATION.md +276 -0
- package/extensions/oracle/index.ts +8 -1
- package/extensions/oracle/lib/commands.ts +25 -29
- package/extensions/oracle/lib/config.ts +56 -2
- package/extensions/oracle/lib/jobs.ts +134 -219
- package/extensions/oracle/lib/locks.ts +41 -209
- package/extensions/oracle/lib/poller.ts +38 -52
- package/extensions/oracle/lib/queue.ts +75 -112
- package/extensions/oracle/lib/runtime.ts +102 -19
- package/extensions/oracle/lib/tools.ts +663 -294
- package/extensions/oracle/shared/job-coordination-helpers.d.mts +84 -0
- package/extensions/oracle/shared/job-coordination-helpers.mjs +168 -0
- package/extensions/oracle/shared/job-lifecycle-helpers.d.mts +131 -0
- package/extensions/oracle/shared/job-lifecycle-helpers.mjs +390 -0
- package/extensions/oracle/shared/job-observability-helpers.d.mts +60 -0
- package/extensions/oracle/shared/job-observability-helpers.mjs +161 -0
- package/extensions/oracle/shared/process-helpers.d.mts +20 -0
- package/extensions/oracle/shared/process-helpers.mjs +128 -0
- package/extensions/oracle/shared/state-coordination-helpers.d.mts +43 -0
- package/extensions/oracle/shared/state-coordination-helpers.mjs +381 -0
- package/extensions/oracle/worker/artifact-heuristics.mjs +5 -0
- package/extensions/oracle/worker/auth-bootstrap.mjs +125 -134
- package/extensions/oracle/worker/auth-cookie-policy.mjs +5 -0
- package/extensions/oracle/worker/auth-flow-helpers.d.mts +41 -0
- package/extensions/oracle/worker/auth-flow-helpers.mjs +165 -0
- package/extensions/oracle/worker/chatgpt-flow-helpers.d.mts +13 -0
- package/extensions/oracle/worker/chatgpt-flow-helpers.mjs +85 -0
- package/extensions/oracle/worker/chatgpt-ui-helpers.mjs +93 -9
- package/extensions/oracle/worker/run-job.mjs +166 -274
- package/extensions/oracle/worker/state-locks.mjs +31 -216
- package/package.json +4 -3
- package/prompts/oracle.md +16 -10
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export interface OracleDurableWorkerHandoffJobLike {
|
|
2
|
+
status?: string;
|
|
3
|
+
workerPid?: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface OracleAdmissionBlockingJobLike extends OracleDurableWorkerHandoffJobLike {
|
|
7
|
+
cleanupPending?: boolean;
|
|
8
|
+
workerStartedAt?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface OracleRuntimeLeaseMetadataLike {
|
|
12
|
+
jobId: string;
|
|
13
|
+
runtimeId: string;
|
|
14
|
+
runtimeSessionName: string;
|
|
15
|
+
runtimeProfileDir: string;
|
|
16
|
+
projectId: string;
|
|
17
|
+
sessionId: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface OracleConversationLeaseMetadataLike {
|
|
22
|
+
jobId: string;
|
|
23
|
+
conversationId: string;
|
|
24
|
+
projectId: string;
|
|
25
|
+
sessionId: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface OracleQueuedPromotionFailureContext<TJob, TWorker> {
|
|
30
|
+
job: TJob;
|
|
31
|
+
latest?: TJob;
|
|
32
|
+
error: unknown;
|
|
33
|
+
at: string;
|
|
34
|
+
spawnedWorker?: TWorker;
|
|
35
|
+
runtimeLeaseAcquired: boolean;
|
|
36
|
+
conversationLeaseAcquired: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type OracleQueuedPromotionFailureOutcome = void | "break";
|
|
40
|
+
|
|
41
|
+
export interface OracleQueuedPromotionOptions<TJob extends { id: string; archivePath: string }, TWorker> {
|
|
42
|
+
listQueuedJobs: () => TJob[];
|
|
43
|
+
refreshJob: (jobId: string) => TJob | undefined;
|
|
44
|
+
readLatestJob: (jobId: string) => TJob | undefined;
|
|
45
|
+
isQueuedJob?: (job: TJob | undefined) => boolean;
|
|
46
|
+
acquireRuntimeLease: (job: TJob, at: string) => Promise<boolean>;
|
|
47
|
+
acquireConversationLease: (job: TJob, at: string) => Promise<boolean>;
|
|
48
|
+
releaseRuntimeLease: (job: TJob) => Promise<void>;
|
|
49
|
+
markSubmitted: (job: TJob, at: string) => Promise<void>;
|
|
50
|
+
spawnWorker: (job: TJob) => Promise<TWorker>;
|
|
51
|
+
persistWorker: (job: TJob, worker: TWorker) => Promise<void>;
|
|
52
|
+
hasDurableWorkerHandoff?: (job: TJob | undefined) => boolean;
|
|
53
|
+
isTerminalJob: (job: TJob) => boolean;
|
|
54
|
+
failQueuedPromotion: (job: TJob, message: string, at: string) => Promise<void>;
|
|
55
|
+
terminateSpawnedWorker: (worker: TWorker) => Promise<void>;
|
|
56
|
+
cleanupAfterFailure: (context: OracleQueuedPromotionFailureContext<TJob, TWorker>) => Promise<OracleQueuedPromotionFailureOutcome>;
|
|
57
|
+
onDurableHandoff?: (job: TJob, latest?: TJob) => Promise<void> | void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare function isQueuedOracleJob(job: OracleDurableWorkerHandoffJobLike | undefined): boolean;
|
|
61
|
+
export declare function compareQueuedOracleJobs(
|
|
62
|
+
left: { createdAt: string; queuedAt?: string; id: string },
|
|
63
|
+
right: { createdAt: string; queuedAt?: string; id: string },
|
|
64
|
+
): number;
|
|
65
|
+
export declare function hasDurableWorkerHandoff(job: OracleDurableWorkerHandoffJobLike | undefined): boolean;
|
|
66
|
+
export declare function hasAdmissionBlockingWorker(
|
|
67
|
+
job: OracleAdmissionBlockingJobLike | undefined,
|
|
68
|
+
isTrackedProcessAliveFn?: (pid: number | undefined, startedAt?: string) => boolean,
|
|
69
|
+
): boolean;
|
|
70
|
+
export declare function jobBlocksAdmission(
|
|
71
|
+
job: OracleAdmissionBlockingJobLike | undefined,
|
|
72
|
+
isTrackedProcessAliveFn?: (pid: number | undefined, startedAt?: string) => boolean,
|
|
73
|
+
): boolean;
|
|
74
|
+
export declare function buildRuntimeLeaseMetadata(
|
|
75
|
+
job: { id: string; runtimeId: string; runtimeSessionName: string; runtimeProfileDir: string; projectId: string; sessionId: string },
|
|
76
|
+
createdAt: string,
|
|
77
|
+
): OracleRuntimeLeaseMetadataLike;
|
|
78
|
+
export declare function buildConversationLeaseMetadata(
|
|
79
|
+
job: { id: string; conversationId?: string; projectId: string; sessionId: string },
|
|
80
|
+
createdAt: string,
|
|
81
|
+
): OracleConversationLeaseMetadataLike | undefined;
|
|
82
|
+
export declare function runQueuedJobPromotionPass<TJob extends { id: string; archivePath: string }, TWorker>(
|
|
83
|
+
options: OracleQueuedPromotionOptions<TJob, TWorker>,
|
|
84
|
+
): Promise<{ promotedJobIds: string[] }>;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// Purpose: Provide shared oracle job coordination helpers for admission control, lease metadata, and queued promotion orchestration.
|
|
2
|
+
// Responsibilities: Normalize queue ordering, derive lease metadata, detect durable handoff/admission blockers, and run a single queued-promotion pass.
|
|
3
|
+
// Scope: Pure coordination/state-machine logic only; filesystem I/O and job persistence remain in injected callbacks.
|
|
4
|
+
// Usage: Imported by lib/queue.ts, lib/runtime.ts, lib/jobs.ts, and worker/run-job.mjs to keep concurrency semantics aligned.
|
|
5
|
+
// Invariants/Assumptions: Queued jobs have durable ids/archive paths, and callers provide side-effect callbacks that preserve atomic job updates.
|
|
6
|
+
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import { isTrackedProcessAlive } from "./process-helpers.mjs";
|
|
9
|
+
|
|
10
|
+
/** @typedef {import("./job-coordination-helpers.d.mts").OracleAdmissionBlockingJobLike} OracleAdmissionBlockingJobLike */
|
|
11
|
+
/** @typedef {import("./job-coordination-helpers.d.mts").OracleConversationLeaseMetadataLike} OracleConversationLeaseMetadataLike */
|
|
12
|
+
/** @typedef {import("./job-coordination-helpers.d.mts").OracleDurableWorkerHandoffJobLike} OracleDurableWorkerHandoffJobLike */
|
|
13
|
+
/** @typedef {import("./job-coordination-helpers.d.mts").OracleRuntimeLeaseMetadataLike} OracleRuntimeLeaseMetadataLike */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {OracleDurableWorkerHandoffJobLike | undefined} job
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
export function isQueuedOracleJob(job) {
|
|
20
|
+
return job?.status === "queued";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {{ createdAt: string; queuedAt?: string; id: string }} left
|
|
25
|
+
* @param {{ createdAt: string; queuedAt?: string; id: string }} right
|
|
26
|
+
* @returns {number}
|
|
27
|
+
*/
|
|
28
|
+
export function compareQueuedOracleJobs(left, right) {
|
|
29
|
+
const leftKey = left.queuedAt ?? left.createdAt;
|
|
30
|
+
const rightKey = right.queuedAt ?? right.createdAt;
|
|
31
|
+
return leftKey.localeCompare(rightKey) || left.createdAt.localeCompare(right.createdAt) || left.id.localeCompare(right.id);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {OracleDurableWorkerHandoffJobLike | undefined} job
|
|
36
|
+
* @returns {boolean}
|
|
37
|
+
*/
|
|
38
|
+
export function hasDurableWorkerHandoff(job) {
|
|
39
|
+
if (!job || job.status === "queued") return false;
|
|
40
|
+
if (job.workerPid) return true;
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {OracleAdmissionBlockingJobLike | undefined} job
|
|
46
|
+
* @param {(pid: number | undefined, startedAt?: string) => boolean} [isTrackedProcessAliveFn]
|
|
47
|
+
* @returns {boolean}
|
|
48
|
+
*/
|
|
49
|
+
export function hasAdmissionBlockingWorker(job, isTrackedProcessAliveFn = isTrackedProcessAlive) {
|
|
50
|
+
if (!job?.workerPid) return false;
|
|
51
|
+
return isTrackedProcessAliveFn(job.workerPid, job.workerStartedAt);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @param {OracleAdmissionBlockingJobLike | undefined} job
|
|
56
|
+
* @param {(pid: number | undefined, startedAt?: string) => boolean} [isTrackedProcessAliveFn]
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
*/
|
|
59
|
+
export function jobBlocksAdmission(job, isTrackedProcessAliveFn = isTrackedProcessAlive) {
|
|
60
|
+
return ["preparing", "submitted", "waiting"].includes(String(job?.status || "")) ||
|
|
61
|
+
job?.cleanupPending === true ||
|
|
62
|
+
hasAdmissionBlockingWorker(job, isTrackedProcessAliveFn);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @param {{ id: string; runtimeId: string; runtimeSessionName: string; runtimeProfileDir: string; projectId: string; sessionId: string }} job
|
|
67
|
+
* @param {string} createdAt
|
|
68
|
+
* @returns {OracleRuntimeLeaseMetadataLike}
|
|
69
|
+
*/
|
|
70
|
+
export function buildRuntimeLeaseMetadata(job, createdAt) {
|
|
71
|
+
return {
|
|
72
|
+
jobId: job.id,
|
|
73
|
+
runtimeId: job.runtimeId,
|
|
74
|
+
runtimeSessionName: job.runtimeSessionName,
|
|
75
|
+
runtimeProfileDir: job.runtimeProfileDir,
|
|
76
|
+
projectId: job.projectId,
|
|
77
|
+
sessionId: job.sessionId,
|
|
78
|
+
createdAt,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @param {{ id: string; conversationId?: string; projectId: string; sessionId: string }} job
|
|
84
|
+
* @param {string} createdAt
|
|
85
|
+
* @returns {OracleConversationLeaseMetadataLike | undefined}
|
|
86
|
+
*/
|
|
87
|
+
export function buildConversationLeaseMetadata(job, createdAt) {
|
|
88
|
+
if (!job.conversationId) return undefined;
|
|
89
|
+
return {
|
|
90
|
+
jobId: job.id,
|
|
91
|
+
conversationId: job.conversationId,
|
|
92
|
+
projectId: job.projectId,
|
|
93
|
+
sessionId: job.sessionId,
|
|
94
|
+
createdAt,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @template {{ id: string; archivePath: string }} TJob
|
|
100
|
+
* @template TWorker
|
|
101
|
+
* @param {import("./job-coordination-helpers.d.mts").OracleQueuedPromotionOptions<TJob, TWorker>} options
|
|
102
|
+
* @returns {Promise<{ promotedJobIds: string[] }>}
|
|
103
|
+
*/
|
|
104
|
+
export async function runQueuedJobPromotionPass(options) {
|
|
105
|
+
const promotedJobIds = [];
|
|
106
|
+
const isQueuedJob = options.isQueuedJob ?? isQueuedOracleJob;
|
|
107
|
+
const durableHandoff = options.hasDurableWorkerHandoff ?? hasDurableWorkerHandoff;
|
|
108
|
+
|
|
109
|
+
for (const queuedJob of options.listQueuedJobs()) {
|
|
110
|
+
const promotedAt = new Date().toISOString();
|
|
111
|
+
let runtimeLeaseAcquired = false;
|
|
112
|
+
let conversationLeaseAcquired = false;
|
|
113
|
+
/** @type {TWorker | undefined} */
|
|
114
|
+
let spawnedWorker;
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
const current = options.refreshJob(queuedJob.id);
|
|
118
|
+
if (!isQueuedJob(current)) continue;
|
|
119
|
+
if (!existsSync(current.archivePath)) {
|
|
120
|
+
await options.failQueuedPromotion(current, `Queued oracle archive is missing: ${current.archivePath}`, promotedAt);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const runtimeAttempt = await options.acquireRuntimeLease(current, promotedAt);
|
|
125
|
+
if (!runtimeAttempt) break;
|
|
126
|
+
runtimeLeaseAcquired = true;
|
|
127
|
+
|
|
128
|
+
const conversationAttempt = await options.acquireConversationLease(current, promotedAt);
|
|
129
|
+
if (!conversationAttempt) {
|
|
130
|
+
await options.releaseRuntimeLease(current).catch(() => undefined);
|
|
131
|
+
runtimeLeaseAcquired = false;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
conversationLeaseAcquired = true;
|
|
135
|
+
|
|
136
|
+
await options.markSubmitted(current, promotedAt);
|
|
137
|
+
spawnedWorker = await options.spawnWorker(current);
|
|
138
|
+
await options.persistWorker(current, spawnedWorker);
|
|
139
|
+
promotedJobIds.push(current.id);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
142
|
+
const latest = options.readLatestJob(queuedJob.id);
|
|
143
|
+
if (spawnedWorker && durableHandoff(latest)) {
|
|
144
|
+
promotedJobIds.push(queuedJob.id);
|
|
145
|
+
await options.onDurableHandoff?.(queuedJob, latest);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (spawnedWorker) {
|
|
149
|
+
await options.terminateSpawnedWorker(spawnedWorker).catch(() => undefined);
|
|
150
|
+
}
|
|
151
|
+
if (latest && !options.isTerminalJob(latest)) {
|
|
152
|
+
await options.failQueuedPromotion(latest, message, promotedAt);
|
|
153
|
+
}
|
|
154
|
+
const failureOutcome = await options.cleanupAfterFailure({
|
|
155
|
+
job: queuedJob,
|
|
156
|
+
latest,
|
|
157
|
+
error,
|
|
158
|
+
at: promotedAt,
|
|
159
|
+
spawnedWorker,
|
|
160
|
+
runtimeLeaseAcquired,
|
|
161
|
+
conversationLeaseAcquired,
|
|
162
|
+
});
|
|
163
|
+
if (failureOutcome === "break") break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return { promotedJobIds };
|
|
168
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export type OracleJobStatus = "queued" | "preparing" | "submitted" | "waiting" | "complete" | "failed" | "cancelled";
|
|
2
|
+
|
|
3
|
+
export type OracleJobPhase =
|
|
4
|
+
| "queued"
|
|
5
|
+
| "submitted"
|
|
6
|
+
| "cloning_runtime"
|
|
7
|
+
| "launching_browser"
|
|
8
|
+
| "verifying_auth"
|
|
9
|
+
| "configuring_model"
|
|
10
|
+
| "uploading_archive"
|
|
11
|
+
| "awaiting_response"
|
|
12
|
+
| "extracting_response"
|
|
13
|
+
| "downloading_artifacts"
|
|
14
|
+
| "complete"
|
|
15
|
+
| "complete_with_artifact_errors"
|
|
16
|
+
| "failed"
|
|
17
|
+
| "cancelled";
|
|
18
|
+
|
|
19
|
+
export interface OracleJobLifecycleEvent {
|
|
20
|
+
at: string;
|
|
21
|
+
source: string;
|
|
22
|
+
kind: "created" | "phase" | "cleanup" | "notification" | "wakeup";
|
|
23
|
+
status: OracleJobStatus;
|
|
24
|
+
phase: OracleJobPhase;
|
|
25
|
+
message: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface OracleLifecycleTrackedJobLike {
|
|
29
|
+
status: OracleJobStatus;
|
|
30
|
+
phase: OracleJobPhase;
|
|
31
|
+
phaseAt: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
queuedAt?: string;
|
|
34
|
+
submittedAt?: string;
|
|
35
|
+
completedAt?: string;
|
|
36
|
+
heartbeatAt?: string;
|
|
37
|
+
lifecycleEvents?: OracleJobLifecycleEvent[];
|
|
38
|
+
cleanupPending?: boolean;
|
|
39
|
+
cleanupWarnings?: string[];
|
|
40
|
+
lastCleanupAt?: string;
|
|
41
|
+
notifyClaimedAt?: string;
|
|
42
|
+
notifyClaimedBy?: string;
|
|
43
|
+
notifiedAt?: string;
|
|
44
|
+
notificationEntryId?: string;
|
|
45
|
+
notificationSessionKey?: string;
|
|
46
|
+
notificationSessionFile?: string;
|
|
47
|
+
wakeupAttemptCount?: number;
|
|
48
|
+
wakeupLastRequestedAt?: string;
|
|
49
|
+
wakeupSettledAt?: string;
|
|
50
|
+
wakeupSettledSource?: string;
|
|
51
|
+
wakeupSettledSessionFile?: string;
|
|
52
|
+
wakeupSettledSessionKey?: string;
|
|
53
|
+
wakeupSettledBeforeFirstAttempt?: boolean;
|
|
54
|
+
wakeupObservedAt?: string;
|
|
55
|
+
wakeupObservedSource?: string;
|
|
56
|
+
wakeupObservedSessionFile?: string;
|
|
57
|
+
wakeupObservedSessionKey?: string;
|
|
58
|
+
error?: string;
|
|
59
|
+
artifactFailureCount?: number;
|
|
60
|
+
responsePath?: string;
|
|
61
|
+
responseFormat?: "text/plain";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface OraclePhaseTransitionOptions<TJob extends OracleLifecycleTrackedJobLike> {
|
|
65
|
+
at?: string;
|
|
66
|
+
source?: string;
|
|
67
|
+
message?: string;
|
|
68
|
+
patch?: Partial<TJob>;
|
|
69
|
+
clearNotificationClaim?: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface OracleWakeupSettlementOptions {
|
|
73
|
+
source: string;
|
|
74
|
+
at?: string;
|
|
75
|
+
sessionFile?: string;
|
|
76
|
+
sessionKey?: string;
|
|
77
|
+
allowBeforeFirstAttempt?: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface OracleNotificationTargetOptions {
|
|
81
|
+
at?: string;
|
|
82
|
+
source?: string;
|
|
83
|
+
notificationSessionKey: string;
|
|
84
|
+
notificationSessionFile?: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface OracleMarkNotifiedOptions {
|
|
88
|
+
at?: string;
|
|
89
|
+
source?: string;
|
|
90
|
+
notificationEntryId?: string;
|
|
91
|
+
notificationSessionKey?: string;
|
|
92
|
+
notificationSessionFile?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const ACTIVE_ORACLE_JOB_STATUSES: readonly OracleJobStatus[];
|
|
96
|
+
export const OPEN_ORACLE_JOB_STATUSES: readonly OracleJobStatus[];
|
|
97
|
+
export const TERMINAL_ORACLE_JOB_STATUSES: readonly OracleJobStatus[];
|
|
98
|
+
export const MAX_ORACLE_JOB_LIFECYCLE_EVENTS: number;
|
|
99
|
+
|
|
100
|
+
export declare function getOracleJobStatusForPhase(phase: OracleJobPhase): OracleJobStatus;
|
|
101
|
+
export declare function assertValidOracleJobState<TJob extends OracleLifecycleTrackedJobLike>(job: TJob): TJob;
|
|
102
|
+
export declare function appendOracleJobLifecycleEvent<TJob extends OracleLifecycleTrackedJobLike>(
|
|
103
|
+
job: TJob,
|
|
104
|
+
event: Omit<OracleJobLifecycleEvent, "status" | "phase"> & { status?: OracleJobStatus; phase?: OracleJobPhase },
|
|
105
|
+
): TJob;
|
|
106
|
+
export declare function getLatestOracleJobLifecycleEvent(job: Pick<OracleLifecycleTrackedJobLike, "lifecycleEvents">): OracleJobLifecycleEvent | undefined;
|
|
107
|
+
export declare function getLatestOracleTerminalLifecycleEvent(job: Pick<OracleLifecycleTrackedJobLike, "lifecycleEvents">): OracleJobLifecycleEvent | undefined;
|
|
108
|
+
export declare function markOracleJobCreated<TJob extends OracleLifecycleTrackedJobLike>(job: TJob, options?: { at?: string; source?: string; message?: string }): TJob;
|
|
109
|
+
export declare function transitionOracleJobPhase<TJob extends OracleLifecycleTrackedJobLike>(
|
|
110
|
+
job: TJob,
|
|
111
|
+
phase: OracleJobPhase,
|
|
112
|
+
options?: OraclePhaseTransitionOptions<TJob>,
|
|
113
|
+
): TJob;
|
|
114
|
+
export declare function applyOracleJobCleanupWarnings<TJob extends OracleLifecycleTrackedJobLike>(
|
|
115
|
+
job: TJob,
|
|
116
|
+
warnings: string[],
|
|
117
|
+
options?: { at?: string; source?: string; message?: string },
|
|
118
|
+
): TJob;
|
|
119
|
+
export declare function clearOracleJobCleanupState<TJob extends OracleLifecycleTrackedJobLike>(
|
|
120
|
+
job: TJob,
|
|
121
|
+
options?: { at?: string; source?: string; message?: string },
|
|
122
|
+
): TJob;
|
|
123
|
+
export declare function claimOracleJobNotification<TJob extends OracleLifecycleTrackedJobLike>(job: TJob, claimedBy: string, at?: string): TJob;
|
|
124
|
+
export declare function recordOracleJobNotificationTarget<TJob extends OracleLifecycleTrackedJobLike>(job: TJob, options: OracleNotificationTargetOptions): TJob;
|
|
125
|
+
export declare function markOracleJobNotified<TJob extends OracleLifecycleTrackedJobLike>(job: TJob, options?: OracleMarkNotifiedOptions): TJob;
|
|
126
|
+
export declare function releaseOracleJobNotificationClaim<TJob extends OracleLifecycleTrackedJobLike>(job: TJob): TJob;
|
|
127
|
+
export declare function noteOracleJobWakeupRequested<TJob extends OracleLifecycleTrackedJobLike>(job: TJob, options?: { at?: string; source?: string }): TJob;
|
|
128
|
+
export declare function markOracleJobWakeupSettled<TJob extends OracleLifecycleTrackedJobLike>(
|
|
129
|
+
job: TJob,
|
|
130
|
+
options: OracleWakeupSettlementOptions,
|
|
131
|
+
): TJob;
|