@opengeni/worker-bundle 0.23.3-canary.0 → 0.23.4-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 +10 -2
- package/dist/activities/agent-turn/claim.d.ts +1 -0
- package/dist/activities/agent-turn/codex.d.ts +2 -2
- package/dist/activities/agent-turn/list-models.d.ts +16 -0
- package/dist/activities/agent-turn/model-usage.d.ts +10 -1
- package/dist/activities/agent-turn/tool-environment.d.ts +1 -0
- package/dist/activities/agent-turn/tool-policy.d.ts +36 -5
- package/dist/activities/agent-turn/turn-context.d.ts +2 -0
- package/dist/activities/automations.d.ts +1 -0
- package/dist/activities/capabilities.d.ts +2 -1
- package/dist/activities/goals.d.ts +11 -0
- package/dist/activities/image-generation-references.d.ts +2 -1
- package/dist/activities/scheduled-tasks.d.ts +1 -0
- package/dist/activities/types.d.ts +8 -0
- package/dist/{activities-control-52W5IDWM.js → activities-control-SGU2WEVB.js} +206 -97
- package/dist/activities-control-SGU2WEVB.js.map +1 -0
- package/dist/activities-control.d.ts +2 -0
- package/dist/{activities-turn-A2G2KLSY.js → activities-turn-7EAQXW6Q.js} +301 -65
- package/dist/activities-turn-7EAQXW6Q.js.map +1 -0
- package/dist/activities.d.ts +2 -0
- package/dist/{chunk-IPVMCAW5.js → chunk-S2QVRVJW.js} +85 -23
- package/dist/chunk-S2QVRVJW.js.map +1 -0
- package/dist/{chunk-GFNXVZVQ.js → chunk-TJIPCHMP.js} +3 -2
- package/dist/chunk-TJIPCHMP.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +29 -6
- package/dist/index.js.map +1 -1
- package/dist/observability-metrics.d.ts +1 -0
- package/dist/workflow-bundle.js +26 -3
- package/dist/workflows/activities.d.ts +5 -0
- package/dist/workflows/automations.d.ts +5 -0
- package/package.json +17 -17
- package/src/activities/agent-run-admission.ts +7 -1
- package/src/activities/agent-turn/admission.ts +28 -6
- package/src/activities/agent-turn/claim.ts +25 -5
- package/src/activities/agent-turn/codex.ts +2 -2
- package/src/activities/agent-turn/compaction-prep.ts +2 -0
- package/src/activities/agent-turn/list-models.ts +101 -0
- package/src/activities/agent-turn/model-usage.ts +88 -42
- package/src/activities/agent-turn/run.ts +6 -3
- package/src/activities/agent-turn/stream-attempt.ts +8 -0
- package/src/activities/agent-turn/tool-environment.ts +62 -1
- package/src/activities/agent-turn/tool-policy.ts +58 -5
- package/src/activities/agent-turn/turn-context.ts +4 -0
- package/src/activities/automations.ts +122 -67
- package/src/activities/capabilities.ts +72 -2
- package/src/activities/goals.ts +107 -31
- package/src/activities/image-generation-references.ts +9 -9
- package/src/activities/scheduled-tasks.ts +120 -26
- package/src/activities/site-auth-maintenance.ts +12 -12
- package/src/activities/types.ts +6 -0
- package/src/activities.ts +1 -0
- package/src/activity-services.ts +4 -1
- package/src/github-rest-mcp.ts +2 -1
- package/src/index.ts +19 -4
- package/src/observability-metrics.ts +2 -0
- package/src/workflows/activities.ts +15 -0
- package/src/workflows/automations.ts +21 -2
- package/dist/activities-control-52W5IDWM.js.map +0 -1
- package/dist/activities-turn-A2G2KLSY.js.map +0 -1
- package/dist/chunk-GFNXVZVQ.js.map +0 -1
- package/dist/chunk-IPVMCAW5.js.map +0 -1
package/src/index.ts
CHANGED
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
type TurnTaskQueueStats,
|
|
65
65
|
} from "./observability-metrics";
|
|
66
66
|
import {
|
|
67
|
+
resolveCatalogSettings,
|
|
67
68
|
SESSION_WORKFLOW_WAKE_DISPATCHER_PERIOD_MS,
|
|
68
69
|
SESSION_WORKFLOW_WAKE_DISPATCHER_SCHEDULE_ID,
|
|
69
70
|
SESSION_WORKFLOW_WAKE_DISPATCHER_WORKFLOW_TYPE,
|
|
@@ -804,6 +805,16 @@ export async function createOpenGeniWorkerService(
|
|
|
804
805
|
let memoryPressureGuard: TurnWorkerMemoryPressureGuard | undefined;
|
|
805
806
|
|
|
806
807
|
try {
|
|
808
|
+
const resolvedCatalog = await retryStartupDependency(
|
|
809
|
+
"model catalog",
|
|
810
|
+
() => resolveCatalogSettings(options.activityDependencies.db, settings),
|
|
811
|
+
{ ...retryOptions, onRetry },
|
|
812
|
+
);
|
|
813
|
+
observability.info("OpenGeni model catalog resolved", {
|
|
814
|
+
role: options.role,
|
|
815
|
+
catalogSource: resolvedCatalog.source,
|
|
816
|
+
catalogVersion: resolvedCatalog.version,
|
|
817
|
+
});
|
|
807
818
|
const needsSignaler =
|
|
808
819
|
options.role === "turn" ||
|
|
809
820
|
!options.activityDependencies.wakeSessionWorkflow ||
|
|
@@ -911,14 +922,18 @@ export async function createOpenGeniWorkerService(
|
|
|
911
922
|
}
|
|
912
923
|
|
|
913
924
|
if (options.http !== false) {
|
|
925
|
+
const databaseReady = dbReadyCheck(
|
|
926
|
+
options.http?.readinessDb ?? options.activityDependencies.db,
|
|
927
|
+
options.databasePosture,
|
|
928
|
+
);
|
|
914
929
|
httpServer = startWorkerHttpServer({
|
|
915
930
|
settings,
|
|
916
931
|
observability,
|
|
917
932
|
checks: {
|
|
918
|
-
db:
|
|
919
|
-
|
|
920
|
-
options.
|
|
921
|
-
|
|
933
|
+
db: async () => {
|
|
934
|
+
await databaseReady();
|
|
935
|
+
await resolveCatalogSettings(options.activityDependencies.db, settings);
|
|
936
|
+
},
|
|
922
937
|
nats: natsReadyCheck(options.activityDependencies.bus),
|
|
923
938
|
temporal: temporalReadyCheck(workerBundle.connection),
|
|
924
939
|
},
|
|
@@ -1023,6 +1023,7 @@ export function recordSandboxRotationBacklogGauges(
|
|
|
1023
1023
|
turnBlocked: number;
|
|
1024
1024
|
directBlocked: number;
|
|
1025
1025
|
processBlocked: number;
|
|
1026
|
+
interactionBlocked: number;
|
|
1026
1027
|
},
|
|
1027
1028
|
): void {
|
|
1028
1029
|
const values = {
|
|
@@ -1031,6 +1032,7 @@ export function recordSandboxRotationBacklogGauges(
|
|
|
1031
1032
|
turn_blocked: backlog.turnBlocked,
|
|
1032
1033
|
direct_blocked: backlog.directBlocked,
|
|
1033
1034
|
process_blocked: backlog.processBlocked,
|
|
1035
|
+
interaction_blocked: backlog.interactionBlocked,
|
|
1034
1036
|
} as const;
|
|
1035
1037
|
for (const [kind, value] of Object.entries(values)) {
|
|
1036
1038
|
observability.setGauge({
|
|
@@ -68,6 +68,21 @@ export const automationActivity = proxyActivities<Pick<typeof activities, "dispa
|
|
|
68
68
|
},
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
+
/** Dispatch has a bounded retry window, but an accepted automation event must
|
|
72
|
+
* not remain durably `dispatching` after that window closes. This compensating
|
|
73
|
+
* database write is idempotent and retries without a cap until the run reaches
|
|
74
|
+
* a terminal state (or is observed as already dispatched). */
|
|
75
|
+
export const automationFailureActivity = proxyActivities<
|
|
76
|
+
Pick<typeof activities, "settleAutomationRunFailure">
|
|
77
|
+
>({
|
|
78
|
+
startToCloseTimeout: "2 minutes",
|
|
79
|
+
retry: {
|
|
80
|
+
initialInterval: "1 second",
|
|
81
|
+
backoffCoefficient: 2,
|
|
82
|
+
maximumInterval: "30 seconds",
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
71
86
|
/** Goal continuation evaluates a durable Postgres obligation at an idle
|
|
72
87
|
* boundary. A transient failure gets a short retry window, then records an
|
|
73
88
|
* explicit delayed outbox wake instead of relying on an unrelated mutation or
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { automationActivity } from "./activities";
|
|
1
|
+
import { automationActivity, automationFailureActivity } from "./activities";
|
|
2
2
|
|
|
3
3
|
export type AutomationRunWorkflowInput = {
|
|
4
4
|
accountId: string;
|
|
@@ -6,6 +6,25 @@ export type AutomationRunWorkflowInput = {
|
|
|
6
6
|
runId: string;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
export type AutomationRunWorkflowActivities = {
|
|
10
|
+
dispatchAutomationRun: (input: AutomationRunWorkflowInput) => Promise<unknown>;
|
|
11
|
+
settleAutomationRunFailure: (input: AutomationRunWorkflowInput) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export async function runAutomationRunWorkflow(
|
|
15
|
+
input: AutomationRunWorkflowInput,
|
|
16
|
+
activities: AutomationRunWorkflowActivities,
|
|
17
|
+
): Promise<void> {
|
|
18
|
+
try {
|
|
19
|
+
await activities.dispatchAutomationRun(input);
|
|
20
|
+
} catch {
|
|
21
|
+
await activities.settleAutomationRunFailure(input);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
export async function automationRunWorkflow(input: AutomationRunWorkflowInput): Promise<void> {
|
|
10
|
-
await
|
|
26
|
+
await runAutomationRunWorkflow(input, {
|
|
27
|
+
dispatchAutomationRun: automationActivity.dispatchAutomationRun,
|
|
28
|
+
settleAutomationRunFailure: automationFailureActivity.settleAutomationRunFailure,
|
|
29
|
+
});
|
|
11
30
|
}
|