@opengeni/worker-bundle 0.14.1 → 0.15.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.d.ts +5 -3
- package/dist/activities/packs.d.ts +2 -1
- package/dist/index.js +51 -6
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/activities/agent-turn.ts +45 -4
- package/src/activities/packs.ts +13 -1
- package/src/index.ts +4 -3
|
@@ -526,9 +526,11 @@ export declare function reconcileActiveSandboxPointer(db: ActivityServices["db"]
|
|
|
526
526
|
/**
|
|
527
527
|
* Warm the Modal private-registry image for the image ref this turn actually
|
|
528
528
|
* resolved, not only the deployment-global OPENGENI_MODAL_IMAGE_REF warmed at
|
|
529
|
-
* worker boot.
|
|
530
|
-
*
|
|
531
|
-
*
|
|
529
|
+
* worker boot. A provider-native modalImageId bypasses registry import and is
|
|
530
|
+
* resolved by ModalImageSelector.fromId during create. Otherwise packs can
|
|
531
|
+
* override `modalImageRef` per workspace/turn, so a private pack image must be
|
|
532
|
+
* resolved before sandbox creation or Modal falls back to the unauthenticated
|
|
533
|
+
* `fromTag` path.
|
|
532
534
|
*/
|
|
533
535
|
export declare function ensureTurnModalRegistryImage(runSettings: Settings, sandboxCreationBackend: Settings["sandboxBackend"] | undefined, ensureRegistryImage?: (settings: Settings) => Promise<void>): Promise<void>;
|
|
534
536
|
/**
|
|
@@ -9,6 +9,7 @@ import { type EffectiveSkillSelection, type PackSkill } from "@opengeni/runtime"
|
|
|
9
9
|
*/
|
|
10
10
|
export type WorkspacePackRuntime = {
|
|
11
11
|
sandboxImage: string | null;
|
|
12
|
+
sandboxProviderImages: CapabilityPack["sandboxProviderImages"] | null;
|
|
12
13
|
skills: PackSkill[];
|
|
13
14
|
};
|
|
14
15
|
export type WorkspaceSkillLibraryRuntime = {
|
|
@@ -54,7 +55,7 @@ export declare function resolveWorkspaceAgentInstructions(db: Database, workspac
|
|
|
54
55
|
* the settings pass through untouched, so deployments without packs keep the
|
|
55
56
|
* global OPENGENI_DOCKER_IMAGE / OPENGENI_MODAL_IMAGE_REF behavior exactly.
|
|
56
57
|
*/
|
|
57
|
-
export declare function settingsWithPackSandboxImage(settings: Settings, sandboxImage: string | null): Settings;
|
|
58
|
+
export declare function settingsWithPackSandboxImage(settings: Settings, sandboxImage: string | null, sandboxProviderImages?: CapabilityPack["sandboxProviderImages"] | null): Settings;
|
|
58
59
|
/**
|
|
59
60
|
* Applies the session's frozen rig-version image to run settings. Rig image is
|
|
60
61
|
* the TOP of the image precedence chain (rig > pack > deployment default): when
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,10 @@ import {
|
|
|
113
113
|
isSessionEventPersistenceError,
|
|
114
114
|
getEnrollment,
|
|
115
115
|
abandonRecordingForTurnAttempt,
|
|
116
|
-
markSessionAttemptQuiesced
|
|
116
|
+
markSessionAttemptQuiesced,
|
|
117
|
+
beginConnectorActionExecution,
|
|
118
|
+
completeConnectorActionExecution,
|
|
119
|
+
prepareConnectorActionApproval
|
|
117
120
|
} from "@opengeni/db";
|
|
118
121
|
import { appendAndPublishTurnEventsFenced, publishDurableSessionEvents } from "@opengeni/events";
|
|
119
122
|
import { sandboxOperationMetricObserver } from "@opengeni/observability";
|
|
@@ -2655,7 +2658,11 @@ import {
|
|
|
2655
2658
|
isSkillLibraryEntryId,
|
|
2656
2659
|
loadSkillLibrarySkill
|
|
2657
2660
|
} from "@opengeni/runtime";
|
|
2658
|
-
var emptyPackRuntime = {
|
|
2661
|
+
var emptyPackRuntime = {
|
|
2662
|
+
sandboxImage: null,
|
|
2663
|
+
sandboxProviderImages: null,
|
|
2664
|
+
skills: []
|
|
2665
|
+
};
|
|
2659
2666
|
async function resolveWorkspacePackRuntime(db, workspaceId) {
|
|
2660
2667
|
const installations = await listPackInstallations(db, workspaceId);
|
|
2661
2668
|
const active = installations.filter((installation) => installation.status === "active");
|
|
@@ -2771,6 +2778,7 @@ function workspacePackRuntimeFromPacks(packs) {
|
|
|
2771
2778
|
}
|
|
2772
2779
|
return {
|
|
2773
2780
|
sandboxImage: imagePacks[0]?.sandboxImage?.trim() ?? null,
|
|
2781
|
+
sandboxProviderImages: imagePacks[0]?.sandboxProviderImages ?? null,
|
|
2774
2782
|
skills
|
|
2775
2783
|
};
|
|
2776
2784
|
}
|
|
@@ -2778,14 +2786,15 @@ async function resolveWorkspaceAgentInstructions(db, workspaceId) {
|
|
|
2778
2786
|
const workspace = await getWorkspace(db, workspaceId);
|
|
2779
2787
|
return workspace?.agentInstructions ?? null;
|
|
2780
2788
|
}
|
|
2781
|
-
function settingsWithPackSandboxImage(settings, sandboxImage) {
|
|
2789
|
+
function settingsWithPackSandboxImage(settings, sandboxImage, sandboxProviderImages = null) {
|
|
2782
2790
|
if (!sandboxImage) {
|
|
2783
2791
|
return settings;
|
|
2784
2792
|
}
|
|
2785
2793
|
return {
|
|
2786
2794
|
...settings,
|
|
2787
2795
|
dockerImage: sandboxImage,
|
|
2788
|
-
modalImageRef: sandboxImage
|
|
2796
|
+
modalImageRef: sandboxImage,
|
|
2797
|
+
modalImageId: sandboxProviderImages?.modal?.imageId
|
|
2789
2798
|
};
|
|
2790
2799
|
}
|
|
2791
2800
|
function settingsWithRigImage(settings, rigImage) {
|
|
@@ -2795,7 +2804,11 @@ function settingsWithRigImage(settings, rigImage) {
|
|
|
2795
2804
|
return {
|
|
2796
2805
|
...settings,
|
|
2797
2806
|
dockerImage: rigImage,
|
|
2798
|
-
modalImageRef: rigImage
|
|
2807
|
+
modalImageRef: rigImage,
|
|
2808
|
+
// A rig image has no provider-native identity in the current rig contract.
|
|
2809
|
+
// Clear a lower-precedence pack/deployment ID so the rig cannot silently
|
|
2810
|
+
// run the wrong Modal image.
|
|
2811
|
+
modalImageId: void 0
|
|
2799
2812
|
};
|
|
2800
2813
|
}
|
|
2801
2814
|
function mergeRigDefaultVariableSetEnvironment(rigDefaultValues, sessionValues) {
|
|
@@ -7036,6 +7049,9 @@ async function ensureTurnModalRegistryImage(runSettings, sandboxCreationBackend,
|
|
|
7036
7049
|
if (sandboxCreationBackend !== "modal") {
|
|
7037
7050
|
return;
|
|
7038
7051
|
}
|
|
7052
|
+
if (runSettings.modalImageId) {
|
|
7053
|
+
return;
|
|
7054
|
+
}
|
|
7039
7055
|
if (!runSettings.modalImageRegistrySecret || !runSettings.modalImageRef) {
|
|
7040
7056
|
return;
|
|
7041
7057
|
}
|
|
@@ -8617,7 +8633,11 @@ function createRunAgentTurnActivity(services) {
|
|
|
8617
8633
|
// deployment default; a rig with no image (or a rig-less turn) is a
|
|
8618
8634
|
// pass-through, leaving the pack/deployment chain exactly as today.
|
|
8619
8635
|
...settingsWithRigImage(
|
|
8620
|
-
settingsWithPackSandboxImage(
|
|
8636
|
+
settingsWithPackSandboxImage(
|
|
8637
|
+
capabilitySettings,
|
|
8638
|
+
packRuntime.sandboxImage,
|
|
8639
|
+
packRuntime.sandboxProviderImages
|
|
8640
|
+
),
|
|
8621
8641
|
rigVersion?.image ?? null
|
|
8622
8642
|
),
|
|
8623
8643
|
openaiModel: turn.model,
|
|
@@ -9710,6 +9730,29 @@ function createRunAgentTurnActivity(services) {
|
|
|
9710
9730
|
turnExecutionPolicy.providerId,
|
|
9711
9731
|
turnExecutionPolicy.latencyMode
|
|
9712
9732
|
);
|
|
9733
|
+
const connectorActionIdentity = {
|
|
9734
|
+
accountId: input.accountId,
|
|
9735
|
+
workspaceId: input.workspaceId,
|
|
9736
|
+
sessionId: input.sessionId,
|
|
9737
|
+
turnId,
|
|
9738
|
+
attemptId: input.attemptId,
|
|
9739
|
+
executionGeneration,
|
|
9740
|
+
initiator: {
|
|
9741
|
+
kind: turn.initiator.kind,
|
|
9742
|
+
subjectId: turn.initiator.subjectId
|
|
9743
|
+
}
|
|
9744
|
+
};
|
|
9745
|
+
const connectorActionPolicy = {
|
|
9746
|
+
prepare: async (call) => await prepareConnectorActionApproval(db, connectorActionIdentity, call),
|
|
9747
|
+
begin: async (call) => await beginConnectorActionExecution(db, connectorActionIdentity, call),
|
|
9748
|
+
complete: async ({ requestId, outcome }) => await completeConnectorActionExecution(db, {
|
|
9749
|
+
accountId: input.accountId,
|
|
9750
|
+
workspaceId: input.workspaceId,
|
|
9751
|
+
requestId,
|
|
9752
|
+
attemptId: input.attemptId,
|
|
9753
|
+
outcome
|
|
9754
|
+
})
|
|
9755
|
+
};
|
|
9713
9756
|
const agent = runtime.buildAgent(modelRunSettings, turnResources, {
|
|
9714
9757
|
reasoningEffort: turn.reasoningEffort,
|
|
9715
9758
|
latencyMode: turnExecutionPolicy.latencyMode,
|
|
@@ -9748,6 +9791,8 @@ function createRunAgentTurnActivity(services) {
|
|
|
9748
9791
|
...activeSandboxBackend ? { activeSandboxBackend } : {},
|
|
9749
9792
|
fileResourceDownloads,
|
|
9750
9793
|
mcpServers: preparedTools.mcpServers,
|
|
9794
|
+
resolvedMcpConnectionIds: preparedTools.resolvedMcpConnectionIds,
|
|
9795
|
+
connectorActionPolicy,
|
|
9751
9796
|
// LIVE by-reference connector namespaces (fills during this turn's
|
|
9752
9797
|
// codex_apps tools/list): the codex tool_search description reads it per
|
|
9753
9798
|
// model call so the model sees the account's real connected sources.
|