@opengeni/runtime 0.11.0 → 0.13.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/{chunk-YUAFQEFY.js → chunk-65UDUFUO.js} +729 -118
- package/dist/chunk-65UDUFUO.js.map +1 -0
- package/dist/chunk-HAN5D27J.js +292 -0
- package/dist/chunk-HAN5D27J.js.map +1 -0
- package/dist/{index-D6yi-JcU.d.ts → index-DGUrY_yR.d.ts} +37 -7
- package/dist/index.d.ts +81 -10
- package/dist/index.js +696 -93
- package/dist/index.js.map +1 -1
- package/dist/mcp-network.d.ts +78 -0
- package/dist/mcp-network.js +62 -0
- package/dist/mcp-network.js.map +1 -0
- package/dist/sandbox/index.d.ts +1 -1
- package/dist/sandbox/index.js +1 -1
- package/package.json +9 -4
- package/src/codex-tool-search.ts +20 -1
- package/src/index.ts +487 -83
- package/src/mcp-network.ts +330 -0
- package/src/sandbox/channel-a.ts +3 -28
- package/src/sandbox/display-stack.ts +860 -23
- package/src/sandbox/exec-banner.ts +67 -0
- package/src/sandbox/index.ts +7 -0
- package/src/sandbox/providers/modal.ts +29 -2
- package/src/sandbox-computer.ts +3 -1
- package/src/usage-telemetry.ts +495 -51
- package/dist/chunk-YUAFQEFY.js.map +0 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Settings } from '@opengeni/config';
|
|
2
|
+
import { DnsLookup, isNonPublicAddress } from '@opengeni/network';
|
|
3
|
+
export { undiciFetch } from '@opengeni/network';
|
|
4
|
+
|
|
5
|
+
declare const MCP_MAX_RESPONSE_BYTES: number;
|
|
6
|
+
declare const MCP_MAX_INBOUND_REQUEST_BYTES: number;
|
|
7
|
+
declare const MCP_MAX_TOOL_DEFINITION_BYTES: number;
|
|
8
|
+
declare const MCP_MAX_TOOL_LIST_BYTES: number;
|
|
9
|
+
declare const MCP_MAX_TOOL_LIST_ENTRIES = 1000;
|
|
10
|
+
declare const MCP_MAX_TOOL_RESULT_BYTES: number;
|
|
11
|
+
declare const MCP_MAX_TOOL_SEARCH_DISCLOSURE_BYTES: number;
|
|
12
|
+
declare const MCP_MAX_SELECTED_SERVERS = 64;
|
|
13
|
+
declare const MCP_MAX_CONCURRENT_SERVER_OPERATIONS = 8;
|
|
14
|
+
declare const MCP_MAX_AGGREGATE_TOOL_LIST_ENTRIES = 4096;
|
|
15
|
+
declare const MCP_MAX_AGGREGATE_TOOL_LIST_BYTES: number;
|
|
16
|
+
declare const MCP_MAX_TOOL_SEARCH_SOURCES = 64;
|
|
17
|
+
declare const MCP_MAX_TOOL_SEARCH_SOURCE_LABEL_LENGTH = 120;
|
|
18
|
+
declare const MCP_MAX_TOOL_SEARCH_DESCRIPTION_BYTES: number;
|
|
19
|
+
declare class McpPayloadTooLargeError extends Error {
|
|
20
|
+
readonly label: string;
|
|
21
|
+
readonly actualBytes: number;
|
|
22
|
+
readonly maxBytes: number;
|
|
23
|
+
constructor(label: string, actualBytes: number, maxBytes: number);
|
|
24
|
+
}
|
|
25
|
+
declare function mcpSerializedSizeBytes(value: unknown): number;
|
|
26
|
+
declare function assertMcpPayloadWithinBytes(value: unknown, maxBytes: number, label: string): void;
|
|
27
|
+
declare function assertMcpToolListWithinBounds<T>(tools: readonly T[]): readonly T[];
|
|
28
|
+
declare function assertMcpServerSelectionWithinBounds<T>(servers: readonly T[]): readonly T[];
|
|
29
|
+
type McpToolListContribution = {
|
|
30
|
+
entries: number;
|
|
31
|
+
bytes: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Atomic aggregate accounting shared by every exposed tools/list in one run.
|
|
35
|
+
* A repeated list for the same source REPLACES its prior contribution, so
|
|
36
|
+
* cache invalidation/relisting cannot ratchet the budget upward. Failed
|
|
37
|
+
* replacements leave the previous accounting intact.
|
|
38
|
+
*/
|
|
39
|
+
declare class McpAggregateToolListBudget {
|
|
40
|
+
private readonly label;
|
|
41
|
+
private readonly maxEntries;
|
|
42
|
+
private readonly maxBytes;
|
|
43
|
+
private readonly contributions;
|
|
44
|
+
private totalEntries;
|
|
45
|
+
private totalBytes;
|
|
46
|
+
constructor(label?: string, maxEntries?: number, maxBytes?: number);
|
|
47
|
+
replace<T>(sourceId: string, tools: readonly T[]): readonly T[];
|
|
48
|
+
remove(sourceId: string): void;
|
|
49
|
+
snapshot(): Readonly<McpToolListContribution>;
|
|
50
|
+
}
|
|
51
|
+
/** Stable-order parallel map with a hard in-flight ceiling and fail-stop drain. */
|
|
52
|
+
declare function boundedParallelMap<T, R>(values: readonly T[], concurrency: number, mapper: (value: T, index: number) => Promise<R>): Promise<R[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Guard normal MCP traffic with the same deployment policy as OAuth traffic.
|
|
55
|
+
* The pinned transport resolves and policy-checks the destination after the
|
|
56
|
+
* caller has composed any credential headers, then performs the final network
|
|
57
|
+
* call through the vetted Agent. It forces manual redirects, so an
|
|
58
|
+
* Authorization-bearing request never follows a provider-controlled Location
|
|
59
|
+
* to an unvalidated host.
|
|
60
|
+
*
|
|
61
|
+
* This module is deliberately agent-loop-free. API code imports the explicit
|
|
62
|
+
* `@opengeni/runtime/mcp-network` leaf rather than the runtime root barrel.
|
|
63
|
+
*/
|
|
64
|
+
declare function guardedMcpFetch<TInput extends string | URL | Request>(settings: Pick<Settings, "environment" | "integrationsAllowPrivateNetworkTargets">, fetchImpl: (input: TInput, init?: RequestInit) => Promise<Response>, options?: {
|
|
65
|
+
maxResponseBytes?: number;
|
|
66
|
+
dnsLookup?: DnsLookup;
|
|
67
|
+
requireHttpsOutsideLocalTest?: boolean;
|
|
68
|
+
}): (input: TInput, init?: RequestInit) => Promise<Response>;
|
|
69
|
+
declare function boundMcpResponseBody(response: Response, maxBytes: number): Response;
|
|
70
|
+
declare function cancelMcpResponseBody(response: Response): Promise<void>;
|
|
71
|
+
/** Read and rebuild an inbound MCP request before the SDK parses it. */
|
|
72
|
+
declare function boundedMcpRequest(request: Request, maxBytes?: number): Promise<Request>;
|
|
73
|
+
declare function assertMcpDestinationAllowed(rawUrl: string, settings: Pick<Settings, "environment" | "integrationsAllowPrivateNetworkTargets">, options?: {
|
|
74
|
+
dnsLookup?: DnsLookup;
|
|
75
|
+
}): Promise<void>;
|
|
76
|
+
declare const isNonPublicMcpAddress: typeof isNonPublicAddress;
|
|
77
|
+
|
|
78
|
+
export { MCP_MAX_AGGREGATE_TOOL_LIST_BYTES, MCP_MAX_AGGREGATE_TOOL_LIST_ENTRIES, MCP_MAX_CONCURRENT_SERVER_OPERATIONS, MCP_MAX_INBOUND_REQUEST_BYTES, MCP_MAX_RESPONSE_BYTES, MCP_MAX_SELECTED_SERVERS, MCP_MAX_TOOL_DEFINITION_BYTES, MCP_MAX_TOOL_LIST_BYTES, MCP_MAX_TOOL_LIST_ENTRIES, MCP_MAX_TOOL_RESULT_BYTES, MCP_MAX_TOOL_SEARCH_DESCRIPTION_BYTES, MCP_MAX_TOOL_SEARCH_DISCLOSURE_BYTES, MCP_MAX_TOOL_SEARCH_SOURCES, MCP_MAX_TOOL_SEARCH_SOURCE_LABEL_LENGTH, McpAggregateToolListBudget, McpPayloadTooLargeError, assertMcpDestinationAllowed, assertMcpPayloadWithinBytes, assertMcpServerSelectionWithinBounds, assertMcpToolListWithinBounds, boundMcpResponseBody, boundedMcpRequest, boundedParallelMap, cancelMcpResponseBody, guardedMcpFetch, isNonPublicMcpAddress, mcpSerializedSizeBytes };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MCP_MAX_AGGREGATE_TOOL_LIST_BYTES,
|
|
3
|
+
MCP_MAX_AGGREGATE_TOOL_LIST_ENTRIES,
|
|
4
|
+
MCP_MAX_CONCURRENT_SERVER_OPERATIONS,
|
|
5
|
+
MCP_MAX_INBOUND_REQUEST_BYTES,
|
|
6
|
+
MCP_MAX_RESPONSE_BYTES,
|
|
7
|
+
MCP_MAX_SELECTED_SERVERS,
|
|
8
|
+
MCP_MAX_TOOL_DEFINITION_BYTES,
|
|
9
|
+
MCP_MAX_TOOL_LIST_BYTES,
|
|
10
|
+
MCP_MAX_TOOL_LIST_ENTRIES,
|
|
11
|
+
MCP_MAX_TOOL_RESULT_BYTES,
|
|
12
|
+
MCP_MAX_TOOL_SEARCH_DESCRIPTION_BYTES,
|
|
13
|
+
MCP_MAX_TOOL_SEARCH_DISCLOSURE_BYTES,
|
|
14
|
+
MCP_MAX_TOOL_SEARCH_SOURCES,
|
|
15
|
+
MCP_MAX_TOOL_SEARCH_SOURCE_LABEL_LENGTH,
|
|
16
|
+
McpAggregateToolListBudget,
|
|
17
|
+
McpPayloadTooLargeError,
|
|
18
|
+
assertMcpDestinationAllowed,
|
|
19
|
+
assertMcpPayloadWithinBytes,
|
|
20
|
+
assertMcpServerSelectionWithinBounds,
|
|
21
|
+
assertMcpToolListWithinBounds,
|
|
22
|
+
boundMcpResponseBody,
|
|
23
|
+
boundedMcpRequest,
|
|
24
|
+
boundedParallelMap,
|
|
25
|
+
cancelMcpResponseBody,
|
|
26
|
+
guardedMcpFetch,
|
|
27
|
+
isNonPublicMcpAddress,
|
|
28
|
+
mcpSerializedSizeBytes,
|
|
29
|
+
undiciFetch
|
|
30
|
+
} from "./chunk-HAN5D27J.js";
|
|
31
|
+
import "./chunk-PZ5AY32C.js";
|
|
32
|
+
export {
|
|
33
|
+
MCP_MAX_AGGREGATE_TOOL_LIST_BYTES,
|
|
34
|
+
MCP_MAX_AGGREGATE_TOOL_LIST_ENTRIES,
|
|
35
|
+
MCP_MAX_CONCURRENT_SERVER_OPERATIONS,
|
|
36
|
+
MCP_MAX_INBOUND_REQUEST_BYTES,
|
|
37
|
+
MCP_MAX_RESPONSE_BYTES,
|
|
38
|
+
MCP_MAX_SELECTED_SERVERS,
|
|
39
|
+
MCP_MAX_TOOL_DEFINITION_BYTES,
|
|
40
|
+
MCP_MAX_TOOL_LIST_BYTES,
|
|
41
|
+
MCP_MAX_TOOL_LIST_ENTRIES,
|
|
42
|
+
MCP_MAX_TOOL_RESULT_BYTES,
|
|
43
|
+
MCP_MAX_TOOL_SEARCH_DESCRIPTION_BYTES,
|
|
44
|
+
MCP_MAX_TOOL_SEARCH_DISCLOSURE_BYTES,
|
|
45
|
+
MCP_MAX_TOOL_SEARCH_SOURCES,
|
|
46
|
+
MCP_MAX_TOOL_SEARCH_SOURCE_LABEL_LENGTH,
|
|
47
|
+
McpAggregateToolListBudget,
|
|
48
|
+
McpPayloadTooLargeError,
|
|
49
|
+
assertMcpDestinationAllowed,
|
|
50
|
+
assertMcpPayloadWithinBytes,
|
|
51
|
+
assertMcpServerSelectionWithinBounds,
|
|
52
|
+
assertMcpToolListWithinBounds,
|
|
53
|
+
boundMcpResponseBody,
|
|
54
|
+
boundedMcpRequest,
|
|
55
|
+
boundedParallelMap,
|
|
56
|
+
cancelMcpResponseBody,
|
|
57
|
+
guardedMcpFetch,
|
|
58
|
+
isNonPublicMcpAddress,
|
|
59
|
+
mcpSerializedSizeBytes,
|
|
60
|
+
undiciFetch
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=mcp-network.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/sandbox/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { collectSandboxEnvironment, parseExposedPorts } from '@opengeni/config';
|
|
2
2
|
export { CAPABILITY_DESCRIPTORS, CapabilityDescriptor, DESKTOP_STREAM_PORT, StreamTokenPayload, StreamTokenPayload as StreamTokenPayloadType, TERMINAL_STREAM_PORT } from '@opengeni/contracts';
|
|
3
3
|
import '@openai/agents/sandbox';
|
|
4
|
-
export { A as ActiveBackendResolverDeps, b as ActiveBackendUnresolvableError, c as ActivePointer, B as BackendUnresolvableCode, C as ChannelAConflictError, d as ChannelAEmitter, e as ChannelAExecArgs, f as ChannelAExecResult, g as ChannelANotFoundError, h as ChannelASession, i as ChannelAUnavailableError, j as ChannelAUnsupportedError, k as ChannelAValidationError, l as ControlRpc, D as DEFAULT_DESKTOP_GEOMETRY, m as DISPLAY_STACK_TIMEOUT_MS, n as DesktopGeometry, o as
|
|
4
|
+
export { A as ActiveBackendResolverDeps, b as ActiveBackendUnresolvableError, c as ActivePointer, B as BackendUnresolvableCode, C as ChannelAConflictError, d as ChannelAEmitter, e as ChannelAExecArgs, f as ChannelAExecResult, g as ChannelANotFoundError, h as ChannelASession, i as ChannelAUnavailableError, j as ChannelAUnsupportedError, k as ChannelAValidationError, l as ControlRpc, D as DEFAULT_DESKTOP_GEOMETRY, m as DISPLAY_STACK_TIMEOUT_MS, n as DesktopGeometry, o as DisplayStackCallerKind, p as DisplayStackClassification, q as DisplayStackError, r as DisplayStackTelemetryContext, s as DisplayStackTelemetryEvent, t as DisplayStackTelemetryStatus, u as DisplayStackUnsupportedError, E as EnsureDisplayStackOptions, v as EnsureDisplayStackResult, w as EnsureTerminalServerOptions, x as EnsureTerminalServerResult, y as EstablishedSandboxSession, z as ExposeStreamPortInput, F as ExposeStreamPortResult, G as ExposedPortEndpoint, H as FAULT_FIELD_WHAT_HAPPENED, I as FAULT_FIELD_WHAT_PRESERVED, J as FAULT_FIELD_WHAT_TO_TRY, K as FAULT_FIELD_WHICH_LAYER, L as LiveModalSandboxLeaseAttribution, M as MaterializeRunCredentialsOptions, N as MintStreamTokenInput, O as MockAgentResponder, P as MockAgentResponderOptions, Q as MockExecHandler, S as ModalModuleLoader, T as ModalOrphanSweepResult, U as ModalOrphanSweepTermination, V as ModalSandboxAttribution, W as NEVER_SENT_DETAIL_KEY, X as NatsControlRpc, Y as NatsOpStreamConnection, Z as NatsOpStreamTransport, _ as NatsRequestConnection, $ as NegotiationContext, a0 as NormalizedRunCredentialMaterial, a1 as NumstatEntry, a2 as OP_STREAM_ACK_INTERVAL_MS, a3 as OP_STREAM_DEFAULT_WINDOW_BYTES, a4 as OP_STREAM_RECONNECT_HOLD_MS, a5 as OP_STREAM_SILENCE_TIMEOUT_MS, a6 as OpStreamExecOutcome, a7 as OpStreamJournal, a8 as OpStreamSubscription, a9 as OpStreamTransport, aa as OpStreamUnavailableError, ab as PROVIDER_REGISTRY, ac as ProviderConstructionContext, ad as ProviderRegistration, ae as REPOSITORY_DISCOVERY_LIMIT, af as RecordingArtifactMetadata, ag as RecordingCodec, ah as RecordingContentType, ai as RecordingError, aj as RecordingProcess, ak as RecordingUnavailableError, al as RepositoryDiscoveryDegradedReason, am as RepositoryDiscoveryResult, an as ResolvedActiveBackend, ao as RevalidateModalOrphanTermination, ap as RoutableBackendSession, aq as RoutableSandbox, ar as RoutingSandboxSession, as as RoutingSandboxSessionDeps, at as RoutingTransitionEvent, au as RoutingUnsupportedError, av as RunCredentialCommandRunner, aw as RunCredentialCommandSession, ax as RunCredentialExpectedScope, R as RunCredentialSessionReady, ay as RunCredentialValidationError, az as SELFHOSTED_DEFAULT_TIMEOUT_MS, aA as SELFHOSTED_DRAINING_MAX_RETRIES, aB as SELFHOSTED_EXEC_DRAINING_MAX_RETRIES, aC as SELFHOSTED_IDEMPOTENT_READONLY_OPS, aD as SELFHOSTED_INFRASTRUCTURE_FAULT_CLASSES, aE as SELFHOSTED_NEVER_SENT_MAX_RETRIES, aF as SELFHOSTED_RECONNECT_WINDOW_MS, aG as SELFHOSTED_RELAY_STREAM_PATH, aH as SELFHOSTED_RETRY_BACKOFF_BASE_MS, aI as SELFHOSTED_RETRY_BACKOFF_CAP_MS, aJ as SELFHOSTED_RETRY_BACKOFF_FACTOR, aK as SELFHOSTED_TIMEOUT_MAX_RETRIES, aL as STREAM_PORT, aM as STREAM_TOKEN_DEFAULT_TTL_SECONDS, aN as SandboxChannelAService, aO as SandboxChannelAServiceOptions, aP as SandboxConfigError, aQ as SandboxCreatedCallback, aR as SandboxProviderUnavailableError, aS as SandboxResumeStateUnavailableError, aT as SelfhostedApplyDiff, aU as SelfhostedControlError, aV as SelfhostedEditor, aW as SelfhostedEnrollment, aX as SelfhostedExecArgs, aY as SelfhostedExecResult, aZ as SelfhostedImageOutput, a_ as SelfhostedLivenessState, a$ as SelfhostedNegotiationInput, b0 as SelfhostedOpObservation, b1 as SelfhostedOpObserver, b2 as SelfhostedOpStreamDeps, b3 as SelfhostedRelayConfig, b4 as SelfhostedRetryClock, b5 as SelfhostedRetryDecision, b6 as SelfhostedSandboxClient, b7 as SelfhostedSession, b8 as SelfhostedSessionBuild, b9 as SelfhostedSessionDeps, ba as SelfhostedSessionState, bb as SelfhostedUnavailableReason, bc as StartRecordingInput, bd as StreamPortUnavailableError, be as SwapTargetEstablishability, bf as TERMINAL_SERVER_TIMEOUT_MS, bg as TerminalServerError, bh as TerminalServerUnsupportedError, bi as ToolspaceTokenPathError, bj as agentErrorToControlError, bk as assertDescriptorRegistryInvariants, bl as assertProviderRegistryInvariants, bm as assertSafeRelPath, bn as backendSupportsOs, bo as buildDisplayStackScript, bp as buildSelfhostedBackendSession, bq as buildStreamUrl, br as buildTerminalServerScript, bs as clearRunCredentials, bt as clearRunCredentialsForAttempt, bu as contentTypeForCodec, bv as createSandboxClient, bw as createSandboxClientForBackend, bx as decideSelfhostedRetry, by as decodeModalSnapshotId, bz as defaultSelfhostedRetryClock, bA as deletePriorPersistedSnapshot, bB as deleteRecordingArtifacts, bC as deserializeSandboxSessionStateEnvelope, bD as desktopCapableBackend, bE as drainingExhaustedError, bF as drainingMessage, bG as ensureDisplayStack, bH as ensureModalRegistryImage, bI as ensureTerminalServer, bJ as establishSandboxSessionFromEnvelope, bK as execDeadlineHint, bL as exposeStreamPort, bM as extForCodec, bN as inspectRecordingArtifact, bO as isExecSessionLostBanner, bP as isProviderSandboxNotFoundError, bQ as isSelfhostedProviderNotFoundError, bR as makeActiveBackendResolver, bS as materializeRunCredentials, bT as mintStreamToken, bU as modalSandboxAttributionEnvironment, bV as modalSandboxAttributionTags, bW as negotiateCapabilities, bX as negotiateSelfhostedCapabilities, bY as nextDurableOpId, bZ as normalizeRunCredentialsResolution, b_ as offlineAgentError, b$ as offlineControlResponse, c0 as opAckSubject, c1 as opFrameSubject, c2 as parseExecBannerExitCode, c3 as parseExecBannerSessionId, c4 as parseNumstatZ, c5 as parsePorcelainV2, c6 as parseUnifiedPatch, c7 as payloadTooLargeMessage, c8 as readWorkspaceArchiveFromEnvelopeSessionState, c9 as recordingStorageKey, ca as renderSelfhostedFault, cb as restoredSandboxSessionStateFromEntry, cc as runCredentialPointerFile, cd as runCredentialRoot, ce as runWithToolCallCorrelation, cf as sandboxStateEntryFromRunState, cg as sanitizeOpIdToken, ch as selectBackend, ci as selfhostedFaultClass, cj as selfhostedLiveness, ck as selfhostedRetryBackoffMs, cl as serializeEstablishedSandboxEnvelope, cm as setSelfhostedApplyDiff, cn as startRecording, co as stopRecording, cp as stripExecBanner, cq as subjectFor, cr as swapTargetEstablishability, cs as sweepModalOrphanSandboxes, ct as tagModalSandbox, cu as tearDownDisplayStack, cv as tearDownTerminalServer, cw as terminateModalSandboxById, cx as timeoutAgentError, cy as timeoutControlResponse, cz as toolspaceTokenFileForSession, cA as toolspaceTokenFileFromEnvironment, cB as uploadRecordingArtifact, cC as verifyStreamToken, cD as withRunCredentialEnvironment, cE as withRunCredentialsClient, cF as withRunCredentialsSession, cG as withToolspaceTokenClient, cH as withToolspaceTokenEnvironment, cI as withToolspaceTokenSession } from '../index-DGUrY_yR.js';
|
|
5
5
|
import 'modal';
|
|
6
6
|
import '@opengeni/agent-proto';
|
package/dist/sandbox/index.js
CHANGED
|
@@ -151,7 +151,7 @@ import {
|
|
|
151
151
|
withToolspaceTokenClient,
|
|
152
152
|
withToolspaceTokenEnvironment,
|
|
153
153
|
withToolspaceTokenSession
|
|
154
|
-
} from "../chunk-
|
|
154
|
+
} from "../chunk-65UDUFUO.js";
|
|
155
155
|
import "../chunk-4YJ5Z52Z.js";
|
|
156
156
|
import "../chunk-K4V4QYCL.js";
|
|
157
157
|
import "../chunk-PZ5AY32C.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"./skill-library": {
|
|
29
29
|
"types": "./dist/skill-library.d.ts",
|
|
30
30
|
"import": "./dist/skill-library.js"
|
|
31
|
+
},
|
|
32
|
+
"./mcp-network": {
|
|
33
|
+
"types": "./dist/mcp-network.d.ts",
|
|
34
|
+
"import": "./dist/mcp-network.js"
|
|
31
35
|
}
|
|
32
36
|
},
|
|
33
37
|
"publishConfig": {
|
|
@@ -45,9 +49,10 @@
|
|
|
45
49
|
"@openai/agents": "0.13.3",
|
|
46
50
|
"@openai/agents-extensions": "0.13.3",
|
|
47
51
|
"@opengeni/agent-proto": "^0.3.0",
|
|
48
|
-
"@opengeni/codex": "^0.2.
|
|
49
|
-
"@opengeni/config": "^0.6.
|
|
50
|
-
"@opengeni/contracts": "^0.
|
|
52
|
+
"@opengeni/codex": "^0.2.7",
|
|
53
|
+
"@opengeni/config": "^0.6.9",
|
|
54
|
+
"@opengeni/contracts": "^0.18.0",
|
|
55
|
+
"@opengeni/network": "^0.1.1",
|
|
51
56
|
"debug": "4.4.3",
|
|
52
57
|
"modal": "0.7.6",
|
|
53
58
|
"openai": "6.47.0",
|
package/src/codex-tool-search.ts
CHANGED
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
// all unchanged). Invocation is untouched; only the wire tool-set shrinks.
|
|
27
27
|
|
|
28
28
|
import { toolSearchTool, type Tool } from "@openai/agents";
|
|
29
|
+
import {
|
|
30
|
+
MCP_MAX_TOOL_DEFINITION_BYTES,
|
|
31
|
+
MCP_MAX_TOOL_SEARCH_DISCLOSURE_BYTES,
|
|
32
|
+
mcpSerializedSizeBytes,
|
|
33
|
+
} from "./mcp-network";
|
|
29
34
|
|
|
30
35
|
/** The prefix OpenGeni's PrefixedMcpServer stamps on codex_apps connector tools. */
|
|
31
36
|
export const CODEX_APPS_TOOL_PREFIX = "codex_apps__";
|
|
@@ -239,7 +244,21 @@ function codexToolSearchExecutor(args: {
|
|
|
239
244
|
const deferred = (args.availableTools ?? []).filter(isCodexAppsFunctionTool);
|
|
240
245
|
if (deferred.length === 0) return [];
|
|
241
246
|
const { query, limit } = parseSearchArgs(args.toolCall?.arguments);
|
|
242
|
-
|
|
247
|
+
const ranked = bm25RankTools(deferred, query, limit);
|
|
248
|
+
const bounded: Tool[] = [];
|
|
249
|
+
let disclosedBytes = 0;
|
|
250
|
+
for (const tool of ranked) {
|
|
251
|
+
const toolBytes = mcpSerializedSizeBytes(tool);
|
|
252
|
+
if (toolBytes > MCP_MAX_TOOL_DEFINITION_BYTES) {
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if (disclosedBytes + toolBytes > MCP_MAX_TOOL_SEARCH_DISCLOSURE_BYTES) {
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
disclosedBytes += toolBytes;
|
|
259
|
+
bounded.push(tool);
|
|
260
|
+
}
|
|
261
|
+
return bounded;
|
|
243
262
|
}
|
|
244
263
|
|
|
245
264
|
const NO_NAMESPACES: ReadonlySet<string> = new Set();
|