@opengeni/sdk 3.1.0 → 3.1.2
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/README.md +1037 -71
- package/dist/accounts.d.ts +5 -1
- package/dist/accounts.js +13 -1
- package/dist/accounts.js.map +1 -1
- package/dist/adapters/express.d.ts +31 -0
- package/dist/adapters/express.js +87 -0
- package/dist/adapters/express.js.map +1 -0
- package/dist/adapters/hono.d.ts +16 -0
- package/dist/adapters/hono.js +8 -0
- package/dist/adapters/hono.js.map +1 -0
- package/dist/adapters/next.d.ts +29 -0
- package/dist/adapters/next.js +22 -0
- package/dist/adapters/next.js.map +1 -0
- package/dist/allowance-refusal.d.ts +2 -0
- package/dist/allowance-refusal.js +50 -0
- package/dist/allowance-refusal.js.map +1 -0
- package/dist/app-links.d.ts +42 -0
- package/dist/app-links.js +66 -0
- package/dist/app-links.js.map +1 -0
- package/dist/artifact-catalog.d.ts +40 -0
- package/dist/artifact-client.d.ts +20 -8
- package/dist/artifacts.d.ts +1 -1
- package/dist/artifacts.js +8 -6
- package/dist/automations.js +8 -2
- package/dist/automations.js.map +1 -1
- package/dist/azure-live-transport.d.ts +32 -0
- package/dist/browser.d.ts +7 -2
- package/dist/browser.js +27 -5
- package/dist/chat/fold.d.ts +75 -0
- package/dist/chat/handler.d.ts +41 -0
- package/dist/chat/http.d.ts +67 -0
- package/dist/chat/ids.d.ts +34 -0
- package/dist/chat/index.d.ts +9 -0
- package/dist/chat/index.js +1703 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/openai.d.ts +30 -0
- package/dist/chat/opengeni.d.ts +129 -0
- package/dist/chat/types.d.ts +207 -0
- package/dist/chat/vercel.d.ts +49 -0
- package/dist/chats.d.ts +8 -0
- package/dist/chunk-4AHR4KGA.js +301 -0
- package/dist/chunk-4AHR4KGA.js.map +1 -0
- package/dist/chunk-6HZGAIUE.js +1665 -0
- package/dist/chunk-6HZGAIUE.js.map +1 -0
- package/dist/chunk-7EWT3PV6.js +368 -0
- package/dist/chunk-7EWT3PV6.js.map +1 -0
- package/dist/{chunk-VYCTL62C.js → chunk-GZQSWAKD.js} +1 -1
- package/dist/chunk-GZQSWAKD.js.map +1 -0
- package/dist/chunk-JXXCTW5W.js +1392 -0
- package/dist/chunk-JXXCTW5W.js.map +1 -0
- package/dist/{chunk-YTAWBDO2.js → chunk-KADZ5PGG.js} +28 -2
- package/dist/chunk-KADZ5PGG.js.map +1 -0
- package/dist/{chunk-YKZME56C.js → chunk-KWADQ227.js} +3 -3
- package/dist/{chunk-YKZME56C.js.map → chunk-KWADQ227.js.map} +1 -1
- package/dist/{chunk-7ZXBPJZP.js → chunk-NEM5N6C6.js} +3902 -1457
- package/dist/chunk-NEM5N6C6.js.map +1 -0
- package/dist/{chunk-GW3EJ2GP.js → chunk-O7KANXC3.js} +86 -13
- package/dist/chunk-O7KANXC3.js.map +1 -0
- package/dist/{chunk-VUQZAB3O.js → chunk-OAKHWFSV.js} +28 -32
- package/dist/chunk-OAKHWFSV.js.map +1 -0
- package/dist/chunk-P7UWKORG.js +561 -0
- package/dist/chunk-P7UWKORG.js.map +1 -0
- package/dist/chunk-QGEIL4TR.js +195 -0
- package/dist/chunk-QGEIL4TR.js.map +1 -0
- package/dist/chunk-RJHCBZF7.js +270 -0
- package/dist/chunk-RJHCBZF7.js.map +1 -0
- package/dist/chunk-S3D75WSQ.js +340 -0
- package/dist/chunk-S3D75WSQ.js.map +1 -0
- package/dist/chunk-UM4ZXXJR.js +9 -0
- package/dist/chunk-UM4ZXXJR.js.map +1 -0
- package/dist/chunk-VPVMLM7Q.js +15 -0
- package/dist/chunk-VPVMLM7Q.js.map +1 -0
- package/dist/{chunk-C2H7HBNP.js → chunk-WVCJRSGJ.js} +119 -14
- package/dist/chunk-WVCJRSGJ.js.map +1 -0
- package/dist/chunk-XA7HVIHI.js +126 -0
- package/dist/chunk-XA7HVIHI.js.map +1 -0
- package/dist/{chunk-TX3EIENU.js → chunk-YDVPI7WT.js} +73 -2
- package/dist/chunk-YDVPI7WT.js.map +1 -0
- package/dist/chunk-YKIHNLWD.js +153 -0
- package/dist/chunk-YKIHNLWD.js.map +1 -0
- package/dist/chunk-ZDUBPV33.js +277 -0
- package/dist/chunk-ZDUBPV33.js.map +1 -0
- package/dist/client.d.ts +1065 -124
- package/dist/codex-realtime-controller.d.ts +13 -0
- package/dist/codex-realtime-controller.js +4 -2
- package/dist/codex-realtime-v3-wire.d.ts +3 -2
- package/dist/codex-realtime.d.ts +5 -1
- package/dist/company-brain.d.ts +1 -11
- package/dist/company-profile.d.ts +13 -0
- package/dist/core.d.ts +7 -2
- package/dist/core.js +25 -6
- package/dist/deprecation.d.ts +47 -0
- package/dist/document-authority-client.d.ts +24 -2
- package/dist/document-authority.js +7 -5
- package/dist/editable-artifacts/index.d.ts +1 -1
- package/dist/editable-artifacts/types.d.ts +12 -2
- package/dist/editable-artifacts.js +19 -3
- package/dist/editable-artifacts.js.map +1 -1
- package/dist/embedding-client.d.ts +129 -0
- package/dist/errors.d.ts +76 -1
- package/dist/feedback.d.ts +23 -0
- package/dist/gateway-realtime-transport.js +1 -1
- package/dist/github-repositories.d.ts +10 -0
- package/dist/github-repositories.js +36 -0
- package/dist/github-repositories.js.map +1 -0
- package/dist/index.d.ts +64 -11
- package/dist/index.js +566 -141
- package/dist/index.js.map +1 -1
- package/dist/insights-usage.d.ts +33 -0
- package/dist/insights-usage.js +7 -0
- package/dist/insights-usage.js.map +1 -0
- package/dist/interaction.d.ts +103 -71
- package/dist/interaction.js +4 -2
- package/dist/knowledge.d.ts +7 -0
- package/dist/knowledge.js +20 -0
- package/dist/knowledge.js.map +1 -0
- package/dist/known-tools.d.ts +4 -0
- package/dist/message-links.d.ts +68 -0
- package/dist/model-context.d.ts +68 -0
- package/dist/model-display.d.ts +2 -0
- package/dist/model-display.js +17 -0
- package/dist/model-display.js.map +1 -0
- package/dist/model-picker-order.d.ts +1 -0
- package/dist/model-picker-order.js +10 -0
- package/dist/model-picker-order.js.map +1 -0
- package/dist/organization-integration-policy.d.ts +26 -0
- package/dist/organization-integration-policy.js +26 -0
- package/dist/organization-integration-policy.js.map +1 -0
- package/dist/pr-review-client.d.ts +1 -1
- package/dist/pr-review.d.ts +1 -1
- package/dist/pr-review.js.map +1 -1
- package/dist/preference-registry.d.ts +1 -1
- package/dist/prepared-mcp-setup.d.ts +5 -0
- package/dist/proxy.d.ts +13 -11
- package/dist/realtime.d.ts +4 -2
- package/dist/realtime.js +253 -7
- package/dist/realtime.js.map +1 -1
- package/dist/session-history-import.d.ts +22 -0
- package/dist/session-history-import.js +36 -0
- package/dist/session-history-import.js.map +1 -0
- package/dist/session-list-entries.d.ts +1 -0
- package/dist/session-list-entries.js +7 -0
- package/dist/session-list-entries.js.map +1 -0
- package/dist/session-message-search.d.ts +53 -0
- package/dist/session-proxy-client.d.ts +28 -0
- package/dist/session-proxy.d.ts +334 -0
- package/dist/session-proxy.js +24 -0
- package/dist/session-proxy.js.map +1 -0
- package/dist/session-titles.d.ts +2 -0
- package/dist/session-usage-limits.d.ts +10 -0
- package/dist/session-usage-limits.js +43 -0
- package/dist/session-usage-limits.js.map +1 -0
- package/dist/shared-catalog-loader.d.ts +34 -0
- package/dist/site-bridge-host.d.ts +112 -0
- package/dist/site-bridge-host.js +285 -0
- package/dist/site-bridge-host.js.map +1 -0
- package/dist/site-browser-entry.d.ts +1 -0
- package/dist/site-browser-runtime.gen.d.ts +1 -0
- package/dist/site-data.d.ts +178 -0
- package/dist/site-document.d.ts +5 -0
- package/dist/site-document.js +20 -0
- package/dist/site-document.js.map +1 -0
- package/dist/site-document.test.d.ts +1 -0
- package/dist/site-http.d.ts +17 -0
- package/dist/site-sql.d.ts +31 -0
- package/dist/site-tool-bridge.d.ts +57 -0
- package/dist/site.d.ts +182 -0
- package/dist/site.js +62 -0
- package/dist/site.js.map +1 -0
- package/dist/skills.d.ts +75 -0
- package/dist/sse.d.ts +1 -1
- package/dist/stream.d.ts +2 -0
- package/dist/tenant-workspaces.d.ts +47 -0
- package/dist/tenant-workspaces.js +8 -0
- package/dist/tenant-workspaces.js.map +1 -0
- package/dist/tool-auth.d.ts +87 -0
- package/dist/tool-auth.js +23 -0
- package/dist/tool-auth.js.map +1 -0
- package/dist/tool-display-metadata.d.ts +3 -0
- package/dist/tools-37DCTCNZ.js +12 -0
- package/dist/tools-37DCTCNZ.js.map +1 -0
- package/dist/tools.d.ts +81 -0
- package/dist/transcription.d.ts +1 -1
- package/dist/types.d.ts +2848 -573
- package/dist/usage-allowances.d.ts +36 -0
- package/dist/usage-allowances.js +80 -0
- package/dist/usage-allowances.js.map +1 -0
- package/dist/vault-types.d.ts +236 -0
- package/dist/vaults-api.d.ts +57 -0
- package/dist/workspace-artifacts.d.ts +47 -5
- package/dist/workspace-instruction-policies.d.ts +2 -2
- package/dist/workspace-integrations.d.ts +74 -0
- package/dist/workspace-integrations.js +65 -0
- package/dist/workspace-integrations.js.map +1 -0
- package/dist/workspace-state.d.ts +8 -71
- package/package.json +99 -5
- package/src/accounts.ts +18 -0
- package/src/adapters/express.ts +136 -0
- package/src/adapters/hono.ts +18 -0
- package/src/adapters/next.ts +42 -0
- package/src/allowance-refusal.ts +5 -0
- package/src/app-links.ts +117 -0
- package/src/artifact-catalog.ts +51 -0
- package/src/artifact-client.ts +40 -49
- package/src/artifacts.ts +1 -0
- package/src/automations-client.ts +8 -2
- package/src/azure-live-transport.ts +286 -0
- package/src/browser.ts +37 -0
- package/src/chat/fold.ts +431 -0
- package/src/chat/handler.ts +240 -0
- package/src/chat/http.ts +257 -0
- package/src/chat/ids.ts +85 -0
- package/src/chat/index.ts +88 -0
- package/src/chat/openai.ts +439 -0
- package/src/chat/opengeni.ts +737 -0
- package/src/chat/types.ts +219 -0
- package/src/chat/vercel.ts +204 -0
- package/src/chats.ts +16 -0
- package/src/client.ts +5822 -1847
- package/src/codex-realtime-controller.ts +163 -8
- package/src/codex-realtime-v3-wire.ts +4 -3
- package/src/codex-realtime-v3.ts +12 -3
- package/src/codex-realtime.ts +11 -3
- package/src/company-brain.ts +0 -40
- package/src/company-profile.ts +13 -0
- package/src/core.ts +20 -0
- package/src/deprecation.ts +149 -0
- package/src/document-authority-client.ts +104 -1
- package/src/editable-artifacts/controller.ts +36 -2
- package/src/editable-artifacts/index.ts +1 -0
- package/src/editable-artifacts/types.ts +29 -16
- package/src/embedding-client.ts +519 -0
- package/src/errors.ts +303 -4
- package/src/feedback.ts +20 -0
- package/src/gateway-realtime-transport.ts +3 -3
- package/src/github-repositories.ts +60 -0
- package/src/index.ts +611 -64
- package/src/insights-usage.ts +61 -0
- package/src/interaction.ts +274 -93
- package/src/knowledge.ts +72 -0
- package/src/known-tools.ts +279 -0
- package/src/message-links.ts +178 -0
- package/src/model-context.ts +113 -0
- package/src/model-display.ts +11 -0
- package/src/model-picker-order.ts +6 -0
- package/src/organization-integration-policy.ts +54 -0
- package/src/pr-review-client.ts +1 -1
- package/src/pr-review.ts +1 -1
- package/src/preference-registry.ts +2 -0
- package/src/prepared-mcp-setup.ts +123 -0
- package/src/proxy.ts +23 -12
- package/src/realtime.ts +16 -6
- package/src/session-history-import.ts +84 -0
- package/src/session-list-entries.ts +1 -0
- package/src/session-message-search.ts +47 -0
- package/src/session-proxy-client.ts +68 -0
- package/src/session-proxy.ts +2098 -0
- package/src/session-titles.ts +10 -0
- package/src/session-usage-limits.ts +71 -0
- package/src/shared-catalog-loader.ts +169 -0
- package/src/site-bridge-host.ts +422 -0
- package/src/site-browser-entry.ts +6 -0
- package/src/site-browser-runtime.gen.ts +2 -0
- package/src/site-data.ts +372 -0
- package/src/site-document.test.ts +64 -0
- package/src/site-document.ts +18 -0
- package/src/site-http.ts +171 -0
- package/src/site-sql.ts +153 -0
- package/src/site-tool-bridge.ts +401 -0
- package/src/site.ts +867 -0
- package/src/skills.ts +69 -0
- package/src/sse.ts +9 -3
- package/src/stream.ts +33 -10
- package/src/tenant-workspaces.ts +148 -0
- package/src/tool-auth.ts +301 -0
- package/src/tool-display-metadata.ts +27 -0
- package/src/tools.ts +452 -0
- package/src/transcription.ts +3 -0
- package/src/types.ts +3216 -581
- package/src/usage-allowances.ts +189 -0
- package/src/vault-types.ts +293 -0
- package/src/vaults-api.ts +288 -0
- package/src/workspace-artifacts.ts +55 -6
- package/src/workspace-instruction-policies.ts +2 -1
- package/src/workspace-integrations.ts +402 -0
- package/src/workspace-state.ts +8 -82
- package/dist/chunk-7ZXBPJZP.js.map +0 -1
- package/dist/chunk-C2H7HBNP.js.map +0 -1
- package/dist/chunk-C4DJPZRU.js +0 -119
- package/dist/chunk-C4DJPZRU.js.map +0 -1
- package/dist/chunk-GW3EJ2GP.js.map +0 -1
- package/dist/chunk-TX3EIENU.js.map +0 -1
- package/dist/chunk-VUQZAB3O.js.map +0 -1
- package/dist/chunk-VYCTL62C.js.map +0 -1
- package/dist/chunk-YTAWBDO2.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,41 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
EMPTY_FINAL_REPLY_NOTICE,
|
|
3
|
+
OpenGeniEmbeddingClient,
|
|
4
|
+
turnCompletedWithEmptyFinalReply
|
|
5
|
+
} from "./chunk-S3D75WSQ.js";
|
|
6
|
+
import "./chunk-OAKHWFSV.js";
|
|
7
|
+
import "./chunk-YDVPI7WT.js";
|
|
4
8
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
humanizeModelSlug,
|
|
10
|
+
isRawModelLabel,
|
|
11
|
+
modelDisplayName,
|
|
12
|
+
modelSlug,
|
|
13
|
+
modelVendor
|
|
14
|
+
} from "./chunk-YKIHNLWD.js";
|
|
15
|
+
import {
|
|
16
|
+
DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY,
|
|
17
|
+
authorizeTranscriptionAdapter,
|
|
18
|
+
createTranscriptionSessionRequest,
|
|
19
|
+
resolveWorkspaceTranscriptionPolicy,
|
|
20
|
+
resolveWorkspaceVoiceInputEnabled
|
|
21
|
+
} from "./chunk-GZQSWAKD.js";
|
|
22
|
+
import {
|
|
23
|
+
OPENGENI_TEST_REQUEST_NIL_ID,
|
|
24
|
+
OPENGENI_WEBHOOK_HEADERS,
|
|
25
|
+
OPENGENI_WEBHOOK_TEST_EVENT_TYPE,
|
|
26
|
+
OpenGeniSignatureError,
|
|
27
|
+
WORKSPACE_WEBHOOK_EVENT_TYPES,
|
|
28
|
+
signOpenGeniPayload,
|
|
29
|
+
verifyCredentialProviderRequest,
|
|
30
|
+
verifyOpenGeniSignature,
|
|
31
|
+
verifyWebhookEvent
|
|
32
|
+
} from "./chunk-RJHCBZF7.js";
|
|
8
33
|
import {
|
|
9
34
|
CODEX_REALTIME_CONTEXT_APPEND_MAX_BYTES,
|
|
10
35
|
CodexRealtimeMicrophoneError,
|
|
11
36
|
acquireCodexRealtimeMicrophone,
|
|
12
37
|
codexRealtimeMicrophoneHealthy,
|
|
38
|
+
codexRealtimeRefusal,
|
|
13
39
|
contextAppendChunks,
|
|
14
40
|
createCodexRealtimeController,
|
|
15
41
|
createCodexRealtimeV3Bridge,
|
|
@@ -18,17 +44,66 @@ import {
|
|
|
18
44
|
parseCodexRealtimeV3Event,
|
|
19
45
|
projectSessionRealtimeLifecycle,
|
|
20
46
|
startCodexRealtimeWebrtc
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-TX3EIENU.js";
|
|
47
|
+
} from "./chunk-WVCJRSGJ.js";
|
|
23
48
|
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} from "./chunk-
|
|
49
|
+
AUTOMATIC_SESSION_TITLE_FALLBACK,
|
|
50
|
+
deriveAutomaticSessionTitlePreview,
|
|
51
|
+
deriveSessionDisplayTitle,
|
|
52
|
+
sessionListEntry,
|
|
53
|
+
sessionTitleIsPending
|
|
54
|
+
} from "./chunk-ZDUBPV33.js";
|
|
55
|
+
import {
|
|
56
|
+
SESSION_SCOPE_HEADER,
|
|
57
|
+
artifactViewerCapability,
|
|
58
|
+
createSessionProxyHandler,
|
|
59
|
+
formatSseEvent,
|
|
60
|
+
isReservedOpenGeniLink,
|
|
61
|
+
openGeniConsolePath,
|
|
62
|
+
openGeniLinkScheme,
|
|
63
|
+
parseOpenGeniLink,
|
|
64
|
+
parseRetainedFileReference,
|
|
65
|
+
parseSandboxLink,
|
|
66
|
+
proxySessionEventStream,
|
|
67
|
+
resumeSequenceFromRequest,
|
|
68
|
+
sessionEventsToSseResponse,
|
|
69
|
+
sessionEventsToSseStream
|
|
70
|
+
} from "./chunk-6HZGAIUE.js";
|
|
71
|
+
import "./chunk-UM4ZXXJR.js";
|
|
72
|
+
import {
|
|
73
|
+
ToolRequestError,
|
|
74
|
+
verifyToolRequest
|
|
75
|
+
} from "./chunk-QGEIL4TR.js";
|
|
76
|
+
import {
|
|
77
|
+
createGatewayRealtimeTransportStarter,
|
|
78
|
+
createXaiSubscriptionRealtimeTransportStarter
|
|
79
|
+
} from "./chunk-KWADQ227.js";
|
|
80
|
+
import {
|
|
81
|
+
OPENGENI_SITE_BRIDGE_CANCEL,
|
|
82
|
+
OPENGENI_SITE_BRIDGE_CONNECT,
|
|
83
|
+
OPENGENI_SITE_BRIDGE_READY,
|
|
84
|
+
OPENGENI_SITE_BRIDGE_REQUEST,
|
|
85
|
+
OPENGENI_SITE_BRIDGE_RESPONSE,
|
|
86
|
+
OPENGENI_SITE_BRIDGE_SIGN_IN_METHOD,
|
|
87
|
+
OPENGENI_SITE_BRIDGE_VERSION,
|
|
88
|
+
OPENGENI_SITE_BRIDGE_VIEWER_METHOD,
|
|
89
|
+
OpenGeniSiteBridgeError,
|
|
90
|
+
createOpenGeniSiteClient,
|
|
91
|
+
createSiteToolBridge,
|
|
92
|
+
isOpenGeniSiteBridgeCancelMessage,
|
|
93
|
+
isOpenGeniSiteBridgeConnectMessage,
|
|
94
|
+
isOpenGeniSiteBridgeRequestMessage,
|
|
95
|
+
isSiteCatalogStaleError,
|
|
96
|
+
sanitizeOpenGeniSiteToolCallRequest
|
|
97
|
+
} from "./chunk-JXXCTW5W.js";
|
|
30
98
|
import {
|
|
99
|
+
OpenGeniToolCallError,
|
|
100
|
+
OpenGeniToolReapprovalRequiredError,
|
|
101
|
+
OpenGeniToolsClient
|
|
102
|
+
} from "./chunk-P7UWKORG.js";
|
|
103
|
+
import {
|
|
104
|
+
asVaultClient,
|
|
31
105
|
generatedImageSandboxPathMatches,
|
|
106
|
+
parseDeprecationNotice,
|
|
32
107
|
parseGeneratedImageReceipt,
|
|
33
108
|
parseGeneratedVideoReceipt,
|
|
34
109
|
parseMediaGenerationResult,
|
|
@@ -36,13 +111,20 @@ import {
|
|
|
36
111
|
parseRetainedGeneratedVideoReference,
|
|
37
112
|
parseRetainedWorkspaceFileReference,
|
|
38
113
|
parseSandboxFileArtifactReceipt,
|
|
39
|
-
parseSseStream,
|
|
40
114
|
parseWorkspaceLiveEvent,
|
|
41
|
-
streamSessionEvents,
|
|
42
115
|
streamWorkspaceControlEvents,
|
|
43
116
|
streamWorkspaceInteractionRevisions,
|
|
44
|
-
streamWorkspaceLiveEvents
|
|
45
|
-
|
|
117
|
+
streamWorkspaceLiveEvents,
|
|
118
|
+
vaultErrorCode,
|
|
119
|
+
vaultErrorDetail,
|
|
120
|
+
vaultsApi
|
|
121
|
+
} from "./chunk-NEM5N6C6.js";
|
|
122
|
+
import "./chunk-VPVMLM7Q.js";
|
|
123
|
+
import {
|
|
124
|
+
parseSseStream,
|
|
125
|
+
sessionEventStreamCoveredThrough,
|
|
126
|
+
streamSessionEvents
|
|
127
|
+
} from "./chunk-4AHR4KGA.js";
|
|
46
128
|
import {
|
|
47
129
|
DEFAULT_FILE_RESOURCE_MOUNT_ROOT,
|
|
48
130
|
GENERATED_VIDEO_MAX_BYTES,
|
|
@@ -57,7 +139,7 @@ import {
|
|
|
57
139
|
RETAINED_OUTPUT_MAX_PAGE_BYTES,
|
|
58
140
|
SANDBOX_FILE_ARTIFACT_MAX_BYTES,
|
|
59
141
|
SESSION_EVENT_TYPES
|
|
60
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-KADZ5PGG.js";
|
|
61
143
|
import {
|
|
62
144
|
AttachedBrowserDeviceCollection,
|
|
63
145
|
AttachedBrowserDeviceResource,
|
|
@@ -95,111 +177,398 @@ import {
|
|
|
95
177
|
computerFrameSocketUrl,
|
|
96
178
|
decodeBrowserFrameMessage,
|
|
97
179
|
decodeComputerFrameMessage,
|
|
180
|
+
decodeComputerFrameMetadataHeader,
|
|
98
181
|
interactionControlFailureFromError,
|
|
99
182
|
parseBrowserFrameMetadata,
|
|
100
183
|
parseComputerFrameMetadata
|
|
101
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-O7KANXC3.js";
|
|
102
185
|
import {
|
|
186
|
+
OpenGeniAllowanceExhaustedError,
|
|
103
187
|
OpenGeniApiContractMismatchError,
|
|
104
188
|
OpenGeniApiError,
|
|
189
|
+
OpenGeniSecureContextRequiredError,
|
|
105
190
|
OpenGeniSessionListCursorError,
|
|
191
|
+
OpenGeniSessionUsageLimitReachedError,
|
|
192
|
+
OpenGeniSessionUsageLimitUnsupportedError,
|
|
193
|
+
OpenGeniSetupError,
|
|
106
194
|
OpenGeniStreamError,
|
|
195
|
+
formatErrorMessage,
|
|
107
196
|
isRetryableStreamError
|
|
108
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-7EWT3PV6.js";
|
|
109
198
|
|
|
110
|
-
// src/
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
199
|
+
// src/prepared-mcp-setup.ts
|
|
200
|
+
var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
201
|
+
var keys = (value, allowed) => Object.keys(value).every((key) => allowed.includes(key));
|
|
202
|
+
var text = (value, max, min = 1) => typeof value === "string" && value.length >= min && value.length <= max;
|
|
203
|
+
var trimmedText = (value, max) => typeof value === "string" && text(value.trim(), max);
|
|
204
|
+
var headerPart = (value) => text(value, 16384, 0) && !/[\r\n\0]/.test(value);
|
|
205
|
+
var fieldId = (value) => typeof value === "string" && /^[A-Za-z][A-Za-z0-9_]{0,63}$/.test(value);
|
|
206
|
+
var endpoint = (value) => {
|
|
207
|
+
if (!text(value, 2048)) return false;
|
|
208
|
+
try {
|
|
209
|
+
const url = new URL(value);
|
|
210
|
+
return url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash;
|
|
211
|
+
} catch {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
function parseCustomMcpSetupRequest(value) {
|
|
216
|
+
if (!record(value) || !keys(value, ["kind", "name", "endpointUrl", "rationale", "ownership", "mcpSetup"]) || value.kind !== "mcp" || !trimmedText(value.name, 256) || !endpoint(value.endpointUrl) || !trimmedText(value.rationale, 2e3))
|
|
217
|
+
return null;
|
|
218
|
+
const base = {
|
|
219
|
+
kind: "mcp",
|
|
220
|
+
name: value.name.trim(),
|
|
221
|
+
endpointUrl: value.endpointUrl,
|
|
222
|
+
rationale: value.rationale.trim()
|
|
223
|
+
};
|
|
224
|
+
if (value.ownership === void 0 && value.mcpSetup === void 0) return base;
|
|
225
|
+
if (value.ownership !== "personal" && value.ownership !== "workspace") return null;
|
|
226
|
+
const setup = value.mcpSetup;
|
|
227
|
+
if (!record(setup) || !keys(setup, ["name", "endpointUrl", "headers", "secretFields"]) || !trimmedText(setup.name, 256) || setup.name.trim() !== base.name || setup.endpointUrl !== base.endpointUrl || !Array.isArray(setup.headers) || setup.headers.length < 1 || setup.headers.length > 32 || !Array.isArray(setup.secretFields) || setup.secretFields.length > 32)
|
|
228
|
+
return null;
|
|
229
|
+
const fields = [];
|
|
230
|
+
const fieldIds = /* @__PURE__ */ new Set();
|
|
231
|
+
for (const field of setup.secretFields) {
|
|
232
|
+
if (!record(field) || !keys(field, ["id", "label"]) || !fieldId(field.id) || !trimmedText(field.label, 256) || fieldIds.has(field.id))
|
|
233
|
+
return null;
|
|
234
|
+
fieldIds.add(field.id);
|
|
235
|
+
fields.push({ id: field.id, label: field.label.trim() });
|
|
236
|
+
}
|
|
237
|
+
const headers = [];
|
|
238
|
+
const names = /* @__PURE__ */ new Set();
|
|
239
|
+
const used = /* @__PURE__ */ new Set();
|
|
240
|
+
for (const header of setup.headers) {
|
|
241
|
+
if (!record(header) || !text(header.name, 256) || !/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(header.name))
|
|
242
|
+
return null;
|
|
243
|
+
const name = header.name.toLowerCase();
|
|
244
|
+
if (names.has(name)) return null;
|
|
245
|
+
names.add(name);
|
|
246
|
+
if ("value" in header) {
|
|
247
|
+
if (!keys(header, ["name", "value"]) || !headerPart(header.value) || !header.value || ["authorization", "proxy-authorization", "cookie", "x-api-key", "api-key"].includes(name))
|
|
248
|
+
return null;
|
|
249
|
+
headers.push({ name: header.name, value: header.value });
|
|
250
|
+
} else {
|
|
251
|
+
if (!keys(header, ["name", "secret", "prefix", "suffix"]) || !fieldId(header.secret) || !fieldIds.has(header.secret) || header.prefix !== void 0 && !headerPart(header.prefix) || header.suffix !== void 0 && !headerPart(header.suffix))
|
|
252
|
+
return null;
|
|
253
|
+
used.add(header.secret);
|
|
254
|
+
headers.push({
|
|
255
|
+
name: header.name,
|
|
256
|
+
secret: header.secret,
|
|
257
|
+
...header.prefix !== void 0 ? { prefix: header.prefix } : {},
|
|
258
|
+
...header.suffix !== void 0 ? { suffix: header.suffix } : {}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (used.size !== fieldIds.size) return null;
|
|
263
|
+
return {
|
|
264
|
+
...base,
|
|
265
|
+
ownership: value.ownership,
|
|
266
|
+
mcpSetup: { name: base.name, endpointUrl: base.endpointUrl, headers, secretFields: fields }
|
|
267
|
+
};
|
|
268
|
+
}
|
|
115
269
|
|
|
116
|
-
|
|
270
|
+
// ../contracts/src/tool-review-presentation.ts
|
|
271
|
+
var protectedName = /password|passwd|secret|credential|authorization|cookie|(^|[_-])token($|[_-])|api[_-]?key|accessToken|refreshToken|privateKey/i;
|
|
272
|
+
var protectedReviewField = (key, fields = []) => protectedName.test(key) || fields.includes(key) || fields.includes("*");
|
|
273
|
+
var bound = (value, limit) => value.length > limit ? `${value.slice(0, limit)}\u2026` : value;
|
|
274
|
+
function toolReviewFieldLabel(key) {
|
|
275
|
+
const label = key.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").replace(/\bids?\b/gi, (word) => word.length === 3 ? "IDs" : "ID").replace(
|
|
276
|
+
/\b(api|url|uri|http|https|ip|sql|json|html)(s?)\b/gi,
|
|
277
|
+
(_word, name, plural) => `${name.toUpperCase()}${plural}`
|
|
278
|
+
).replace(
|
|
279
|
+
/(?<=\S\s+)([A-Z])([a-z]+)\b/g,
|
|
280
|
+
(_word, first, rest) => `${first.toLowerCase()}${rest}`
|
|
281
|
+
).trim();
|
|
282
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
117
283
|
}
|
|
118
|
-
function
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
clearInterval(heartbeat);
|
|
126
|
-
heartbeat = void 0;
|
|
284
|
+
function decodeReviewArguments(value) {
|
|
285
|
+
let decoded = value;
|
|
286
|
+
if (typeof decoded === "string") {
|
|
287
|
+
try {
|
|
288
|
+
decoded = JSON.parse(decoded);
|
|
289
|
+
} catch {
|
|
290
|
+
return null;
|
|
127
291
|
}
|
|
292
|
+
}
|
|
293
|
+
return decoded && typeof decoded === "object" && !Array.isArray(decoded) ? decoded : null;
|
|
294
|
+
}
|
|
295
|
+
function safeReviewValue(value, key = "", protectedFields = [], depth = 0) {
|
|
296
|
+
if (protectedReviewField(key, protectedFields)) return "[Protected value]";
|
|
297
|
+
if (depth > 20) return "[Nested value; open this field for details]";
|
|
298
|
+
if (Array.isArray(value))
|
|
299
|
+
return value.map((entry) => safeReviewValue(entry, "", protectedFields, depth + 1));
|
|
300
|
+
if (value && typeof value === "object")
|
|
301
|
+
return Object.fromEntries(
|
|
302
|
+
Object.entries(value).map(([name, entry]) => [
|
|
303
|
+
name,
|
|
304
|
+
safeReviewValue(entry, name, protectedFields, depth + 1)
|
|
305
|
+
])
|
|
306
|
+
);
|
|
307
|
+
return value;
|
|
308
|
+
}
|
|
309
|
+
function valueText(value) {
|
|
310
|
+
return typeof value === "string" ? value : value === null ? "None" : typeof value === "boolean" ? value ? "Yes" : "No" : JSON.stringify(value) ?? "Unavailable";
|
|
311
|
+
}
|
|
312
|
+
var pointer = (name) => `/${name.replaceAll("~", "~0").replaceAll("/", "~1")}`;
|
|
313
|
+
var fieldPointer = (key, index, parent = "") => pointer(key).length > 256 || parent.length + pointer(key).length > 1024 ? `/~2${index}` : pointer(key);
|
|
314
|
+
function toolReviewFields(argumentsValue, context) {
|
|
315
|
+
const args = decodeReviewArguments(argumentsValue);
|
|
316
|
+
if (!args) return { fields: [], moreFields: 0 };
|
|
317
|
+
const entries = Object.entries(args);
|
|
318
|
+
if (context?.email) {
|
|
319
|
+
const email = toolReviewFields(context.email);
|
|
320
|
+
const original = toolReviewFields(args, { ...context, email: void 0 });
|
|
321
|
+
const fields = [
|
|
322
|
+
...email.fields.filter(
|
|
323
|
+
(field) => field.path !== "/contentSha256" && field.path !== "/htmlBody" && field.preview !== ""
|
|
324
|
+
).map((field) => ({
|
|
325
|
+
...field,
|
|
326
|
+
label: field.path === "/textBody" ? "Message" : field.label,
|
|
327
|
+
path: `/$email${field.path}`,
|
|
328
|
+
...field.path === "/attachments" ? {
|
|
329
|
+
preview: context.email.attachments.map((attachment) => attachment.name).join(", ").slice(0, 240)
|
|
330
|
+
} : {}
|
|
331
|
+
})),
|
|
332
|
+
...original.fields.filter(
|
|
333
|
+
(field) => ![
|
|
334
|
+
"/raw",
|
|
335
|
+
"/expectedContentSha256",
|
|
336
|
+
"/from",
|
|
337
|
+
"/to",
|
|
338
|
+
"/cc",
|
|
339
|
+
"/bcc",
|
|
340
|
+
"/subject",
|
|
341
|
+
"/body",
|
|
342
|
+
"/textBody",
|
|
343
|
+
"/htmlBody",
|
|
344
|
+
"/attachments"
|
|
345
|
+
].includes(field.path)
|
|
346
|
+
)
|
|
347
|
+
];
|
|
348
|
+
return {
|
|
349
|
+
fields: fields.slice(0, 16),
|
|
350
|
+
moreFields: original.moreFields + Math.max(0, fields.length - 16)
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
moreFields: Math.max(0, entries.length - 16),
|
|
355
|
+
fields: entries.slice(0, 16).map(([key, value], index) => {
|
|
356
|
+
const hidden = protectedReviewField(key, context?.protectedFields);
|
|
357
|
+
const safe = hidden ? "[Protected value]" : value;
|
|
358
|
+
const count = !hidden && Array.isArray(value) ? value.length : void 0;
|
|
359
|
+
const compactList = !hidden && Array.isArray(value) && value.length > 0 && value.length <= 4 && value.every(
|
|
360
|
+
(entry) => typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean"
|
|
361
|
+
) ? value.map(valueText).join(", ") : void 0;
|
|
362
|
+
const text2 = compactList !== void 0 ? compactList : count !== void 0 ? `${count.toLocaleString("en-US")} item${count === 1 ? "" : "s"}` : safe && typeof safe === "object" ? `${Object.keys(safe).length} field${Object.keys(safe).length === 1 ? "" : "s"}` : valueText(safe);
|
|
363
|
+
return {
|
|
364
|
+
path: fieldPointer(key, index),
|
|
365
|
+
label: bound(
|
|
366
|
+
(context?.fieldLabels && Object.hasOwn(context.fieldLabels, key) ? context.fieldLabels[key] : void 0) ?? toolReviewFieldLabel(key),
|
|
367
|
+
256
|
|
368
|
+
),
|
|
369
|
+
preview: bound(text2, 240),
|
|
370
|
+
...count !== void 0 ? { count } : {},
|
|
371
|
+
truncated: !hidden && (text2.length > 240 || compactList === void 0 && typeof value === "object" && value !== null),
|
|
372
|
+
...hidden ? { protected: true } : {}
|
|
373
|
+
};
|
|
374
|
+
})
|
|
128
375
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
376
|
+
}
|
|
377
|
+
function toolReviewAction(toolName, argumentsValue, context) {
|
|
378
|
+
const fallback = {
|
|
379
|
+
title: context?.title ?? bound(
|
|
380
|
+
toolReviewFieldLabel(
|
|
381
|
+
toolName.replace(/^mcp_[^_]+__/, "").replace(/^batch[_-](?=[a-z])/i, "")
|
|
382
|
+
),
|
|
383
|
+
256
|
|
384
|
+
),
|
|
385
|
+
approveLabel: "Approve action",
|
|
386
|
+
effects: []
|
|
387
|
+
};
|
|
388
|
+
if (context?.kind !== "gmail") return fallback;
|
|
389
|
+
const args = decodeReviewArguments(argumentsValue);
|
|
390
|
+
if (!args) return fallback;
|
|
391
|
+
const thread = toolName.endsWith("_thread");
|
|
392
|
+
const selectionKind = thread ? "threads" : "messages";
|
|
393
|
+
const ids = thread && typeof args.threadId === "string" ? [args.threadId] : Array.isArray(args.messageIds) ? args.messageIds : typeof args.messageId === "string" ? [args.messageId] : null;
|
|
394
|
+
const selectionCount = ids?.every((id) => typeof id === "string") ? new Set(ids).size : void 0;
|
|
395
|
+
const noun = selectionCount === void 0 ? thread ? "conversations" : "messages" : `${selectionCount.toLocaleString("en-US")} ${thread ? "conversation" : "message"}${selectionCount === 1 ? "" : "s"}`;
|
|
396
|
+
const addValues = toolName.startsWith("label_") ? args.labelIds : args.addLabelIds;
|
|
397
|
+
const adds = Array.isArray(addValues) ? addValues.filter((v) => typeof v === "string") : [];
|
|
398
|
+
const removeValues = toolName.startsWith("unlabel_") ? args.labelIds : args.removeLabelIds;
|
|
399
|
+
const removes = Array.isArray(removeValues) ? removeValues.filter((v) => typeof v === "string") : [];
|
|
400
|
+
const labelEffect = (label, adding) => {
|
|
401
|
+
const known = {
|
|
402
|
+
TRASH: ["Move to Trash", "Remove from Trash"],
|
|
403
|
+
INBOX: ["Move to Inbox", "Remove from Inbox"],
|
|
404
|
+
UNREAD: ["Mark as unread", "Mark as read"],
|
|
405
|
+
STARRED: ["Add star", "Remove star"],
|
|
406
|
+
SPAM: ["Mark as spam", "Remove from Spam"],
|
|
407
|
+
IMPORTANT: ["Mark as important", "Remove importance"]
|
|
408
|
+
};
|
|
409
|
+
return (Object.hasOwn(known, label) ? known[label]?.[adding ? 0 : 1] : void 0) ?? `${adding ? "Add" : "Remove"} label ${bound(label, 120)}`;
|
|
410
|
+
};
|
|
411
|
+
const effects = [
|
|
412
|
+
...adds.map((id) => labelEffect(id, true)),
|
|
413
|
+
...removes.map((id) => labelEffect(id, false))
|
|
414
|
+
];
|
|
415
|
+
if ([
|
|
416
|
+
"batch_modify_messages",
|
|
417
|
+
"modify_message",
|
|
418
|
+
"modify_thread",
|
|
419
|
+
"label_message",
|
|
420
|
+
"label_thread",
|
|
421
|
+
"unlabel_message",
|
|
422
|
+
"unlabel_thread"
|
|
423
|
+
].includes(toolName)) {
|
|
424
|
+
const trash = adds.includes("TRASH");
|
|
425
|
+
return {
|
|
426
|
+
title: trash ? `Move ${noun} to Trash` : `Update ${noun}`,
|
|
427
|
+
approveLabel: trash ? "Move to Trash" : "Apply changes",
|
|
428
|
+
effects,
|
|
429
|
+
...selectionCount === void 0 ? {} : { selectionCount, selectionKind },
|
|
430
|
+
...trash ? { consequence: "Messages stay recoverable in Trash until Gmail deletes them." } : thread ? { consequence: "Applies to every message in the conversation." } : {}
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
if (["trash_message", "restore_message", "trash_thread", "restore_thread"].includes(toolName))
|
|
434
|
+
return {
|
|
435
|
+
title: toolName.startsWith("trash_") ? `Move ${noun} to Trash` : `Remove ${noun} from Trash`,
|
|
436
|
+
approveLabel: toolName.startsWith("trash_") ? "Move to Trash" : "Remove from Trash",
|
|
437
|
+
effects,
|
|
438
|
+
...selectionCount === void 0 ? {} : { selectionCount, selectionKind }
|
|
439
|
+
};
|
|
440
|
+
const named = {
|
|
441
|
+
send_message: ["Send email", "Send email"],
|
|
442
|
+
send_draft: ["Send draft", "Send draft"],
|
|
443
|
+
create_draft: ["Create email draft", "Create draft"],
|
|
444
|
+
update_draft: ["Update email draft", "Update draft"],
|
|
445
|
+
delete_draft: ["Delete email draft", "Delete draft"],
|
|
446
|
+
create_label: ["Create label", "Create label"],
|
|
447
|
+
update_label: ["Update label", "Update label"],
|
|
448
|
+
delete_label: ["Delete label", "Delete label"]
|
|
449
|
+
};
|
|
450
|
+
const action = Object.hasOwn(named, toolName) ? named[toolName] : void 0;
|
|
451
|
+
return action ? { title: action[0], approveLabel: action[1], effects } : fallback;
|
|
452
|
+
}
|
|
453
|
+
function toolReviewDetails(argumentsValue, context, path, offset, limit = 25) {
|
|
454
|
+
if (!Number.isSafeInteger(offset) || offset < 0 || !Number.isSafeInteger(limit) || limit < 1 || limit > 50)
|
|
455
|
+
throw new Error("Invalid review page");
|
|
456
|
+
const args = decodeReviewArguments(argumentsValue);
|
|
457
|
+
let value = context?.email ? { ...args, $email: context.email } : args;
|
|
458
|
+
if (path !== "") {
|
|
459
|
+
if (!path.startsWith("/")) throw new Error("Invalid review field");
|
|
460
|
+
for (const escaped of path.slice(1).split("/")) {
|
|
461
|
+
if (/^~2\d+$/.test(escaped)) {
|
|
462
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
463
|
+
throw new Error("Review field not found");
|
|
464
|
+
const selected = Object.entries(value)[Number(escaped.slice(2))];
|
|
465
|
+
if (!selected) throw new Error("Review field not found");
|
|
466
|
+
value = {
|
|
467
|
+
fieldName: selected[0],
|
|
468
|
+
value: protectedReviewField(selected[0], context?.protectedFields) ? "[Protected value]" : selected[1]
|
|
469
|
+
};
|
|
470
|
+
continue;
|
|
151
471
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
472
|
+
const key = escaped.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
473
|
+
if (protectedReviewField(key, context?.protectedFields)) {
|
|
474
|
+
value = "[Protected value]";
|
|
475
|
+
break;
|
|
156
476
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
cancelled = true;
|
|
161
|
-
stopHeartbeat();
|
|
162
|
-
options.onCancel?.();
|
|
163
|
-
void Promise.resolve(iterator.return?.(void 0)).then(
|
|
164
|
-
() => void 0,
|
|
165
|
-
() => void 0
|
|
166
|
-
);
|
|
477
|
+
if (!value || typeof value !== "object" || !Object.hasOwn(value, key))
|
|
478
|
+
throw new Error("Review field not found");
|
|
479
|
+
value = value[key];
|
|
167
480
|
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
481
|
+
}
|
|
482
|
+
const preview = (entry, key, childPath) => {
|
|
483
|
+
const hidden = protectedReviewField(key, context?.protectedFields);
|
|
484
|
+
if (!hidden && entry !== null && typeof entry === "object") {
|
|
485
|
+
const count = Array.isArray(entry) ? entry.length : Object.keys(entry).length;
|
|
486
|
+
return {
|
|
487
|
+
value: `${count.toLocaleString("en-US")} ${Array.isArray(entry) ? count === 1 ? "item" : "items" : count === 1 ? "field" : "fields"}`,
|
|
488
|
+
path: childPath,
|
|
489
|
+
truncated: true
|
|
490
|
+
};
|
|
176
491
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
492
|
+
const text2 = valueText(safeReviewValue(entry, key, context?.protectedFields));
|
|
493
|
+
return {
|
|
494
|
+
value: bound(text2, 4e3),
|
|
495
|
+
...hidden ? {} : { path: childPath },
|
|
496
|
+
truncated: !hidden && text2.length > 4e3
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
let total;
|
|
500
|
+
let items;
|
|
501
|
+
if (Array.isArray(value)) {
|
|
502
|
+
total = value.length;
|
|
503
|
+
items = value.slice(offset, offset + limit).map((entry, index) => ({
|
|
504
|
+
label: `${offset + index + 1}`,
|
|
505
|
+
...preview(entry, "", `${path}/${offset + index}`)
|
|
506
|
+
}));
|
|
507
|
+
} else if (value && typeof value === "object") {
|
|
508
|
+
const entries = Object.entries(value);
|
|
509
|
+
total = entries.length;
|
|
510
|
+
items = entries.slice(offset, offset + limit).map(([key, entry], index) => ({
|
|
511
|
+
label: bound(
|
|
512
|
+
(context?.fieldLabels && Object.hasOwn(context.fieldLabels, key) ? context.fieldLabels[key] : void 0) ?? toolReviewFieldLabel(key),
|
|
513
|
+
256
|
|
514
|
+
),
|
|
515
|
+
...preview(entry, key, `${path}${fieldPointer(key, offset + index, path)}`)
|
|
516
|
+
}));
|
|
190
517
|
} else {
|
|
191
|
-
|
|
518
|
+
const text2 = valueText(value);
|
|
519
|
+
total = Math.max(1, Math.ceil(text2.length / 4e3));
|
|
520
|
+
items = Array.from({ length: Math.max(0, Math.min(limit, total - offset)) }, (_, index) => ({
|
|
521
|
+
label: `Part ${offset + index + 1}`,
|
|
522
|
+
value: text2.slice((offset + index) * 4e3, (offset + index + 1) * 4e3)
|
|
523
|
+
}));
|
|
192
524
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
525
|
+
return { path, items, total, nextOffset: offset + limit < total ? offset + limit : null };
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// ../contracts/src/mcp-endpoint.ts
|
|
529
|
+
function mcpEndpointIdentity(value) {
|
|
530
|
+
if (!value) return null;
|
|
531
|
+
try {
|
|
532
|
+
const url = new URL(value);
|
|
533
|
+
if (!["https:", "http:"].includes(url.protocol) || url.username || url.password) return null;
|
|
534
|
+
url.hash = "";
|
|
535
|
+
return url.href;
|
|
536
|
+
} catch {
|
|
537
|
+
return null;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
function pluginMcpUnavailableReason(server) {
|
|
541
|
+
if (server.transport === "stdio" || !server.endpoint) return "Requires a local runtime";
|
|
542
|
+
if (server.transport && !["http", "streamable-http", "streamable_http"].includes(server.transport))
|
|
543
|
+
return "Unsupported transport: " + server.transport;
|
|
544
|
+
if (server.requiresConfiguration || server.endpoint.includes("{"))
|
|
545
|
+
return "Requires custom connection configuration";
|
|
546
|
+
const endpoint2 = mcpEndpointIdentity(server.endpoint);
|
|
547
|
+
if (!endpoint2?.startsWith("https://")) return "Requires a valid HTTPS endpoint";
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// src/tool-display-metadata.ts
|
|
552
|
+
function parseToolDisplayMetadata(value) {
|
|
553
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
554
|
+
const item = value;
|
|
555
|
+
if (Object.keys(item).some(
|
|
556
|
+
(key) => !["toolName", "title", "accountLabel", "connector", "providerDomain"].includes(key)
|
|
557
|
+
))
|
|
558
|
+
return void 0;
|
|
559
|
+
const text2 = (v, max) => typeof v === "string" && v.length > 0 && v.length <= max;
|
|
560
|
+
if (!text2(item.toolName, 512) || /[\u0000-\u001f\u007f]/u.test(item.toolName)) return void 0;
|
|
561
|
+
if (item.title !== void 0 && !text2(item.title, 512)) return void 0;
|
|
562
|
+
if (item.accountLabel !== void 0 && !text2(item.accountLabel, 1024)) return void 0;
|
|
563
|
+
if (item.connector !== void 0 && !text2(item.connector, 512)) return void 0;
|
|
564
|
+
if (item.providerDomain !== void 0 && !text2(item.providerDomain, 253)) return void 0;
|
|
565
|
+
return {
|
|
566
|
+
toolName: item.toolName,
|
|
567
|
+
...item.title !== void 0 ? { title: item.title } : {},
|
|
568
|
+
...item.accountLabel !== void 0 ? { accountLabel: item.accountLabel } : {},
|
|
569
|
+
...item.connector !== void 0 ? { connector: item.connector } : {},
|
|
570
|
+
...item.providerDomain !== void 0 ? { providerDomain: item.providerDomain } : {}
|
|
571
|
+
};
|
|
203
572
|
}
|
|
204
573
|
|
|
205
574
|
// src/mcp-output.ts
|
|
@@ -232,31 +601,31 @@ function normalizeValue(value, depth, ancestors) {
|
|
|
232
601
|
if (Array.isArray(value)) {
|
|
233
602
|
return { value, text: safeStringify(value), isError: false };
|
|
234
603
|
}
|
|
235
|
-
const
|
|
236
|
-
const envelopeError =
|
|
237
|
-
if (
|
|
238
|
-
const normalized = normalizeText(
|
|
604
|
+
const record2 = value;
|
|
605
|
+
const envelopeError = record2.isError === true;
|
|
606
|
+
if (record2.type === "text" && typeof record2.text === "string") {
|
|
607
|
+
const normalized = normalizeText(record2.text, depth + 1, ancestors);
|
|
239
608
|
return {
|
|
240
609
|
value: normalized.value,
|
|
241
|
-
text:
|
|
610
|
+
text: record2.text,
|
|
242
611
|
isError: envelopeError || normalized.isError
|
|
243
612
|
};
|
|
244
613
|
}
|
|
245
|
-
if ("structuredContent" in
|
|
246
|
-
const normalized = normalizeValue(
|
|
614
|
+
if ("structuredContent" in record2) {
|
|
615
|
+
const normalized = normalizeValue(record2.structuredContent, depth + 1, ancestors);
|
|
247
616
|
return {
|
|
248
617
|
value: normalized.value,
|
|
249
|
-
text: firstMcpText(
|
|
618
|
+
text: firstMcpText(record2.content) ?? normalized.text,
|
|
250
619
|
isError: envelopeError || normalized.isError
|
|
251
620
|
};
|
|
252
621
|
}
|
|
253
|
-
if (isMcpContent(
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
256
|
-
const normalized = normalizeText(
|
|
622
|
+
if (isMcpContent(record2.content)) {
|
|
623
|
+
const text2 = firstMcpText(record2.content);
|
|
624
|
+
if (text2 !== null) {
|
|
625
|
+
const normalized = normalizeText(text2, depth + 1, ancestors);
|
|
257
626
|
return {
|
|
258
627
|
value: normalized.value,
|
|
259
|
-
text,
|
|
628
|
+
text: text2,
|
|
260
629
|
isError: envelopeError || normalized.isError
|
|
261
630
|
};
|
|
262
631
|
}
|
|
@@ -266,8 +635,8 @@ function normalizeValue(value, depth, ancestors) {
|
|
|
266
635
|
isError: envelopeError
|
|
267
636
|
};
|
|
268
637
|
}
|
|
269
|
-
if (isResultEnvelope(
|
|
270
|
-
const normalized = normalizeValue(
|
|
638
|
+
if (isResultEnvelope(record2)) {
|
|
639
|
+
const normalized = normalizeValue(record2.result, depth + 1, ancestors);
|
|
271
640
|
return {
|
|
272
641
|
value: normalized.value,
|
|
273
642
|
text: normalized.text,
|
|
@@ -283,17 +652,17 @@ function normalizeValue(value, depth, ancestors) {
|
|
|
283
652
|
ancestors.delete(value);
|
|
284
653
|
}
|
|
285
654
|
}
|
|
286
|
-
function normalizeText(
|
|
655
|
+
function normalizeText(text2, depth, ancestors) {
|
|
287
656
|
try {
|
|
288
|
-
const parsed = JSON.parse(
|
|
657
|
+
const parsed = JSON.parse(text2);
|
|
289
658
|
const normalized = normalizeValue(parsed, depth + 1, ancestors);
|
|
290
659
|
return {
|
|
291
660
|
value: normalized.value,
|
|
292
|
-
text,
|
|
661
|
+
text: text2,
|
|
293
662
|
isError: normalized.isError
|
|
294
663
|
};
|
|
295
664
|
} catch {
|
|
296
|
-
return { value:
|
|
665
|
+
return { value: text2, text: text2, isError: false };
|
|
297
666
|
}
|
|
298
667
|
}
|
|
299
668
|
function isMcpContent(value) {
|
|
@@ -312,8 +681,8 @@ function firstMcpText(value) {
|
|
|
312
681
|
}
|
|
313
682
|
return null;
|
|
314
683
|
}
|
|
315
|
-
function isResultEnvelope(
|
|
316
|
-
return "result" in
|
|
684
|
+
function isResultEnvelope(record2) {
|
|
685
|
+
return "result" in record2 && Object.keys(record2).every((key) => RESULT_ENVELOPE_KEYS.has(key));
|
|
317
686
|
}
|
|
318
687
|
function safeStringify(value) {
|
|
319
688
|
try {
|
|
@@ -429,18 +798,6 @@ function normalizeCompanyProfileStableKey(value) {
|
|
|
429
798
|
function inspectorPath(workspaceId, suffix) {
|
|
430
799
|
return `/v1/workspaces/${workspaceId}/company-brain/${suffix}`;
|
|
431
800
|
}
|
|
432
|
-
function searchCompanyBrainKnowledge(client, workspaceId, request) {
|
|
433
|
-
return client.requestJson("POST", inspectorPath(workspaceId, "knowledge/search"), request);
|
|
434
|
-
}
|
|
435
|
-
function getCompanyBrainKnowledge(client, workspaceId, recordId) {
|
|
436
|
-
return client.requestJson(
|
|
437
|
-
"GET",
|
|
438
|
-
`${inspectorPath(workspaceId, "knowledge/record")}?id=${encodeURIComponent(recordId)}`
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
function browseCompanyBrainKnowledge(client, workspaceId, request = {}) {
|
|
442
|
-
return client.requestJson("POST", inspectorPath(workspaceId, "knowledge/browse"), request);
|
|
443
|
-
}
|
|
444
801
|
function listCompanyBrainContextReceipts(client, workspaceId, options = {}) {
|
|
445
802
|
const params = new URLSearchParams();
|
|
446
803
|
if (options.attemptId) params.set("attemptId", options.attemptId);
|
|
@@ -462,6 +819,7 @@ function normalizePreferenceRegistryStableKey(value) {
|
|
|
462
819
|
return value.normalize("NFKC").trim().toLowerCase().replace(/\s+/gu, "-").replace(/-+/g, "-");
|
|
463
820
|
}
|
|
464
821
|
export {
|
|
822
|
+
AUTOMATIC_SESSION_TITLE_FALLBACK,
|
|
465
823
|
AttachedBrowserDeviceCollection,
|
|
466
824
|
AttachedBrowserDeviceResource,
|
|
467
825
|
AuthRunCollection,
|
|
@@ -493,6 +851,7 @@ export {
|
|
|
493
851
|
ComputerTargetCollection,
|
|
494
852
|
DEFAULT_FILE_RESOURCE_MOUNT_ROOT,
|
|
495
853
|
DEFAULT_WORKSPACE_TRANSCRIPTION_POLICY,
|
|
854
|
+
EMPTY_FINAL_REPLY_NOTICE,
|
|
496
855
|
GENERATED_VIDEO_MAX_BYTES,
|
|
497
856
|
INTERACTION_PROTOCOL_VERSION,
|
|
498
857
|
InteractionInterventionCollection,
|
|
@@ -504,82 +863,148 @@ export {
|
|
|
504
863
|
OPENGENI_API_CONTRACT_HEADER,
|
|
505
864
|
OPENGENI_API_CONTRACT_REVISION,
|
|
506
865
|
OPENGENI_CORRELATION_HEADER,
|
|
866
|
+
OPENGENI_SITE_BRIDGE_CANCEL,
|
|
867
|
+
OPENGENI_SITE_BRIDGE_CONNECT,
|
|
868
|
+
OPENGENI_SITE_BRIDGE_READY,
|
|
869
|
+
OPENGENI_SITE_BRIDGE_REQUEST,
|
|
870
|
+
OPENGENI_SITE_BRIDGE_RESPONSE,
|
|
871
|
+
OPENGENI_SITE_BRIDGE_SIGN_IN_METHOD,
|
|
872
|
+
OPENGENI_SITE_BRIDGE_VERSION,
|
|
873
|
+
OPENGENI_SITE_BRIDGE_VIEWER_METHOD,
|
|
874
|
+
OPENGENI_TEST_REQUEST_NIL_ID,
|
|
875
|
+
OPENGENI_WEBHOOK_HEADERS,
|
|
876
|
+
OPENGENI_WEBHOOK_TEST_EVENT_TYPE,
|
|
877
|
+
OpenGeniAllowanceExhaustedError,
|
|
507
878
|
OpenGeniApiContractMismatchError,
|
|
508
879
|
OpenGeniApiError,
|
|
509
|
-
OpenGeniClient,
|
|
880
|
+
OpenGeniEmbeddingClient as OpenGeniClient,
|
|
510
881
|
OpenGeniInteractionClient,
|
|
882
|
+
OpenGeniSecureContextRequiredError,
|
|
511
883
|
OpenGeniSessionListCursorError,
|
|
884
|
+
OpenGeniSessionUsageLimitReachedError,
|
|
885
|
+
OpenGeniSessionUsageLimitUnsupportedError,
|
|
886
|
+
OpenGeniSetupError,
|
|
887
|
+
OpenGeniSignatureError,
|
|
888
|
+
OpenGeniSiteBridgeError,
|
|
512
889
|
OpenGeniStreamError,
|
|
890
|
+
OpenGeniToolCallError,
|
|
891
|
+
OpenGeniToolReapprovalRequiredError,
|
|
892
|
+
OpenGeniToolsClient,
|
|
513
893
|
PERSONAL_RESOURCE_SHARED_OUTPUT_WARNING,
|
|
514
894
|
PERSONAL_RESOURCE_SHARED_OUTPUT_WARNING_VERSION,
|
|
515
895
|
RETAINED_OUTPUT_DEFAULT_PAGE_BYTES,
|
|
516
896
|
RETAINED_OUTPUT_MAX_PAGE_BYTES,
|
|
517
897
|
SANDBOX_FILE_ARTIFACT_MAX_BYTES,
|
|
518
898
|
SESSION_EVENT_TYPES,
|
|
899
|
+
SESSION_SCOPE_HEADER,
|
|
519
900
|
SiteAuthConnectionCollection,
|
|
520
901
|
SiteAuthConnectionResource,
|
|
521
902
|
TTYD_SUBPROTOCOL,
|
|
903
|
+
ToolRequestError,
|
|
522
904
|
TtydClientCommand,
|
|
523
905
|
TtydServerCommand,
|
|
524
906
|
WORKSPACE_INSTRUCTION_POLICY_CONTENT_MAX_CHARS,
|
|
907
|
+
WORKSPACE_WEBHOOK_EVENT_TYPES,
|
|
525
908
|
acquireCodexRealtimeMicrophone,
|
|
526
909
|
applyUrlRotation,
|
|
910
|
+
artifactViewerCapability,
|
|
911
|
+
asVaultClient,
|
|
527
912
|
authorizeTranscriptionAdapter,
|
|
528
|
-
browseCompanyBrainKnowledge,
|
|
529
913
|
browserFrameSocketUrl,
|
|
530
914
|
codexRealtimeMicrophoneHealthy,
|
|
915
|
+
codexRealtimeRefusal,
|
|
531
916
|
computerFrameSocketUrl,
|
|
532
917
|
contextAppendChunks,
|
|
533
918
|
createCodexRealtimeController,
|
|
534
919
|
createCodexRealtimeV3Bridge,
|
|
535
920
|
createGatewayRealtimeTransportStarter,
|
|
921
|
+
createOpenGeniSiteClient,
|
|
922
|
+
createSessionProxyHandler,
|
|
923
|
+
createSiteToolBridge,
|
|
536
924
|
createTranscriptionSessionRequest,
|
|
537
925
|
createXaiSubscriptionRealtimeTransportStarter,
|
|
538
926
|
decodeBrowserFrameMessage,
|
|
539
927
|
decodeComputerFrameMessage,
|
|
928
|
+
decodeComputerFrameMetadataHeader,
|
|
929
|
+
deriveAutomaticSessionTitlePreview,
|
|
930
|
+
deriveSessionDisplayTitle,
|
|
540
931
|
desktopSocketUrl,
|
|
541
932
|
encodeCodexRealtimeV3DelegationContextAppend,
|
|
542
933
|
encodeCodexRealtimeV3SessionContextAppend,
|
|
934
|
+
formatErrorMessage,
|
|
543
935
|
formatSseEvent,
|
|
544
936
|
generatedImageSandboxPathMatches,
|
|
545
|
-
|
|
937
|
+
humanizeModelSlug,
|
|
546
938
|
interactionControlFailureFromError,
|
|
939
|
+
isOpenGeniSiteBridgeCancelMessage,
|
|
940
|
+
isOpenGeniSiteBridgeConnectMessage,
|
|
941
|
+
isOpenGeniSiteBridgeRequestMessage,
|
|
942
|
+
isRawModelLabel,
|
|
943
|
+
isReservedOpenGeniLink,
|
|
547
944
|
isRetryableStreamError,
|
|
945
|
+
isSiteCatalogStaleError,
|
|
548
946
|
listCompanyBrainContextReceipts,
|
|
549
947
|
listCompanyBrainKnowledgeProposals,
|
|
948
|
+
modelDisplayName,
|
|
949
|
+
modelSlug,
|
|
950
|
+
modelVendor,
|
|
550
951
|
nextDesktopState,
|
|
551
952
|
normalizeCompanyProfileStableKey,
|
|
552
953
|
normalizeMcpOutput,
|
|
553
954
|
normalizePreferenceRegistryStableKey,
|
|
554
955
|
normalizeWorkspaceInstructionPolicyRoleKey,
|
|
956
|
+
openGeniConsolePath,
|
|
957
|
+
openGeniLinkScheme,
|
|
555
958
|
parseBrowserFrameMetadata,
|
|
556
959
|
parseCodexRealtimeV3Event,
|
|
557
960
|
parseComputerFrameMetadata,
|
|
961
|
+
parseCustomMcpSetupRequest,
|
|
962
|
+
parseDeprecationNotice,
|
|
558
963
|
parseGeneratedImageReceipt,
|
|
559
964
|
parseGeneratedVideoReceipt,
|
|
560
965
|
parseMediaGenerationResult,
|
|
966
|
+
parseOpenGeniLink,
|
|
967
|
+
parseRetainedFileReference,
|
|
561
968
|
parseRetainedGeneratedImageReference,
|
|
562
969
|
parseRetainedGeneratedVideoReference,
|
|
563
970
|
parseRetainedWorkspaceFileReference,
|
|
564
971
|
parseSandboxFileArtifactReceipt,
|
|
972
|
+
parseSandboxLink,
|
|
565
973
|
parseSseStream,
|
|
974
|
+
parseToolDisplayMetadata,
|
|
566
975
|
parseWorkspaceLiveEvent,
|
|
976
|
+
pluginMcpUnavailableReason,
|
|
567
977
|
projectSessionRealtimeLifecycle,
|
|
568
978
|
proxySessionEventStream,
|
|
569
979
|
resolveWorkspaceTranscriptionPolicy,
|
|
570
980
|
resolveWorkspaceVoiceInputEnabled,
|
|
571
981
|
resumeSequenceFromRequest,
|
|
572
|
-
|
|
982
|
+
sanitizeOpenGeniSiteToolCallRequest,
|
|
983
|
+
sessionEventStreamCoveredThrough,
|
|
573
984
|
sessionEventsToSseResponse,
|
|
574
985
|
sessionEventsToSseStream,
|
|
986
|
+
sessionListEntry,
|
|
987
|
+
sessionTitleIsPending,
|
|
988
|
+
signOpenGeniPayload,
|
|
575
989
|
startCodexRealtimeWebrtc,
|
|
576
990
|
streamSessionEvents,
|
|
577
991
|
streamWorkspaceControlEvents,
|
|
578
992
|
streamWorkspaceInteractionRevisions,
|
|
579
993
|
streamWorkspaceLiveEvents,
|
|
580
994
|
terminalSocketUrl,
|
|
995
|
+
toolReviewAction,
|
|
996
|
+
toolReviewDetails,
|
|
997
|
+
toolReviewFields,
|
|
581
998
|
ttydAuthFrame,
|
|
582
999
|
ttydInputFrame,
|
|
583
|
-
ttydResizeFrame
|
|
1000
|
+
ttydResizeFrame,
|
|
1001
|
+
turnCompletedWithEmptyFinalReply,
|
|
1002
|
+
vaultErrorCode,
|
|
1003
|
+
vaultErrorDetail,
|
|
1004
|
+
vaultsApi,
|
|
1005
|
+
verifyCredentialProviderRequest,
|
|
1006
|
+
verifyOpenGeniSignature,
|
|
1007
|
+
verifyToolRequest,
|
|
1008
|
+
verifyWebhookEvent
|
|
584
1009
|
};
|
|
585
1010
|
//# sourceMappingURL=index.js.map
|