@apollo/client-ai-apps 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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 +353 -0
- package/__mocks__/fs/promises.cjs +3 -0
- package/__mocks__/fs.cjs +3 -0
- package/dist/config/defineConfig.d.ts +26 -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":"cacheAsync.js","sourceRoot":"","sources":["../../src/utilities/cacheAsync.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,yEAAyE;AACzE,gFAAgF;AAChF,6EAA6E;AAC7E,8EAA8E;AAC9E,MAAM,UAAU,UAAU,CACxB,EAAwC;IAExC,IAAI,OAAqC,CAAC;IAE1C,OAAO,MAAM,CAAC,MAAM,CAClB,CAAC,GAAG,IAAW,EAAoB,EAAE;QACnC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACjC,CAAC,EACD;QACE,KAAK,EAAE,GAAG,EAAE;YACV,OAAO,GAAG,SAAS,CAAC;QACtB,CAAC;KACF,CACF,CAAC;AACJ,CAAC","sourcesContent":["// NOTE: This is a simplified cache function that does not handles variances in\n// arguments. For a more robust implementation, we would want to consider\n// caching based on input so it works more similarly to a memoization cache. For\n// that we can use `@sry/trie`. That is overkill for our use now, but if this\n// needs to be more robust later, let's implement the cache with that package.\nexport function cacheAsync<TArgs extends any[], TReturn>(\n fn: (...args: TArgs) => Promise<TReturn>\n) {\n let promise: Promise<TReturn> | undefined;\n\n return Object.assign(\n (...args: TArgs): Promise<TReturn> => {\n if (promise) {\n return promise;\n }\n\n return (promise = fn(...args));\n },\n {\n reset: () => {\n promise = undefined;\n },\n }\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utilities/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,cAAc,eAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utilities/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["/**\n * Used to mark this package's client in order to validate the right client is\n * provided.\n */\nexport const aiClientSymbol = Symbol.for(\"apollo.aiClient\");\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emptyModule.d.ts","sourceRoot":"","sources":["../../src/utilities/emptyModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emptyModule.js","sourceRoot":"","sources":["../../src/utilities/emptyModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC","sourcesContent":["export {};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OperationVariables } from "@apollo/client";
|
|
2
|
+
import type { ManifestOperation } from "../types/application-manifest.js";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare function getVariablesForOperationFromToolInput(operation: ManifestOperation, toolInput: Record<string, unknown> | undefined): OperationVariables;
|
|
5
|
+
//# sourceMappingURL=getVariablesForOperationFromToolInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVariablesForOperationFromToolInput.d.ts","sourceRoot":"","sources":["../../src/utilities/getVariablesForOperationFromToolInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAO1E,gBAAgB;AAChB,wBAAgB,qCAAqC,CACnD,SAAS,EAAE,iBAAiB,EAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC7C,kBAAkB,CAcpB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// We need to get the variables used as part of the tool call that resulted in
|
|
2
|
+
// rendering this app so that we can properly write to the cache, however we
|
|
3
|
+
// want to only include keys that are defined as part of the operation in case
|
|
4
|
+
// additional input was provided to the tool.
|
|
5
|
+
/** @internal */
|
|
6
|
+
export function getVariablesForOperationFromToolInput(operation, toolInput) {
|
|
7
|
+
if (!operation.variables || !toolInput) {
|
|
8
|
+
return {};
|
|
9
|
+
}
|
|
10
|
+
const variableNames = new Set(Object.keys(operation.variables));
|
|
11
|
+
return Object.keys(toolInput).reduce((obj, key) => {
|
|
12
|
+
if (variableNames.has(key)) {
|
|
13
|
+
obj[key] = toolInput[key];
|
|
14
|
+
}
|
|
15
|
+
return obj;
|
|
16
|
+
}, {});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=getVariablesForOperationFromToolInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVariablesForOperationFromToolInput.js","sourceRoot":"","sources":["../../src/utilities/getVariablesForOperationFromToolInput.ts"],"names":[],"mappings":"AAGA,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,6CAA6C;AAE7C,gBAAgB;AAChB,MAAM,UAAU,qCAAqC,CACnD,SAA4B,EAC5B,SAA8C;IAE9C,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,CAAC,SAAS,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhE,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAChD,IAAI,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAwB,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import type { OperationVariables } from \"@apollo/client\";\nimport type { ManifestOperation } from \"../types/application-manifest.js\";\n\n// We need to get the variables used as part of the tool call that resulted in\n// rendering this app so that we can properly write to the cache, however we\n// want to only include keys that are defined as part of the operation in case\n// additional input was provided to the tool.\n\n/** @internal */\nexport function getVariablesForOperationFromToolInput(\n operation: ManifestOperation,\n toolInput: Record<string, unknown> | undefined\n): OperationVariables {\n if (!operation.variables || !toolInput) {\n return {};\n }\n\n const variableNames = new Set(Object.keys(operation.variables));\n\n return Object.keys(toolInput).reduce((obj, key) => {\n if (variableNames.has(key)) {\n obj[key] = toolInput[key];\n }\n\n return obj;\n }, {} as OperationVariables);\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { aiClientSymbol } from "./constants.js";
|
|
2
|
+
export { getVariablesForOperationFromToolInput } from "./getVariablesForOperationFromToolInput.js";
|
|
3
|
+
export { cacheAsync } from "./cacheAsync.js";
|
|
4
|
+
export { invariant } from "./invariant.js";
|
|
5
|
+
export { promiseWithResolvers } from "./promiseWithResolvers.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { aiClientSymbol } from "./constants.js";
|
|
2
|
+
export { getVariablesForOperationFromToolInput } from "./getVariablesForOperationFromToolInput.js";
|
|
3
|
+
export { cacheAsync } from "./cacheAsync.js";
|
|
4
|
+
export { invariant } from "./invariant.js";
|
|
5
|
+
export { promiseWithResolvers } from "./promiseWithResolvers.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC","sourcesContent":["export { aiClientSymbol } from \"./constants.js\";\nexport { getVariablesForOperationFromToolInput } from \"./getVariablesForOperationFromToolInput.js\";\nexport { cacheAsync } from \"./cacheAsync.js\";\nexport { invariant } from \"./invariant.js\";\nexport { promiseWithResolvers } from \"./promiseWithResolvers.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../../src/utilities/invariant.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAI5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant.js","sourceRoot":"","sources":["../../src/utilities/invariant.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,SAAc,EAAE,OAAe;IACvD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC","sourcesContent":["export function invariant(condition: any, message: string): asserts condition {\n if (!condition) {\n throw new Error(message);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promiseWithResolvers.d.ts","sourceRoot":"","sources":["../../src/utilities/promiseWithResolvers.ts"],"names":[],"mappings":"AAMA,gBAAgB;AAChB,wBAAgB,oBAAoB,CAAC,CAAC;;qBACd,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI;sBAC1B,GAAG,KAAK,IAAI;EAQpC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Polyfill for the `Promise.withResolvers` API:
|
|
2
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers
|
|
3
|
+
//
|
|
4
|
+
// Once `Promise.withResolvers` hits widely available, we should remove this
|
|
5
|
+
// polyfill in favor of that API.
|
|
6
|
+
/** @internal */
|
|
7
|
+
export function promiseWithResolvers() {
|
|
8
|
+
let resolve;
|
|
9
|
+
let reject;
|
|
10
|
+
const promise = new Promise((res, rej) => {
|
|
11
|
+
resolve = res;
|
|
12
|
+
reject = rej;
|
|
13
|
+
});
|
|
14
|
+
return { promise, resolve, reject };
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=promiseWithResolvers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promiseWithResolvers.js","sourceRoot":"","sources":["../../src/utilities/promiseWithResolvers.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,yGAAyG;AACzG,EAAE;AACF,4EAA4E;AAC5E,iCAAiC;AAEjC,gBAAgB;AAChB,MAAM,UAAU,oBAAoB;IAClC,IAAI,OAA6C,CAAC;IAClD,IAAI,MAA+B,CAAC;IAEpC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAC1C,OAAO,GAAG,GAAG,CAAC;QACd,MAAM,GAAG,GAAG,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACtC,CAAC","sourcesContent":["// Polyfill for the `Promise.withResolvers` API:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers\n//\n// Once `Promise.withResolvers` hits widely available, we should remove this\n// polyfill in favor of that API.\n\n/** @internal */\nexport function promiseWithResolvers<T>() {\n let resolve!: (value: T | PromiseLike<T>) => void;\n let reject!: (reason?: any) => void;\n\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n\n return { promise, resolve, reject };\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type InlineConfig } from "vite";
|
|
2
|
+
type Plugins = NonNullable<InlineConfig["plugins"]>;
|
|
3
|
+
export declare function setupServer(config: InlineConfig & {
|
|
4
|
+
plugins: Plugins;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
7
|
+
config: import("vite").ResolvedConfig;
|
|
8
|
+
middlewares: import("vite").Connect.Server;
|
|
9
|
+
httpServer: import("vite").HttpServer | null;
|
|
10
|
+
watcher: import("vite").FSWatcher;
|
|
11
|
+
ws: import("vite").WebSocketServer;
|
|
12
|
+
hot: import("vite").NormalizedHotChannel;
|
|
13
|
+
pluginContainer: import("vite").PluginContainer;
|
|
14
|
+
environments: Record<"client" | "ssr" | (string & {}), import("vite").DevEnvironment>;
|
|
15
|
+
moduleGraph: import("vite").ModuleGraph;
|
|
16
|
+
resolvedUrls: import("vite").ResolvedServerUrls | null;
|
|
17
|
+
transformRequest(url: string, options?: import("vite").TransformOptions): Promise<import("vite").TransformResult | null>;
|
|
18
|
+
warmupRequest(url: string, options?: import("vite").TransformOptions): Promise<void>;
|
|
19
|
+
transformIndexHtml(url: string, html: string, originalUrl?: string): Promise<string>;
|
|
20
|
+
ssrTransform(code: string, inMap: import("rollup").SourceMap | {
|
|
21
|
+
mappings: "";
|
|
22
|
+
} | null, url: string, originalCode?: string): Promise<import("vite").TransformResult | null>;
|
|
23
|
+
ssrLoadModule(url: string, opts?: {
|
|
24
|
+
fixStacktrace?: boolean;
|
|
25
|
+
}): Promise<Record<string, any>>;
|
|
26
|
+
ssrRewriteStacktrace(stack: string): string;
|
|
27
|
+
ssrFixStacktrace(e: Error): void;
|
|
28
|
+
reloadModule(module: import("vite").ModuleNode): Promise<void>;
|
|
29
|
+
listen(port?: number, isRestart?: boolean): Promise<import("vite").ViteDevServer>;
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
printUrls(): void;
|
|
32
|
+
bindCLIShortcuts(options?: import("vite").BindCLIShortcutsOptions<import("vite").ViteDevServer>): void;
|
|
33
|
+
restart(forceOptimize?: boolean): Promise<void>;
|
|
34
|
+
openBrowser(): void;
|
|
35
|
+
waitForRequestsIdle: (ignoredId?: string) => Promise<void>;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function buildApp(config: Omit<InlineConfig, "configFile" | "plugins"> & {
|
|
38
|
+
plugins: Plugins;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/vite/__tests__/utilities/build.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAE9D,KAAK,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;AAEpD,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;;;;;;;;qBAkEmmkG,CAAC;;;;;;;;;;;mCAA45C,CAAC;GAlD7knG;AAED,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC,GAAG;IACrD,OAAO,EAAE,OAAO,CAAC;CAClB,iBA4CF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { build, createServer } from "vite";
|
|
4
|
+
export async function setupServer(config) {
|
|
5
|
+
const server = await createServer({
|
|
6
|
+
configFile: false,
|
|
7
|
+
server: {
|
|
8
|
+
port: 3333,
|
|
9
|
+
...config.server,
|
|
10
|
+
},
|
|
11
|
+
...config,
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
...server,
|
|
15
|
+
[Symbol.asyncDispose]() {
|
|
16
|
+
return server.close();
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export async function buildApp(config) {
|
|
21
|
+
await build({
|
|
22
|
+
configFile: false,
|
|
23
|
+
logLevel: "silent",
|
|
24
|
+
...config,
|
|
25
|
+
build: {
|
|
26
|
+
emptyOutDir: false,
|
|
27
|
+
outDir: "dist",
|
|
28
|
+
...config.build,
|
|
29
|
+
rollupOptions: {
|
|
30
|
+
input: config.build?.rollupOptions?.input ?? "virtual:entry",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
plugins: [
|
|
34
|
+
...config.plugins,
|
|
35
|
+
// We need to use `fs` to resolve modules to ensure vite uses memfs when
|
|
36
|
+
// building, otherwise we get an ENOENT error for any files written to the
|
|
37
|
+
// virtual filesystem.
|
|
38
|
+
{
|
|
39
|
+
name: "test:virtual-entry",
|
|
40
|
+
resolveId(id) {
|
|
41
|
+
if (id === "virtual:entry")
|
|
42
|
+
return id;
|
|
43
|
+
if (id.endsWith(".html"))
|
|
44
|
+
return path.resolve(id);
|
|
45
|
+
if (id.startsWith("/")) {
|
|
46
|
+
const resolved = path.resolve(id.slice(1));
|
|
47
|
+
if (fs.existsSync(resolved)) {
|
|
48
|
+
return resolved;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
load(id) {
|
|
53
|
+
if (id === "virtual:entry")
|
|
54
|
+
return "export default {};";
|
|
55
|
+
if (fs.existsSync(id)) {
|
|
56
|
+
return fs.readFileSync(id, "utf8");
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/vite/__tests__/utilities/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,YAAY,EAAqB,MAAM,MAAM,CAAC;AAI9D,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAA2C;IAC3E,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;QAChC,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE;YACN,IAAI,EAAE,IAAI;YACV,GAAG,MAAM,CAAC,MAAM;SACjB;QACD,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,MAAM;QACT,CAAC,MAAM,CAAC,YAAY,CAAC;YACnB,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAEC;IAED,MAAM,KAAK,CAAC;QACV,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,QAAQ;QAClB,GAAG,MAAM;QACT,KAAK,EAAE;YACL,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,MAAM;YACd,GAAG,MAAM,CAAC,KAAK;YACf,aAAa,EAAE;gBACb,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,eAAe;aAC7D;SACF;QACD,OAAO,EAAE;YACP,GAAG,MAAM,CAAC,OAAO;YAEjB,wEAAwE;YACxE,0EAA0E;YAC1E,sBAAsB;YACtB;gBACE,IAAI,EAAE,oBAAoB;gBAC1B,SAAS,CAAC,EAAE;oBACV,IAAI,EAAE,KAAK,eAAe;wBAAE,OAAO,EAAE,CAAC;oBACtC,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;wBAAE,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;oBAElD,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;wBACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;wBAE3C,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;4BAC5B,OAAO,QAAQ,CAAC;wBAClB,CAAC;oBACH,CAAC;gBACH,CAAC;gBACD,IAAI,CAAC,EAAE;oBACL,IAAI,EAAE,KAAK,eAAe;wBAAE,OAAO,oBAAoB,CAAC;oBAExD,IAAI,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;wBACtB,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;oBACrC,CAAC;gBACH,CAAC;aACF;SACF;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { build, createServer, type InlineConfig } from \"vite\";\n\ntype Plugins = NonNullable<InlineConfig[\"plugins\"]>;\n\nexport async function setupServer(config: InlineConfig & { plugins: Plugins }) {\n const server = await createServer({\n configFile: false,\n server: {\n port: 3333,\n ...config.server,\n },\n ...config,\n });\n\n return {\n ...server,\n [Symbol.asyncDispose]() {\n return server.close();\n },\n };\n}\n\nexport async function buildApp(\n config: Omit<InlineConfig, \"configFile\" | \"plugins\"> & {\n plugins: Plugins;\n }\n) {\n await build({\n configFile: false,\n logLevel: \"silent\",\n ...config,\n build: {\n emptyOutDir: false,\n outDir: \"dist\",\n ...config.build,\n rollupOptions: {\n input: config.build?.rollupOptions?.input ?? \"virtual:entry\",\n },\n },\n plugins: [\n ...config.plugins,\n\n // We need to use `fs` to resolve modules to ensure vite uses memfs when\n // building, otherwise we get an ENOENT error for any files written to the\n // virtual filesystem.\n {\n name: \"test:virtual-entry\",\n resolveId(id) {\n if (id === \"virtual:entry\") return id;\n if (id.endsWith(\".html\")) return path.resolve(id);\n\n if (id.startsWith(\"/\")) {\n const resolved = path.resolve(id.slice(1));\n\n if (fs.existsSync(resolved)) {\n return resolved;\n }\n }\n },\n load(id) {\n if (id === \"virtual:entry\") return \"export default {};\";\n\n if (fs.existsSync(id)) {\n return fs.readFileSync(id, \"utf8\");\n }\n },\n },\n ],\n });\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Plugin } from "vite";
|
|
2
|
+
import { type DocumentNode } from "@apollo/client";
|
|
3
|
+
import type { ApolloClientAiAppsConfig } from "../config/index.js";
|
|
4
|
+
export declare namespace apolloClientAiApps {
|
|
5
|
+
type Target = ApolloClientAiAppsConfig.AppTarget;
|
|
6
|
+
interface Options {
|
|
7
|
+
targets: Target[];
|
|
8
|
+
devTarget?: Target | undefined;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare function devTarget(target: string | undefined): "mcp" | "openai" | undefined;
|
|
12
|
+
export declare function apolloClientAiApps(options: apolloClientAiApps.Options): Plugin;
|
|
13
|
+
export declare function sortTopLevelDefinitions(query: DocumentNode): DocumentNode;
|
|
14
|
+
//# sourceMappingURL=apolloClientAiApps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apolloClientAiApps.d.ts","sourceRoot":"","sources":["../../src/vite/apolloClientAiApps.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EAEZ,MAAM,MAAM,CAAC;AAId,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAoB7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAInE,MAAM,CAAC,OAAO,WAAW,kBAAkB,CAAC;IAC1C,KAAY,MAAM,GAAG,wBAAwB,CAAC,SAAS,CAAC;IAExD,UAAiB,OAAO;QACtB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC;CACF;AAgBD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,gCAOnD;AAQD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,CAAC,OAAO,GAClC,MAAM,CA6QR;AA8ED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CA2CzE"}
|