@mcpjam/widget-react 0.1.16 → 0.2.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/index.d.ts +122 -1
- package/dist/index.js +239 -166
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -734,6 +734,7 @@ interface AppInstance {
|
|
|
734
734
|
bridge: AppBridge;
|
|
735
735
|
tools: AppToolDescriptor[];
|
|
736
736
|
registeredAtMs: number;
|
|
737
|
+
toolSource?: "mcp-apps" | "webmcp";
|
|
737
738
|
/**
|
|
738
739
|
* Accessor for the iframe DOM node that hosts this app instance. Lets
|
|
739
740
|
* callers (e.g. `onToolCall`) scroll the iframe into view before
|
|
@@ -766,6 +767,7 @@ interface AppToolAttribution {
|
|
|
766
767
|
appName: string;
|
|
767
768
|
}
|
|
768
769
|
interface AppToolsRegistryState {
|
|
770
|
+
enabled: boolean;
|
|
769
771
|
instancesByBridgeId: Map<BridgeId, AppInstance>;
|
|
770
772
|
aliases: Map<string, AppToolAlias>;
|
|
771
773
|
/** Active app-tool provider per chat-scoped host tool call. */
|
|
@@ -835,6 +837,7 @@ declare const useAppToolsRegistry: (<T = AppToolsRegistryState>(selector?: (stat
|
|
|
835
837
|
* context.
|
|
836
838
|
*/
|
|
837
839
|
interface AppToolInvocationRecord {
|
|
840
|
+
initiatedBy?: "user";
|
|
838
841
|
alias: string;
|
|
839
842
|
rawName: string;
|
|
840
843
|
appName: string;
|
|
@@ -868,6 +871,107 @@ declare const __internal: {
|
|
|
868
871
|
ALIAS_REGEX: RegExp;
|
|
869
872
|
};
|
|
870
873
|
|
|
874
|
+
/** Dispatch exactly once using the source selected at discovery. */
|
|
875
|
+
declare function dispatchAppToolCall(entry: NonNullable<ReturnType<AppToolsRegistryState["resolve"]>>, args: Record<string, unknown>, options?: {
|
|
876
|
+
signal?: AbortSignal;
|
|
877
|
+
}): Promise<{
|
|
878
|
+
[x: string]: unknown;
|
|
879
|
+
content: ({
|
|
880
|
+
type: "text";
|
|
881
|
+
text: string;
|
|
882
|
+
annotations?: {
|
|
883
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
884
|
+
priority?: number | undefined;
|
|
885
|
+
lastModified?: string | undefined;
|
|
886
|
+
} | undefined;
|
|
887
|
+
_meta?: {
|
|
888
|
+
[x: string]: unknown;
|
|
889
|
+
} | undefined;
|
|
890
|
+
} | {
|
|
891
|
+
type: "image";
|
|
892
|
+
data: string;
|
|
893
|
+
mimeType: string;
|
|
894
|
+
annotations?: {
|
|
895
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
896
|
+
priority?: number | undefined;
|
|
897
|
+
lastModified?: string | undefined;
|
|
898
|
+
} | undefined;
|
|
899
|
+
_meta?: {
|
|
900
|
+
[x: string]: unknown;
|
|
901
|
+
} | undefined;
|
|
902
|
+
} | {
|
|
903
|
+
type: "audio";
|
|
904
|
+
data: string;
|
|
905
|
+
mimeType: string;
|
|
906
|
+
annotations?: {
|
|
907
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
908
|
+
priority?: number | undefined;
|
|
909
|
+
lastModified?: string | undefined;
|
|
910
|
+
} | undefined;
|
|
911
|
+
_meta?: {
|
|
912
|
+
[x: string]: unknown;
|
|
913
|
+
} | undefined;
|
|
914
|
+
} | {
|
|
915
|
+
uri: string;
|
|
916
|
+
name: string;
|
|
917
|
+
type: "resource_link";
|
|
918
|
+
description?: string | undefined;
|
|
919
|
+
mimeType?: string | undefined;
|
|
920
|
+
size?: number | undefined;
|
|
921
|
+
annotations?: {
|
|
922
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
923
|
+
priority?: number | undefined;
|
|
924
|
+
lastModified?: string | undefined;
|
|
925
|
+
} | undefined;
|
|
926
|
+
_meta?: {
|
|
927
|
+
[x: string]: unknown;
|
|
928
|
+
} | undefined;
|
|
929
|
+
icons?: {
|
|
930
|
+
src: string;
|
|
931
|
+
mimeType?: string | undefined;
|
|
932
|
+
sizes?: string[] | undefined;
|
|
933
|
+
theme?: "light" | "dark" | undefined;
|
|
934
|
+
}[] | undefined;
|
|
935
|
+
title?: string | undefined;
|
|
936
|
+
} | {
|
|
937
|
+
type: "resource";
|
|
938
|
+
resource: {
|
|
939
|
+
uri: string;
|
|
940
|
+
text: string;
|
|
941
|
+
mimeType?: string | undefined;
|
|
942
|
+
_meta?: {
|
|
943
|
+
[x: string]: unknown;
|
|
944
|
+
} | undefined;
|
|
945
|
+
} | {
|
|
946
|
+
uri: string;
|
|
947
|
+
blob: string;
|
|
948
|
+
mimeType?: string | undefined;
|
|
949
|
+
_meta?: {
|
|
950
|
+
[x: string]: unknown;
|
|
951
|
+
} | undefined;
|
|
952
|
+
};
|
|
953
|
+
annotations?: {
|
|
954
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
955
|
+
priority?: number | undefined;
|
|
956
|
+
lastModified?: string | undefined;
|
|
957
|
+
} | undefined;
|
|
958
|
+
_meta?: {
|
|
959
|
+
[x: string]: unknown;
|
|
960
|
+
} | undefined;
|
|
961
|
+
})[];
|
|
962
|
+
_meta?: {
|
|
963
|
+
[x: string]: unknown;
|
|
964
|
+
progressToken?: string | number | undefined;
|
|
965
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
966
|
+
taskId: string;
|
|
967
|
+
} | undefined;
|
|
968
|
+
} | undefined;
|
|
969
|
+
structuredContent?: {
|
|
970
|
+
[x: string]: unknown;
|
|
971
|
+
} | undefined;
|
|
972
|
+
isError?: boolean | undefined;
|
|
973
|
+
}>;
|
|
974
|
+
|
|
871
975
|
/**
|
|
872
976
|
* useToolInputStreaming – manages the streaming delivery of tool input to
|
|
873
977
|
* an MCP App bridge.
|
|
@@ -1372,4 +1476,21 @@ interface WidgetFullscreenPlacement {
|
|
|
1372
1476
|
}
|
|
1373
1477
|
declare const WidgetFullscreenPlacementContext: react.Context<WidgetFullscreenPlacement | null>;
|
|
1374
1478
|
|
|
1375
|
-
|
|
1479
|
+
declare const MAX_SNAPSHOT_ENTRIES = 64;
|
|
1480
|
+
type AppToolDropReason = "entry_cap" | "schema_too_large" | "schema_unserializable";
|
|
1481
|
+
interface AppToolCatalogEntry extends AppToolAlias {
|
|
1482
|
+
instance: AppInstance;
|
|
1483
|
+
description?: string;
|
|
1484
|
+
inputSchema?: Record<string, unknown>;
|
|
1485
|
+
}
|
|
1486
|
+
interface AppToolCatalog {
|
|
1487
|
+
offered: AppToolCatalogEntry[];
|
|
1488
|
+
dropped: (AppToolCatalogEntry & {
|
|
1489
|
+
reason: AppToolDropReason;
|
|
1490
|
+
})[];
|
|
1491
|
+
}
|
|
1492
|
+
type AppToolCatalogState = Pick<AppToolsRegistryState, "aliases" | "instancesByBridgeId" | "activeBridgeByParent" | "enabled">;
|
|
1493
|
+
/** Alias order is the wire order, including when an app re-registers. */
|
|
1494
|
+
declare function listAppToolCatalog(state: AppToolCatalogState, chatSessionId?: string | null): AppToolCatalog;
|
|
1495
|
+
|
|
1496
|
+
export { type AddTrafficLog, type AppInstance, type AppToolAlias, type AppToolAttribution, type AppToolCatalog, type AppToolCatalogEntry, type AppToolCatalogState, type AppToolDescriptor, type AppToolDropReason, type AppToolInvocationLog, type AppToolInvocationLogState, type AppToolInvocationRecord, type AppToolSnapshotEntry, type AppToolsRegistry, type AppToolsRegistryState, type BridgeId, type CspApplicationIntent, type CspClientContext, type CspMode, type CspMountId, type CspSubtypePolicy, type CspViolation, type DeviceCapabilities, type DeviceType, type DisplayMode, type EffectiveCompatRuntime, type FetchWidgetContentRequest, type FetchWidgetContentResponse, type ListResourcesResult, MAX_SNAPSHOT_ENTRIES, MCPAppsRenderer, type MCPAppsRendererProps, MCPAppsRendererSurface, type OpenAiAppsCapabilities, PARTIAL_INPUT_THROTTLE_MS, type ProjectHostContextDraft, type ResolvedHostCapabilities, type ResolvedHostInfo, type ResolvedHostStyle, type ResolvedMcpAppsCapabilities, type ResolvedOpenAiAppsCapabilities, SIGNATURE_MAX_ARRAY_ITEMS, SIGNATURE_MAX_DEPTH, SIGNATURE_MAX_OBJECT_KEYS, SIGNATURE_STRING_EDGE_LENGTH, STREAMING_REVEAL_FALLBACK_MS, type SafeAreaInsets, type SandboxProxyLocation, SandboxedIframe, type SandboxedIframeHandle, type ScenarioHostStyle, type ThemeMode, type ToolLike, type ToolState, UIType, type UiLogEvent, type UiProtocol, type UseToolInputStreamingParams, type UseToolInputStreamingReturn, type WidgetCheckoutProps, type WidgetDebugInfo, type WidgetDebugSink, type WidgetFullscreenPlacement, WidgetFullscreenPlacementContext, type WidgetGlobals, type WidgetHost, type WidgetHostComponents, type WidgetHostEnvironment, type WidgetHostEnvironmentInputs, WidgetHostProvider, type WidgetHostProviderProps, type WidgetHostResolvers, type WidgetHostServices, type WidgetLifecycleEvent, type WidgetModalProps, type WidgetMount, type WidgetSandboxApplied, type WidgetSandboxInfo, type WidgetSurfaceAdmissionError, WidgetSurfaceHost, WidgetSurfaceHostProvider, type WidgetSurfaceId, type WidgetSurfaceInfo, type WidgetSurfaceKind, type WidgetSurfaceRecord, type WidgetSurfaceStore, WidgetWorkspaceProvider, WidgetWorkspaceSurfaceHost, __internal, closeWorkspaceSurface, createAppToolInvocationLog, createAppToolsRegistry, createWidgetSurfaceStore, detectUIType, detectUiTypeFromTool, dispatchAppToolCall, getRenderableSurfaceEntries, getToolInputSignature, getUIResourceUri, listAppToolCatalog, readToolResultMeta, readToolResultObject, readToolResultServerId, recordAppToolInvocation, resolveSandboxProxyUrl, useAppToolAttribution, useAppToolAttributionResolver, useAppToolInvocationLog, useAppToolInvocationLogApi, useAppToolsRegistry, useAppToolsRegistryApi, useOptionalWidgetWorkspace, usePersistentWidgetSurfaceHost, useToolInputStreaming, useWidgetHost, useWidgetSurfaceAdmissionError, useWidgetSurfaceStore, useWidgetSurfaceStoreApi, useWidgetWorkspace };
|