@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
|
+
* @apollographql/ai-apps
|
|
@@ -78,4 +78,26 @@ jobs:
|
|
|
78
78
|
|
|
79
79
|
- name: Check types
|
|
80
80
|
shell: bash
|
|
81
|
-
run: npm test
|
|
81
|
+
run: npm test -- --coverage
|
|
82
|
+
|
|
83
|
+
arethetypeswrong:
|
|
84
|
+
name: Are the types wrong
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
steps:
|
|
87
|
+
- name: Checkout repo
|
|
88
|
+
uses: actions/checkout@v4
|
|
89
|
+
|
|
90
|
+
- name: Setup Node.js
|
|
91
|
+
uses: actions/setup-node@v4
|
|
92
|
+
with:
|
|
93
|
+
node-version: 24.x
|
|
94
|
+
|
|
95
|
+
- name: Install dependencies
|
|
96
|
+
run: npm ci
|
|
97
|
+
|
|
98
|
+
- name: Run build
|
|
99
|
+
run: npm run build
|
|
100
|
+
|
|
101
|
+
- name: Run AreTheTypesWrong
|
|
102
|
+
id: attw
|
|
103
|
+
run: npm run attw -- --format ascii > $GITHUB_STEP_SUMMARY
|
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
release:
|
|
15
15
|
name: Release
|
|
16
16
|
# Important: Only run this when we've merged a "release/*" PR into main... all other PRs should be skipped.
|
|
17
|
-
if: github.repository == 'apollographql/apollo-ai-apps
|
|
17
|
+
if: github.repository == 'apollographql/apollo-client-ai-apps' && (github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/'))
|
|
18
18
|
runs-on: ubuntu-latest
|
|
19
19
|
steps:
|
|
20
20
|
- uses: actions/checkout@v6
|
|
@@ -35,10 +35,6 @@ jobs:
|
|
|
35
35
|
shell: bash
|
|
36
36
|
run: npm run build
|
|
37
37
|
|
|
38
|
-
- name: Test
|
|
39
|
-
shell: bash
|
|
40
|
-
run: npm run test
|
|
41
|
-
|
|
42
38
|
- name: Configure Git
|
|
43
39
|
run: |
|
|
44
40
|
git config --global user.name GitHub Actions
|
|
@@ -2,11 +2,10 @@ name: Verify Changeset
|
|
|
2
2
|
on:
|
|
3
3
|
pull_request:
|
|
4
4
|
types: [opened, reopened, synchronize, ready_for_review, labeled]
|
|
5
|
-
paths
|
|
6
|
-
- "
|
|
7
|
-
- "
|
|
8
|
-
- "
|
|
9
|
-
- "*.md"
|
|
5
|
+
paths:
|
|
6
|
+
- "src/**"
|
|
7
|
+
- "tsconfig.*"
|
|
8
|
+
- "package.json"
|
|
10
9
|
workflow_dispatch:
|
|
11
10
|
|
|
12
11
|
jobs:
|
|
@@ -32,27 +31,119 @@ jobs:
|
|
|
32
31
|
f.filename.startsWith(dir) &&
|
|
33
32
|
['added','modified','renamed'].includes(f.status)
|
|
34
33
|
);
|
|
35
|
-
if (
|
|
36
|
-
core.setFailed(`No changeset added to ${dir}.`);
|
|
37
|
-
} else {
|
|
34
|
+
if (ok) {
|
|
38
35
|
core.info(`Changeset found under ${dir}.`);
|
|
36
|
+
} else {
|
|
37
|
+
core.setFailed(`No changeset added to ${dir}.`);
|
|
39
38
|
}
|
|
40
39
|
core.setOutput('ok', ok ? 'true' : 'false');
|
|
41
|
-
- name: Add changeset
|
|
40
|
+
- name: Add or update changeset comment on failure
|
|
42
41
|
uses: actions/github-script@v7
|
|
43
42
|
if: failure()
|
|
44
43
|
with:
|
|
45
44
|
script: |
|
|
46
45
|
const pr = context.payload.pull_request;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
const marker = '<!-- changeset-bot-comment -->';
|
|
47
|
+
const body = [
|
|
48
|
+
marker,
|
|
49
|
+
"❌ **Changeset file missing for PR**",
|
|
50
|
+
"",
|
|
51
|
+
"All changes should include an associated changeset file.",
|
|
52
|
+
"Please use `knope document-change` to create a changeset. (installation instructions: https://knope.tech/installation/)"
|
|
53
|
+
].join("\n");
|
|
54
|
+
|
|
55
|
+
const comments = await github.paginate(
|
|
56
|
+
github.rest.issues.listComments,
|
|
57
|
+
{ owner: context.repo.owner, repo: context.repo.repo, issue_number: pr.number }
|
|
58
|
+
);
|
|
59
|
+
const existing = comments.find(c => c.body.includes(marker));
|
|
60
|
+
|
|
61
|
+
if (existing) {
|
|
62
|
+
await github.rest.issues.updateComment({
|
|
63
|
+
owner: context.repo.owner,
|
|
64
|
+
repo: context.repo.repo,
|
|
65
|
+
comment_id: existing.id,
|
|
66
|
+
body: body
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
await github.rest.issues.createComment({
|
|
70
|
+
owner: context.repo.owner,
|
|
71
|
+
repo: context.repo.repo,
|
|
72
|
+
issue_number: pr.number,
|
|
73
|
+
body: body
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
- name: Add or update changeset comment on success
|
|
78
|
+
uses: actions/github-script@v7
|
|
79
|
+
if: success()
|
|
80
|
+
with:
|
|
81
|
+
script: |
|
|
82
|
+
const pr = context.payload.pull_request;
|
|
83
|
+
const marker = '<!-- changeset-bot-comment -->';
|
|
84
|
+
const body = [
|
|
85
|
+
marker,
|
|
86
|
+
"✅ **Changeset file added - thank you!**"
|
|
87
|
+
].join("\n");
|
|
88
|
+
|
|
89
|
+
const comments = await github.paginate(
|
|
90
|
+
github.rest.issues.listComments,
|
|
91
|
+
{ owner: context.repo.owner, repo: context.repo.repo, issue_number: pr.number }
|
|
92
|
+
);
|
|
93
|
+
const existing = comments.find(c => c.body.includes(marker));
|
|
94
|
+
|
|
95
|
+
if (existing) {
|
|
96
|
+
await github.rest.issues.updateComment({
|
|
97
|
+
owner: context.repo.owner,
|
|
98
|
+
repo: context.repo.repo,
|
|
99
|
+
comment_id: existing.id,
|
|
100
|
+
body: body
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
await github.rest.issues.createComment({
|
|
104
|
+
owner: context.repo.owner,
|
|
105
|
+
repo: context.repo.repo,
|
|
106
|
+
issue_number: pr.number,
|
|
107
|
+
body: body
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
handle-skip-label:
|
|
112
|
+
if: ${{ contains(github.event.pull_request.labels.*.name, 'skip-changeset') && github.head_ref != 'release' && !startsWith(github.head_ref, 'release/') && !startsWith(github.head_ref, 'conflict/') && !github.event.pull_request.draft }}
|
|
113
|
+
name: Handle Skip Label
|
|
114
|
+
runs-on: ubuntu-24.04
|
|
115
|
+
permissions:
|
|
116
|
+
pull-requests: write
|
|
117
|
+
steps:
|
|
118
|
+
- name: Add or update comment to show skipped
|
|
119
|
+
uses: actions/github-script@v7
|
|
120
|
+
with:
|
|
121
|
+
script: |
|
|
122
|
+
const pr = context.payload.pull_request;
|
|
123
|
+
const marker = '<!-- changeset-bot-comment -->';
|
|
124
|
+
const body = [
|
|
125
|
+
marker,
|
|
126
|
+
"⏭️ **Changeset check skipped via label**"
|
|
127
|
+
].join("\n");
|
|
128
|
+
|
|
129
|
+
const comments = await github.paginate(
|
|
130
|
+
github.rest.issues.listComments,
|
|
131
|
+
{ owner: context.repo.owner, repo: context.repo.repo, issue_number: pr.number }
|
|
132
|
+
);
|
|
133
|
+
const existing = comments.find(c => c.body.includes(marker));
|
|
134
|
+
|
|
135
|
+
if (existing) {
|
|
136
|
+
await github.rest.issues.updateComment({
|
|
137
|
+
owner: context.repo.owner,
|
|
138
|
+
repo: context.repo.repo,
|
|
139
|
+
comment_id: existing.id,
|
|
140
|
+
body: body
|
|
141
|
+
});
|
|
142
|
+
} else {
|
|
143
|
+
await github.rest.issues.createComment({
|
|
144
|
+
owner: context.repo.owner,
|
|
145
|
+
repo: context.repo.repo,
|
|
146
|
+
issue_number: pr.number,
|
|
147
|
+
body: body
|
|
148
|
+
});
|
|
149
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,364 @@
|
|
|
1
|
+
## 0.5.1 (2026-02-19)
|
|
2
|
+
|
|
3
|
+
### Fixes
|
|
4
|
+
|
|
5
|
+
#### Fixes the type of `ApolloClientAiAppsConfig.Config`
|
|
6
|
+
|
|
7
|
+
The `ApolloClientAiAppsConfig.Config` is mistakenly set as the output type instead of the input type. This primarily affected the `labels` config which expected a different input shape than the output shape.
|
|
8
|
+
|
|
9
|
+
## 0.5.0 (2026-02-19)
|
|
10
|
+
|
|
11
|
+
### Breaking Changes
|
|
12
|
+
|
|
13
|
+
#### Introduce compatibility with MCP Apps
|
|
14
|
+
|
|
15
|
+
This change introduces compatibility with the [MCP Apps specification](https://github.com/modelcontextprotocol/ext-apps/blob/a815f31392555b1434ebf9a65a15dd4a7bde3fd6/specification/draft/apps.mdx). As a result, it is now possible to build your apps targeting both ChatGPT apps and MCP Apps.
|
|
16
|
+
|
|
17
|
+
### Vite plugin
|
|
18
|
+
|
|
19
|
+
A new `apolloClientAiApps` combines existing plugins (`ApplicationManifestPlugin` and `AbsoluteAssetImportsPlugin`) into a single plugin. It requires a `targets` option specifying which platforms to build for, and an optional `devTarget` for development mode when using multiple targets.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { apolloClientAiApps } from "@apollo/client-ai-apps/vite";
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
plugins: [
|
|
26
|
+
apolloClientAiApps({
|
|
27
|
+
targets: ["openai", "mcp"],
|
|
28
|
+
devTarget: "openai",
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
When building, the plugin produces separate outputs per target.
|
|
35
|
+
|
|
36
|
+
### Conditional exports
|
|
37
|
+
|
|
38
|
+
Platform-specific code is now gated behind [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to reduce the possibility for error when building for a specific platform. As such, two new platform-specific entrypoints are now available:
|
|
39
|
+
|
|
40
|
+
- `@apollo/client-ai-apps/mcp`
|
|
41
|
+
- `@apollo/client-ai-apps/openai`
|
|
42
|
+
|
|
43
|
+
Any available root-level exports that contain platform-specific code (e.g. `ApolloClient`, `ToolCallLink`) are provided behind conditional exports to ensure the right implementation is selected at build.
|
|
44
|
+
|
|
45
|
+
### New optional peer dependency
|
|
46
|
+
|
|
47
|
+
`@modelcontextprotocol/ext-apps` (^0.4.0) is now an optional peer dependency. This is required when you choose to build MCP apps.
|
|
48
|
+
|
|
49
|
+
### Extendable TypeScript configs
|
|
50
|
+
|
|
51
|
+
Extendable TypeScript configurations are now available for each platform:
|
|
52
|
+
|
|
53
|
+
- `@apollo/client-ai-apps/tsconfig/core`
|
|
54
|
+
- `@apollo/client-ai-apps/tsconfig/mcp`
|
|
55
|
+
- `@apollo/client-ai-apps/tsconfig/openai`
|
|
56
|
+
|
|
57
|
+
### Breaking changes
|
|
58
|
+
|
|
59
|
+
#### OpenAI hooks and types removed from root export
|
|
60
|
+
|
|
61
|
+
All OpenAI-specific hooks and types have been removed from the root `@apollo/client-ai-apps` entrypoint. Import them from `@apollo/client-ai-apps/openai` instead.
|
|
62
|
+
|
|
63
|
+
```diff
|
|
64
|
+
- import { useToolName, useToolInput, useToolOutput } from "@apollo/client-ai-apps";
|
|
65
|
+
+ import { useToolName, useToolInput, useToolOutput } from "@apollo/client-ai-apps/openai";
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### ApolloProvider is now Suspense-based
|
|
69
|
+
|
|
70
|
+
`ApolloProvider` now uses React Suspense to await client initialization. Wrap `ApolloProvider` in a `Suspense` component to show a loading state while the client is initializing.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { Suspense } from "react";
|
|
74
|
+
import { ApolloProvider } from "@apollo/client-ai-apps";
|
|
75
|
+
|
|
76
|
+
render(
|
|
77
|
+
<Suspense fallback={<Spinner />}>
|
|
78
|
+
<ApolloProvider client={client}>
|
|
79
|
+
<App />
|
|
80
|
+
<ApolloProvider />
|
|
81
|
+
</Suspense>
|
|
82
|
+
);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### Changes to vite plugins
|
|
86
|
+
|
|
87
|
+
The `ApplicationManifestPlugin` and `AbsoluteAssetImportsPlugin` have been combined with the `apolloClientAiApps` plugin and are no longer available as individual plugins. Please remove these plugins from your vite config and use the `apolloClientAiApps` plugin instead.
|
|
88
|
+
|
|
89
|
+
```diff
|
|
90
|
+
// vite.config.ts
|
|
91
|
+
import {
|
|
92
|
+
- ApplicationManifestPlugin,
|
|
93
|
+
- AbsoluteAssetImportsPlugin,
|
|
94
|
+
+ apolloClientAiApps
|
|
95
|
+
} from "@apollo/client-ai-apps/vite";
|
|
96
|
+
|
|
97
|
+
export default defineConfig({
|
|
98
|
+
// ...
|
|
99
|
+
plugins: [
|
|
100
|
+
- ApplicationManifestPlugin(),
|
|
101
|
+
- AbsoluteAssetImportsPlugin(),
|
|
102
|
+
+ apolloClientAiApps({ targets: [/* define targets here */] }),
|
|
103
|
+
],
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### Load configuration with cosmiconfig
|
|
108
|
+
|
|
109
|
+
Apps config is now loaded via [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig). As a result, config defined in `package.json` MUST be defined under the `apollo-client-ai-apps` key.
|
|
110
|
+
|
|
111
|
+
```diff
|
|
112
|
+
// package.json
|
|
113
|
+
{
|
|
114
|
+
// ...
|
|
115
|
+
- "csp": {
|
|
116
|
+
- "connectDomains": ["https://example.com"]
|
|
117
|
+
- }
|
|
118
|
+
+ "apollo-client-ai-apps": {
|
|
119
|
+
+ "csp": {
|
|
120
|
+
+ "connectDomains": ["https://example.com"]
|
|
121
|
+
+ }
|
|
122
|
+
+ }
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Configuration can be loaded from the following files:
|
|
127
|
+
|
|
128
|
+
- `.apollo-client-ai-apps.config.json`
|
|
129
|
+
- `apollo-client-ai-apps.config.json`
|
|
130
|
+
- `.apollo-client-ai-apps.config.yml`
|
|
131
|
+
- `apollo-client-ai-apps.config.yml`
|
|
132
|
+
- `.apollo-client-ai-apps.config.yaml`
|
|
133
|
+
- `apollo-client-ai-apps.config.yaml`
|
|
134
|
+
- `.apollo-client-ai-apps.config.js`
|
|
135
|
+
- `apollo-client-ai-apps.config.js`
|
|
136
|
+
- `.apollo-client-ai-apps.config.ts`
|
|
137
|
+
- `apollo-client-ai-apps.config.ts`
|
|
138
|
+
- `.apollo-client-ai-apps.config.cjs`
|
|
139
|
+
- `apollo-client-ai-apps.config.cjs`
|
|
140
|
+
- A `apollo-client-ai-apps` key in package.json
|
|
141
|
+
|
|
142
|
+
### Type-safe configuration
|
|
143
|
+
|
|
144
|
+
A `defineConfig` helper is now available to export type-safe configuration when using a `config.ts` file (recommended).
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
// apollo-client-ai-apps.config.ts
|
|
148
|
+
import { defineConfig } from "@apollo/client-ai-apps/config";
|
|
149
|
+
|
|
150
|
+
export default defineConfig({
|
|
151
|
+
csp: {
|
|
152
|
+
connectDomains: ["https://example.com"],
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Alternatively you may use the type directly:
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
// apollo-client-ai-apps.config.ts
|
|
161
|
+
import type { ApolloClientAiAppsConfig } from "@apollo/client-ai-apps/config";
|
|
162
|
+
|
|
163
|
+
const config: ApolloClientAiAppsConfig.Config = {
|
|
164
|
+
csp: {
|
|
165
|
+
connectDomains: ["https://example.com"],
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export default config;
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Move React-related exports to `/react` entry point
|
|
173
|
+
|
|
174
|
+
Move all React-related exports to `/react` entry point. This ensures apps that built on top of the core APIs do not have to install and use the `react` package. In addition, platform-specific `/react` entry points have been added in order to use platform-specific hooks:
|
|
175
|
+
|
|
176
|
+
- `@apollo/client-ai-apps/react` - Shared React utilities for both platforms
|
|
177
|
+
- `@apollo/client-ai-apps/openai/react` - OpenAI specific React utilities
|
|
178
|
+
- `@apollo/client-ai-apps/mcp/react` - MCP Apps specific React utilities
|
|
179
|
+
|
|
180
|
+
This change means the `react` and `react-dom` packages are now marked as optional peer dependencies.
|
|
181
|
+
|
|
182
|
+
#### Removal of hooks from `/openai` entrypoint
|
|
183
|
+
|
|
184
|
+
The following hooks have been removed from `@apollo/client-ai-apps/openai`.
|
|
185
|
+
|
|
186
|
+
**`useOpenAiGlobal`**
|
|
187
|
+
|
|
188
|
+
This hook is now an internal-only hook. If you use `window.openai` directly and
|
|
189
|
+
need to listen for changes to properties, setup an event listener to listen for
|
|
190
|
+
changes to global values.
|
|
191
|
+
|
|
192
|
+
**`useSendFollowupMessage`**
|
|
193
|
+
|
|
194
|
+
Use the `App` instance returned by `useApp()` to send followup messages.
|
|
195
|
+
|
|
196
|
+
```diff
|
|
197
|
+
import {
|
|
198
|
+
- useSendFollowupMessage,
|
|
199
|
+
+ useApp
|
|
200
|
+
} from "@apollo/client-ai-apps/openai";
|
|
201
|
+
|
|
202
|
+
function MyComponent() {
|
|
203
|
+
- const sendFollowupMessage = useSendFollowupMessage();
|
|
204
|
+
+ const app = useApp();
|
|
205
|
+
|
|
206
|
+
function sendMessage() {
|
|
207
|
+
- sendFollowupMessage({ prompt: "..." });
|
|
208
|
+
+ app.sendMessage({
|
|
209
|
+
+ role: "user",
|
|
210
|
+
+ content: [{ type: "text", text: "..." }]
|
|
211
|
+
+ });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**`useRequestDisplayMode`**
|
|
217
|
+
|
|
218
|
+
Use the `App` instance returned by `useApp()` to request changes to display mode.
|
|
219
|
+
|
|
220
|
+
```diff
|
|
221
|
+
import {
|
|
222
|
+
- useRequestDisplayMode,
|
|
223
|
+
+ useApp
|
|
224
|
+
} from "@apollo/client-ai-apps/openai";
|
|
225
|
+
|
|
226
|
+
function MyComponent() {
|
|
227
|
+
- const requestDisplayMode = useRequestDisplayMode();
|
|
228
|
+
+ const app = useApp();
|
|
229
|
+
|
|
230
|
+
function changeDisplayMode() {
|
|
231
|
+
- requestDisplayMode({ mode: "fullscreen" });
|
|
232
|
+
+ app.requestDisplayMode({ mode: "fullscreen" });
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**`useOpenExternal`**
|
|
238
|
+
|
|
239
|
+
Use the `App` instance returned by `useApp()` to open external links.
|
|
240
|
+
|
|
241
|
+
```diff
|
|
242
|
+
import {
|
|
243
|
+
- useOpenExternal,
|
|
244
|
+
+ useApp
|
|
245
|
+
} from "@apollo/client-ai-apps/openai";
|
|
246
|
+
|
|
247
|
+
function MyComponent() {
|
|
248
|
+
- const openLink = useOpenExternal();
|
|
249
|
+
+ const app = useApp();
|
|
250
|
+
|
|
251
|
+
function changeDisplayMode() {
|
|
252
|
+
- openLink({ href: "https://example.com" });
|
|
253
|
+
+ app.openLink({ url: "https://example.com" });
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**`useCallTool`**
|
|
259
|
+
|
|
260
|
+
Use the `App` instance returned by `useApp()` to call tools directly.
|
|
261
|
+
|
|
262
|
+
```diff
|
|
263
|
+
import {
|
|
264
|
+
- useCallTool,
|
|
265
|
+
+ useApp
|
|
266
|
+
} from "@apollo/client-ai-apps/openai";
|
|
267
|
+
|
|
268
|
+
function MyComponent() {
|
|
269
|
+
- const callTool = useCallTool();
|
|
270
|
+
+ const app = useApp();
|
|
271
|
+
|
|
272
|
+
async function changeDisplayMode() {
|
|
273
|
+
- await callTool("...", params)
|
|
274
|
+
+ app.callServerTool({ name: "...", arguments: params });
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**`useToolOutput`**
|
|
280
|
+
|
|
281
|
+
Apollo Client uses the tool output to populate the cache. Use the `data` property returned from Apollo Client query hooks instead `useToolOutput`.
|
|
282
|
+
|
|
283
|
+
### Rename of `useToolResponseMetadata`
|
|
284
|
+
|
|
285
|
+
To better align with the equivalent MCP app hook, `useToolResponseMetadata` has been renamed to `useToolMetadata` and now requires `ApolloClient` in React context to function.
|
|
286
|
+
|
|
287
|
+
#### Remove `useToolEffect` hook
|
|
288
|
+
|
|
289
|
+
Removes the `useToolEffect` hook from `@apollo/client-ai-apps/openai`. This change also removes `ToolUseProvider` as it is no longer used by any remaining hook.
|
|
290
|
+
|
|
291
|
+
#### Updates `openai` related exports to work the the MCP Apps host bridge
|
|
292
|
+
|
|
293
|
+
Uses the MCP Apps host bridge to communicate with the OpenAI host, falling back to `window.openai` where necessary.
|
|
294
|
+
|
|
295
|
+
This change affects both the `useToolName` and `useToolResponseMetadata` hooks exported in `@apollo/client-ai-apps/openai` which now require the use of the `client` in the `ApolloProvider` context.
|
|
296
|
+
|
|
297
|
+
### Features
|
|
298
|
+
|
|
299
|
+
#### Add a new `Platform` utility
|
|
300
|
+
|
|
301
|
+
Adds a new `Platform` utility that makes it easier to detect the current platform. Useful when needing to select a value based on the current platform in a shared component.
|
|
302
|
+
|
|
303
|
+
```tsx
|
|
304
|
+
import { Platform } from "@apollo/client-ai-apps";
|
|
305
|
+
|
|
306
|
+
// `Platform.target` returns the current target ("openai" or "mcp")
|
|
307
|
+
// `Platform.select` returns the value based on the current target. The value
|
|
308
|
+
// can by anything.
|
|
309
|
+
<div
|
|
310
|
+
style={{
|
|
311
|
+
border: Platform.select({ mcp: "1px solid red", openai: "1px solid blue" }),
|
|
312
|
+
}}
|
|
313
|
+
>
|
|
314
|
+
{Platform.target}
|
|
315
|
+
</div>;
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
#### Add a `useToolInput` hook for the `/mcp` entrypoint
|
|
319
|
+
|
|
320
|
+
Adds a `useToolInput` to get the tool input value.
|
|
321
|
+
|
|
322
|
+
#### App version now configured
|
|
323
|
+
|
|
324
|
+
The MCP app version is now configured in the manifest and is set by the version your `package.json` file.
|
|
325
|
+
|
|
326
|
+
#### Apps config now parsed with zod
|
|
327
|
+
|
|
328
|
+
The apps config and directive inputs are now parsed and validated with [`zod`](https://zod.dev/). Validation is now more strict and does not allow additional properties that don't exist in the validation schemas. Additionally, you may see a change in the format of the error message if a validation error occurs.
|
|
329
|
+
|
|
330
|
+
#### Export shared hooks in top-level entry point
|
|
331
|
+
|
|
332
|
+
Common hooks used in the `/openai` and `/mcp` entry points are now exported from the top-level entry point. These include the following:
|
|
333
|
+
|
|
334
|
+
- `useApp`
|
|
335
|
+
- `useToolInput`
|
|
336
|
+
- `useToolMetadata`
|
|
337
|
+
- `useToolName`
|
|
338
|
+
|
|
339
|
+
#### Support for platform-specific entry point config
|
|
340
|
+
|
|
341
|
+
You can now provide a custom entry for a specific target. In your `package.json`:
|
|
342
|
+
|
|
343
|
+
```json
|
|
344
|
+
{
|
|
345
|
+
"entry": {
|
|
346
|
+
"production": {
|
|
347
|
+
"mcp": "https://mcp.example.com",
|
|
348
|
+
"openai": "https://openai.example.com"
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
The MCP app version is now configured by the version your `package.json` file
|
|
355
|
+
|
|
356
|
+
### Fixes
|
|
357
|
+
|
|
358
|
+
#### Remove the app prefix when matching tool names.
|
|
359
|
+
|
|
360
|
+
The app prefix has been removed in tool names from the MCP server, so we no longer need to match against tool names with the app prefix.
|
|
361
|
+
|
|
1
362
|
## 0.4.0 (2026-01-15)
|
|
2
363
|
|
|
3
364
|
### Breaking Changes
|
package/__mocks__/fs.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ApolloClientAiAppsConfig } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Helper type that makes it easier to define app configuration
|
|
4
|
+
*/
|
|
5
|
+
export declare function defineConfig(config: ApolloClientAiAppsConfig.Config): {
|
|
6
|
+
name?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
entry?: Partial<Record<string, string | Partial<Record<"mcp" | "openai", string>>>>;
|
|
10
|
+
csp?: {
|
|
11
|
+
connectDomains?: string[];
|
|
12
|
+
frameDomains?: string[];
|
|
13
|
+
redirectDomains?: string[];
|
|
14
|
+
resourceDomains?: string[];
|
|
15
|
+
};
|
|
16
|
+
widgetSettings?: {
|
|
17
|
+
prefersBorder?: boolean;
|
|
18
|
+
description?: string;
|
|
19
|
+
domain?: string;
|
|
20
|
+
};
|
|
21
|
+
labels?: {
|
|
22
|
+
toolInvocation?: {
|
|
23
|
+
invoking?: string;
|
|
24
|
+
invoked?: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=defineConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineConfig.d.ts","sourceRoot":"","sources":["../../src/config/defineConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,wBAAwB,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;EAEnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineConfig.js","sourceRoot":"","sources":["../../src/config/defineConfig.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAuC;IAClE,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { ApolloClientAiAppsConfig } from \"./types.js\";\n\n/**\n * Helper type that makes it easier to define app configuration\n */\nexport function defineConfig(config: ApolloClientAiAppsConfig.Config) {\n return config;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { ApolloClientAiAppsConfig } from \"./types.js\";\nexport { defineConfig } from \"./defineConfig.js\";\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const AppTarget: z.ZodLiteral<"mcp" | "openai">;
|
|
3
|
+
export declare const ApolloClientAiAppsConfigSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodExactOptional<z.ZodString>;
|
|
5
|
+
description: z.ZodExactOptional<z.ZodString>;
|
|
6
|
+
version: z.ZodExactOptional<z.ZodString>;
|
|
7
|
+
entry: z.ZodExactOptional<z.ZodRecord<z.ZodUnion<[z.ZodLiteral<"development" | "production">, z.ZodCustom<string & {}, string & {}>]> & z.core.$partial, z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodLiteral<"mcp" | "openai"> & z.core.$partial, z.ZodString>]>>>;
|
|
8
|
+
csp: z.ZodExactOptional<z.ZodObject<{
|
|
9
|
+
connectDomains: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
|
|
10
|
+
frameDomains: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
|
|
11
|
+
redirectDomains: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
|
|
12
|
+
resourceDomains: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
|
|
13
|
+
}, z.core.$strict>>;
|
|
14
|
+
widgetSettings: z.ZodExactOptional<z.ZodObject<{
|
|
15
|
+
prefersBorder: z.ZodExactOptional<z.ZodBoolean>;
|
|
16
|
+
description: z.ZodExactOptional<z.ZodString>;
|
|
17
|
+
domain: z.ZodExactOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>>;
|
|
19
|
+
labels: z.ZodCodec<z.ZodExactOptional<z.ZodObject<{
|
|
20
|
+
toolInvocation: z.ZodExactOptional<z.ZodObject<{
|
|
21
|
+
invoking: z.ZodExactOptional<z.ZodString>;
|
|
22
|
+
invoked: z.ZodExactOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strict>>;
|
|
24
|
+
}, z.core.$strict>>, z.ZodExactOptional<z.ZodObject<{
|
|
25
|
+
"toolInvocation/invoking": z.ZodExactOptional<z.ZodString>;
|
|
26
|
+
"toolInvocation/invoked": z.ZodExactOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>>>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,SAAS,gCAA+B,CAAC;AAwBtD,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;kBA8CzC,CAAC"}
|