@opengeni/worker-bundle 0.23.4-canary.0 → 0.24.2-canary.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/dist/activities/agent-turn/admission.d.ts +7 -0
- package/dist/activities/agent-turn/model-usage.d.ts +5 -0
- package/dist/activities/agent-turn/quiescence.d.ts +2 -0
- package/dist/activities/agent-turn/run.d.ts +9 -0
- package/dist/activities/agent-turn/sandbox-runtime.d.ts +15 -0
- package/dist/activities/agent-turn/session-title.d.ts +21 -0
- package/dist/activities/agent-turn/stream-attempt.d.ts +4 -0
- package/dist/activities/agent-turn/tool-environment.d.ts +1 -0
- package/dist/activities/agent-turn/turn-context.d.ts +2 -1
- package/dist/activities/agent-turn.d.ts +1 -1
- package/dist/activities/capabilities.d.ts +1 -0
- package/dist/activities/context-compaction.d.ts +2 -0
- package/dist/{activities-control-SGU2WEVB.js → activities-control-ZWH7J4KZ.js} +102 -94
- package/dist/activities-control-ZWH7J4KZ.js.map +1 -0
- package/dist/{activities-turn-7EAQXW6Q.js → activities-turn-I4OPLQLS.js} +613 -284
- package/dist/activities-turn-I4OPLQLS.js.map +1 -0
- package/dist/{chunk-TJIPCHMP.js → chunk-65JEWP2Q.js} +105 -6
- package/dist/chunk-65JEWP2Q.js.map +1 -0
- package/dist/{chunk-GRFQTTSQ.js → chunk-GDCLDKSH.js} +7 -3
- package/dist/{chunk-GRFQTTSQ.js.map → chunk-GDCLDKSH.js.map} +1 -1
- package/dist/{chunk-S2QVRVJW.js → chunk-RQNH6CGR.js} +28 -41
- package/dist/chunk-RQNH6CGR.js.map +1 -0
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/observability-metrics.d.ts +33 -7
- package/dist/sandbox-reaper-timeout.d.ts +2 -2
- package/dist/sandbox-resume.d.ts +6 -1
- package/package.json +17 -17
- package/src/activities/agent-turn/admission.ts +19 -0
- package/src/activities/agent-turn/claim.ts +9 -1
- package/src/activities/agent-turn/compaction-prep.ts +6 -1
- package/src/activities/agent-turn/finalization.ts +31 -17
- package/src/activities/agent-turn/model-usage.ts +33 -4
- package/src/activities/agent-turn/quiescence.ts +11 -2
- package/src/activities/agent-turn/run.ts +74 -1
- package/src/activities/agent-turn/sandbox-runtime.ts +78 -81
- package/src/activities/agent-turn/session-title.ts +55 -2
- package/src/activities/agent-turn/stream-attempt.ts +258 -135
- package/src/activities/agent-turn/tool-environment.ts +41 -7
- package/src/activities/agent-turn/turn-context.ts +4 -2
- package/src/activities/agent-turn.ts +5 -1
- package/src/activities/api-integrations.ts +11 -1
- package/src/activities/capabilities.ts +57 -0
- package/src/activities/context-compaction.ts +3 -0
- package/src/activities/goals.ts +1 -0
- package/src/activities/mcp-credentials.ts +53 -0
- package/src/activities/rig-verification.ts +5 -3
- package/src/activities/scheduled-tasks.ts +111 -98
- package/src/index.ts +15 -0
- package/src/observability-metrics.ts +152 -14
- package/src/sandbox-reaper-timeout.ts +10 -4
- package/src/sandbox-resume.ts +58 -8
- package/dist/activities-control-SGU2WEVB.js.map +0 -1
- package/dist/activities-turn-7EAQXW6Q.js.map +0 -1
- package/dist/chunk-S2QVRVJW.js.map +0 -1
- package/dist/chunk-TJIPCHMP.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -10,14 +10,16 @@ import {
|
|
|
10
10
|
createTurnWorkerConcurrencyPlan,
|
|
11
11
|
sandboxLifecycleTaskQueue,
|
|
12
12
|
turnWorkerConcurrencyLogFields
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GDCLDKSH.js";
|
|
14
14
|
import {
|
|
15
|
+
initializeContextCompactionMetrics,
|
|
15
16
|
initializeWorkerOutcomeMetrics,
|
|
16
17
|
normalizeTurnTaskQueueStats,
|
|
17
18
|
observabilityEventLogger,
|
|
19
|
+
startContextCompactionPendingMonitor,
|
|
18
20
|
startSessionRecoveryMonitor,
|
|
19
21
|
startTurnCapacityMonitor
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-65JEWP2Q.js";
|
|
21
23
|
|
|
22
24
|
// src/index.ts
|
|
23
25
|
import {
|
|
@@ -32,6 +34,7 @@ import {
|
|
|
32
34
|
assertRuntimeDatabasePosture as assertRuntimeDatabasePosture2,
|
|
33
35
|
countSessionRecoveryBacklog,
|
|
34
36
|
createDb,
|
|
37
|
+
getContextCompactionPendingSummary,
|
|
35
38
|
markSessionWorkflowWakeDelivered
|
|
36
39
|
} from "@opengeni/db";
|
|
37
40
|
import {
|
|
@@ -778,7 +781,7 @@ function temporalWorkflowExecutionNotFound(error) {
|
|
|
778
781
|
return isGrpcServiceError(error) && error.code === 5;
|
|
779
782
|
}
|
|
780
783
|
async function createDefaultWorkerActivities(role, dependencies = {}) {
|
|
781
|
-
return role === "control" ? (await import("./activities-control-
|
|
784
|
+
return role === "control" ? (await import("./activities-control-ZWH7J4KZ.js")).createControlActivities(dependencies) : (await import("./activities-turn-I4OPLQLS.js")).createTurnActivities(dependencies);
|
|
782
785
|
}
|
|
783
786
|
function resolveOpenGeniWorkflowDefinition(moduleUrl = import.meta.url) {
|
|
784
787
|
const modulePath = fileURLToPath(moduleUrl).replaceAll("\\", "/");
|
|
@@ -806,6 +809,9 @@ async function createOpenGeniWorker(options) {
|
|
|
806
809
|
}
|
|
807
810
|
const observability = options.activityDependencies?.observability ?? createObservability(settings, { component: `worker-${options.role}` });
|
|
808
811
|
initializeWorkerOutcomeMetrics(observability);
|
|
812
|
+
if (options.role === "turn") {
|
|
813
|
+
initializeContextCompactionMetrics(observability);
|
|
814
|
+
}
|
|
809
815
|
if (options.role === "turn" && options.workflowBundle) {
|
|
810
816
|
throw new Error("workflowBundle is valid only for the control worker role");
|
|
811
817
|
}
|
|
@@ -1229,6 +1235,7 @@ async function createOpenGeniWorkerService(options) {
|
|
|
1229
1235
|
let workerBundle;
|
|
1230
1236
|
let turnCapacityMonitor;
|
|
1231
1237
|
let sessionRecoveryMonitor;
|
|
1238
|
+
let contextCompactionPendingMonitor;
|
|
1232
1239
|
const schedules = [];
|
|
1233
1240
|
let httpServer;
|
|
1234
1241
|
let memoryPressureGuard;
|
|
@@ -1290,6 +1297,10 @@ async function createOpenGeniWorkerService(options) {
|
|
|
1290
1297
|
observability,
|
|
1291
1298
|
read: async () => await countSessionRecoveryBacklog(options.activityDependencies.db)
|
|
1292
1299
|
});
|
|
1300
|
+
contextCompactionPendingMonitor = startContextCompactionPendingMonitor({
|
|
1301
|
+
observability,
|
|
1302
|
+
read: async () => await getContextCompactionPendingSummary(options.activityDependencies.db)
|
|
1303
|
+
});
|
|
1293
1304
|
}
|
|
1294
1305
|
if (workerOwnsInternalSchedules(options.role, options.internalSchedules)) {
|
|
1295
1306
|
schedules.push(
|
|
@@ -1346,6 +1357,7 @@ async function createOpenGeniWorkerService(options) {
|
|
|
1346
1357
|
await Promise.allSettled([
|
|
1347
1358
|
turnCapacityMonitor?.close(),
|
|
1348
1359
|
sessionRecoveryMonitor?.close(),
|
|
1360
|
+
contextCompactionPendingMonitor?.close(),
|
|
1349
1361
|
workerBundle?.connection.close(),
|
|
1350
1362
|
signaler?.close(),
|
|
1351
1363
|
...schedules.map((schedule) => schedule.close())
|
|
@@ -1367,6 +1379,7 @@ async function createOpenGeniWorkerService(options) {
|
|
|
1367
1379
|
await Promise.allSettled([
|
|
1368
1380
|
turnCapacityMonitor?.close(),
|
|
1369
1381
|
sessionRecoveryMonitor?.close(),
|
|
1382
|
+
contextCompactionPendingMonitor?.close(),
|
|
1370
1383
|
activeWorkerBundle.connection.close(),
|
|
1371
1384
|
activeSignaler?.close(),
|
|
1372
1385
|
...schedules.map((schedule) => schedule.close())
|