@opengeni/worker-bundle 4.3.3-canary.39786771332001 → 4.4.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.
@@ -0,0 +1,30 @@
1
+ import { appendTurnCapabilityCardOnce } from "@opengeni/db";
2
+ import { publishDurableSessionEvents } from "@opengeni/events";
3
+ import type { UserSetupCardPoster } from "@opengeni/runtime";
4
+ type AppendCardOnce = typeof appendTurnCapabilityCardOnce;
5
+ type PublishEvents = typeof publishDurableSessionEvents;
6
+ export type UserSetupCardInput = {
7
+ db: Parameters<AppendCardOnce>[0];
8
+ bus: Parameters<PublishEvents>[0];
9
+ /** Connected Machines are enabled on this deployment; their cards can't help otherwise. */
10
+ connectedMachinesEnabled: boolean;
11
+ /** The web app's base URL, for the chat link the agent can hand out. */
12
+ webBaseUrl: string | null | undefined;
13
+ workspaceId: string;
14
+ sessionId: string;
15
+ turnId: string;
16
+ executionGeneration: number;
17
+ attemptId: string;
18
+ append?: AppendCardOnce;
19
+ publish?: PublishEvents;
20
+ };
21
+ /**
22
+ * Posts the setup card for a tool refusal the person can fix (see
23
+ * USER_SETUP_BLOCKERS) in the calling turn, at most once per turn and card: a
24
+ * later refusal in the same turn reuses the card already shown. The append
25
+ * runs under the attempt fence, so a replaced turn posts nothing. Resolves
26
+ * "unavailable" when the card can't help on this deployment, and null when it
27
+ * was not posted.
28
+ */
29
+ export declare function userSetupCardPoster(input: UserSetupCardInput): UserSetupCardPoster;
30
+ export {};
@@ -34210,6 +34210,36 @@ async function createKnowledgeSourceAttemptTools(input) {
34210
34210
  ];
34211
34211
  }
34212
34212
 
34213
+ // src/activities/agent-turn/user-setup-card.ts
34214
+ import { sessionChatUrl } from "@opengeni/contracts";
34215
+ import { CONNECTED_MACHINE_CAPABILITY_ID, userSetupCardPayload } from "@opengeni/core";
34216
+ import { appendTurnCapabilityCardOnce } from "@opengeni/db";
34217
+ import { publishDurableSessionEvents as publishDurableSessionEvents13 } from "@opengeni/events";
34218
+ function userSetupCardPoster(input) {
34219
+ const append = input.append ?? appendTurnCapabilityCardOnce;
34220
+ const publish = input.publish ?? publishDurableSessionEvents13;
34221
+ return async (blocker, toolName) => {
34222
+ if (blocker.capabilityId === CONNECTED_MACHINE_CAPABILITY_ID && !input.connectedMachinesEnabled) {
34223
+ return "unavailable";
34224
+ }
34225
+ const payload = userSetupCardPayload(blocker, { toolName });
34226
+ if (!payload) return null;
34227
+ const appended = await append(
34228
+ input.db,
34229
+ input.workspaceId,
34230
+ input.sessionId,
34231
+ input.turnId,
34232
+ input.executionGeneration,
34233
+ input.attemptId,
34234
+ blocker.capabilityId,
34235
+ { type: "tool.auth_needed", payload }
34236
+ );
34237
+ await publish(input.bus, input.workspaceId, input.sessionId, appended.events);
34238
+ if (!appended.accepted) return null;
34239
+ return { chatUrl: sessionChatUrl(input.webBaseUrl, input.workspaceId, input.sessionId) };
34240
+ };
34241
+ }
34242
+
34213
34243
  // src/activities/agent-turn/tool-environment.ts
34214
34244
  import {
34215
34245
  resolveInitiatingHuman as resolveInitiatingHuman2,
@@ -34230,7 +34260,7 @@ import {
34230
34260
  subscriptionCoreCodexAppsRequestAuth,
34231
34261
  getSessionTitleOperation as getSessionTitleOperation2
34232
34262
  } from "@opengeni/db";
34233
- import { publishDurableSessionEvents as publishDurableSessionEvents13 } from "@opengeni/events";
34263
+ import { publishDurableSessionEvents as publishDurableSessionEvents14 } from "@opengeni/events";
34234
34264
  import {
34235
34265
  selectedSessionRemoteMcpTargets as selectedSessionRemoteMcpTargets3,
34236
34266
  createFirstPartyInteractionAttemptToolDefinitions,
@@ -38422,7 +38452,7 @@ async function prepareTurnToolRuntime(deps) {
38422
38452
  title,
38423
38453
  source: "agent"
38424
38454
  });
38425
- await publishDurableSessionEvents13(
38455
+ await publishDurableSessionEvents14(
38426
38456
  bus,
38427
38457
  input.workspaceId,
38428
38458
  input.sessionId,
@@ -38447,7 +38477,18 @@ async function prepareTurnToolRuntime(deps) {
38447
38477
  selectedTools: selectedFirstPartyMcpTools,
38448
38478
  subjectId: "worker:first-party-mcp",
38449
38479
  subjectLabel: "Opengeni worker",
38450
- ...interactionInterventionResume ? { interventionResume: interactionInterventionResume } : {}
38480
+ ...interactionInterventionResume ? { interventionResume: interactionInterventionResume } : {},
38481
+ postSetupCard: userSetupCardPoster({
38482
+ db,
38483
+ bus,
38484
+ connectedMachinesEnabled: runSettings.sandboxSelfhostedEnabled,
38485
+ webBaseUrl: runSettings.webBaseUrl ?? runSettings.publicBaseUrl,
38486
+ workspaceId: input.workspaceId,
38487
+ sessionId: input.sessionId,
38488
+ turnId: turn.id,
38489
+ executionGeneration: attempt.executionGeneration,
38490
+ attemptId: input.attemptId
38491
+ })
38451
38492
  }),
38452
38493
  ...googleDrivePublicationTool && googleDrivePublicationAllowed ? [googleDrivePublicationTool] : [],
38453
38494
  ...codeSearchTools,
@@ -43139,7 +43180,7 @@ import {
43139
43180
  subscriptionCoreXaiBearer as subscriptionCoreXaiBearer2,
43140
43181
  subscriptionCoreXaiFetch as subscriptionCoreXaiFetch2
43141
43182
  } from "@opengeni/db";
43142
- import { publishDurableSessionEvents as publishDurableSessionEvents14 } from "@opengeni/events";
43183
+ import { publishDurableSessionEvents as publishDurableSessionEvents15 } from "@opengeni/events";
43143
43184
 
43144
43185
  // src/activities/gateway-video-generation.ts
43145
43186
  import { readResponseTextBounded as readResponseTextBounded2 } from "@opengeni/network";
@@ -44027,7 +44068,7 @@ async function deliverTerminalResult(service, operation) {
44027
44068
  return;
44028
44069
  }
44029
44070
  if (result.added && result.events.length > 0) {
44030
- await publishDurableSessionEvents14(
44071
+ await publishDurableSessionEvents15(
44031
44072
  service.bus,
44032
44073
  operation.workspaceId,
44033
44074
  operation.sessionId,
@@ -44218,4 +44259,4 @@ export {
44218
44259
  createTurnActivities,
44219
44260
  createTurnActivitiesFromServices
44220
44261
  };
44221
- //# sourceMappingURL=activities-turn-WVRRHWOU.js.map
44262
+ //# sourceMappingURL=activities-turn-G33RWTX2.js.map