@opengeni/worker-bundle 2.0.0 → 2.0.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/activities/agent-turn/agent-build.d.ts +1 -0
- package/dist/activities/agent-turn/tool-environment.d.ts +34 -0
- package/dist/activities/codemode-dispatcher.d.ts +3 -1
- package/dist/{activities-control-BOLIY3H4.js → activities-control-QA6OLRQY.js} +2 -2
- package/dist/{activities-turn-2B3WMHBB.js → activities-turn-YVVKCGAK.js} +44 -9
- package/dist/activities-turn-YVVKCGAK.js.map +1 -0
- package/dist/{chunk-TVEE2UUC.js → chunk-M3NVMF2V.js} +3 -3
- package/dist/chunk-M3NVMF2V.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +15 -15
- package/src/activities/agent-turn/agent-build.ts +5 -1
- package/src/activities/agent-turn/claim.ts +12 -2
- package/src/activities/agent-turn/run.ts +1 -0
- package/src/activities/agent-turn/stream-attempt.ts +14 -1
- package/src/activities/agent-turn/tool-environment.ts +5 -0
- package/src/activities/codemode-dispatcher.ts +6 -0
- package/src/sandbox-routing.ts +7 -3
- package/dist/activities-turn-2B3WMHBB.js.map +0 -1
- package/dist/chunk-TVEE2UUC.js.map +0 -1
- /package/dist/{activities-control-BOLIY3H4.js.map → activities-control-QA6OLRQY.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -785,7 +785,7 @@ function temporalWorkflowExecutionNotFound(error) {
|
|
|
785
785
|
return isGrpcServiceError(error) && error.code === 5;
|
|
786
786
|
}
|
|
787
787
|
async function createDefaultWorkerActivities(role, dependencies = {}) {
|
|
788
|
-
return role === "control" ? (await import("./activities-control-
|
|
788
|
+
return role === "control" ? (await import("./activities-control-QA6OLRQY.js")).createControlActivities(dependencies) : (await import("./activities-turn-YVVKCGAK.js")).createTurnActivities(dependencies);
|
|
789
789
|
}
|
|
790
790
|
function resolveOpenGeniWorkflowDefinition(moduleUrl = import.meta.url) {
|
|
791
791
|
const modulePath = fileURLToPath(moduleUrl).replaceAll("\\", "/");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/worker-bundle",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "OpenGeni worker entry and reusable embedded lifecycle, shipped with a release-coherent pre-bundled Temporal workflow artifact.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -56,21 +56,21 @@
|
|
|
56
56
|
"@llamaindex/liteparse": "2.14.2",
|
|
57
57
|
"@opengeni/agent-proto": "^0.6.0",
|
|
58
58
|
"@opengeni/capabilities": "^0.3.4",
|
|
59
|
-
"@opengeni/codemode": "^0.6.
|
|
60
|
-
"@opengeni/codex": "^0.2.
|
|
61
|
-
"@opengeni/config": "^2.
|
|
62
|
-
"@opengeni/contracts": "^5.
|
|
63
|
-
"@opengeni/core": "^4.0.
|
|
64
|
-
"@opengeni/db": "^6.0.
|
|
65
|
-
"@opengeni/documents": "^0.8.
|
|
66
|
-
"@opengeni/events": "^0.4.
|
|
67
|
-
"@opengeni/github": "^0.7.
|
|
59
|
+
"@opengeni/codemode": "^0.6.1",
|
|
60
|
+
"@opengeni/codex": "^0.2.25",
|
|
61
|
+
"@opengeni/config": "^2.1.0",
|
|
62
|
+
"@opengeni/contracts": "^5.1.0",
|
|
63
|
+
"@opengeni/core": "^4.0.1",
|
|
64
|
+
"@opengeni/db": "^6.0.1",
|
|
65
|
+
"@opengeni/documents": "^0.8.32",
|
|
66
|
+
"@opengeni/events": "^0.4.30",
|
|
67
|
+
"@opengeni/github": "^0.7.15",
|
|
68
68
|
"@opengeni/network": "^0.3.1",
|
|
69
|
-
"@opengeni/observability": "^0.8.
|
|
70
|
-
"@opengeni/runtime": "^4.0.
|
|
71
|
-
"@opengeni/sdk": "^7.
|
|
72
|
-
"@opengeni/storage": "^0.2.
|
|
73
|
-
"@opengeni/tool-gateway": "^0.1.
|
|
69
|
+
"@opengeni/observability": "^0.8.31",
|
|
70
|
+
"@opengeni/runtime": "^4.0.1",
|
|
71
|
+
"@opengeni/sdk": "^7.1.0",
|
|
72
|
+
"@opengeni/storage": "^0.2.132",
|
|
73
|
+
"@opengeni/tool-gateway": "^0.1.12",
|
|
74
74
|
"@opengeni/xai-subscription": "^0.1.4",
|
|
75
75
|
"@temporalio/activity": "^1.17.0",
|
|
76
76
|
"@temporalio/client": "^1.17.0",
|
|
@@ -79,6 +79,7 @@ import { resolveVideoReferenceSandboxAccess } from "./video-reference-sandbox";
|
|
|
79
79
|
|
|
80
80
|
export type BuildTurnAgentDeps = {
|
|
81
81
|
skillCatalog: NonNullable<BuildAgentOptions["skillCatalog"]>;
|
|
82
|
+
mcpServers: Settings["mcpServers"];
|
|
82
83
|
input: RunAgentTurnInput;
|
|
83
84
|
db: ActivityServices["db"];
|
|
84
85
|
runtime: ActivityServices["runtime"];
|
|
@@ -139,6 +140,7 @@ export type BuildTurnAgentDeps = {
|
|
|
139
140
|
|
|
140
141
|
export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
141
142
|
const {
|
|
143
|
+
mcpServers,
|
|
142
144
|
input,
|
|
143
145
|
db,
|
|
144
146
|
runtime,
|
|
@@ -621,7 +623,9 @@ export async function buildTurnAgent(deps: BuildTurnAgentDeps) {
|
|
|
621
623
|
const agentConstructionStartedAt = performance.now();
|
|
622
624
|
let agentConstructionOutcome: "completed" | "failed" = "completed";
|
|
623
625
|
try {
|
|
624
|
-
|
|
626
|
+
// Approval policy must use the same accepted account identities as tool
|
|
627
|
+
// preparation. Keep the separately resolved model/sandbox settings intact.
|
|
628
|
+
return runtime.buildAgent({ ...eventing.modelRunSettings, mcpServers }, runtimeResources, {
|
|
625
629
|
...(linkedToolAuthority
|
|
626
630
|
? {
|
|
627
631
|
authorizeAttemptExecution: async () => {
|
|
@@ -19,6 +19,7 @@ import { linkCurrentSpanToAdmission, turnExecutionTelemetryKey } from "@opengeni
|
|
|
19
19
|
import { deliverChildRequiresActionToParent } from "../parent-wake";
|
|
20
20
|
import {
|
|
21
21
|
assertTurnExecutionPolicyMatchesConfigV1,
|
|
22
|
+
settingsForAcceptedSubscriptionTurn,
|
|
22
23
|
resolveTurnExecutionPolicyV1,
|
|
23
24
|
type Settings,
|
|
24
25
|
} from "@opengeni/config";
|
|
@@ -277,7 +278,7 @@ export async function claimTurnAttempt(deps: ClaimTurnDeps): Promise<ClaimTurnOu
|
|
|
277
278
|
gatewaySettings,
|
|
278
279
|
claimedPolicy.kind === "valid" ? claimedPolicy.policy.productModelId : turn.model,
|
|
279
280
|
);
|
|
280
|
-
|
|
281
|
+
let capabilitySettings = await settingsWithOrganizationProviderCredentials(
|
|
281
282
|
db,
|
|
282
283
|
input.accountId,
|
|
283
284
|
input.workspaceId,
|
|
@@ -287,7 +288,6 @@ export async function claimTurnAttempt(deps: ClaimTurnDeps): Promise<ClaimTurnOu
|
|
|
287
288
|
const codexAppsCredentialId = capabilitySettings.codexConnectedAppsEnabled
|
|
288
289
|
? await resolveCodexAppsCredentialIdForRun(db, input.workspaceId)
|
|
289
290
|
: null;
|
|
290
|
-
runtime.configure(capabilitySettings);
|
|
291
291
|
const policyForAbsent =
|
|
292
292
|
claimedPolicy.kind === "valid"
|
|
293
293
|
? claimedPolicy.policy
|
|
@@ -304,6 +304,16 @@ export async function claimTurnAttempt(deps: ClaimTurnDeps): Promise<ClaimTurnOu
|
|
|
304
304
|
if (!installedPolicy.accepted) {
|
|
305
305
|
throw new TurnAttemptFencedError(`turn execution policy was fenced: ${installedPolicy.reason}`);
|
|
306
306
|
}
|
|
307
|
+
capabilitySettings = settingsForAcceptedSubscriptionTurn(
|
|
308
|
+
capabilitySettings,
|
|
309
|
+
installedPolicy.policy,
|
|
310
|
+
{
|
|
311
|
+
modelId: turn.model,
|
|
312
|
+
reasoningEffort: turn.reasoningEffort,
|
|
313
|
+
latencyMode: turn.latencyMode,
|
|
314
|
+
},
|
|
315
|
+
);
|
|
316
|
+
runtime.configure(capabilitySettings);
|
|
307
317
|
const verifiedExecutionPolicy = assertTurnExecutionPolicyMatchesConfigV1(
|
|
308
318
|
capabilitySettings,
|
|
309
319
|
installedPolicy.policy,
|
|
@@ -1302,6 +1302,7 @@ export function createRunAgentTurnActivity(services: () => Promise<ActivityServi
|
|
|
1302
1302
|
|
|
1303
1303
|
const builtAgent = await buildTurnAgent({
|
|
1304
1304
|
skillCatalog: toolRuntime.skillCatalog,
|
|
1305
|
+
mcpServers: toolRuntime.mcpServers,
|
|
1305
1306
|
input,
|
|
1306
1307
|
db,
|
|
1307
1308
|
runtime,
|
|
@@ -17,6 +17,7 @@ import { publishDurableSessionEvents } from "@opengeni/events";
|
|
|
17
17
|
import {
|
|
18
18
|
normalizeModelCallUsage,
|
|
19
19
|
normalizeSdkEvent,
|
|
20
|
+
withMcpToolDisplayMetadata,
|
|
20
21
|
extractOpenSuffixFromRunState,
|
|
21
22
|
assertOpenSuffixResumable,
|
|
22
23
|
interruptionKindForCallItem,
|
|
@@ -1304,6 +1305,11 @@ export async function runTurnStreamAttempt(
|
|
|
1304
1305
|
: {},
|
|
1305
1306
|
);
|
|
1306
1307
|
for (const event of normalized) {
|
|
1308
|
+
if (event.type === "agent.toolCall.created")
|
|
1309
|
+
event.payload = withMcpToolDisplayMetadata(
|
|
1310
|
+
eventing.preparedTools?.mcpServers ?? [],
|
|
1311
|
+
event.payload,
|
|
1312
|
+
);
|
|
1307
1313
|
streamTiming.onEvent(event.type);
|
|
1308
1314
|
await eventing.batcher.push(event);
|
|
1309
1315
|
}
|
|
@@ -1641,7 +1647,14 @@ export async function runTurnStreamAttempt(
|
|
|
1641
1647
|
? [
|
|
1642
1648
|
{
|
|
1643
1649
|
type: "session.requiresAction" as const,
|
|
1644
|
-
payload: {
|
|
1650
|
+
payload: {
|
|
1651
|
+
approvals: approvals.map((approval) =>
|
|
1652
|
+
withMcpToolDisplayMetadata(
|
|
1653
|
+
eventing.preparedTools?.mcpServers ?? [],
|
|
1654
|
+
approval,
|
|
1655
|
+
),
|
|
1656
|
+
),
|
|
1657
|
+
},
|
|
1645
1658
|
},
|
|
1646
1659
|
]
|
|
1647
1660
|
: []),
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
type ConnectorAttachmentMaterializationRequest,
|
|
32
32
|
type ConnectorActionPolicyHooks,
|
|
33
33
|
createFirstPartyInteractionAttemptToolDefinitions,
|
|
34
|
+
mcpToolDisplayMetadata,
|
|
34
35
|
} from "@opengeni/runtime";
|
|
35
36
|
import {
|
|
36
37
|
createGoogleDrivePublicationAttemptTool,
|
|
@@ -1095,6 +1096,9 @@ export async function prepareTurnToolRuntime(deps: PrepareTurnToolRuntimeDeps) {
|
|
|
1095
1096
|
executionGeneration: attempt.executionGeneration,
|
|
1096
1097
|
},
|
|
1097
1098
|
cancellationSignal,
|
|
1099
|
+
undefined,
|
|
1100
|
+
{},
|
|
1101
|
+
(name) => mcpToolDisplayMetadata(tools.mcpServers, name),
|
|
1098
1102
|
);
|
|
1099
1103
|
eventing.codemodeDispatcher.start();
|
|
1100
1104
|
};
|
|
@@ -1113,6 +1117,7 @@ export async function prepareTurnToolRuntime(deps: PrepareTurnToolRuntimeDeps) {
|
|
|
1113
1117
|
return {
|
|
1114
1118
|
attemptConnectorActionBindings,
|
|
1115
1119
|
connectorActionPolicy,
|
|
1120
|
+
mcpServers: runSettings.mcpServers,
|
|
1116
1121
|
generateSessionTitleInParallel: titleToolPlan.generateTitleInParallel,
|
|
1117
1122
|
postToolPreparationStartedAt,
|
|
1118
1123
|
preparationIndependentToolNames: [
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
CODEMODE_MAX_CONCURRENT_CALLS_PER_ATTEMPT,
|
|
17
17
|
type CodemodeOperation,
|
|
18
18
|
type SessionEvent,
|
|
19
|
+
type ToolDisplayMetadata,
|
|
19
20
|
} from "@opengeni/contracts";
|
|
20
21
|
import {
|
|
21
22
|
cancelQueuedCodemodeOperationsForAttempt,
|
|
@@ -70,6 +71,7 @@ export class CodemodeAttemptDispatcher {
|
|
|
70
71
|
private readonly turnSignal?: AbortSignal,
|
|
71
72
|
private readonly maxConcurrentCalls = CODEMODE_MAX_CONCURRENT_CALLS_PER_ATTEMPT,
|
|
72
73
|
timings: CodemodeDispatcherTimings = {},
|
|
74
|
+
private readonly toolDisplayMetadata?: (modelName: string) => ToolDisplayMetadata | undefined,
|
|
73
75
|
) {
|
|
74
76
|
if (
|
|
75
77
|
environment.catalog.accountId !== scope.accountId ||
|
|
@@ -371,6 +373,10 @@ export class CodemodeAttemptDispatcher {
|
|
|
371
373
|
payload: {
|
|
372
374
|
id: operation.operationId,
|
|
373
375
|
name: entry.modelName,
|
|
376
|
+
display: this.toolDisplayMetadata?.(entry.modelName) ?? {
|
|
377
|
+
toolName: entry.identity.toolName,
|
|
378
|
+
...(entry.title ? { title: entry.title } : {}),
|
|
379
|
+
},
|
|
374
380
|
arguments: operation.arguments,
|
|
375
381
|
origin: "codemode",
|
|
376
382
|
subjectId: operation.caller.subjectId,
|
package/src/sandbox-routing.ts
CHANGED
|
@@ -787,11 +787,15 @@ function adoptRetainedProcessAsBackgroundCommandForTurn(
|
|
|
787
787
|
services: RoutingWiringServices,
|
|
788
788
|
ids: RoutingWiringIds,
|
|
789
789
|
):
|
|
790
|
-
| ((input: {
|
|
790
|
+
| ((input: {
|
|
791
|
+
backend: ResolvedActiveBackend;
|
|
792
|
+
process: RoutingRetainedProcess;
|
|
793
|
+
command?: string | undefined;
|
|
794
|
+
}) => Promise<void>)
|
|
791
795
|
| undefined {
|
|
792
796
|
const fence = ids.workspaceMutationFence;
|
|
793
797
|
if (!fence) return undefined;
|
|
794
|
-
return async ({ backend, process }) => {
|
|
798
|
+
return async ({ backend, process, command }) => {
|
|
795
799
|
const durable = await getRetainedProcess(services.db, {
|
|
796
800
|
workspaceId: ids.workspaceId,
|
|
797
801
|
sessionId: ids.sessionId,
|
|
@@ -818,7 +822,7 @@ function adoptRetainedProcessAsBackgroundCommandForTurn(
|
|
|
818
822
|
attemptId: fence.attemptId,
|
|
819
823
|
processId: process.id,
|
|
820
824
|
expected: retainedProcessSettlementIdentity(durable),
|
|
821
|
-
command: "
|
|
825
|
+
command: command ?? "Background command",
|
|
822
826
|
});
|
|
823
827
|
};
|
|
824
828
|
}
|