@opengeni/worker-bundle 0.17.2 → 0.20.1
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-run-admission.d.ts +12 -0
- package/dist/activities/agent-turn.d.ts +49 -1
- package/dist/activities/browser-state-artifact-reaper.d.ts +29 -0
- package/dist/activities/capabilities.d.ts +6 -0
- package/dist/activities/codex-capacity.d.ts +1 -0
- package/dist/activities/environment.d.ts +7 -1
- package/dist/activities/packs.d.ts +8 -10
- package/dist/activities/run-input.d.ts +8 -0
- package/dist/activities/session-state.d.ts +7 -3
- package/dist/activities/site-auth-maintenance.d.ts +27 -0
- package/dist/activities/types.d.ts +43 -0
- package/dist/activities/video-generation-admission.d.ts +9 -4
- package/dist/activities/video-generation-credential.d.ts +17 -0
- package/dist/activities/video-reference-staging.d.ts +7 -1
- package/dist/activities/xai-auth.d.ts +23 -0
- package/dist/activities/xai-image-generation.d.ts +26 -0
- package/dist/activities/xai-video-generation.d.ts +18 -0
- package/dist/{activities-control-44KBWLSM.js → activities-control-SMKF2OBE.js} +438 -55
- package/dist/activities-control-SMKF2OBE.js.map +1 -0
- package/dist/activities-control.d.ts +10 -2
- package/dist/{activities-turn-K4CEDEGJ.js → activities-turn-IDS3WEHA.js} +6704 -4847
- package/dist/activities-turn-IDS3WEHA.js.map +1 -0
- package/dist/activities.d.ts +11 -3
- package/dist/{chunk-E3RI3I33.js → chunk-N5TJIFCE.js} +156 -10
- package/dist/chunk-N5TJIFCE.js.map +1 -0
- package/dist/{chunk-KKCRGAGZ.js → chunk-P6Z2SLAA.js} +99 -98
- package/dist/chunk-P6Z2SLAA.js.map +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +49 -2
- package/dist/index.js.map +1 -1
- package/dist/model-checkpoint-memory-collector.d.ts +1 -0
- package/dist/model-context-contributions.d.ts +40 -0
- package/dist/observability-metrics.d.ts +57 -1
- package/dist/sandbox-routing.d.ts +4 -0
- package/dist/workflow-bundle.js +232 -18
- package/dist/workflows/activities.d.ts +1 -1
- package/dist/workflows/session.d.ts +17 -1
- package/dist/workflows/site-auth-maintenance.d.ts +2 -0
- package/dist/workflows.d.ts +1 -0
- package/package.json +16 -15
- package/src/activities/agent-run-admission.ts +76 -0
- package/src/activities/agent-turn.ts +2777 -1241
- package/src/activities/browser-state-artifact-reaper.ts +120 -0
- package/src/activities/capabilities.ts +10 -0
- package/src/activities/codex-capacity.ts +48 -1
- package/src/activities/environment.ts +14 -8
- package/src/activities/goals.ts +2 -1
- package/src/activities/packs.ts +45 -122
- package/src/activities/parent-wake.ts +13 -1
- package/src/activities/run-input.ts +137 -45
- package/src/activities/scheduled-tasks.ts +30 -73
- package/src/activities/session-state.ts +87 -5
- package/src/activities/site-auth-maintenance.ts +269 -0
- package/src/activities/types.ts +44 -0
- package/src/activities/video-generation-admission.ts +37 -4
- package/src/activities/video-generation-credential.ts +84 -6
- package/src/activities/video-generation-reconciliation.ts +212 -19
- package/src/activities/video-media-validation.ts +8 -2
- package/src/activities/video-reference-staging.ts +121 -34
- package/src/activities/xai-auth.ts +122 -0
- package/src/activities/xai-image-generation.ts +86 -0
- package/src/activities/xai-video-generation.ts +69 -0
- package/src/activities-control.ts +4 -0
- package/src/activities.ts +7 -0
- package/src/index.ts +51 -0
- package/src/model-checkpoint-memory-collector.ts +8 -1
- package/src/model-context-contributions.ts +159 -0
- package/src/observability-metrics.ts +282 -12
- package/src/sandbox-routing.ts +13 -0
- package/src/workflows/activities.ts +1 -0
- package/src/workflows/file-upload-reaper.ts +8 -2
- package/src/workflows/session.ts +219 -14
- package/src/workflows/site-auth-maintenance.ts +14 -0
- package/src/workflows.ts +1 -0
- package/dist/activities-control-44KBWLSM.js.map +0 -1
- package/dist/activities-turn-K4CEDEGJ.js.map +0 -1
- package/dist/chunk-E3RI3I33.js.map +0 -1
- package/dist/chunk-KKCRGAGZ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ import { type WorkerRunTarget } from "./worker-service-lifecycle.js";
|
|
|
13
13
|
export { createHostExportPump, type HostExportDrainResult, type HostExportPump, type HostExportPumpOptions, type HostEventExport, type HostEventExportBatch, type HostEventSink, type HostUsageExport, type HostUsageExportBatch, type HostUsageSink, } from "./host-export.js";
|
|
14
14
|
export declare const FILE_UPLOAD_REAPER_SCHEDULE_ID = "opengeni-file-upload-reaper";
|
|
15
15
|
export declare const FILE_UPLOAD_REAPER_PERIOD_MS: number;
|
|
16
|
+
export declare const SITE_AUTH_MAINTENANCE_SCHEDULE_ID = "opengeni-site-auth-maintenance";
|
|
17
|
+
export declare const SITE_AUTH_MAINTENANCE_PERIOD_MS: number;
|
|
16
18
|
export type OpenGeniWorkerRole = "control" | "turn";
|
|
17
19
|
export type WorkerOptions = {
|
|
18
20
|
role: OpenGeniWorkerRole;
|
|
@@ -46,12 +48,14 @@ export declare function temporalWorkflowExecutionNotFound(error: unknown): boole
|
|
|
46
48
|
* until an activity first resolves its injected services. */
|
|
47
49
|
export declare function createDefaultWorkerActivities(role: OpenGeniWorkerRole, dependencies?: ActivityDependencies): Promise<{
|
|
48
50
|
getCodexCapacityWait: (input: import("./activities.js").GetCodexCapacityWaitInput) => Promise<{
|
|
51
|
+
provider?: "xai";
|
|
49
52
|
waiterId: string;
|
|
50
53
|
generation: number;
|
|
51
54
|
nextCheckAt: string;
|
|
52
55
|
wakeRevision: number;
|
|
53
56
|
} | null>;
|
|
54
57
|
reconcileCodexCapacityWait: (input: import("./activities.js").ReconcileCodexCapacityWaitInput) => Promise<import("./activities.js").ReconcileCodexCapacityWaitResult>;
|
|
58
|
+
maintainBrowserStateArtifacts: () => Promise<import("./activities/browser-state-artifact-reaper.js").MaintainBrowserStateArtifactsResult>;
|
|
55
59
|
indexDocument: (input: import("./activities.js").IndexDocumentInput) => Promise<{
|
|
56
60
|
id: string;
|
|
57
61
|
workspaceId: string;
|
|
@@ -175,7 +179,8 @@ export declare function createDefaultWorkerActivities(role: OpenGeniWorkerRole,
|
|
|
175
179
|
maintainSandboxLeaseSweep: (input: import("./sandbox-reaper-contract.js").SandboxLeaseSweepMaintenanceInput) => Promise<import("./activities/sandbox-lease.js").SandboxLeaseSweepMaintenanceResult>;
|
|
176
180
|
reapSandboxLeases: () => Promise<import("./activities/sandbox-lease.js").ReapSandboxLeasesResult>;
|
|
177
181
|
dispatchScheduledTaskRun: (input: import("./activities.js").DispatchScheduledTaskRunInput) => Promise<import("./activities.js").DispatchScheduledTaskRunResult>;
|
|
178
|
-
|
|
182
|
+
maintainSiteAuthConnections: () => Promise<import("./activities/site-auth-maintenance.js").MaintainSiteAuthConnectionsResult>;
|
|
183
|
+
failSessionAttempt: (input: import("./activities.js").FailSessionAttemptInput) => Promise<import("./activities.js").FailSessionAttemptResult>;
|
|
179
184
|
settleSessionInterruptions: (input: import("./activities/types.js").SettleSessionInterruptionsInput) => Promise<{
|
|
180
185
|
action: "paused" | "continue" | "stale";
|
|
181
186
|
}>;
|
|
@@ -185,6 +190,7 @@ export declare function createDefaultWorkerActivities(role: OpenGeniWorkerRole,
|
|
|
185
190
|
recoverEscapedMcpTimeout: (input: import("./activities.js").RecoverEscapedMcpTimeoutInput) => Promise<import("./activities.js").RecoverEscapedMcpTimeoutResult>;
|
|
186
191
|
peekSessionWork: (input: import("./activities/types.js").PeekSessionWorkInput) => Promise<import("@opengeni/db").SessionWorkPeek>;
|
|
187
192
|
expireSessionHumanInput: (input: import("./activities.js").ExpireSessionHumanInputInput) => Promise<import("./activities.js").ExpireSessionHumanInputResult>;
|
|
193
|
+
expireSessionInteractionIntervention: (input: import("./activities/types.js").ExpireSessionInteractionInterventionInput) => Promise<import("./activities/types.js").ExpireSessionInteractionInterventionResult>;
|
|
188
194
|
markSessionIdle: (input: import("./activities/types.js").MarkSessionIdleInput) => Promise<void>;
|
|
189
195
|
dispatchSessionWorkflowWakes(): Promise<import("./activities/workflow-wake.js").DispatchSessionWorkflowWakesResult>;
|
|
190
196
|
} | {
|
|
@@ -258,6 +264,13 @@ export declare function registerFileUploadReaperSchedule(settings: Settings, obs
|
|
|
258
264
|
registered: boolean;
|
|
259
265
|
close: () => Promise<void>;
|
|
260
266
|
}>;
|
|
267
|
+
/** Register the deployment-wide maintained-auth dispatcher. Its one-minute
|
|
268
|
+
* cadence matches the minimum public policy interval; DB claims own overlap,
|
|
269
|
+
* crash recovery, and exact session idempotency. */
|
|
270
|
+
export declare function registerSiteAuthMaintenanceSchedule(settings: Settings, observability: Observability): Promise<{
|
|
271
|
+
registered: boolean;
|
|
272
|
+
close: () => Promise<void>;
|
|
273
|
+
}>;
|
|
261
274
|
/**
|
|
262
275
|
* Register the one repair cadence for committed workflow-wake revisions. The
|
|
263
276
|
* activity only reads the transactional outbox and sends revision-scoped
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
normalizeTurnTaskQueueStats,
|
|
16
16
|
observabilityEventLogger,
|
|
17
17
|
startTurnCapacityMonitor
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-N5TJIFCE.js";
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
import {
|
|
@@ -695,6 +695,8 @@ function safeWarn(observability, message, attributes) {
|
|
|
695
695
|
var SANDBOX_REAPER_SCHEDULE_ID = "opengeni-sandbox-lease-reaper";
|
|
696
696
|
var FILE_UPLOAD_REAPER_SCHEDULE_ID = "opengeni-file-upload-reaper";
|
|
697
697
|
var FILE_UPLOAD_REAPER_PERIOD_MS = 15 * 60 * 1e3;
|
|
698
|
+
var SITE_AUTH_MAINTENANCE_SCHEDULE_ID = "opengeni-site-auth-maintenance";
|
|
699
|
+
var SITE_AUTH_MAINTENANCE_PERIOD_MS = 60 * 1e3;
|
|
698
700
|
function temporalTimeMs(value) {
|
|
699
701
|
if (value?.seconds === void 0 || value.seconds === null) return null;
|
|
700
702
|
return Number(String(value.seconds)) * 1e3 + Math.floor((value.nanos ?? 0) / 1e6);
|
|
@@ -709,7 +711,7 @@ function temporalWorkflowExecutionNotFound(error) {
|
|
|
709
711
|
return isGrpcServiceError(error) && error.code === 5;
|
|
710
712
|
}
|
|
711
713
|
async function createDefaultWorkerActivities(role, dependencies = {}) {
|
|
712
|
-
return role === "control" ? (await import("./activities-control-
|
|
714
|
+
return role === "control" ? (await import("./activities-control-SMKF2OBE.js")).createControlActivities(dependencies) : (await import("./activities-turn-IDS3WEHA.js")).createTurnActivities(dependencies);
|
|
713
715
|
}
|
|
714
716
|
function resolveOpenGeniWorkflowDefinition(moduleUrl = import.meta.url) {
|
|
715
717
|
const modulePath = fileURLToPath(moduleUrl).replaceAll("\\", "/");
|
|
@@ -1075,6 +1077,41 @@ async function registerFileUploadReaperSchedule(settings, observability) {
|
|
|
1075
1077
|
throw error;
|
|
1076
1078
|
}
|
|
1077
1079
|
}
|
|
1080
|
+
async function registerSiteAuthMaintenanceSchedule(settings, observability) {
|
|
1081
|
+
const connection = await Connection.connect(temporalConnectionOptions(settings));
|
|
1082
|
+
const temporal = new TemporalClient({ connection, namespace: settings.temporalNamespace });
|
|
1083
|
+
try {
|
|
1084
|
+
await temporal.schedule.create({
|
|
1085
|
+
scheduleId: SITE_AUTH_MAINTENANCE_SCHEDULE_ID,
|
|
1086
|
+
spec: { intervals: [{ every: SITE_AUTH_MAINTENANCE_PERIOD_MS }] },
|
|
1087
|
+
action: {
|
|
1088
|
+
type: "startWorkflow",
|
|
1089
|
+
workflowType: "siteAuthMaintenanceWorkflow",
|
|
1090
|
+
taskQueue: settings.temporalTaskQueue,
|
|
1091
|
+
args: []
|
|
1092
|
+
},
|
|
1093
|
+
policies: {
|
|
1094
|
+
overlap: ScheduleOverlapPolicy.SKIP,
|
|
1095
|
+
catchupWindow: "1m",
|
|
1096
|
+
pauseOnFailure: false
|
|
1097
|
+
}
|
|
1098
|
+
});
|
|
1099
|
+
observability.info("Registered the global site-auth maintenance Schedule", {
|
|
1100
|
+
scheduleId: SITE_AUTH_MAINTENANCE_SCHEDULE_ID,
|
|
1101
|
+
maintenancePeriodMs: SITE_AUTH_MAINTENANCE_PERIOD_MS
|
|
1102
|
+
});
|
|
1103
|
+
return { registered: true, close: async () => connection.close() };
|
|
1104
|
+
} catch (error) {
|
|
1105
|
+
if (error instanceof ScheduleAlreadyRunning) {
|
|
1106
|
+
observability.info("Global site-auth maintenance Schedule already registered", {
|
|
1107
|
+
scheduleId: SITE_AUTH_MAINTENANCE_SCHEDULE_ID
|
|
1108
|
+
});
|
|
1109
|
+
return { registered: false, close: async () => connection.close() };
|
|
1110
|
+
}
|
|
1111
|
+
await connection.close().catch(() => void 0);
|
|
1112
|
+
throw error;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1078
1115
|
async function registerSessionWorkflowWakeDispatcherSchedule(settings, observability) {
|
|
1079
1116
|
const connection = await Connection.connect(temporalConnectionOptions(settings));
|
|
1080
1117
|
const temporal = new TemporalClient({ connection, namespace: settings.temporalNamespace });
|
|
@@ -1184,6 +1221,13 @@ async function createOpenGeniWorkerService(options) {
|
|
|
1184
1221
|
{ ...retryOptions, onRetry }
|
|
1185
1222
|
)
|
|
1186
1223
|
);
|
|
1224
|
+
schedules.push(
|
|
1225
|
+
await retryStartupDependency(
|
|
1226
|
+
"Temporal schedule (site auth maintenance)",
|
|
1227
|
+
() => registerSiteAuthMaintenanceSchedule(settings, observability),
|
|
1228
|
+
{ ...retryOptions, onRetry }
|
|
1229
|
+
)
|
|
1230
|
+
);
|
|
1187
1231
|
schedules.push(
|
|
1188
1232
|
await retryStartupDependency(
|
|
1189
1233
|
"Temporal schedule (session-workflow wake dispatcher)",
|
|
@@ -1352,6 +1396,8 @@ if (import.meta.main) {
|
|
|
1352
1396
|
export {
|
|
1353
1397
|
FILE_UPLOAD_REAPER_PERIOD_MS,
|
|
1354
1398
|
FILE_UPLOAD_REAPER_SCHEDULE_ID,
|
|
1399
|
+
SITE_AUTH_MAINTENANCE_PERIOD_MS,
|
|
1400
|
+
SITE_AUTH_MAINTENANCE_SCHEDULE_ID,
|
|
1355
1401
|
createDefaultWorkerActivities,
|
|
1356
1402
|
createHostExportPump,
|
|
1357
1403
|
createOpenGeniWorker,
|
|
@@ -1360,6 +1406,7 @@ export {
|
|
|
1360
1406
|
registerFileUploadReaperSchedule,
|
|
1361
1407
|
registerSandboxReaperSchedule,
|
|
1362
1408
|
registerSessionWorkflowWakeDispatcherSchedule,
|
|
1409
|
+
registerSiteAuthMaintenanceSchedule,
|
|
1363
1410
|
resolveOpenGeniWorkflowDefinition,
|
|
1364
1411
|
runOpenGeniWorker,
|
|
1365
1412
|
startWorker,
|