@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/worker-bundle",
3
- "version": "4.3.3-canary.39786771332001",
3
+ "version": "4.4.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,32 +56,32 @@
56
56
  "@1password/sdk": "0.5.0",
57
57
  "@keeper-security/secrets-manager-core": "17.6.0",
58
58
  "@llamaindex/liteparse": "2.14.2",
59
- "@opengeni/agent-proto": "4.3.3-canary.39786771332001",
60
- "@opengeni/capabilities": "4.3.3-canary.39786771332001",
61
- "@opengeni/codemode": "4.3.3-canary.39786771332001",
62
- "@opengeni/codex": "4.3.3-canary.39786771332001",
63
- "@opengeni/config": "4.3.3-canary.39786771332001",
64
- "@opengeni/contracts": "4.3.3-canary.39786771332001",
65
- "@opengeni/core": "4.3.3-canary.39786771332001",
66
- "@opengeni/db": "4.3.3-canary.39786771332001",
67
- "@opengeni/decisions": "4.3.3-canary.39786771332001",
68
- "@opengeni/documents": "4.3.3-canary.39786771332001",
69
- "@opengeni/events": "4.3.3-canary.39786771332001",
70
- "@opengeni/github": "4.3.3-canary.39786771332001",
71
- "@opengeni/interaction": "4.3.3-canary.39786771332001",
72
- "@opengeni/jev": "4.3.3-canary.39786771332001",
73
- "@opengeni/network": "4.3.3-canary.39786771332001",
74
- "@opengeni/observability": "4.3.3-canary.39786771332001",
75
- "@opengeni/runtime": "4.3.3-canary.39786771332001",
76
- "@opengeni/sdk": "4.3.3-canary.39786771332001",
77
- "@opengeni/storage": "4.3.3-canary.39786771332001",
78
- "@opengeni/subscriptions": "4.3.3-canary.39786771332001",
79
- "@opengeni/tool-gateway": "4.3.3-canary.39786771332001",
80
- "@opengeni/vaults": "4.3.3-canary.39786771332001",
81
- "@opengeni/vaults-keeper": "4.3.3-canary.39786771332001",
82
- "@opengeni/vaults-onepassword": "4.3.3-canary.39786771332001",
83
- "@opengeni/vaults-protonpass": "4.3.3-canary.39786771332001",
84
- "@opengeni/xai-subscription": "4.3.3-canary.39786771332001",
59
+ "@opengeni/agent-proto": "4.4.1",
60
+ "@opengeni/capabilities": "4.4.1",
61
+ "@opengeni/codemode": "4.4.1",
62
+ "@opengeni/codex": "4.4.1",
63
+ "@opengeni/config": "4.4.1",
64
+ "@opengeni/contracts": "4.4.1",
65
+ "@opengeni/core": "4.4.1",
66
+ "@opengeni/db": "4.4.1",
67
+ "@opengeni/decisions": "4.4.1",
68
+ "@opengeni/documents": "4.4.1",
69
+ "@opengeni/events": "4.4.1",
70
+ "@opengeni/github": "4.4.1",
71
+ "@opengeni/interaction": "4.4.1",
72
+ "@opengeni/jev": "4.4.1",
73
+ "@opengeni/network": "4.4.1",
74
+ "@opengeni/observability": "4.4.1",
75
+ "@opengeni/runtime": "4.4.1",
76
+ "@opengeni/sdk": "4.4.1",
77
+ "@opengeni/storage": "4.4.1",
78
+ "@opengeni/subscriptions": "4.4.1",
79
+ "@opengeni/tool-gateway": "4.4.1",
80
+ "@opengeni/vaults": "4.4.1",
81
+ "@opengeni/vaults-keeper": "4.4.1",
82
+ "@opengeni/vaults-onepassword": "4.4.1",
83
+ "@opengeni/vaults-protonpass": "4.4.1",
84
+ "@opengeni/xai-subscription": "4.4.1",
85
85
  "@temporalio/activity": "^1.17.0",
86
86
  "@temporalio/client": "^1.17.0",
87
87
  "@temporalio/worker": "^1.17.0",
@@ -1,4 +1,5 @@
1
1
  import { createKnowledgeSourceAttemptTools } from "./knowledge-source-tools";
