@apollo/client-ai-apps 0.4.0 → 0.5.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/.github/CODEOWNERS +1 -0
- package/.github/workflows/pr.yaml +23 -1
- package/.github/workflows/release.yaml +1 -5
- package/.github/workflows/verify-changeset.yml +112 -21
- package/CHANGELOG.md +361 -0
- package/__mocks__/fs/promises.cjs +3 -0
- package/__mocks__/fs.cjs +3 -0
- package/dist/config/defineConfig.d.ts +28 -0
- package/dist/config/defineConfig.d.ts.map +1 -0
- package/dist/config/defineConfig.js +7 -0
- package/dist/config/defineConfig.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/schema.d.ts +29 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +51 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/types.d.ts +7 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/core/ApolloClient.d.ts +4 -3
- package/dist/core/ApolloClient.d.ts.map +1 -1
- package/dist/core/ApolloClient.js +6 -59
- package/dist/core/ApolloClient.js.map +1 -1
- package/dist/core/Platform.d.ts +8 -0
- package/dist/core/Platform.d.ts.map +1 -0
- package/dist/core/Platform.js +20 -0
- package/dist/core/Platform.js.map +1 -0
- package/dist/core/types.d.ts +13 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +1 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mcp.d.ts +5 -0
- package/dist/index.mcp.d.ts.map +1 -0
- package/dist/index.mcp.js +5 -0
- package/dist/index.mcp.js.map +1 -0
- package/dist/index.openai.d.ts +5 -0
- package/dist/index.openai.d.ts.map +1 -0
- package/dist/index.openai.js +5 -0
- package/dist/index.openai.js.map +1 -0
- package/dist/link/ToolCallLink.d.ts +3 -3
- package/dist/link/ToolCallLink.d.ts.map +1 -1
- package/dist/link/ToolCallLink.js +5 -14
- package/dist/link/ToolCallLink.js.map +1 -1
- package/dist/mcp/core/ApolloClient.d.ts +21 -0
- package/dist/mcp/core/ApolloClient.d.ts.map +1 -0
- package/dist/mcp/core/ApolloClient.js +65 -0
- package/dist/mcp/core/ApolloClient.js.map +1 -0
- package/dist/mcp/core/McpAppManager.d.ts +34 -0
- package/dist/mcp/core/McpAppManager.d.ts.map +1 -0
- package/dist/mcp/core/McpAppManager.js +63 -0
- package/dist/mcp/core/McpAppManager.js.map +1 -0
- package/dist/mcp/core/Platform.d.ts +8 -0
- package/dist/mcp/core/Platform.d.ts.map +1 -0
- package/dist/mcp/core/Platform.js +8 -0
- package/dist/mcp/core/Platform.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/link/ToolCallLink.d.ts +28 -0
- package/dist/mcp/link/ToolCallLink.d.ts.map +1 -0
- package/dist/mcp/link/ToolCallLink.js +35 -0
- package/dist/mcp/link/ToolCallLink.js.map +1 -0
- package/dist/mcp/react/hooks/useApolloClient.d.ts +3 -0
- package/dist/mcp/react/hooks/useApolloClient.d.ts.map +1 -0
- package/dist/mcp/react/hooks/useApolloClient.js +9 -0
- package/dist/mcp/react/hooks/useApolloClient.js.map +1 -0
- package/dist/mcp/react/hooks/useApp.d.ts +2 -0
- package/dist/mcp/react/hooks/useApp.d.ts.map +1 -0
- package/dist/mcp/react/hooks/useApp.js +5 -0
- package/dist/mcp/react/hooks/useApp.js.map +1 -0
- package/dist/mcp/react/hooks/useToolInput.d.ts +2 -0
- package/dist/mcp/react/hooks/useToolInput.d.ts.map +1 -0
- package/dist/mcp/react/hooks/useToolInput.js +5 -0
- package/dist/mcp/react/hooks/useToolInput.js.map +1 -0
- package/dist/mcp/react/hooks/useToolMetadata.d.ts +8 -0
- package/dist/mcp/react/hooks/useToolMetadata.d.ts.map +1 -0
- package/dist/mcp/react/hooks/useToolMetadata.js +5 -0
- package/dist/mcp/react/hooks/useToolMetadata.js.map +1 -0
- package/dist/mcp/react/hooks/useToolName.d.ts +2 -0
- package/dist/mcp/react/hooks/useToolName.d.ts.map +1 -0
- package/dist/mcp/react/hooks/useToolName.js +5 -0
- package/dist/mcp/react/hooks/useToolName.js.map +1 -0
- package/dist/mcp/react/index.d.ts +5 -0
- package/dist/mcp/react/index.d.ts.map +1 -0
- package/dist/mcp/react/index.js +5 -0
- package/dist/mcp/react/index.js.map +1 -0
- package/dist/openai/core/ApolloClient.d.ts +21 -0
- package/dist/openai/core/ApolloClient.d.ts.map +1 -0
- package/dist/openai/core/ApolloClient.js +66 -0
- package/dist/openai/core/ApolloClient.js.map +1 -0
- package/dist/openai/core/McpAppManager.d.ts +28 -0
- package/dist/openai/core/McpAppManager.d.ts.map +1 -0
- package/dist/openai/core/McpAppManager.js +73 -0
- package/dist/openai/core/McpAppManager.js.map +1 -0
- package/dist/openai/core/Platform.d.ts +8 -0
- package/dist/openai/core/Platform.d.ts.map +1 -0
- package/dist/openai/core/Platform.js +8 -0
- package/dist/openai/core/Platform.js.map +1 -0
- package/dist/openai/globals.d.ts +12 -0
- package/dist/openai/globals.d.ts.map +1 -0
- package/dist/openai/globals.js +2 -0
- package/dist/openai/globals.js.map +1 -0
- package/dist/openai/index.d.ts +3 -0
- package/dist/openai/index.d.ts.map +1 -0
- package/dist/openai/index.js +3 -0
- package/dist/openai/index.js.map +1 -0
- package/dist/openai/link/ToolCallLink.d.ts +28 -0
- package/dist/openai/link/ToolCallLink.d.ts.map +1 -0
- package/dist/openai/link/ToolCallLink.js +35 -0
- package/dist/openai/link/ToolCallLink.js.map +1 -0
- package/dist/openai/react/hooks/useApolloClient.d.ts +3 -0
- package/dist/openai/react/hooks/useApolloClient.d.ts.map +1 -0
- package/dist/openai/react/hooks/useApolloClient.js +9 -0
- package/dist/openai/react/hooks/useApolloClient.js.map +1 -0
- package/dist/openai/react/hooks/useApp.d.ts +2 -0
- package/dist/openai/react/hooks/useApp.d.ts.map +1 -0
- package/dist/openai/react/hooks/useApp.js +5 -0
- package/dist/openai/react/hooks/useApp.js.map +1 -0
- package/dist/openai/react/hooks/useOpenAiGlobal.d.ts +3 -0
- package/dist/openai/react/hooks/useOpenAiGlobal.d.ts.map +1 -0
- package/dist/{react → openai/react}/hooks/useOpenAiGlobal.js +1 -1
- package/dist/openai/react/hooks/useOpenAiGlobal.js.map +1 -0
- package/dist/openai/react/hooks/useToolInput.d.ts +2 -0
- package/dist/openai/react/hooks/useToolInput.d.ts.map +1 -0
- package/dist/openai/react/hooks/useToolInput.js +5 -0
- package/dist/openai/react/hooks/useToolInput.js.map +1 -0
- package/dist/openai/react/hooks/useToolMetadata.d.ts +2 -0
- package/dist/openai/react/hooks/useToolMetadata.d.ts.map +1 -0
- package/dist/openai/react/hooks/useToolMetadata.js +5 -0
- package/dist/openai/react/hooks/useToolMetadata.js.map +1 -0
- package/dist/openai/react/hooks/useToolName.d.ts.map +1 -0
- package/dist/openai/react/hooks/useToolName.js +5 -0
- package/dist/openai/react/hooks/useToolName.js.map +1 -0
- package/dist/{react → openai/react}/hooks/useWidgetState.d.ts +1 -1
- package/dist/openai/react/hooks/useWidgetState.d.ts.map +1 -0
- package/dist/openai/react/hooks/useWidgetState.js.map +1 -0
- package/dist/openai/react/index.d.ts +6 -0
- package/dist/openai/react/index.d.ts.map +1 -0
- package/dist/openai/react/index.js +6 -0
- package/dist/openai/react/index.js.map +1 -0
- package/dist/{types/openai.d.ts → openai/types.d.ts} +7 -11
- package/dist/openai/types.d.ts.map +1 -0
- package/dist/{types/openai.js → openai/types.js} +1 -1
- package/dist/openai/types.js.map +1 -0
- package/dist/react/ApolloProvider.d.ts +6 -2
- package/dist/react/ApolloProvider.d.ts.map +1 -1
- package/dist/react/ApolloProvider.js +12 -27
- package/dist/react/ApolloProvider.js.map +1 -1
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +9 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mcp.d.ts +3 -0
- package/dist/react/index.mcp.d.ts.map +1 -0
- package/dist/react/index.mcp.js +3 -0
- package/dist/react/index.mcp.js.map +1 -0
- package/dist/react/index.openai.d.ts +3 -0
- package/dist/react/index.openai.d.ts.map +1 -0
- package/dist/react/index.openai.js +3 -0
- package/dist/react/index.openai.js.map +1 -0
- package/dist/react/missingHook.d.ts +2 -0
- package/dist/react/missingHook.d.ts.map +1 -0
- package/dist/react/missingHook.js +6 -0
- package/dist/react/missingHook.js.map +1 -0
- package/dist/tsconfig/core/tsconfig.json +5 -0
- package/dist/tsconfig/mcp/tsconfig.json +6 -0
- package/dist/tsconfig/openai/tsconfig.json +7 -0
- package/dist/types/application-manifest.d.ts +5 -1
- package/dist/types/application-manifest.d.ts.map +1 -1
- package/dist/types/application-manifest.js.map +1 -1
- package/dist/utilities/cacheAsync.d.ts +4 -0
- package/dist/utilities/cacheAsync.d.ts.map +1 -0
- package/dist/utilities/cacheAsync.js +19 -0
- package/dist/utilities/cacheAsync.js.map +1 -0
- package/dist/utilities/constants.d.ts +6 -0
- package/dist/utilities/constants.d.ts.map +1 -0
- package/dist/utilities/constants.js +6 -0
- package/dist/utilities/constants.js.map +1 -0
- package/dist/utilities/emptyModule.d.ts +2 -0
- package/dist/utilities/emptyModule.d.ts.map +1 -0
- package/dist/utilities/emptyModule.js +2 -0
- package/dist/utilities/emptyModule.js.map +1 -0
- package/dist/utilities/getVariablesForOperationFromToolInput.d.ts +5 -0
- package/dist/utilities/getVariablesForOperationFromToolInput.d.ts.map +1 -0
- package/dist/utilities/getVariablesForOperationFromToolInput.js +18 -0
- package/dist/utilities/getVariablesForOperationFromToolInput.js.map +1 -0
- package/dist/utilities/index.d.ts +6 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/index.js +6 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/invariant.d.ts +2 -0
- package/dist/utilities/invariant.d.ts.map +1 -0
- package/dist/utilities/invariant.js +6 -0
- package/dist/utilities/invariant.js.map +1 -0
- package/dist/utilities/promiseWithResolvers.d.ts +7 -0
- package/dist/utilities/promiseWithResolvers.d.ts.map +1 -0
- package/dist/utilities/promiseWithResolvers.js +16 -0
- package/dist/utilities/promiseWithResolvers.js.map +1 -0
- package/dist/vite/__tests__/utilities/build.d.ts +41 -0
- package/dist/vite/__tests__/utilities/build.d.ts.map +1 -0
- package/dist/vite/__tests__/utilities/build.js +63 -0
- package/dist/vite/__tests__/utilities/build.js.map +1 -0
- package/dist/vite/apolloClientAiApps.d.ts +14 -0
- package/dist/vite/apolloClientAiApps.d.ts.map +1 -0
- package/dist/vite/apolloClientAiApps.js +350 -0
- package/dist/vite/apolloClientAiApps.js.map +1 -0
- package/dist/vite/index.d.ts +1 -2
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +1 -2
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/utilities/config.d.ts +2 -0
- package/dist/vite/utilities/config.d.ts.map +1 -0
- package/dist/vite/utilities/config.js +11 -0
- package/dist/vite/utilities/config.js.map +1 -0
- package/dist/vite/utilities/graphql.d.ts +20 -0
- package/dist/vite/utilities/graphql.d.ts.map +1 -0
- package/dist/vite/utilities/graphql.js +42 -0
- package/dist/vite/utilities/graphql.js.map +1 -0
- package/knope.toml +1 -1
- package/package.json +105 -9
- package/src/config/defineConfig.ts +8 -0
- package/src/config/index.ts +2 -0
- package/src/config/schema.ts +73 -0
- package/src/config/types.ts +7 -0
- package/src/core/ApolloClient.ts +7 -95
- package/src/core/Platform.ts +27 -0
- package/src/core/types.ts +14 -0
- package/src/index.mcp.ts +5 -0
- package/src/index.openai.ts +5 -0
- package/src/index.ts +2 -27
- package/src/link/ToolCallLink.ts +6 -22
- package/src/mcp/core/ApolloClient.ts +102 -0
- package/src/mcp/core/McpAppManager.ts +98 -0
- package/src/mcp/core/Platform.ts +11 -0
- package/src/mcp/core/__tests__/ApolloClient.test.ts +464 -0
- package/src/mcp/index.ts +2 -0
- package/src/mcp/link/ToolCallLink.ts +40 -0
- package/src/mcp/link/__tests__/ToolCallLink.test.ts +53 -0
- package/src/mcp/react/hooks/__tests__/useApp.test.tsx +46 -0
- package/src/mcp/react/hooks/__tests__/useToolInput.test.tsx +50 -0
- package/src/mcp/react/hooks/__tests__/useToolMetadata.test.tsx +53 -0
- package/src/mcp/react/hooks/__tests__/useToolName.test.tsx +50 -0
- package/src/mcp/react/hooks/useApolloClient.ts +14 -0
- package/src/mcp/react/hooks/useApp.ts +5 -0
- package/src/mcp/react/hooks/useToolInput.ts +5 -0
- package/src/mcp/react/hooks/useToolMetadata.ts +5 -0
- package/src/mcp/react/hooks/useToolName.ts +5 -0
- package/src/mcp/react/index.ts +4 -0
- package/src/openai/core/ApolloClient.ts +100 -0
- package/src/openai/core/McpAppManager.ts +110 -0
- package/src/openai/core/Platform.ts +11 -0
- package/src/openai/core/__tests__/ApolloClient.test.ts +537 -0
- package/src/openai/globals.ts +14 -0
- package/src/openai/index.ts +2 -0
- package/src/openai/link/ToolCallLink.ts +40 -0
- package/src/{react → openai/react}/hooks/__tests__/useOpenAiGlobal.test.ts +1 -1
- package/src/openai/react/hooks/__tests__/useToolInput.test.tsx +85 -0
- package/src/openai/react/hooks/__tests__/useToolMetadata.test.tsx +86 -0
- package/src/openai/react/hooks/__tests__/useToolName.test.tsx +50 -0
- package/src/{react → openai/react}/hooks/__tests__/useWidgetState.test.tsx +1 -1
- package/src/openai/react/hooks/useApolloClient.ts +14 -0
- package/src/openai/react/hooks/useApp.ts +5 -0
- package/src/{react → openai/react}/hooks/useOpenAiGlobal.ts +2 -2
- package/src/openai/react/hooks/useToolInput.ts +5 -0
- package/src/openai/react/hooks/useToolMetadata.ts +5 -0
- package/src/openai/react/hooks/useToolName.ts +5 -0
- package/src/{react → openai/react}/hooks/useWidgetState.ts +1 -1
- package/src/openai/react/index.ts +5 -0
- package/src/{types/openai.ts → openai/types.ts} +9 -13
- package/src/react/ApolloProvider.tsx +23 -31
- package/src/react/__tests__/ApolloProvider/mcp.test.tsx +74 -0
- package/src/react/__tests__/ApolloProvider/openai.test.tsx +146 -0
- package/src/react/index.mcp.ts +7 -0
- package/src/react/index.openai.ts +7 -0
- package/src/react/index.ts +19 -0
- package/src/react/missingHook.ts +9 -0
- package/src/testing/internal/index.ts +8 -0
- package/src/testing/internal/matchers/index.ts +2 -0
- package/src/testing/internal/matchers/toComplete.ts +46 -0
- package/src/testing/internal/matchers/toEmitValue.ts +71 -0
- package/src/testing/internal/matchers/types.ts +3 -0
- package/src/testing/internal/mcp/graphqlToolResult.ts +31 -0
- package/src/testing/internal/mcp/minimalHostContextWithToolName.ts +9 -0
- package/src/testing/internal/mcp/mockMcpHost.ts +188 -0
- package/src/testing/internal/openai/dispatchStateChange.ts +1 -1
- package/src/testing/internal/openai/stubOpenAiGlobals.ts +22 -9
- package/src/testing/internal/react/renderAsync.ts +7 -0
- package/src/testing/internal/utilities/ObservableStream.ts +172 -0
- package/src/testing/internal/utilities/getSerializableProperties.ts +55 -0
- package/src/testing/internal/utilities/mockApplicationManifest.ts +39 -0
- package/src/testing/internal/utilities/spyOnConsole.ts +29 -0
- package/src/testing/internal/utilities/wait.ts +3 -0
- package/src/tsconfig/core/tsconfig.json +5 -0
- package/src/tsconfig/mcp/tsconfig.json +6 -0
- package/src/tsconfig/openai/tsconfig.json +7 -0
- package/src/types/application-manifest.ts +7 -1
- package/src/utilities/__tests__/cacheAsync.test.ts +64 -0
- package/src/utilities/cacheAsync.ts +25 -0
- package/src/utilities/constants.ts +5 -0
- package/src/utilities/emptyModule.ts +1 -0
- package/src/utilities/getVariablesForOperationFromToolInput.ts +27 -0
- package/src/utilities/index.ts +5 -0
- package/src/utilities/invariant.ts +5 -0
- package/src/utilities/promiseWithResolvers.ts +18 -0
- package/src/vite/__tests__/apolloClientAiApps.test.ts +1521 -0
- package/src/vite/__tests__/utilities/build.ts +72 -0
- package/src/vite/apolloClientAiApps.ts +515 -0
- package/src/vite/index.ts +1 -2
- package/src/vite/utilities/config.ts +13 -0
- package/src/vite/utilities/graphql.ts +123 -0
- package/tsconfig.base.json +2 -2
- package/tsconfig.vite.build.json +4 -1
- package/tsconfig.vite.json +8 -2
- package/vitest-setup.ts +28 -0
- package/dist/react/context/ToolUseContext.d.ts +0 -16
- package/dist/react/context/ToolUseContext.d.ts.map +0 -1
- package/dist/react/context/ToolUseContext.js +0 -11
- package/dist/react/context/ToolUseContext.js.map +0 -1
- package/dist/react/hooks/useCallTool.d.ts +0 -4
- package/dist/react/hooks/useCallTool.d.ts.map +0 -1
- package/dist/react/hooks/useCallTool.js +0 -5
- package/dist/react/hooks/useCallTool.js.map +0 -1
- package/dist/react/hooks/useOpenAiGlobal.d.ts +0 -3
- package/dist/react/hooks/useOpenAiGlobal.d.ts.map +0 -1
- package/dist/react/hooks/useOpenAiGlobal.js.map +0 -1
- package/dist/react/hooks/useOpenExternal.d.ts +0 -4
- package/dist/react/hooks/useOpenExternal.d.ts.map +0 -1
- package/dist/react/hooks/useOpenExternal.js +0 -5
- package/dist/react/hooks/useOpenExternal.js.map +0 -1
- package/dist/react/hooks/useRequestDisplayMode.d.ts +0 -7
- package/dist/react/hooks/useRequestDisplayMode.d.ts.map +0 -1
- package/dist/react/hooks/useRequestDisplayMode.js +0 -6
- package/dist/react/hooks/useRequestDisplayMode.js.map +0 -1
- package/dist/react/hooks/useSendFollowUpMessage.d.ts +0 -2
- package/dist/react/hooks/useSendFollowUpMessage.d.ts.map +0 -1
- package/dist/react/hooks/useSendFollowUpMessage.js +0 -8
- package/dist/react/hooks/useSendFollowUpMessage.js.map +0 -1
- package/dist/react/hooks/useToolEffect.d.ts +0 -3
- package/dist/react/hooks/useToolEffect.d.ts.map +0 -1
- package/dist/react/hooks/useToolEffect.js +0 -28
- package/dist/react/hooks/useToolEffect.js.map +0 -1
- package/dist/react/hooks/useToolInput.d.ts +0 -2
- package/dist/react/hooks/useToolInput.d.ts.map +0 -1
- package/dist/react/hooks/useToolInput.js +0 -6
- package/dist/react/hooks/useToolInput.js.map +0 -1
- package/dist/react/hooks/useToolName.d.ts.map +0 -1
- package/dist/react/hooks/useToolName.js +0 -6
- package/dist/react/hooks/useToolName.js.map +0 -1
- package/dist/react/hooks/useToolOutput.d.ts +0 -2
- package/dist/react/hooks/useToolOutput.d.ts.map +0 -1
- package/dist/react/hooks/useToolOutput.js +0 -5
- package/dist/react/hooks/useToolOutput.js.map +0 -1
- package/dist/react/hooks/useToolResponseMetadata.d.ts +0 -2
- package/dist/react/hooks/useToolResponseMetadata.d.ts.map +0 -1
- package/dist/react/hooks/useToolResponseMetadata.js +0 -5
- package/dist/react/hooks/useToolResponseMetadata.js.map +0 -1
- package/dist/react/hooks/useWidgetState.d.ts.map +0 -1
- package/dist/react/hooks/useWidgetState.js.map +0 -1
- package/dist/types/openai.d.ts.map +0 -1
- package/dist/types/openai.js.map +0 -1
- package/dist/vite/absolute_asset_imports_plugin.d.ts +0 -5
- package/dist/vite/absolute_asset_imports_plugin.d.ts.map +0 -1
- package/dist/vite/absolute_asset_imports_plugin.js +0 -17
- package/dist/vite/absolute_asset_imports_plugin.js.map +0 -1
- package/dist/vite/application_manifest_plugin.d.ts +0 -10
- package/dist/vite/application_manifest_plugin.d.ts.map +0 -1
- package/dist/vite/application_manifest_plugin.js +0 -317
- package/dist/vite/application_manifest_plugin.js.map +0 -1
- package/src/core/__tests__/ApolloClient.test.ts +0 -646
- package/src/react/__tests__/ApolloProvider.test.tsx +0 -41
- package/src/react/context/ToolUseContext.tsx +0 -31
- package/src/react/hooks/__tests__/useCallTool.test.ts +0 -46
- package/src/react/hooks/__tests__/useOpenExternal.test.tsx +0 -24
- package/src/react/hooks/__tests__/useRequestDisplayMode.test.ts +0 -17
- package/src/react/hooks/__tests__/useSendFollowUpMessage.test.ts +0 -15
- package/src/react/hooks/__tests__/useToolEffect.test.tsx +0 -67
- package/src/react/hooks/__tests__/useToolInput.test.ts +0 -13
- package/src/react/hooks/__tests__/useToolName.test.ts +0 -13
- package/src/react/hooks/__tests__/useToolOutput.test.tsx +0 -49
- package/src/react/hooks/__tests__/useToolResponseMetadata.test.tsx +0 -49
- package/src/react/hooks/useCallTool.ts +0 -13
- package/src/react/hooks/useOpenExternal.ts +0 -11
- package/src/react/hooks/useRequestDisplayMode.ts +0 -7
- package/src/react/hooks/useSendFollowUpMessage.ts +0 -7
- package/src/react/hooks/useToolEffect.tsx +0 -37
- package/src/react/hooks/useToolInput.ts +0 -7
- package/src/react/hooks/useToolName.ts +0 -7
- package/src/react/hooks/useToolOutput.ts +0 -5
- package/src/react/hooks/useToolResponseMetadata.ts +0 -5
- package/src/vite/__tests__/absolute_asset_imports_plugin.test.ts +0 -102
- package/src/vite/__tests__/application_manifest_plugin.test.ts +0 -1199
- package/src/vite/absolute_asset_imports_plugin.ts +0 -22
- package/src/vite/application_manifest_plugin.ts +0 -539
- /package/dist/{react → openai/react}/hooks/useToolName.d.ts +0 -0
- /package/dist/{react → openai/react}/hooks/useWidgetState.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/openai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/openai/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export { ApolloClient } from \"./core/ApolloClient.js\";\nexport { ToolCallLink } from \"./link/ToolCallLink.js\";\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ApolloLink, Observable } from "@apollo/client";
|
|
2
|
+
/**
|
|
3
|
+
* A terminating link that sends a GraphQL request through an agent tool call.
|
|
4
|
+
* When providing a custom link chain to `ApolloClient`, `ApolloClient` will
|
|
5
|
+
* validate that the terminating link is an instance of this link.
|
|
6
|
+
*
|
|
7
|
+
* @example Providing a custom link chain
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { ApolloLink } from "@apollo/client";
|
|
11
|
+
* import { ApolloClient, ToolCallLink } from "@apollo/client-ai-apps";
|
|
12
|
+
*
|
|
13
|
+
* const link = ApolloLink.from([
|
|
14
|
+
* ...otherLinks,
|
|
15
|
+
* new ToolCallLink()
|
|
16
|
+
* ]);
|
|
17
|
+
*
|
|
18
|
+
* const client = new ApolloClient({
|
|
19
|
+
* link,
|
|
20
|
+
* // ...
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class ToolCallLink extends ApolloLink {
|
|
25
|
+
readonly name = "ToolCallLink";
|
|
26
|
+
request(operation: ApolloLink.Operation): Observable<ApolloLink.Result>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=ToolCallLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolCallLink.d.ts","sourceRoot":"","sources":["../../../src/openai/link/ToolCallLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIxD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,YAAa,SAAQ,UAAU;IAC1C,QAAQ,CAAC,IAAI,kBAAkB;IAE/B,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC;CAUxE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ApolloLink, Observable } from "@apollo/client";
|
|
2
|
+
import { from } from "rxjs";
|
|
3
|
+
/**
|
|
4
|
+
* A terminating link that sends a GraphQL request through an agent tool call.
|
|
5
|
+
* When providing a custom link chain to `ApolloClient`, `ApolloClient` will
|
|
6
|
+
* validate that the terminating link is an instance of this link.
|
|
7
|
+
*
|
|
8
|
+
* @example Providing a custom link chain
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { ApolloLink } from "@apollo/client";
|
|
12
|
+
* import { ApolloClient, ToolCallLink } from "@apollo/client-ai-apps";
|
|
13
|
+
*
|
|
14
|
+
* const link = ApolloLink.from([
|
|
15
|
+
* ...otherLinks,
|
|
16
|
+
* new ToolCallLink()
|
|
17
|
+
* ]);
|
|
18
|
+
*
|
|
19
|
+
* const client = new ApolloClient({
|
|
20
|
+
* link,
|
|
21
|
+
* // ...
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export class ToolCallLink extends ApolloLink {
|
|
26
|
+
name = "ToolCallLink";
|
|
27
|
+
request(operation) {
|
|
28
|
+
const client = operation.client;
|
|
29
|
+
return from(client["appManager"].executeQuery({
|
|
30
|
+
query: operation.query,
|
|
31
|
+
variables: operation.variables,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=ToolCallLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolCallLink.js","sourceRoot":"","sources":["../../../src/openai/link/ToolCallLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,YAAa,SAAQ,UAAU;IACjC,IAAI,GAAG,cAAc,CAAC;IAE/B,OAAO,CAAC,SAA+B;QACrC,MAAM,MAAM,GAAG,SAAS,CAAC,MAA4B,CAAC;QAEtD,OAAO,IAAI,CACT,MAAM,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC;YAChC,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,SAAS,EAAE,SAAS,CAAC,SAAS;SAC/B,CAAC,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { ApolloLink, Observable } from \"@apollo/client\";\nimport { from } from \"rxjs\";\nimport type { ApolloClient as OpenAiApolloClient } from \"../core/ApolloClient\";\n\n/**\n * A terminating link that sends a GraphQL request through an agent tool call.\n * When providing a custom link chain to `ApolloClient`, `ApolloClient` will\n * validate that the terminating link is an instance of this link.\n *\n * @example Providing a custom link chain\n *\n * ```ts\n * import { ApolloLink } from \"@apollo/client\";\n * import { ApolloClient, ToolCallLink } from \"@apollo/client-ai-apps\";\n *\n * const link = ApolloLink.from([\n * ...otherLinks,\n * new ToolCallLink()\n * ]);\n *\n * const client = new ApolloClient({\n * link,\n * // ...\n * });\n * ```\n */\nexport class ToolCallLink extends ApolloLink {\n readonly name = \"ToolCallLink\";\n\n request(operation: ApolloLink.Operation): Observable<ApolloLink.Result> {\n const client = operation.client as OpenAiApolloClient;\n\n return from(\n client[\"appManager\"].executeQuery({\n query: operation.query,\n variables: operation.variables,\n })\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useApolloClient.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,YAAY,gBAStD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useApolloClient as useBaseApolloClient } from "@apollo/client/react";
|
|
2
|
+
import { ApolloClient } from "../../core/ApolloClient.js";
|
|
3
|
+
import { aiClientSymbol, invariant } from "../../../utilities/index.js";
|
|
4
|
+
export function useApolloClient(override) {
|
|
5
|
+
const client = useBaseApolloClient(override);
|
|
6
|
+
invariant(client[aiClientSymbol], 'The "client" instance provided to <ApolloProvider /> is the wrong instance. You might have imported `ApolloClient` from `@apollo/client`. Please import `ApolloClient` from `@apollo/client-ai-apps` instead.');
|
|
7
|
+
return client;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=useApolloClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useApolloClient.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useApolloClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,UAAU,eAAe,CAAC,QAAuB;IACrD,MAAM,MAAM,GAAG,mBAAmB,CAAC,QAAQ,CAAiB,CAAC;IAE7D,SAAS,CACP,MAAM,CAAC,cAAc,CAAC,EACtB,+MAA+M,CAChN,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { useApolloClient as useBaseApolloClient } from \"@apollo/client/react\";\nimport { ApolloClient } from \"../../core/ApolloClient.js\";\nimport { aiClientSymbol, invariant } from \"../../../utilities/index.js\";\n\nexport function useApolloClient(override?: ApolloClient) {\n const client = useBaseApolloClient(override) as ApolloClient;\n\n invariant(\n client[aiClientSymbol],\n 'The \"client\" instance provided to <ApolloProvider /> is the wrong instance. You might have imported `ApolloClient` from `@apollo/client`. Please import `ApolloClient` from `@apollo/client-ai-apps` instead.'\n );\n\n return client;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useApp.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useApp.ts"],"names":[],"mappings":"AAEA,wBAAgB,MAAM,iDAErB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useApp.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,UAAU,MAAM;IACpB,OAAO,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC;AAC7C,CAAC","sourcesContent":["import { useApolloClient } from \"./useApolloClient.js\";\n\nexport function useApp() {\n return useApolloClient()[\"appManager\"].app;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOpenAiGlobal.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useOpenAiGlobal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGrE,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,aAAa,EAC3D,GAAG,EAAE,CAAC,GACL,aAAa,CAAC,CAAC,CAAC,CAsBlB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSyncExternalStore, useCallback } from "react";
|
|
2
|
-
import { SET_GLOBALS_EVENT_TYPE } from "../../types
|
|
2
|
+
import { SET_GLOBALS_EVENT_TYPE } from "../../types.js";
|
|
3
3
|
export function useOpenAiGlobal(key) {
|
|
4
4
|
return useSyncExternalStore(useCallback((onChange) => {
|
|
5
5
|
const handleSetGlobal = (event) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOpenAiGlobal.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useOpenAiGlobal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,UAAU,eAAe,CAC7B,GAAM;IAEN,OAAO,oBAAoB,CACzB,WAAW,CAAC,CAAC,QAAQ,EAAE,EAAE;QACvB,MAAM,eAAe,GAAG,CAAC,KAAsB,EAAE,EAAE;YACjD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO;YACT,CAAC;YAED,QAAQ,EAAE,CAAC;QACb,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,eAAe,EAAE;YAC/D,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,sBAAsB,EAAE,eAAe,CAAC,CAAC;QACtE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,EACN,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import { useSyncExternalStore, useCallback } from \"react\";\nimport type { SetGlobalsEvent, OpenAiGlobals } from \"../../types.js\";\nimport { SET_GLOBALS_EVENT_TYPE } from \"../../types.js\";\n\nexport function useOpenAiGlobal<K extends keyof OpenAiGlobals>(\n key: K\n): OpenAiGlobals[K] {\n return useSyncExternalStore(\n useCallback((onChange) => {\n const handleSetGlobal = (event: SetGlobalsEvent) => {\n const value = event.detail.globals[key];\n if (value === undefined) {\n return;\n }\n\n onChange();\n };\n\n window.addEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobal, {\n passive: true,\n });\n\n return () => {\n window.removeEventListener(SET_GLOBALS_EVENT_TYPE, handleSetGlobal);\n };\n }, []),\n () => window.openai[key]\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolInput.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolInput.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,wCAE3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolInput.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,UAAU,YAAY;IAC1B,OAAO,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC","sourcesContent":["import { useApolloClient } from \"./useApolloClient.js\";\n\nexport function useToolInput() {\n return useApolloClient()[\"appManager\"].toolInput;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolMetadata.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolMetadata.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,mCAE9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolMetadata.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,UAAU,eAAe;IAC7B,OAAO,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC;AACtD,CAAC","sourcesContent":["import { useApolloClient } from \"./useApolloClient.js\";\n\nexport function useToolMetadata() {\n return useApolloClient()[\"appManager\"].toolMetadata;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolName.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,0BAEvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToolName.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useToolName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,OAAO,eAAe,EAAE,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC;AAClD,CAAC,CAAC","sourcesContent":["import { useApolloClient } from \"./useApolloClient.js\";\n\nexport const useToolName = () => {\n return useApolloClient()[\"appManager\"].toolName;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SetStateAction } from "react";
|
|
2
|
-
import type { UnknownObject } from "../../types
|
|
2
|
+
import type { UnknownObject } from "../../types.js";
|
|
3
3
|
export declare function useWidgetState<T extends UnknownObject>(defaultState: T | (() => T)): readonly [T, (state: SetStateAction<T>) => void];
|
|
4
4
|
export declare function useWidgetState<T extends UnknownObject>(defaultState?: T | (() => T | null) | null): readonly [T | null, (state: SetStateAction<T | null>) => void];
|
|
5
5
|
//# sourceMappingURL=useWidgetState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWidgetState.d.ts","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useWidgetState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGpD,wBAAgB,cAAc,CAAC,CAAC,SAAS,aAAa,EACpD,YAAY,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAC1B,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;AAEpD,wBAAgB,cAAc,CAAC,CAAC,SAAS,aAAa,EACpD,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,GACzC,SAAS,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWidgetState.js","sourceRoot":"","sources":["../../../../src/openai/react/hooks/useWidgetState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAUvD,MAAM,UAAU,cAAc,CAC5B,YAA0C;IAE1C,MAAM,qBAAqB,GAAG,eAAe,CAAC,aAAa,CAAM,CAAC;IAClE,MAAM,CAAC,6BAA6B,EAAE,gCAAgC,CAAC,GACrE,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IAElC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAW,GAAG,EAAE;QAC3D,IAAI,qBAAqB,IAAI,IAAI,EAAE,CAAC;YAClC,OAAO,qBAAqB,CAAC;QAC/B,CAAC;QAED,OAAO,OAAO,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CACzD,CAAC,YAAY,IAAI,IAAI,CAAC,CACvB,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,IAAI,6BAA6B,KAAK,qBAAqB,EAAE,CAAC;QAC5D,eAAe,CAAC,CAAC,WAAW,GAAG,qBAAqB,CAAC,CAAC,CAAC;QACvD,gCAAgC,CAAC,qBAAqB,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,cAAc,GAAG,WAAW,CAAC,CAAC,KAA+B,EAAE,EAAE;QACrE,eAAe,CAAC,CAAC,SAAS,EAAE,EAAE;YAC5B,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YAExE,IAAI,QAAQ,IAAI,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;gBACtD,KAAK,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,QAAQ,CAAC,CAAC;YACjD,CAAC;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AACvC,CAAC","sourcesContent":["import type { SetStateAction } from \"react\";\nimport { useCallback, useState } from \"react\";\nimport type { UnknownObject } from \"../../types.js\";\nimport { useOpenAiGlobal } from \"./useOpenAiGlobal.js\";\n\nexport function useWidgetState<T extends UnknownObject>(\n defaultState: T | (() => T)\n): readonly [T, (state: SetStateAction<T>) => void];\n\nexport function useWidgetState<T extends UnknownObject>(\n defaultState?: T | (() => T | null) | null\n): readonly [T | null, (state: SetStateAction<T | null>) => void];\n\nexport function useWidgetState<T extends UnknownObject>(\n defaultState?: T | (() => T | null) | null\n): readonly [T | null, (state: SetStateAction<T | null>) => void] {\n const widgetStateFromWindow = useOpenAiGlobal(\"widgetState\") as T;\n const [previousWidgetStateFromWindow, setPreviousWidgetStateFromWindow] =\n useState(widgetStateFromWindow);\n\n let [widgetState, _setWidgetState] = useState<T | null>(() => {\n if (widgetStateFromWindow != null) {\n return widgetStateFromWindow;\n }\n\n return typeof defaultState === \"function\" ? defaultState() : (\n (defaultState ?? null)\n );\n });\n\n if (previousWidgetStateFromWindow !== widgetStateFromWindow) {\n _setWidgetState((widgetState = widgetStateFromWindow));\n setPreviousWidgetStateFromWindow(widgetStateFromWindow);\n }\n\n const setWidgetState = useCallback((state: SetStateAction<T | null>) => {\n _setWidgetState((prevState) => {\n const newState = typeof state === \"function\" ? state(prevState) : state;\n\n if (newState != null && typeof window !== \"undefined\") {\n void window.openai?.setWidgetState?.(newState);\n }\n\n return newState;\n });\n }, []);\n\n return [widgetState, setWidgetState];\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useApp } from "./hooks/useApp.js";
|
|
2
|
+
export { useToolName } from "./hooks/useToolName.js";
|
|
3
|
+
export { useToolMetadata } from "./hooks/useToolMetadata.js";
|
|
4
|
+
export { useToolInput } from "./hooks/useToolInput.js";
|
|
5
|
+
export { useWidgetState } from "./hooks/useWidgetState.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/openai/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { useApp } from "./hooks/useApp.js";
|
|
2
|
+
export { useToolName } from "./hooks/useToolName.js";
|
|
3
|
+
export { useToolMetadata } from "./hooks/useToolMetadata.js";
|
|
4
|
+
export { useToolInput } from "./hooks/useToolInput.js";
|
|
5
|
+
export { useWidgetState } from "./hooks/useWidgetState.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openai/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["export { useApp } from \"./hooks/useApp.js\";\nexport { useToolName } from \"./hooks/useToolName.js\";\nexport { useToolMetadata } from \"./hooks/useToolMetadata.js\";\nexport { useToolInput } from \"./hooks/useToolInput.js\";\nexport { useWidgetState } from \"./hooks/useWidgetState.js\";\n"]}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
+
import type { ApolloMcpServerApps } from "../core/types";
|
|
1
2
|
export type UnknownObject = Record<string, unknown>;
|
|
2
|
-
|
|
3
|
-
interface Window {
|
|
4
|
-
openai: API<any> & OpenAiGlobals;
|
|
5
|
-
}
|
|
6
|
-
interface WindowEventMap {
|
|
7
|
-
[SET_GLOBALS_EVENT_TYPE]: SetGlobalsEvent;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export type OpenAiGlobals<ToolInput extends UnknownObject = UnknownObject, ToolOutput extends UnknownObject = UnknownObject, ToolResponseMetadata extends UnknownObject = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
|
|
3
|
+
export type OpenAiGlobals<ToolInput extends UnknownObject = UnknownObject, ToolOutput = ApolloMcpServerApps.StructuredContent, ToolResponseMetadata = UnknownObject, WidgetState extends UnknownObject = UnknownObject> = {
|
|
11
4
|
theme: Theme;
|
|
12
5
|
userAgent: UserAgent;
|
|
13
6
|
locale: string;
|
|
@@ -48,7 +41,10 @@ export declare class SetGlobalsEvent extends CustomEvent<{
|
|
|
48
41
|
}> {
|
|
49
42
|
readonly type = "openai:set_globals";
|
|
50
43
|
}
|
|
51
|
-
export type CallTool = (name: string, args: Record<string, unknown>) => Promise<
|
|
44
|
+
export type CallTool = (name: string, args: Record<string, unknown>) => Promise<CallToolResponse>;
|
|
45
|
+
export type CallToolResponse = {
|
|
46
|
+
result: string;
|
|
47
|
+
};
|
|
52
48
|
export type DisplayMode = "pip" | "inline" | "fullscreen";
|
|
53
49
|
export type Theme = "light" | "dark";
|
|
54
50
|
export type SafeAreaInsets = {
|
|
@@ -70,4 +66,4 @@ export type UserAgent = {
|
|
|
70
66
|
touch: boolean;
|
|
71
67
|
};
|
|
72
68
|
};
|
|
73
|
-
//# sourceMappingURL=
|
|
69
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/openai/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD,MAAM,MAAM,aAAa,CACvB,SAAS,SAAS,aAAa,GAAG,aAAa,EAC/C,UAAU,GAAG,mBAAmB,CAAC,iBAAiB,EAClD,oBAAoB,GAAG,aAAa,EACpC,WAAW,SAAS,aAAa,GAAG,aAAa,IAC/C;IACF,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;IAGnB,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClD,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,WAAW,SAAS,aAAa,IAAI;IACnD,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAExE,2DAA2D;IAC3D,mBAAmB,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE,+DAA+D;IAC/D,YAAY,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAE9C,gEAAgE;IAChE,kBAAkB,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC;QAC3D;;;WAGG;QACH,IAAI,EAAE,WAAW,CAAC;KACnB,CAAC,CAAC;IAEH,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC;AAGF,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAC3D,qBAAa,eAAgB,SAAQ,WAAW,CAAC;IAC/C,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACjC,CAAC;IACA,QAAQ,CAAC,IAAI,wBAA0B;CACxC;AAED,MAAM,MAAM,QAAQ,GAAG,CACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE/B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE1D,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAErE,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC;IAC7B,YAAY,EAAE;QACZ,KAAK,EAAE,OAAO,CAAC;QACf,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/openai/types.ts"],"names":[],"mappings":"AAgDA,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,OAAO,eAAgB,SAAQ,WAEnC;IACS,IAAI,GAAG,sBAAsB,CAAC;CACxC","sourcesContent":["import type { ApolloMcpServerApps } from \"../core/types\";\n\nexport type UnknownObject = Record<string, unknown>;\n\nexport type OpenAiGlobals<\n ToolInput extends UnknownObject = UnknownObject,\n ToolOutput = ApolloMcpServerApps.StructuredContent,\n ToolResponseMetadata = UnknownObject,\n WidgetState extends UnknownObject = UnknownObject,\n> = {\n theme: Theme;\n userAgent: UserAgent;\n locale: string;\n\n // layout\n maxHeight: number;\n displayMode: DisplayMode;\n safeArea: SafeArea;\n\n // state\n toolInput: ToolInput;\n toolOutput: ToolOutput | null;\n toolResponseMetadata: ToolResponseMetadata | null;\n widgetState: WidgetState | null;\n};\n\nexport type API<WidgetState extends UnknownObject> = {\n /** Calls a tool on your MCP. Returns the full response. */\n callTool: (name: string, args: Record<string, unknown>) => Promise<any>;\n\n /** Triggers a followup turn in the ChatGPT conversation */\n sendFollowUpMessage: (args: { prompt: string }) => Promise<void>;\n\n /** Opens an external link, redirects web page or mobile app */\n openExternal(payload: { href: string }): void;\n\n /** For transitioning an app from inline to fullscreen or pip */\n requestDisplayMode: (args: { mode: DisplayMode }) => Promise<{\n /**\n * The granted display mode. The host may reject the request.\n * For mobile, PiP is always coerced to fullscreen.\n */\n mode: DisplayMode;\n }>;\n\n setWidgetState: (state: WidgetState) => Promise<void>;\n};\n\n// Dispatched when any global changes in the host page\nexport const SET_GLOBALS_EVENT_TYPE = \"openai:set_globals\";\nexport class SetGlobalsEvent extends CustomEvent<{\n globals: Partial<OpenAiGlobals>;\n}> {\n readonly type = SET_GLOBALS_EVENT_TYPE;\n}\n\nexport type CallTool = (\n name: string,\n args: Record<string, unknown>\n) => Promise<CallToolResponse>;\n\nexport type CallToolResponse = {\n result: string;\n};\n\nexport type DisplayMode = \"pip\" | \"inline\" | \"fullscreen\";\n\nexport type Theme = \"light\" | \"dark\";\n\nexport type SafeAreaInsets = {\n top: number;\n bottom: number;\n left: number;\n right: number;\n};\n\nexport type SafeArea = {\n insets: SafeAreaInsets;\n};\n\nexport type DeviceType = \"mobile\" | \"tablet\" | \"desktop\" | \"unknown\";\n\nexport type UserAgent = {\n device: { type: DeviceType };\n capabilities: {\n hover: boolean;\n touch: boolean;\n };\n};\n"]}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { ApolloClient as OpenAiApolloClient } from "../openai/core/ApolloClient.js";
|
|
3
|
+
import { ApolloClient as McpApolloClient } from "../mcp/core/ApolloClient.js";
|
|
4
|
+
import type { ApolloClient as FallbackApolloClient } from "../core/ApolloClient.js";
|
|
5
|
+
type ApolloClient = OpenAiApolloClient | McpApolloClient | FallbackApolloClient;
|
|
3
6
|
export declare namespace ApolloProvider {
|
|
4
7
|
interface Props {
|
|
5
8
|
children?: ReactNode;
|
|
6
9
|
client: ApolloClient;
|
|
7
10
|
}
|
|
8
11
|
}
|
|
9
|
-
export declare
|
|
12
|
+
export declare function ApolloProvider({ children, client }: ApolloProvider.Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
10
14
|
//# sourceMappingURL=ApolloProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloProvider.d.ts","sourceRoot":"","sources":["../../src/react/ApolloProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ApolloProvider.d.ts","sourceRoot":"","sources":["../../src/react/ApolloProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAIpF,KAAK,YAAY,GAAG,kBAAkB,GAAG,eAAe,GAAG,oBAAoB,CAAC;AAEhF,MAAM,CAAC,OAAO,WAAW,cAAc,CAAC;IACtC,UAAiB,KAAK;QACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;QACrB,MAAM,EAAE,YAAY,CAAC;KACtB;CACF;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,cAAc,CAAC,KAAK,2CAexE"}
|
|
@@ -1,30 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { use } from "react";
|
|
3
3
|
import { ApolloProvider as BaseApolloProvider } from "@apollo/client/react";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
window.addEventListener(SET_GLOBALS_EVENT_TYPE, prefetchData, {
|
|
17
|
-
passive: true,
|
|
18
|
-
});
|
|
19
|
-
if (window.openai?.toolOutput) {
|
|
20
|
-
window.dispatchEvent(new CustomEvent(SET_GLOBALS_EVENT_TYPE));
|
|
21
|
-
}
|
|
22
|
-
return () => {
|
|
23
|
-
window.removeEventListener(SET_GLOBALS_EVENT_TYPE, prefetchData);
|
|
24
|
-
};
|
|
25
|
-
}, []);
|
|
26
|
-
return hasPreloaded ?
|
|
27
|
-
_jsx(BaseApolloProvider, { client: client, children: children })
|
|
28
|
-
: null;
|
|
29
|
-
};
|
|
4
|
+
import { ApolloClient as OpenAiApolloClient } from "../openai/core/ApolloClient.js";
|
|
5
|
+
import { ApolloClient as McpApolloClient } from "../mcp/core/ApolloClient.js";
|
|
6
|
+
import { __DEV__ } from "@apollo/client/utilities/environment";
|
|
7
|
+
import { aiClientSymbol, invariant } from "../utilities/index.js";
|
|
8
|
+
export function ApolloProvider({ children, client }) {
|
|
9
|
+
if (__DEV__) {
|
|
10
|
+
invariant(client[aiClientSymbol], 'The "client" instance provided to <ApolloProvider /> is the wrong instance. You might have imported `ApolloClient` from `@apollo/client`. Please import `ApolloClient` from `@apollo/client-ai-apps` instead.');
|
|
11
|
+
}
|
|
12
|
+
use(client.waitForInitialization());
|
|
13
|
+
return (_jsx(BaseApolloProvider, { client: client, children: children }));
|
|
14
|
+
}
|
|
30
15
|
//# sourceMappingURL=ApolloProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../src/react/ApolloProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../src/react/ApolloProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9E,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAWlE,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAwB;IACvE,IAAI,OAAO,EAAE,CAAC;QACZ,SAAS,CACP,MAAM,CAAC,cAAc,CAAC,EACtB,+MAA+M,CAChN,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,CAAC;IAEpC,OAAO,CACL,KAAC,kBAAkB,IAAC,MAAM,EAAE,MAA0B,YACnD,QAAQ,GACU,CACtB,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { use } from \"react\";\nimport { ApolloProvider as BaseApolloProvider } from \"@apollo/client/react\";\nimport type { ApolloClient as BaseApolloClient } from \"@apollo/client\";\nimport { ApolloClient as OpenAiApolloClient } from \"../openai/core/ApolloClient.js\";\nimport { ApolloClient as McpApolloClient } from \"../mcp/core/ApolloClient.js\";\nimport type { ApolloClient as FallbackApolloClient } from \"../core/ApolloClient.js\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { aiClientSymbol, invariant } from \"../utilities/index.js\";\n\ntype ApolloClient = OpenAiApolloClient | McpApolloClient | FallbackApolloClient;\n\nexport declare namespace ApolloProvider {\n export interface Props {\n children?: ReactNode;\n client: ApolloClient;\n }\n}\n\nexport function ApolloProvider({ children, client }: ApolloProvider.Props) {\n if (__DEV__) {\n invariant(\n client[aiClientSymbol],\n 'The \"client\" instance provided to <ApolloProvider /> is the wrong instance. You might have imported `ApolloClient` from `@apollo/client`. Please import `ApolloClient` from `@apollo/client-ai-apps` instead.'\n );\n }\n\n use(client.waitForInitialization());\n\n return (\n <BaseApolloProvider client={client as BaseApolloClient}>\n {children}\n </BaseApolloProvider>\n );\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ApolloProvider } from "./ApolloProvider.js";
|
|
2
|
+
export declare const useApp: typeof import("./index.mcp.js").useApp;
|
|
3
|
+
export declare const useToolInput: typeof import("./index.mcp.js").useToolInput;
|
|
4
|
+
export declare const useToolMetadata: typeof import("./index.mcp.js").useToolMetadata;
|
|
5
|
+
export declare const useToolName: typeof import("./index.mcp.js").useToolName;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrD,eAAO,MAAM,MAAM,wCAC4C,CAAC;AAEhE,eAAO,MAAM,YAAY,8CACkD,CAAC;AAE5E,eAAO,MAAM,eAAe,iDAGzB,CAAC;AAEJ,eAAO,MAAM,WAAW,6CACiD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { missingHook } from "./missingHook.js";
|
|
2
|
+
export { ApolloProvider } from "./ApolloProvider.js";
|
|
3
|
+
// Use `mcp` related types since these are the most common between the two
|
|
4
|
+
// targets
|
|
5
|
+
export const useApp = missingHook("useApp");
|
|
6
|
+
export const useToolInput = missingHook("useToolInput");
|
|
7
|
+
export const useToolMetadata = missingHook("useToolMetadata");
|
|
8
|
+
export const useToolName = missingHook("useToolName");
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,0EAA0E;AAC1E,UAAU;AACV,MAAM,CAAC,MAAM,MAAM,GACjB,WAAW,CAAyC,QAAQ,CAAC,CAAC;AAEhE,MAAM,CAAC,MAAM,YAAY,GACvB,WAAW,CAA+C,cAAc,CAAC,CAAC;AAE5E,MAAM,CAAC,MAAM,eAAe,GAC1B,WAAW,CACT,iBAAiB,CAClB,CAAC;AAEJ,MAAM,CAAC,MAAM,WAAW,GACtB,WAAW,CAA8C,aAAa,CAAC,CAAC","sourcesContent":["import { missingHook } from \"./missingHook.js\";\n\nexport { ApolloProvider } from \"./ApolloProvider.js\";\n\n// Use `mcp` related types since these are the most common between the two\n// targets\nexport const useApp =\n missingHook<typeof import(\"./index.mcp.js\").useApp>(\"useApp\");\n\nexport const useToolInput =\n missingHook<typeof import(\"./index.mcp.js\").useToolInput>(\"useToolInput\");\n\nexport const useToolMetadata =\n missingHook<typeof import(\"./index.mcp.js\").useToolMetadata>(\n \"useToolMetadata\"\n );\n\nexport const useToolName =\n missingHook<typeof import(\"./index.mcp.js\").useToolName>(\"useToolName\");\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mcp.d.ts","sourceRoot":"","sources":["../../src/react/index.mcp.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,eAAe,EACf,WAAW,GACZ,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mcp.js","sourceRoot":"","sources":["../../src/react/index.mcp.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,eAAe,EACf,WAAW,GACZ,MAAM,uBAAuB,CAAC","sourcesContent":["export * from \"./index.js\";\nexport {\n useApp,\n useToolInput,\n useToolMetadata,\n useToolName,\n} from \"../mcp/react/index.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.openai.d.ts","sourceRoot":"","sources":["../../src/react/index.openai.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.openai.js","sourceRoot":"","sources":["../../src/react/index.openai.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,eAAe,EACf,WAAW,GACZ,MAAM,0BAA0B,CAAC","sourcesContent":["export * from \"./index.js\";\nexport {\n useApp,\n useToolInput,\n useToolMetadata,\n useToolName,\n} from \"../openai/react/index.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingHook.d.ts","sourceRoot":"","sources":["../../src/react/missingHook.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,MAAM,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAChE,IAAI,EAAE,MAAM,GAMK,MAAM,CACxB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function missingHook(name) {
|
|
2
|
+
return (() => {
|
|
3
|
+
throw new Error(`Cannot use the '${name}' hook without export conditions. Please set export conditions or import from the \`/openai\` or \`/mcp\` subpath directly.`);
|
|
4
|
+
});
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=missingHook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingHook.js","sourceRoot":"","sources":["../../src/react/missingHook.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CACzB,IAAY;IAEZ,OAAO,CAAC,GAAG,EAAE;QACX,MAAM,IAAI,KAAK,CACb,mBAAmB,IAAI,6HAA6H,CACrJ,CAAC;IACJ,CAAC,CAAsB,CAAC;AAC1B,CAAC","sourcesContent":["export function missingHook<HookFn extends (...args: any[]) => any>(\n name: string\n) {\n return (() => {\n throw new Error(\n `Cannot use the '${name}' hook without export conditions. Please set export conditions or import from the \\`/openai\\` or \\`/mcp\\` subpath directly.`\n );\n }) as unknown as HookFn;\n}\n"]}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
export type ApplicationManifest = {
|
|
2
2
|
format: "apollo-ai-app-manifest";
|
|
3
3
|
version: "1";
|
|
4
|
+
appVersion: string;
|
|
4
5
|
name: string;
|
|
5
6
|
description: string;
|
|
6
7
|
hash: string;
|
|
7
|
-
resource: string
|
|
8
|
+
resource: string | {
|
|
9
|
+
mcp?: string;
|
|
10
|
+
openai?: string;
|
|
11
|
+
};
|
|
8
12
|
operations: ManifestOperation[];
|
|
9
13
|
csp: ManifestCsp;
|
|
10
14
|
widgetSettings?: ManifestWidgetSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-manifest.d.ts","sourceRoot":"","sources":["../../src/types/application-manifest.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,wBAAwB,CAAC;IACjC,OAAO,EAAE,GAAG,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"application-manifest.d.ts","sourceRoot":"","sources":["../../src/types/application-manifest.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,wBAAwB,CAAC;IACjC,OAAO,EAAE,GAAG,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EACJ,MAAM,GACN;QACE,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACN,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,GAAG,EAAE,WAAW,CAAC;IACjB,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/C,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-manifest.js","sourceRoot":"","sources":["../../src/types/application-manifest.ts"],"names":[],"mappings":"","sourcesContent":["export type ApplicationManifest = {\n format: \"apollo-ai-app-manifest\";\n version: \"1\";\n name: string;\n description: string;\n hash: string;\n resource
|
|
1
|
+
{"version":3,"file":"application-manifest.js","sourceRoot":"","sources":["../../src/types/application-manifest.ts"],"names":[],"mappings":"","sourcesContent":["export type ApplicationManifest = {\n format: \"apollo-ai-app-manifest\";\n version: \"1\";\n appVersion: string;\n name: string;\n description: string;\n hash: string;\n resource:\n | string\n | {\n mcp?: string;\n openai?: string;\n };\n operations: ManifestOperation[];\n csp: ManifestCsp;\n widgetSettings?: ManifestWidgetSettings;\n labels?: ManifestLabels;\n};\n\nexport type ManifestOperation = {\n id: string;\n name: string;\n type: \"query\" | \"mutation\";\n body: string;\n variables?: Record<string, string | undefined>;\n prefetch: boolean;\n prefetchID?: string;\n tools: ManifestTool[];\n};\n\nexport type ManifestTool = {\n name: string;\n description: string;\n extraInputs?: ManifestExtraInput[];\n labels?: ManifestLabels;\n};\n\nexport type ManifestWidgetSettings = {\n description?: string;\n domain?: string;\n prefersBorder?: boolean;\n};\n\nexport type ManifestExtraInput = {\n name: string;\n description: string;\n type: \"string\" | \"boolean\" | \"number\";\n};\n\nexport type ManifestCsp = {\n connectDomains: string[];\n frameDomains: string[];\n redirectDomains: string[];\n resourceDomains: string[];\n};\n\nexport type ManifestLabels = {\n \"toolInvocation/invoking\"?: string;\n \"toolInvocation/invoked\"?: string;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheAsync.d.ts","sourceRoot":"","sources":["../../src/utilities/cacheAsync.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,KAAK,SAAS,GAAG,EAAE,EAAE,OAAO,EACrD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,cAK5B,KAAK,KAAG,OAAO,CAAC,OAAO,CAAC;;EAarC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// NOTE: This is a simplified cache function that does not handles variances in
|
|
2
|
+
// arguments. For a more robust implementation, we would want to consider
|
|
3
|
+
// caching based on input so it works more similarly to a memoization cache. For
|
|
4
|
+
// that we can use `@sry/trie`. That is overkill for our use now, but if this
|
|
5
|
+
// needs to be more robust later, let's implement the cache with that package.
|
|
6
|
+
export function cacheAsync(fn) {
|
|
7
|
+
let promise;
|
|
8
|
+
return Object.assign((...args) => {
|
|
9
|
+
if (promise) {
|
|
10
|
+
return promise;
|
|
11
|
+
}
|
|
12
|
+
return (promise = fn(...args));
|
|
13
|
+
}, {
|
|
14
|
+
reset: () => {
|
|
15
|
+
promise = undefined;
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=cacheAsync.js.map
|