@opengeni/worker-bundle 0.12.10 → 0.13.5
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/dist/activities/agent-turn.d.ts +778 -0
- package/dist/activities/capabilities.d.ts +18 -0
- package/dist/activities/codex-auth.d.ts +1 -0
- package/dist/activities/codex-capacity.d.ts +31 -0
- package/dist/activities/codex-fleet-shadow.d.ts +74 -0
- package/dist/activities/codex-rotation.d.ts +261 -0
- package/dist/activities/common.d.ts +17 -0
- package/dist/activities/context-compaction.d.ts +81 -0
- package/dist/activities/documents.d.ts +39 -0
- package/dist/activities/environment.d.ts +97 -0
- package/dist/activities/expiring-material-renewal.d.ts +38 -0
- package/dist/activities/file-upload-reaper.d.ts +25 -0
- package/dist/activities/git-credential-renewal.d.ts +41 -0
- package/dist/activities/goals.d.ts +16 -0
- package/dist/activities/mcp-credentials.d.ts +14 -0
- package/dist/activities/packs.d.ts +77 -0
- package/dist/activities/parent-wake.d.ts +54 -0
- package/dist/activities/recording.d.ts +90 -0
- package/dist/activities/redaction.d.ts +1 -0
- package/dist/activities/rig-verification.d.ts +131 -0
- package/dist/activities/run-credential-renewal.d.ts +28 -0
- package/dist/activities/run-credentials.d.ts +36 -0
- package/dist/activities/run-input.d.ts +106 -0
- package/dist/activities/sandbox-lease.d.ts +128 -0
- package/dist/activities/scheduled-tasks.d.ts +4 -0
- package/dist/activities/session-state.d.ts +39 -0
- package/dist/activities/streaming.d.ts +24 -0
- package/dist/activities/toolspace-token-renewal.d.ts +23 -0
- package/dist/activities/turn-attempt-fenced.d.ts +11 -0
- package/dist/activities/types.d.ts +240 -0
- package/dist/activities/workflow-wake.d.ts +15 -0
- package/dist/activities/workspace-capture.d.ts +105 -0
- package/dist/activities.d.ts +312 -0
- package/dist/concurrency.d.ts +19 -0
- package/dist/host-export-pump.d.ts +66 -0
- package/dist/host-export.d.ts +6 -67
- package/dist/http.d.ts +32 -0
- package/dist/index.d.ts +27 -388
- package/dist/index.js +2729 -1208
- package/dist/index.js.map +1 -1
- package/dist/observability-metrics.d.ts +200 -0
- package/dist/op-journal.d.ts +10 -0
- package/dist/sandbox-resume.d.ts +152 -0
- package/dist/sandbox-routing.d.ts +159 -0
- package/dist/worker-service-lifecycle.d.ts +20 -0
- package/dist/workflow-bundle.js +88 -20
- package/dist/workflows/activities.d.ts +27 -0
- package/dist/workflows/document-index.d.ts +41 -0
- package/dist/workflows/file-upload-reaper.d.ts +2 -0
- package/dist/workflows/rig-verification.d.ts +3 -0
- package/dist/workflows/sandbox-reaper.d.ts +1 -0
- package/dist/workflows/scheduled-tasks.d.ts +17 -0
- package/dist/workflows/session.d.ts +58 -0
- package/dist/workflows/workflow-wake.d.ts +3 -0
- package/dist/workflows.d.ts +7 -0
- package/package.json +13 -13
- package/src/activities/agent-turn.ts +873 -131
- package/src/activities/context-compaction.ts +265 -76
- package/src/activities/environment.ts +1 -0
- package/src/activities/goals.ts +14 -0
- package/src/activities/rig-verification.ts +2 -0
- package/src/activities/run-input.ts +18 -4
- package/src/activities/sandbox-lease.ts +787 -133
- package/src/activities/session-state.ts +56 -0
- package/src/activities/types.ts +21 -0
- package/src/activities/workspace-capture.ts +95 -4
- package/src/activities.ts +3 -0
- package/src/observability-metrics.ts +94 -0
- package/src/sandbox-resume.ts +383 -90
- package/src/sandbox-routing.ts +32 -10
- package/src/workflows/activities.ts +1 -0
- package/src/workflows/session.ts +70 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,375 +1,16 @@
|
|
|
1
|
-
import { Settings } from
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
type WakeSessionWorkflowSignal = (input: {
|
|
15
|
-
accountId: string;
|
|
16
|
-
workspaceId: string;
|
|
17
|
-
sessionId: string;
|
|
18
|
-
workflowId: string;
|
|
19
|
-
wakeRevision: number;
|
|
20
|
-
interruptionRequested?: boolean;
|
|
21
|
-
}) => Promise<void>;
|
|
22
|
-
type SignalCodexCapacityWorkflow = (input: {
|
|
23
|
-
accountId: string;
|
|
24
|
-
workspaceId: string;
|
|
25
|
-
sessionId: string;
|
|
26
|
-
workflowId: string;
|
|
27
|
-
wakeRevision: number;
|
|
28
|
-
}) => Promise<void>;
|
|
29
|
-
/** Exact activity-owned proof that the hard sandbox/tool fence physically
|
|
30
|
-
* drained. This is delivery evidence only: the workflow still validates the
|
|
31
|
-
* persisted attempt dispatch and commits the authoritative Postgres receipt. */
|
|
32
|
-
type SessionAttemptQuiescenceProof = {
|
|
33
|
-
accountId: string;
|
|
34
|
-
workspaceId: string;
|
|
35
|
-
sessionId: string;
|
|
36
|
-
attemptId: string;
|
|
37
|
-
workflowId: string;
|
|
38
|
-
workflowRunId: string;
|
|
39
|
-
activityId: string;
|
|
40
|
-
};
|
|
41
|
-
type SignalSessionAttemptQuiesced = (input: SessionAttemptQuiescenceProof) => Promise<void>;
|
|
42
|
-
type InspectSessionAttemptActivity = (input: {
|
|
43
|
-
workflowId: string;
|
|
44
|
-
workflowRunId: string;
|
|
45
|
-
activityId: string;
|
|
46
|
-
}) => Promise<"pending" | "settled">;
|
|
47
|
-
type ActivityServices = {
|
|
48
|
-
settings: Settings;
|
|
49
|
-
db: Database;
|
|
50
|
-
bus: EventBus;
|
|
51
|
-
runtime: OpenGeniRuntime;
|
|
52
|
-
objectStorage: ObjectStorage | null;
|
|
53
|
-
documentServices: DocumentServices;
|
|
54
|
-
observability: Observability;
|
|
55
|
-
wakeSessionWorkflow: WakeSessionWorkflowSignal | null;
|
|
56
|
-
/** Durable signalWithStart fallback used only after the activity's direct
|
|
57
|
-
* physical-quiescence receipt write exhausts its bounded DB retries. */
|
|
58
|
-
signalSessionAttemptQuiesced: SignalSessionAttemptQuiesced | null;
|
|
59
|
-
/** Server-authoritative Temporal activity lease inspection used only to
|
|
60
|
-
* recover a missing quiescence receipt after the original activity vanished. */
|
|
61
|
-
inspectSessionAttemptActivity: InspectSessionAttemptActivity | null;
|
|
62
|
-
/** Revision-carrying capacity nudge; generic outbox repair is also sufficient. */
|
|
63
|
-
signalCodexCapacityWorkflow?: SignalCodexCapacityWorkflow | null;
|
|
64
|
-
entitlements?: EntitlementsPort | null;
|
|
65
|
-
connectionCredentials?: ConnectionCredentialsPort | null;
|
|
66
|
-
};
|
|
67
|
-
type CodexCapacityWaitRef = {
|
|
68
|
-
waiterId: string;
|
|
69
|
-
generation: number;
|
|
70
|
-
nextCheckAt: string;
|
|
71
|
-
wakeRevision: number;
|
|
72
|
-
};
|
|
73
|
-
type GetCodexCapacityWaitInput = {
|
|
74
|
-
workspaceId: string;
|
|
75
|
-
sessionId: string;
|
|
76
|
-
};
|
|
77
|
-
type ReconcileCodexCapacityWaitInput = {
|
|
78
|
-
accountId: string;
|
|
79
|
-
workspaceId: string;
|
|
80
|
-
sessionId: string;
|
|
81
|
-
waiterId: string;
|
|
82
|
-
generation: number;
|
|
83
|
-
cause: "timer" | "signal" | "queue" | "recovery";
|
|
84
|
-
};
|
|
85
|
-
type ReconcileCodexCapacityWaitResult = ({
|
|
86
|
-
action: "waiting";
|
|
87
|
-
} & CodexCapacityWaitRef) | {
|
|
88
|
-
action: "resumed" | "paused" | "superseded" | "stale";
|
|
89
|
-
};
|
|
90
|
-
type ActivityDependencies = Partial<ActivityServices>;
|
|
91
|
-
type RunAgentTurnInput = {
|
|
92
|
-
accountId: string;
|
|
93
|
-
workspaceId: string;
|
|
94
|
-
sessionId: string;
|
|
95
|
-
workflowId: string;
|
|
96
|
-
workflowRunId: string;
|
|
97
|
-
attemptId: string;
|
|
98
|
-
trigger: {
|
|
99
|
-
kind: "next";
|
|
100
|
-
} | {
|
|
101
|
-
kind: "approval";
|
|
102
|
-
triggerEventId: string;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
type SettleSessionInterruptionsInput = {
|
|
106
|
-
accountId: string;
|
|
107
|
-
workspaceId: string;
|
|
108
|
-
sessionId: string;
|
|
109
|
-
attemptId: string;
|
|
110
|
-
workflowId: string;
|
|
111
|
-
/**
|
|
112
|
-
* Replay-only compatibility for session workflow histories created before
|
|
113
|
-
* the receipt-gated cancellation v2 patch. New histories never send this
|
|
114
|
-
* phase; the exact activity writes the authoritative receipt itself.
|
|
115
|
-
*/
|
|
116
|
-
phase?: "logical" | "attempt_quiesced";
|
|
117
|
-
};
|
|
118
|
-
type PersistSessionAttemptQuiescenceInput = SessionAttemptQuiescenceProof;
|
|
119
|
-
type ReconcileSessionAttemptQuiescenceInput = {
|
|
120
|
-
accountId: string;
|
|
121
|
-
workspaceId: string;
|
|
122
|
-
sessionId: string;
|
|
123
|
-
attemptId: string;
|
|
124
|
-
workflowId: string;
|
|
125
|
-
};
|
|
126
|
-
type ReconcileSessionAttemptQuiescenceResult = {
|
|
127
|
-
action: "quiesced" | "pending" | "stale";
|
|
128
|
-
};
|
|
129
|
-
type FailSessionAttemptInput = {
|
|
130
|
-
accountId: string;
|
|
131
|
-
workspaceId: string;
|
|
132
|
-
sessionId: string;
|
|
133
|
-
attemptId: string;
|
|
134
|
-
error?: string;
|
|
135
|
-
};
|
|
136
|
-
type RecoverDispatchInput = {
|
|
137
|
-
accountId: string;
|
|
138
|
-
workspaceId: string;
|
|
139
|
-
sessionId: string;
|
|
140
|
-
attemptId: string;
|
|
141
|
-
timeoutType: "HEARTBEAT" | "SCHEDULE_TO_START";
|
|
142
|
-
};
|
|
143
|
-
type RecoverDispatchResult = {
|
|
144
|
-
action: "unclaimed";
|
|
145
|
-
} | {
|
|
146
|
-
action: "recovering";
|
|
147
|
-
turnId: string;
|
|
148
|
-
redispatches: number;
|
|
149
|
-
} | {
|
|
150
|
-
action: "stale";
|
|
151
|
-
} | {
|
|
152
|
-
action: "exceeded";
|
|
153
|
-
turnId: string;
|
|
154
|
-
redispatches: number;
|
|
155
|
-
};
|
|
156
|
-
type PeekSessionWorkInput = {
|
|
157
|
-
workspaceId: string;
|
|
158
|
-
sessionId: string;
|
|
159
|
-
};
|
|
160
|
-
type ExpireSessionHumanInputInput = {
|
|
161
|
-
accountId: string;
|
|
162
|
-
workspaceId: string;
|
|
163
|
-
sessionId: string;
|
|
164
|
-
requestId: string;
|
|
165
|
-
};
|
|
166
|
-
type ExpireSessionHumanInputResult = {
|
|
167
|
-
action: "expired" | "stale" | "not_found";
|
|
168
|
-
};
|
|
169
|
-
type MarkSessionIdleInput = {
|
|
170
|
-
workspaceId: string;
|
|
171
|
-
sessionId: string;
|
|
172
|
-
};
|
|
173
|
-
type MaybeContinueGoalInput = {
|
|
174
|
-
accountId: string;
|
|
175
|
-
workspaceId: string;
|
|
176
|
-
sessionId: string;
|
|
177
|
-
workflowId: string;
|
|
178
|
-
};
|
|
179
|
-
type MaybeContinueGoalResult = {
|
|
180
|
-
action: "none" | "queue" | "continue" | "paused";
|
|
181
|
-
};
|
|
182
|
-
type DispatchScheduledTaskRunInput = {
|
|
183
|
-
workspaceId: string;
|
|
184
|
-
taskId: string;
|
|
185
|
-
/** Stable Temporal workflow identity; retries must reuse the same source row. */
|
|
186
|
-
producerKey?: string;
|
|
187
|
-
} & ({
|
|
188
|
-
triggerType: Extract<ScheduledTaskTriggerType, "scheduled">;
|
|
189
|
-
agentRunUsageIdempotencyKey?: never;
|
|
190
|
-
initiator?: never;
|
|
191
|
-
} | {
|
|
192
|
-
triggerType: Extract<ScheduledTaskTriggerType, "manual">;
|
|
193
|
-
agentRunUsageIdempotencyKey: string;
|
|
194
|
-
/** Exact identity used by the API-side charge for this same trigger. */
|
|
195
|
-
initiator: TurnInitiator;
|
|
196
|
-
});
|
|
197
|
-
type DispatchScheduledTaskRunResult = {
|
|
198
|
-
action: "deleted";
|
|
199
|
-
} | {
|
|
200
|
-
action: "blocked";
|
|
201
|
-
reason: "insufficient_credits" | "monthly_model_cost_limit" | "monthly_agent_run_limit" | "malformed_manual_trigger";
|
|
202
|
-
} | {
|
|
203
|
-
action: "start" | "signal";
|
|
204
|
-
accountId: string;
|
|
205
|
-
workspaceId: string;
|
|
206
|
-
sessionId: string;
|
|
207
|
-
triggerEventId: string;
|
|
208
|
-
workflowId: string;
|
|
209
|
-
workflowWakeRevision: number | null;
|
|
210
|
-
};
|
|
211
|
-
type IndexDocumentInput = {
|
|
212
|
-
accountId: string;
|
|
213
|
-
workspaceId: string;
|
|
214
|
-
documentId: string;
|
|
215
|
-
};
|
|
216
|
-
type ClaimedRunAgentTurnResult = {
|
|
217
|
-
status: "idle" | "requires_action" | "failed" | "cancelled" | "recovering" | "waiting_capacity";
|
|
218
|
-
turnId: string;
|
|
219
|
-
attemptId: string;
|
|
220
|
-
continueDelayMs?: number;
|
|
221
|
-
idleUntilReset?: boolean;
|
|
222
|
-
capacityWait?: CodexCapacityWaitRef;
|
|
223
|
-
deferredUntilWake?: boolean;
|
|
224
|
-
};
|
|
225
|
-
type RunAgentTurnResult = ClaimedRunAgentTurnResult | {
|
|
226
|
-
status: "unclaimed";
|
|
227
|
-
reason: "gate-closed" | "no-work" | "stale-approval" | "control-pending";
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
type ReapExpiredFileUploadsResult = {
|
|
231
|
-
claimed: number;
|
|
232
|
-
deleted: number;
|
|
233
|
-
failed: number;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
type DispatchSessionWorkflowWakesResult = {
|
|
237
|
-
claimed: number;
|
|
238
|
-
delivered: number;
|
|
239
|
-
failed: number;
|
|
240
|
-
exhaustedBatchLimit: boolean;
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
type ReapSandboxLeasesResult = {
|
|
244
|
-
/** Stale viewer holders + warming-death rows the sweep touched is folded into
|
|
245
|
-
* the DB pass; here we report the terminate outcomes. */
|
|
246
|
-
examined: number;
|
|
247
|
-
/** Boxes whose provider terminate fired AND whose lease went cold. */
|
|
248
|
-
terminated: number;
|
|
249
|
-
/** Drainable rows skipped because the CAS no longer held (re-armed / newer
|
|
250
|
-
* epoch / already drained by a concurrent sweep) — provider stop() did NOT
|
|
251
|
-
* fire. */
|
|
252
|
-
skipped: number;
|
|
253
|
-
/** Warm viewer-only leases that accrued warm-seconds this tick (P2.1). */
|
|
254
|
-
metered: number;
|
|
255
|
-
/** Viewer-only boxes force-drained because their workspace is over a limit
|
|
256
|
-
* (0 balance / over the warm cap) — turn-held boxes are never drained (P2.1). */
|
|
257
|
-
forceDrained: number;
|
|
258
|
-
/** Provider-side Modal orphan sandboxes terminated by the defensive sweep. */
|
|
259
|
-
modalOrphansTerminated: number;
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
declare function createControlActivities(dependencies?: ActivityDependencies): {
|
|
263
|
-
reapSandboxLeases: () => Promise<ReapSandboxLeasesResult>;
|
|
264
|
-
dispatchSessionWorkflowWakes(): Promise<DispatchSessionWorkflowWakesResult>;
|
|
265
|
-
reapExpiredFileUploads: () => Promise<ReapExpiredFileUploadsResult>;
|
|
266
|
-
verifyRigChange: (input: {
|
|
267
|
-
workspaceId: string;
|
|
268
|
-
changeId: string;
|
|
269
|
-
}) => Promise<{
|
|
270
|
-
id: string;
|
|
271
|
-
rigId: string;
|
|
272
|
-
baseVersionId: string | null;
|
|
273
|
-
kind: "setup_append" | "definition_edit";
|
|
274
|
-
payload: Record<string, unknown>;
|
|
275
|
-
status: "failed" | "proposed" | "rejected" | "verifying" | "merged";
|
|
276
|
-
proposedBy: string | null;
|
|
277
|
-
verification: {
|
|
278
|
-
[x: string]: unknown;
|
|
279
|
-
startedAt?: string | undefined;
|
|
280
|
-
finishedAt?: string | undefined;
|
|
281
|
-
log?: string | undefined;
|
|
282
|
-
checkResults?: {
|
|
283
|
-
name: string;
|
|
284
|
-
command: string;
|
|
285
|
-
exitCode: number | null;
|
|
286
|
-
output?: string | undefined;
|
|
287
|
-
}[] | undefined;
|
|
288
|
-
} | null;
|
|
289
|
-
resultVersionId: string | null;
|
|
290
|
-
createdAt: string;
|
|
291
|
-
updatedAt: string;
|
|
292
|
-
}>;
|
|
293
|
-
verifyRigVersion: (input: {
|
|
294
|
-
workspaceId: string;
|
|
295
|
-
versionId: string;
|
|
296
|
-
}) => Promise<{
|
|
297
|
-
versionId: string;
|
|
298
|
-
passed: boolean;
|
|
299
|
-
checkResults: {
|
|
300
|
-
exitCode: number | null;
|
|
301
|
-
output: string;
|
|
302
|
-
name: string;
|
|
303
|
-
command: string;
|
|
304
|
-
}[];
|
|
305
|
-
}>;
|
|
306
|
-
getCodexCapacityWait: (input: GetCodexCapacityWaitInput) => Promise<{
|
|
307
|
-
waiterId: string;
|
|
308
|
-
generation: number;
|
|
309
|
-
nextCheckAt: string;
|
|
310
|
-
wakeRevision: number;
|
|
311
|
-
} | null>;
|
|
312
|
-
reconcileCodexCapacityWait: (input: ReconcileCodexCapacityWaitInput) => Promise<ReconcileCodexCapacityWaitResult>;
|
|
313
|
-
enqueueGoalRetryWake: (input: MaybeContinueGoalInput) => Promise<void>;
|
|
314
|
-
maybeContinueGoal: (input: MaybeContinueGoalInput) => Promise<MaybeContinueGoalResult>;
|
|
315
|
-
dispatchScheduledTaskRun: (input: DispatchScheduledTaskRunInput) => Promise<DispatchScheduledTaskRunResult>;
|
|
316
|
-
failSessionAttempt: (input: FailSessionAttemptInput) => Promise<void>;
|
|
317
|
-
settleSessionInterruptions: (input: SettleSessionInterruptionsInput) => Promise<{
|
|
318
|
-
action: "paused" | "continue" | "stale";
|
|
319
|
-
}>;
|
|
320
|
-
persistSessionAttemptQuiescence: (input: PersistSessionAttemptQuiescenceInput) => Promise<void>;
|
|
321
|
-
reconcileSessionAttemptQuiescence: (input: ReconcileSessionAttemptQuiescenceInput) => Promise<ReconcileSessionAttemptQuiescenceResult>;
|
|
322
|
-
recoverDispatch: (input: RecoverDispatchInput) => Promise<RecoverDispatchResult>;
|
|
323
|
-
peekSessionWork: (input: PeekSessionWorkInput) => Promise<_opengeni_db.SessionWorkPeek>;
|
|
324
|
-
expireSessionHumanInput: (input: ExpireSessionHumanInputInput) => Promise<ExpireSessionHumanInputResult>;
|
|
325
|
-
markSessionIdle: (input: MarkSessionIdleInput) => Promise<void>;
|
|
326
|
-
indexDocument: (input: IndexDocumentInput) => Promise<{
|
|
327
|
-
id: string;
|
|
328
|
-
workspaceId: string;
|
|
329
|
-
baseId: string;
|
|
330
|
-
fileId: string;
|
|
331
|
-
status: "ready" | "failed" | "queued" | "indexing";
|
|
332
|
-
title: string;
|
|
333
|
-
parser: string;
|
|
334
|
-
chunkCount: number;
|
|
335
|
-
error: string | null;
|
|
336
|
-
sourceKind: "repository" | "email" | "manual_upload" | "meeting_transcript" | "chat" | "document" | "web" | "other";
|
|
337
|
-
sourceUri: string | null;
|
|
338
|
-
sourceExternalId: string | null;
|
|
339
|
-
sourceTitle: string | null;
|
|
340
|
-
sourceAuthor: string | null;
|
|
341
|
-
sourceCreatedAt: string | null;
|
|
342
|
-
sourceUpdatedAt: string | null;
|
|
343
|
-
sourceVersion: string | null;
|
|
344
|
-
aclTags: string[];
|
|
345
|
-
visibility: "workspace" | "private";
|
|
346
|
-
createdBy: string | null;
|
|
347
|
-
agentAccess: boolean;
|
|
348
|
-
summary: string | null;
|
|
349
|
-
topics: string[];
|
|
350
|
-
curationStatus: "none" | "pending" | "failed" | "suggested" | "auto_filed";
|
|
351
|
-
curation: {
|
|
352
|
-
suggestedBaseId: string | null;
|
|
353
|
-
suggestedBaseName: string | null;
|
|
354
|
-
confidence: number;
|
|
355
|
-
reason: string | null;
|
|
356
|
-
originalTitle: string | null;
|
|
357
|
-
model: string | null;
|
|
358
|
-
} | null;
|
|
359
|
-
createdAt: string;
|
|
360
|
-
updatedAt: string;
|
|
361
|
-
}>;
|
|
362
|
-
};
|
|
363
|
-
declare function createTurnActivities(dependencies?: ActivityDependencies): {
|
|
364
|
-
runAgentTurn: (input: RunAgentTurnInput) => Promise<RunAgentTurnResult>;
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
type WorkerLifecycleState = "starting" | "ready" | "draining" | "stopped" | "failed";
|
|
368
|
-
|
|
369
|
-
declare const FILE_UPLOAD_REAPER_SCHEDULE_ID = "opengeni-file-upload-reaper";
|
|
370
|
-
declare const FILE_UPLOAD_REAPER_PERIOD_MS: number;
|
|
371
|
-
type OpenGeniWorkerRole = "control" | "turn";
|
|
372
|
-
type WorkerOptions = {
|
|
1
|
+
import { type Settings } from "@opengeni/config";
|
|
2
|
+
import { type Database, type RuntimeDatabasePostureOptions } from "@opengeni/db";
|
|
3
|
+
import { type EventBus } from "@opengeni/events";
|
|
4
|
+
import { type Observability } from "@opengeni/observability";
|
|
5
|
+
import { NativeConnection, Worker, type WorkflowBundleOption } from "@temporalio/worker";
|
|
6
|
+
import { createControlActivities, createTurnActivities, type ActivityDependencies } from "./activities";
|
|
7
|
+
import type { InspectSessionAttemptActivity, SignalCodexCapacityWorkflow, SignalSessionAttemptQuiesced, WakeSessionWorkflowSignal } from "./activities/types";
|
|
8
|
+
import { type WorkerLifecycleState } from "./http";
|
|
9
|
+
export { createHostExportPump, type HostExportDrainResult, type HostExportPump, type HostExportPumpOptions, type HostEventExport, type HostEventExportBatch, type HostEventSink, type HostUsageExport, type HostUsageExportBatch, type HostUsageSink, } from "./host-export";
|
|
10
|
+
export declare const FILE_UPLOAD_REAPER_SCHEDULE_ID = "opengeni-file-upload-reaper";
|
|
11
|
+
export declare const FILE_UPLOAD_REAPER_PERIOD_MS: number;
|
|
12
|
+
export type OpenGeniWorkerRole = "control" | "turn";
|
|
13
|
+
export type WorkerOptions = {
|
|
373
14
|
role: OpenGeniWorkerRole;
|
|
374
15
|
settings?: Settings;
|
|
375
16
|
activities?: ReturnType<typeof createControlActivities> | ReturnType<typeof createTurnActivities>;
|
|
@@ -393,7 +34,7 @@ type TemporalActivityLease = {
|
|
|
393
34
|
} | null;
|
|
394
35
|
} | null;
|
|
395
36
|
};
|
|
396
|
-
declare function temporalActivityLeaseSettled(pending: TemporalActivityLease | null | undefined, nowMs?: number): boolean;
|
|
37
|
+
export declare function temporalActivityLeaseSettled(pending: TemporalActivityLease | null | undefined, nowMs?: number): boolean;
|
|
397
38
|
type WorkerWorkflowDefinition = {
|
|
398
39
|
workflowBundle: WorkflowBundleOption;
|
|
399
40
|
} | {
|
|
@@ -405,12 +46,12 @@ type WorkerWorkflowDefinition = {
|
|
|
405
46
|
* the source path for the local development loop; published dist execution
|
|
406
47
|
* fails closed unless the build-generated sibling artifact is present.
|
|
407
48
|
*/
|
|
408
|
-
declare function resolveOpenGeniWorkflowDefinition(moduleUrl?: string): WorkerWorkflowDefinition;
|
|
409
|
-
declare function createOpenGeniWorker(options: WorkerOptions): Promise<{
|
|
49
|
+
export declare function resolveOpenGeniWorkflowDefinition(moduleUrl?: string): WorkerWorkflowDefinition;
|
|
50
|
+
export declare function createOpenGeniWorker(options: WorkerOptions): Promise<{
|
|
410
51
|
worker: Worker;
|
|
411
52
|
connection: NativeConnection;
|
|
412
53
|
}>;
|
|
413
|
-
declare function createWorkerWorkflowSignaler(settings: Settings, db: Database): Promise<{
|
|
54
|
+
export declare function createWorkerWorkflowSignaler(settings: Settings, db: Database): Promise<{
|
|
414
55
|
wakeSessionWorkflow: WakeSessionWorkflowSignal;
|
|
415
56
|
signalSessionAttemptQuiesced: SignalSessionAttemptQuiesced;
|
|
416
57
|
inspectSessionAttemptActivity: InspectSessionAttemptActivity;
|
|
@@ -435,7 +76,7 @@ declare function createWorkerWorkflowSignaler(settings: Settings, db: Database):
|
|
|
435
76
|
* Returns a `close()` for the dedicated client connection (separate from the
|
|
436
77
|
* worker's NativeConnection — the Schedule client is a @temporalio/client).
|
|
437
78
|
*/
|
|
438
|
-
declare function registerSandboxReaperSchedule(settings: Settings, observability: Observability): Promise<{
|
|
79
|
+
export declare function registerSandboxReaperSchedule(settings: Settings, observability: Observability): Promise<{
|
|
439
80
|
registered: boolean;
|
|
440
81
|
close: () => Promise<void>;
|
|
441
82
|
}>;
|
|
@@ -445,7 +86,7 @@ declare function registerSandboxReaperSchedule(settings: Settings, observability
|
|
|
445
86
|
* deployments where sandbox ownership is disabled. The activity is a cheap
|
|
446
87
|
* no-op when object storage is not configured.
|
|
447
88
|
*/
|
|
448
|
-
declare function registerFileUploadReaperSchedule(settings: Settings, observability: Observability): Promise<{
|
|
89
|
+
export declare function registerFileUploadReaperSchedule(settings: Settings, observability: Observability): Promise<{
|
|
449
90
|
registered: boolean;
|
|
450
91
|
close: () => Promise<void>;
|
|
451
92
|
}>;
|
|
@@ -454,11 +95,11 @@ declare function registerFileUploadReaperSchedule(settings: Settings, observabil
|
|
|
454
95
|
* activity only reads the transactional outbox and sends revision-scoped
|
|
455
96
|
* signals; it is independent of sandbox ownership and child-agent features.
|
|
456
97
|
*/
|
|
457
|
-
declare function registerSessionWorkflowWakeDispatcherSchedule(settings: Settings, observability: Observability): Promise<{
|
|
98
|
+
export declare function registerSessionWorkflowWakeDispatcherSchedule(settings: Settings, observability: Observability): Promise<{
|
|
458
99
|
registered: boolean;
|
|
459
100
|
close: () => Promise<void>;
|
|
460
101
|
}>;
|
|
461
|
-
type OpenGeniWorkerServiceOptions = Omit<WorkerOptions, "activityDependencies"> & {
|
|
102
|
+
export type OpenGeniWorkerServiceOptions = Omit<WorkerOptions, "activityDependencies"> & {
|
|
462
103
|
activityDependencies: ActivityDependencies & {
|
|
463
104
|
db: Database;
|
|
464
105
|
bus: EventBus;
|
|
@@ -480,7 +121,7 @@ type OpenGeniWorkerServiceOptions = Omit<WorkerOptions, "activityDependencies">
|
|
|
480
121
|
readinessTimeoutMs?: number;
|
|
481
122
|
};
|
|
482
123
|
};
|
|
483
|
-
type OpenGeniWorkerService = {
|
|
124
|
+
export type OpenGeniWorkerService = {
|
|
484
125
|
readonly role: OpenGeniWorkerRole;
|
|
485
126
|
readonly worker: Worker;
|
|
486
127
|
readonly connection: NativeConnection;
|
|
@@ -489,20 +130,18 @@ type OpenGeniWorkerService = {
|
|
|
489
130
|
drain(reason?: string): void;
|
|
490
131
|
close(): Promise<void>;
|
|
491
132
|
};
|
|
492
|
-
declare function workerOwnsInternalSchedules(role: OpenGeniWorkerRole, policy?: OpenGeniWorkerServiceOptions["internalSchedules"]): boolean;
|
|
133
|
+
export declare function workerOwnsInternalSchedules(role: OpenGeniWorkerRole, policy?: OpenGeniWorkerServiceOptions["internalSchedules"]): boolean;
|
|
493
134
|
/**
|
|
494
135
|
* Construct one role-specific worker process around the lower-level Temporal
|
|
495
136
|
* worker factory. The service owns every Temporal client and HTTP listener it
|
|
496
137
|
* creates. The embedding host retains ownership of its injected DB and EventBus
|
|
497
138
|
* handles and closes those only after this service has drained.
|
|
498
139
|
*/
|
|
499
|
-
declare function createOpenGeniWorkerService(options: OpenGeniWorkerServiceOptions): Promise<OpenGeniWorkerService>;
|
|
500
|
-
type RunOpenGeniWorkerOptions = OpenGeniWorkerServiceOptions & {
|
|
140
|
+
export declare function createOpenGeniWorkerService(options: OpenGeniWorkerServiceOptions): Promise<OpenGeniWorkerService>;
|
|
141
|
+
export type RunOpenGeniWorkerOptions = OpenGeniWorkerServiceOptions & {
|
|
501
142
|
/** Defaults to SIGTERM and SIGINT. Pass false when the host owns process signals. */
|
|
502
143
|
shutdownSignals?: false | ReadonlyArray<"SIGTERM" | "SIGINT">;
|
|
503
144
|
};
|
|
504
145
|
/** Start, drain, and close one embedded worker process. */
|
|
505
|
-
declare function runOpenGeniWorker(options: RunOpenGeniWorkerOptions): Promise<void>;
|
|
506
|
-
declare function startWorker(): Promise<void>;
|
|
507
|
-
|
|
508
|
-
export { FILE_UPLOAD_REAPER_PERIOD_MS, FILE_UPLOAD_REAPER_SCHEDULE_ID, type OpenGeniWorkerRole, type OpenGeniWorkerService, type OpenGeniWorkerServiceOptions, type RunOpenGeniWorkerOptions, type WorkerOptions, createOpenGeniWorker, createOpenGeniWorkerService, createWorkerWorkflowSignaler, registerFileUploadReaperSchedule, registerSandboxReaperSchedule, registerSessionWorkflowWakeDispatcherSchedule, resolveOpenGeniWorkflowDefinition, runOpenGeniWorker, startWorker, temporalActivityLeaseSettled, workerOwnsInternalSchedules };
|
|
146
|
+
export declare function runOpenGeniWorker(options: RunOpenGeniWorkerOptions): Promise<void>;
|
|
147
|
+
export declare function startWorker(): Promise<void>;
|