@opengeni/worker-bundle 0.24.2-canary.0 → 0.26.0-canary.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 +3 -10
- package/dist/activities/agent-turn/claim.d.ts +7 -0
- package/dist/activities/agent-turn/credential-leases.d.ts +8 -0
- package/dist/activities/agent-turn/errors.d.ts +6 -5
- package/dist/activities/agent-turn/failure-settlement.d.ts +43 -1
- package/dist/activities/agent-turn/history-prefix.d.ts +8 -0
- package/dist/activities/agent-turn/history-sink.d.ts +6 -2
- package/dist/activities/agent-turn/quiescence.d.ts +13 -8
- package/dist/activities/agent-turn/tool-environment.d.ts +2 -13
- package/dist/activities/agent-turn/tool-policy.d.ts +4 -0
- package/dist/activities/agent-turn/turn-context.d.ts +9 -1
- package/dist/activities/codemode-dispatcher.d.ts +10 -1
- package/dist/activities/codex-capacity.d.ts +32 -3
- package/dist/activities/codex-fleet-shadow.d.ts +1 -1
- package/dist/activities/codex-image-generation.d.ts +1 -1
- package/dist/activities/codex-rotation.d.ts +8 -67
- package/dist/activities/goals.d.ts +1 -1
- package/dist/activities/google-drive-publication.d.ts +2 -13
- package/dist/activities/image-generation-operation.d.ts +13 -4
- package/dist/activities/sandbox-lease.d.ts +7 -2
- package/dist/activities/session-state.d.ts +4 -2
- package/dist/activities/types.d.ts +11 -1
- package/dist/activities/xai-quota.d.ts +3 -0
- package/dist/{activities-control-ZWH7J4KZ.js → activities-control-KS3ZPQVY.js} +233 -88
- package/dist/activities-control-KS3ZPQVY.js.map +1 -0
- package/dist/activities-control.d.ts +2 -0
- package/dist/{activities-turn-I4OPLQLS.js → activities-turn-GHSFZB64.js} +1109 -1865
- package/dist/activities-turn-GHSFZB64.js.map +1 -0
- package/dist/activities.d.ts +2 -0
- package/dist/{chunk-65JEWP2Q.js → chunk-D4ZEFOYH.js} +1 -1
- package/dist/chunk-D4ZEFOYH.js.map +1 -0
- package/dist/{chunk-RQNH6CGR.js → chunk-O2LQWJIK.js} +3250 -2061
- package/dist/chunk-O2LQWJIK.js.map +1 -0
- package/dist/github-rest-mcp.d.ts +0 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/observability-metrics.d.ts +1 -1
- package/dist/sandbox-routing.d.ts +6 -0
- package/dist/workflow-bundle.js +94 -9
- package/dist/workflows/activities.d.ts +1 -1
- package/dist/workflows/session.d.ts +3 -0
- package/package.json +17 -17
- package/src/activities/agent-turn/agent-build.ts +21 -26
- package/src/activities/agent-turn/claim.ts +26 -1
- package/src/activities/agent-turn/codex-capacity.ts +311 -234
- package/src/activities/agent-turn/credential-leases.ts +36 -0
- package/src/activities/agent-turn/errors.ts +73 -12
- package/src/activities/agent-turn/failure-settlement.ts +472 -331
- package/src/activities/agent-turn/history-prefix.ts +51 -0
- package/src/activities/agent-turn/history-sink.ts +30 -6
- package/src/activities/agent-turn/quiescence.ts +29 -17
- package/src/activities/agent-turn/run.ts +22 -5
- package/src/activities/agent-turn/stream-attempt.ts +35 -8
- package/src/activities/agent-turn/tool-environment.ts +42 -32
- package/src/activities/agent-turn/tool-policy.ts +14 -8
- package/src/activities/agent-turn/turn-context.ts +13 -0
- package/src/activities/agent-turn/xai-capacity.ts +11 -0
- package/src/activities/codemode-dispatcher.ts +235 -59
- package/src/activities/codex-capacity.ts +107 -10
- package/src/activities/codex-fleet-shadow.ts +8 -1
- package/src/activities/codex-image-generation.ts +19 -2
- package/src/activities/codex-rotation.ts +45 -142
- package/src/activities/goals.ts +9 -9
- package/src/activities/google-drive-publication.ts +4 -81
- package/src/activities/image-generation-operation.ts +28 -3
- package/src/activities/run-input.ts +6 -7
- package/src/activities/sandbox-lease.ts +246 -87
- package/src/activities/session-state.ts +20 -1
- package/src/activities/types.ts +16 -8
- package/src/activities/xai-quota.ts +35 -0
- package/src/activities.ts +1 -0
- package/src/github-rest-mcp.ts +0 -82
- package/src/observability-metrics.ts +4 -0
- package/src/sandbox-routing.ts +186 -16
- package/src/workflows/activities.ts +1 -0
- package/src/workflows/session.ts +114 -8
- package/dist/activities/api-integrations.d.ts +0 -21
- package/dist/activities-control-ZWH7J4KZ.js.map +0 -1
- package/dist/activities-turn-I4OPLQLS.js.map +0 -1
- package/dist/chunk-65JEWP2Q.js.map +0 -1
- package/dist/chunk-RQNH6CGR.js.map +0 -1
- package/src/activities/api-integrations.ts +0 -151
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createGraphqlMcpServer,
|
|
3
|
-
createOpenApiMcpServer,
|
|
4
|
-
createPinnedIntegrationTransport,
|
|
5
|
-
type IntegrationCredentialResolver,
|
|
6
|
-
type IntegrationInvocationAuthority,
|
|
7
|
-
} from "@opengeni/capabilities";
|
|
8
|
-
import type { Settings } from "@opengeni/config";
|
|
9
|
-
import type { ToolAuthNeededPayload } from "@opengeni/contracts";
|
|
10
|
-
import type {
|
|
11
|
-
ApiIntegrationRuntime,
|
|
12
|
-
ResolveConnectionCredentialInput,
|
|
13
|
-
ResolveConnectionCredentialResult,
|
|
14
|
-
} from "@opengeni/db";
|
|
15
|
-
import type { LocalMcpServerRegistration } from "@opengeni/runtime";
|
|
16
|
-
import type { FetchLike } from "@opengeni/network";
|
|
17
|
-
|
|
18
|
-
export type BuildApiIntegrationServersInput = {
|
|
19
|
-
settings: Settings;
|
|
20
|
-
integrations: readonly ApiIntegrationRuntime[];
|
|
21
|
-
authority: Omit<IntegrationInvocationAuthority, "connectionRef">;
|
|
22
|
-
resolveCredential: (
|
|
23
|
-
input: ResolveConnectionCredentialInput,
|
|
24
|
-
) => Promise<ResolveConnectionCredentialResult>;
|
|
25
|
-
onAuthNeeded?: (payload: ToolAuthNeededPayload) => Promise<void> | void;
|
|
26
|
-
fetchImpl?: FetchLike;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Compile active persisted API facets into ordinary in-process MCP servers for
|
|
31
|
-
* one exact attempt. Connection resolution remains request-time, destination-
|
|
32
|
-
* bound, personal-delegation-fenced, and refreshable through the same worker
|
|
33
|
-
* resolver used by remote MCP servers.
|
|
34
|
-
*/
|
|
35
|
-
export function buildApiIntegrationServersForTurn(
|
|
36
|
-
input: BuildApiIntegrationServersInput,
|
|
37
|
-
): LocalMcpServerRegistration[] {
|
|
38
|
-
const transport = createPinnedIntegrationTransport({
|
|
39
|
-
network: input.settings,
|
|
40
|
-
...(input.fetchImpl ? { fetchImpl: input.fetchImpl } : {}),
|
|
41
|
-
});
|
|
42
|
-
return input.integrations.map((integration) => {
|
|
43
|
-
const authority: IntegrationInvocationAuthority = {
|
|
44
|
-
...input.authority,
|
|
45
|
-
...(integration.connectionRef?.connectionId
|
|
46
|
-
? { connectionRef: integration.connectionRef.connectionId }
|
|
47
|
-
: {}),
|
|
48
|
-
};
|
|
49
|
-
const credentialResolver = integration.connectionRef
|
|
50
|
-
? integrationCredentialResolver(input, integration)
|
|
51
|
-
: undefined;
|
|
52
|
-
const server =
|
|
53
|
-
integration.revision.protocol === "openapi"
|
|
54
|
-
? createOpenApiMcpServer({
|
|
55
|
-
revision: integration.revision,
|
|
56
|
-
transport,
|
|
57
|
-
authority,
|
|
58
|
-
...(credentialResolver ? { credentialResolver } : {}),
|
|
59
|
-
})
|
|
60
|
-
: createGraphqlMcpServer({
|
|
61
|
-
revision: integration.revision,
|
|
62
|
-
endpoint: integration.baseUrl,
|
|
63
|
-
transport,
|
|
64
|
-
authority,
|
|
65
|
-
...(credentialResolver ? { credentialResolver } : {}),
|
|
66
|
-
});
|
|
67
|
-
return {
|
|
68
|
-
id: integration.serverId,
|
|
69
|
-
server,
|
|
70
|
-
...(integration.connectionRef?.connectionId
|
|
71
|
-
? { resolvedConnectionId: integration.connectionRef.connectionId }
|
|
72
|
-
: {}),
|
|
73
|
-
};
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function integrationCredentialResolver(
|
|
78
|
-
input: BuildApiIntegrationServersInput,
|
|
79
|
-
integration: ApiIntegrationRuntime,
|
|
80
|
-
): IntegrationCredentialResolver {
|
|
81
|
-
const connectionRef = integration.connectionRef;
|
|
82
|
-
if (!connectionRef) throw new Error("Integration credential resolver requires a connection");
|
|
83
|
-
return {
|
|
84
|
-
resolve: async (request) => {
|
|
85
|
-
const result = await input.resolveCredential({
|
|
86
|
-
workspaceId: input.authority.workspaceId,
|
|
87
|
-
serverId: integration.serverId,
|
|
88
|
-
toolName: request.operationKey,
|
|
89
|
-
connectionRef,
|
|
90
|
-
destinationUrl: request.destinationUrl,
|
|
91
|
-
credentialTarget: "http_api",
|
|
92
|
-
forceRefresh: request.forceRefresh === true,
|
|
93
|
-
});
|
|
94
|
-
if (result.status === "auth_needed") {
|
|
95
|
-
await publishAuthNeeded(
|
|
96
|
-
input,
|
|
97
|
-
integration.serverId,
|
|
98
|
-
request.operationKey,
|
|
99
|
-
result,
|
|
100
|
-
connectionRef,
|
|
101
|
-
);
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
const destination = new URL(request.destinationUrl);
|
|
105
|
-
return {
|
|
106
|
-
audience: { origin: destination.origin, pathPrefix: "/" },
|
|
107
|
-
placements:
|
|
108
|
-
result.placements ??
|
|
109
|
-
Object.entries(result.headers).map(([name, value]) => ({
|
|
110
|
-
carrier: "header" as const,
|
|
111
|
-
name,
|
|
112
|
-
value,
|
|
113
|
-
})),
|
|
114
|
-
...(result.authorizeProviderRequest
|
|
115
|
-
? { authorizeProviderRequest: result.authorizeProviderRequest }
|
|
116
|
-
: {}),
|
|
117
|
-
...(result.expiresAt ? { expiresAt: result.expiresAt.toISOString() } : {}),
|
|
118
|
-
...(connectionRef.scopes ? { scope: [...connectionRef.scopes] } : {}),
|
|
119
|
-
};
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
async function publishAuthNeeded(
|
|
125
|
-
input: BuildApiIntegrationServersInput,
|
|
126
|
-
serverId: string,
|
|
127
|
-
toolName: string,
|
|
128
|
-
result: Extract<ResolveConnectionCredentialResult, { status: "auth_needed" }>,
|
|
129
|
-
connectionRef: NonNullable<ApiIntegrationRuntime["connectionRef"]>,
|
|
130
|
-
): Promise<void> {
|
|
131
|
-
try {
|
|
132
|
-
await input.onAuthNeeded?.({
|
|
133
|
-
serverId,
|
|
134
|
-
toolName,
|
|
135
|
-
providerDomain: result.providerDomain,
|
|
136
|
-
...(result.provider ? { provider: result.provider } : {}),
|
|
137
|
-
reason: result.reason,
|
|
138
|
-
...(result.connectionId ? { connectionId: result.connectionId } : {}),
|
|
139
|
-
...(result.authoritySource === "host" || connectionRef.authoritySource === "host"
|
|
140
|
-
? { authoritySource: "host" as const }
|
|
141
|
-
: {}),
|
|
142
|
-
...(result.scopes ? { scopes: result.scopes } : {}),
|
|
143
|
-
...(result.resource ? { resource: result.resource } : {}),
|
|
144
|
-
...(result.selectedResources ? { selectedResources: result.selectedResources } : {}),
|
|
145
|
-
...(result.authorizationUrl ? { authorizationUrl: result.authorizationUrl } : {}),
|
|
146
|
-
});
|
|
147
|
-
} catch {
|
|
148
|
-
// Authentication notices are advisory UI/audit signals. The local tool
|
|
149
|
-
// still returns the fixed connection-required result when publication fails.
|
|
150
|
-
}
|
|
151
|
-
}
|