@opengeni/worker-bundle 0.26.0-canary.6 → 0.26.0-canary.7
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/goals.d.ts +0 -1
- package/dist/{activities-control-SHMDOQWS.js → activities-control-VMA3XMHE.js} +45 -8
- package/dist/{activities-control-SHMDOQWS.js.map → activities-control-VMA3XMHE.js.map} +1 -1
- package/dist/{activities-turn-GHSFZB64.js → activities-turn-57AOUNYN.js} +64 -13
- package/dist/activities-turn-57AOUNYN.js.map +1 -0
- package/dist/{chunk-O2LQWJIK.js → chunk-7LS42PHP.js} +4 -8
- package/dist/chunk-7LS42PHP.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +17 -17
- package/src/activities/agent-turn/codex-capacity.ts +18 -3
- package/src/activities/agent-turn/run.ts +8 -0
- package/src/activities/agent-turn/tool-environment.ts +9 -0
- package/src/activities/agent-turn/xai-capacity.ts +17 -0
- package/src/activities/capabilities.ts +16 -3
- package/src/activities/goals.ts +5 -7
- package/src/activities/scheduled-tasks.ts +77 -8
- package/dist/activities-turn-GHSFZB64.js.map +0 -1
- package/dist/chunk-O2LQWJIK.js.map +0 -1
|
@@ -10,7 +10,6 @@ export declare function goalContinuationModelDecision(input: {
|
|
|
10
10
|
settings: Settings;
|
|
11
11
|
workspaceModelPolicy: Awaited<ReturnType<typeof getWorkspaceModelPolicy>>;
|
|
12
12
|
inheritedModel: string;
|
|
13
|
-
sessionModel: string;
|
|
14
13
|
}): {
|
|
15
14
|
model: string;
|
|
16
15
|
blocked: string | null;
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
scheduledUserMessagePayload,
|
|
34
34
|
withFirstPartyTools,
|
|
35
35
|
workflowIdForSession
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-7LS42PHP.js";
|
|
37
37
|
import {
|
|
38
38
|
inspectOpenSandboxKubernetesInventory,
|
|
39
39
|
recordCreditBalanceGauges,
|
|
@@ -7410,6 +7410,9 @@ import {
|
|
|
7410
7410
|
resolveWorkspaceCodexCompactionDefault,
|
|
7411
7411
|
SCHEDULED_TASK_OCCURRENCE_PAYLOAD_MAX_BYTES,
|
|
7412
7412
|
ScheduledTaskRunAcceptedExecution,
|
|
7413
|
+
SessionAgentAccess,
|
|
7414
|
+
SessionEndUser,
|
|
7415
|
+
SessionMemoryScope,
|
|
7413
7416
|
normalizeAutomaticSessionTitle,
|
|
7414
7417
|
scheduledOccurrencePayloadUtf8Bytes,
|
|
7415
7418
|
stableJson,
|
|
@@ -7434,6 +7437,7 @@ import {
|
|
|
7434
7437
|
enqueueSessionWorkflowWakeIfRunnable,
|
|
7435
7438
|
failScheduledGeneratedSessionRoute,
|
|
7436
7439
|
getScheduledTask as getScheduledTask2,
|
|
7440
|
+
getScheduledTaskCreatorPolicy,
|
|
7437
7441
|
getScheduledTaskRunAcceptedExecution,
|
|
7438
7442
|
getScheduledTaskRunByProducerKey,
|
|
7439
7443
|
getScheduledTargetSessionExecution,
|
|
@@ -7449,6 +7453,7 @@ import {
|
|
|
7449
7453
|
getScheduledScopedRigVersionMetadata,
|
|
7450
7454
|
getNestedAgentDepthDeploymentPolicy,
|
|
7451
7455
|
getSessionByCreateIdempotencyKey,
|
|
7456
|
+
getSessionCreationExecutionPolicy,
|
|
7452
7457
|
getVariableSet,
|
|
7453
7458
|
isCodexBilledModel,
|
|
7454
7459
|
initializeSessionStartAtomically,
|
|
@@ -7470,7 +7475,11 @@ import {
|
|
|
7470
7475
|
withSessionActivityRlsContext
|
|
7471
7476
|
} from "@opengeni/db";
|
|
7472
7477
|
import { publishDurableSessionEvents } from "@opengeni/events";
|
|
7473
|
-
import {
|
|
7478
|
+
import {
|
|
7479
|
+
allowedFirstPartyMcpToolsForSession,
|
|
7480
|
+
resolveFirstPartyMcpToolPolicy,
|
|
7481
|
+
resolveTurnExecutionPolicyV1 as resolveTurnExecutionPolicyV12
|
|
7482
|
+
} from "@opengeni/config";
|
|
7474
7483
|
import { Context as Context2 } from "@temporalio/activity";
|
|
7475
7484
|
import { createHash as createHash5 } from "crypto";
|
|
7476
7485
|
|
|
@@ -7848,7 +7857,12 @@ function createScheduledTaskActivities(services) {
|
|
|
7848
7857
|
let sandboxBackend = task.agentConfig.sandboxBackend ?? settings.sandboxBackend;
|
|
7849
7858
|
let sandboxOs = "linux";
|
|
7850
7859
|
const taskTools = withFirstPartyTools(settings, task.agentConfig.tools);
|
|
7851
|
-
const
|
|
7860
|
+
const creatorPolicy = await getScheduledTaskCreatorPolicy(db, task.workspaceId, task.id);
|
|
7861
|
+
const firstPartyMcpTools = creatorPolicy?.firstPartyMcpTools ? allowedFirstPartyMcpToolsForSession(settings, creatorPolicy.firstPartyMcpTools) : resolveFirstPartyMcpToolPolicy(settings).default;
|
|
7862
|
+
const firstPartyMcpPermissions = creatorPolicy?.firstPartyMcpPermissions ? [...creatorPolicy.firstPartyMcpPermissions] : [...DEFAULT_FIRST_PARTY_MCP_PERMISSIONS];
|
|
7863
|
+
const creatorSessionPolicy = scheduledCreatorSessionPolicyInput(
|
|
7864
|
+
creatorPolicy?.sessionPolicy ?? null
|
|
7865
|
+
);
|
|
7852
7866
|
const generatedTarget = task.runMode === "new_session_per_run" || task.runMode === "reusable_session" && task.reusableSessionId === null;
|
|
7853
7867
|
if (generatedTarget && task.agentConfig.machineTarget) {
|
|
7854
7868
|
const access = {
|
|
@@ -8004,7 +8018,7 @@ function createScheduledTaskActivities(services) {
|
|
|
8004
8018
|
} : {
|
|
8005
8019
|
tools: taskTools,
|
|
8006
8020
|
firstPartyMcpTools,
|
|
8007
|
-
firstPartyMcpPermissions
|
|
8021
|
+
firstPartyMcpPermissions,
|
|
8008
8022
|
variableSetId: acceptedVariableSet?.id ?? null,
|
|
8009
8023
|
rigId: acceptedRig?.id ?? null,
|
|
8010
8024
|
rigVersionId: acceptedRig?.activeVersion?.id ?? null,
|
|
@@ -8104,7 +8118,7 @@ function createScheduledTaskActivities(services) {
|
|
|
8104
8118
|
resolvedSandboxOs: sandboxOs,
|
|
8105
8119
|
resolvedTools: taskTools,
|
|
8106
8120
|
resolvedFirstPartyMcpTools: firstPartyMcpTools,
|
|
8107
|
-
resolvedFirstPartyMcpPermissions:
|
|
8121
|
+
resolvedFirstPartyMcpPermissions: firstPartyMcpPermissions,
|
|
8108
8122
|
resolvedVariableSet: acceptedVariableSet ? { id: acceptedVariableSet.id, generation: acceptedVariableSet.generation } : null,
|
|
8109
8123
|
resolvedRig: acceptedRig?.activeVersion ? {
|
|
8110
8124
|
id: acceptedRig.id,
|
|
@@ -8282,7 +8296,8 @@ function createScheduledTaskActivities(services) {
|
|
|
8282
8296
|
resources: task.agentConfig.resources,
|
|
8283
8297
|
tools: taskTools,
|
|
8284
8298
|
firstPartyMcpTools,
|
|
8285
|
-
firstPartyMcpPermissions
|
|
8299
|
+
firstPartyMcpPermissions,
|
|
8300
|
+
...creatorSessionPolicy,
|
|
8286
8301
|
metadata: {
|
|
8287
8302
|
...taskMetadata,
|
|
8288
8303
|
model,
|
|
@@ -9123,6 +9138,11 @@ async function recoverBoundScheduledTaskDispatch(input) {
|
|
|
9123
9138
|
}
|
|
9124
9139
|
const taskMetadata = { ...task.agentConfig.metadata };
|
|
9125
9140
|
delete taskMetadata[OPENGENI_SLACK_BOT_SESSION_METADATA_KEY];
|
|
9141
|
+
const recoveredCreatorPolicy = await getScheduledTaskCreatorPolicy(
|
|
9142
|
+
input.db,
|
|
9143
|
+
task.workspaceId,
|
|
9144
|
+
task.id
|
|
9145
|
+
);
|
|
9126
9146
|
const created = await createSessionWithIdempotencyKeyResult(input.db, {
|
|
9127
9147
|
accountId: task.accountId,
|
|
9128
9148
|
workspaceId: task.workspaceId,
|
|
@@ -9131,6 +9151,7 @@ async function recoverBoundScheduledTaskDispatch(input) {
|
|
|
9131
9151
|
tools: input.acceptedExecution.resolvedTools,
|
|
9132
9152
|
firstPartyMcpTools: input.acceptedExecution.resolvedFirstPartyMcpTools,
|
|
9133
9153
|
firstPartyMcpPermissions: input.acceptedExecution.resolvedFirstPartyMcpPermissions,
|
|
9154
|
+
...scheduledCreatorSessionPolicyInput(recoveredCreatorPolicy?.sessionPolicy ?? null),
|
|
9134
9155
|
metadata: {
|
|
9135
9156
|
...taskMetadata,
|
|
9136
9157
|
model: input.acceptedExecution.resolvedModel,
|
|
@@ -9241,6 +9262,11 @@ async function recoverBoundScheduledTaskDispatch(input) {
|
|
|
9241
9262
|
}
|
|
9242
9263
|
const generatedBinding = input.acceptedExecution.generatedSessionBinding;
|
|
9243
9264
|
const canonicalGeneratedRunId = task.runMode === "reusable_session" && typeof session.metadata.scheduledTaskRunId === "string" ? session.metadata.scheduledTaskRunId : input.run.id;
|
|
9265
|
+
const creationPolicy = await getSessionCreationExecutionPolicy(
|
|
9266
|
+
input.db,
|
|
9267
|
+
task.workspaceId,
|
|
9268
|
+
session.id
|
|
9269
|
+
);
|
|
9244
9270
|
const expectedTaskMetadata = { ...task.agentConfig.metadata };
|
|
9245
9271
|
delete expectedTaskMetadata[OPENGENI_SLACK_BOT_SESSION_METADATA_KEY];
|
|
9246
9272
|
const expectedMetadata = {
|
|
@@ -9257,7 +9283,7 @@ async function recoverBoundScheduledTaskDispatch(input) {
|
|
|
9257
9283
|
label: "OpenGeni scheduler",
|
|
9258
9284
|
scheduledTaskId: task.id,
|
|
9259
9285
|
scheduledTaskRunId: canonicalGeneratedRunId
|
|
9260
|
-
}) || task.runMode === "new_session_per_run" && input.acceptedExecution.alertOccurrenceLabels === null && (session.metadata.scheduledTaskRunId !== input.run.id || session.createdByContext.scheduledTaskRunId !== input.run.id) ||
|
|
9286
|
+
}) || task.runMode === "new_session_per_run" && input.acceptedExecution.alertOccurrenceLabels === null && (session.metadata.scheduledTaskRunId !== input.run.id || session.createdByContext.scheduledTaskRunId !== input.run.id) || creationPolicy?.model !== input.acceptedExecution.resolvedModel || creationPolicy.reasoningEffort !== input.acceptedExecution.resolvedReasoningEffort || creationPolicy.latencyMode !== input.acceptedExecution.resolvedLatencyMode || session.sandboxBackend !== input.acceptedExecution.resolvedSandboxBackend || session.sandboxOs !== input.acceptedExecution.resolvedSandboxOs || session.activeSandboxId !== (task.agentConfig.machineTarget?.targetSandboxId ?? null) || stableJson(session.resources) !== stableJson(task.agentConfig.resources) || stableJson(session.tools) !== stableJson(input.acceptedExecution.resolvedTools) || stableJson(session.firstPartyMcpTools) !== stableJson(input.acceptedExecution.resolvedFirstPartyMcpTools) || stableJson(session.firstPartyMcpPermissions) !== stableJson(input.acceptedExecution.resolvedFirstPartyMcpPermissions) || session.maxNestedAgentDepthOverride !== (task.agentConfig.maxNestedAgentDepth ?? null) || (session.variableSetId ?? null) !== (input.acceptedExecution.resolvedVariableSet?.id ?? null) || (session.rigId ?? null) !== (input.acceptedExecution.resolvedRig?.id ?? null) || (session.rigVersionId ?? null) !== (input.acceptedExecution.resolvedRig?.versionId ?? null) || scheduledSlackBotConnectionId(session.metadata) !== (frozenSlack?.id ?? null)) {
|
|
9261
9287
|
throw new ScheduledRunTerminalAuthorityError(
|
|
9262
9288
|
"scheduled_generated_session_changed",
|
|
9263
9289
|
"scheduled generated session differs from accepted execution"
|
|
@@ -9496,6 +9522,17 @@ async function replayScheduledTaskDispatch(input) {
|
|
|
9496
9522
|
}
|
|
9497
9523
|
return result;
|
|
9498
9524
|
}
|
|
9525
|
+
function scheduledCreatorSessionPolicyInput(policy) {
|
|
9526
|
+
if (!policy) return {};
|
|
9527
|
+
const agentAccess = SessionAgentAccess.safeParse(policy.agentAccess);
|
|
9528
|
+
const endUser = SessionEndUser.safeParse(policy.endUser);
|
|
9529
|
+
const memoryScope = SessionMemoryScope.safeParse(policy.memoryScope);
|
|
9530
|
+
return {
|
|
9531
|
+
...agentAccess.success ? { agentAccess: agentAccess.data } : {},
|
|
9532
|
+
...endUser.success ? { endUser: endUser.data } : {},
|
|
9533
|
+
...memoryScope.success ? { memoryScope: memoryScope.data } : {}
|
|
9534
|
+
};
|
|
9535
|
+
}
|
|
9499
9536
|
function knowledgeSourceSyncEffectivelyPaused(task) {
|
|
9500
9537
|
if (task.status === "paused") return true;
|
|
9501
9538
|
const value = task.metadata.knowledgeSourceSync;
|
|
@@ -10236,4 +10273,4 @@ export {
|
|
|
10236
10273
|
createControlActivities,
|
|
10237
10274
|
createControlActivitiesFromServices
|
|
10238
10275
|
};
|
|
10239
|
-
//# sourceMappingURL=activities-control-
|
|
10276
|
+
//# sourceMappingURL=activities-control-VMA3XMHE.js.map
|