2
+ import { userSetupCardPoster } from "./user-setup-card";
2
3
  import {
3
4
  resolveInitiatingHuman,
4
5
  buildSlackApiRateLimiter,
@@ -933,6 +934,17 @@ export async function prepareTurnToolRuntime(deps: PrepareTurnToolRuntimeDeps) {
933
934
  ...(interactionInterventionResume
934
935
  ? { interventionResume: interactionInterventionResume }
935
936
  : {}),
937
+ postSetupCard: userSetupCardPoster({
938
+ db,
939
+ bus,
940
+ connectedMachinesEnabled: runSettings.sandboxSelfhostedEnabled,
941
+ webBaseUrl: runSettings.webBaseUrl ?? runSettings.publicBaseUrl,
942
+ workspaceId: input.workspaceId,
943
+ sessionId: input.sessionId,
944
+ turnId: turn.id,
945
+ executionGeneration: attempt.executionGeneration,
946
+ attemptId: input.attemptId,
947
+ }),
936
948
  }),
937
949
  ...(googleDrivePublicationTool && googleDrivePublicationAllowed
938
950
  ? [googleDrivePublicationTool]
@@ -0,0 +1,60 @@
1
+ import { sessionChatUrl } from "@opengeni/contracts";
2
+ import { CONNECTED_MACHINE_CAPABILITY_ID, userSetupCardPayload } from "@opengeni/core";
3
+ import { appendTurnCapabilityCardOnce } from "@opengeni/db";
4
+ import { publishDurableSessionEvents } from "@opengeni/events";
5
+ import type { UserSetupCardPoster } from "@opengeni/runtime";
6
+
7
+ type AppendCardOnce = typeof appendTurnCapabilityCardOnce;
8
+ type PublishEvents = typeof publishDurableSessionEvents;
9
+
10
+ export type UserSetupCardInput = {
11
+ db: Parameters<AppendCardOnce>[0];
12
+ bus: Parameters<PublishEvents>[0];
13
+ /** Connected Machines are enabled on this deployment; their cards can't help otherwise. */
14
+ connectedMachinesEnabled: boolean;
15
+ /** The web app's base URL, for the chat link the agent can hand out. */
16
+ webBaseUrl: string | null | undefined;
17
+ workspaceId: string;
18
+ sessionId: string;
19
+ turnId: string;
20
+ executionGeneration: number;
21
+ attemptId: string;
22
+ append?: AppendCardOnce;
23
+ publish?: PublishEvents;
24
+ };
25
+
26
+ /**
27
+ * Posts the setup card for a tool refusal the person can fix (see
28
+ * USER_SETUP_BLOCKERS) in the calling turn, at most once per turn and card: a
29
+ * later refusal in the same turn reuses the card already shown. The append
30
+ * runs under the attempt fence, so a replaced turn posts nothing. Resolves
31
+ * "unavailable" when the card can't help on this deployment, and null when it
32
+ * was not posted.
33
+ */
34
+ export function userSetupCardPoster(input: UserSetupCardInput): UserSetupCardPoster {
35
+ const append = input.append ?? appendTurnCapabilityCardOnce;
36
+ const publish = input.publish ?? publishDurableSessionEvents;
37
+ return async (blocker, toolName) => {
38
+ if (
39
+ blocker.capabilityId === CONNECTED_MACHINE_CAPABILITY_ID &&
40
+ !input.connectedMachinesEnabled
41
+ ) {
42
+ return "unavailable";
43
+ }
44
+ const payload = userSetupCardPayload(blocker, { toolName });
45
+ if (!payload) return null;
46
+ const appended = await append(
47
+ input.db,
48
+ input.workspaceId,
49
+ input.sessionId,
50
+ input.turnId,
51
+ input.executionGeneration,
52
+ input.attemptId,
53
+ blocker.capabilityId,
54
+ { type: "tool.auth_needed", payload },
55
+ );
56
+ await publish(input.bus, input.workspaceId, input.sessionId, appended.events);
57
+ if (!appended.accepted) return null;
58
+ return { chatUrl: sessionChatUrl(input.webBaseUrl, input.workspaceId, input.sessionId) };
59
+ };
60
+ }