@opengeni/worker-bundle 0.2.0 → 0.2.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/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/activities/agent-turn.ts +48 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/worker-bundle",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "OpenGeni worker entry: runOpenGeniWorker/createOpenGeniWorker(deps) + the un-bundled Temporal workflow source tree. An engine-distribution surface — its runtime closure includes engine-internal packages and the workflow bundle ships as on-disk TS source.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@opengeni/codex": "^0.2.0",
|
|
41
|
-
"@opengeni/config": "^0.2.
|
|
42
|
-
"@opengeni/contracts": "^0.
|
|
43
|
-
"@opengeni/db": "^0.2.
|
|
44
|
-
"@opengeni/documents": "^0.2.
|
|
45
|
-
"@opengeni/events": "^0.2.
|
|
41
|
+
"@opengeni/config": "^0.2.1",
|
|
42
|
+
"@opengeni/contracts": "^0.4.0",
|
|
43
|
+
"@opengeni/db": "^0.2.1",
|
|
44
|
+
"@opengeni/documents": "^0.2.1",
|
|
45
|
+
"@opengeni/events": "^0.2.1",
|
|
46
46
|
"@opengeni/observability": "^0.2.0",
|
|
47
|
-
"@opengeni/runtime": "^0.2.
|
|
48
|
-
"@opengeni/storage": "^0.2.
|
|
47
|
+
"@opengeni/runtime": "^0.2.1",
|
|
48
|
+
"@opengeni/storage": "^0.2.1",
|
|
49
49
|
"@temporalio/activity": "^1.17.0",
|
|
50
50
|
"@temporalio/client": "^1.17.0",
|
|
51
51
|
"@temporalio/worker": "^1.17.0",
|
|
@@ -325,6 +325,45 @@ export async function resolveActiveSandboxBackend(
|
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
/**
|
|
329
|
+
* Decide whether to start on-turn desktop recording for THIS turn.
|
|
330
|
+
*
|
|
331
|
+
* On-turn recording runs ffmpeg/x11grab INSIDE the box and reads the .mp4 back
|
|
332
|
+
* out of the box's /tmp — plumbing that exists only for OpenGeni-operated cloud
|
|
333
|
+
* boxes (the Modal desktop backend). A turn whose EFFECTIVE backend is a connected
|
|
334
|
+
* machine ("selfhosted") runs on the user's REAL computer, which has none of that
|
|
335
|
+
* capture plumbing (and the platform must never shell ffmpeg onto a user's machine
|
|
336
|
+
* — the same reason the runtime skips its setup hooks for selfhosted). Left ungated
|
|
337
|
+
* it films nothing, finds no /tmp file, and emits recording.started followed by
|
|
338
|
+
* recording.failed{box-death} on EVERY machine-primary turn — misleading timeline
|
|
339
|
+
* noise + wasted work. So gate it off, exactly like a recording-disabled deployment:
|
|
340
|
+
* skip silently, emit nothing (no new event shape).
|
|
341
|
+
*
|
|
342
|
+
* `effectiveBackend` is the resolved ACTIVE backend for the turn
|
|
343
|
+
* (resolveActiveSandboxBackend) — NOT the session's home backend. A modal-home
|
|
344
|
+
* session actively swapped onto a machine resolves to "selfhosted" here and
|
|
345
|
+
* correctly skips; a machine-home turn that degraded back to its cloud group box
|
|
346
|
+
* (swap-away / flag-off) resolves to undefined and records as before.
|
|
347
|
+
*
|
|
348
|
+
* EDGE — mid-turn swap: this is evaluated ONCE at turn start (the box is only filmed
|
|
349
|
+
* for the duration of one turn). A swap AFTER the recording starts is deliberately
|
|
350
|
+
* ignored — a partial-turn recording already has defined failure semantics, so we do
|
|
351
|
+
* not add machinery to stop/restart it mid-turn.
|
|
352
|
+
*/
|
|
353
|
+
export function shouldStartOnTurnRecording(params: {
|
|
354
|
+
recordingEnabled: boolean;
|
|
355
|
+
desktopEnabled: boolean;
|
|
356
|
+
establishedBackendId: string;
|
|
357
|
+
effectiveBackend: Settings["sandboxBackend"] | undefined;
|
|
358
|
+
}): boolean {
|
|
359
|
+
return (
|
|
360
|
+
params.recordingEnabled
|
|
361
|
+
&& params.desktopEnabled
|
|
362
|
+
&& desktopCapableBackend(params.establishedBackendId)
|
|
363
|
+
&& params.effectiveBackend !== "selfhosted"
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
328
367
|
/**
|
|
329
368
|
* SELF-HEAL helper for the all-capped rotation idle (invariant 4: BOUNDED, no thrash).
|
|
330
369
|
* The turn hot path never refreshes Codex usage — only the usage API route does — so a
|
|
@@ -1046,9 +1085,15 @@ export function createRunAgentTurnActivity(services: () => Promise<ActivityServi
|
|
|
1046
1085
|
// `finally` (read+PUT in this same activity — never a Temporal payload).
|
|
1047
1086
|
if (
|
|
1048
1087
|
resolvedSandbox
|
|
1049
|
-
&&
|
|
1050
|
-
|
|
1051
|
-
|
|
1088
|
+
&& shouldStartOnTurnRecording({
|
|
1089
|
+
recordingEnabled: settings.recordingEnabled,
|
|
1090
|
+
desktopEnabled: settings.sandboxDesktopEnabled,
|
|
1091
|
+
establishedBackendId: resolvedSandbox.established.backendId,
|
|
1092
|
+
// EFFECTIVE (active) backend, not the session home: a machine-primary turn
|
|
1093
|
+
// resolves to "selfhosted" and skips; a swap back to the cloud group box
|
|
1094
|
+
// resolves to undefined and records as before.
|
|
1095
|
+
effectiveBackend: activeSandboxBackend,
|
|
1096
|
+
})
|
|
1052
1097
|
) {
|
|
1053
1098
|
try {
|
|
1054
1099
|
const begun = await beginRecording({
|