diff --git a/.github/ISSUE_TEMPLATE/package-server-ai--bug_report.md b/.github/ISSUE_TEMPLATE/package-server-ai--bug_report.md new file mode 100644 index 00000000..ed713a21 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/package-server-ai--bug_report.md @@ -0,0 +1,37 @@ +--- +name: LaunchDarkly.ServerSdk.Ai Bug report +about: Create a report to help us improve +title: '' +labels: 'package: sdk/server-ai, bug' +assignees: '' + +--- + +**Is this a support request?** +This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/hc/en-us/requests/new) or by emailing support@launchdarkly.com. + +Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above. + +**Describe the bug** +A clear and concise description of what the bug is. + +**To reproduce** +Steps to reproduce the behavior. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Logs** +If applicable, add any log output related to your problem. + +**Server SDK & AI package version** +The version of the AI package, as well as the version of the server-side SDK. + +**Language version, developer tools** +For instance, .NET 6.0. + +**OS/platform** +For instance, Ubuntu 16.04, Windows 10, or Android 4.0.3. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/package-server-ai--feature_request.md b/.github/ISSUE_TEMPLATE/package-server-ai--feature_request.md new file mode 100644 index 00000000..377631db --- /dev/null +++ b/.github/ISSUE_TEMPLATE/package-server-ai--feature_request.md @@ -0,0 +1,20 @@ +--- +name: LaunchDarkly.ServerSdk.Ai Feature request +about: Suggest an idea for this project +title: '' +labels: 'package: sdk/server-ai, feature' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context about the feature request here. diff --git a/.github/workflows/sdk-server-ai-ci.yml b/.github/workflows/sdk-server-ai-ci.yml new file mode 100644 index 00000000..f049b315 --- /dev/null +++ b/.github/workflows/sdk-server-ai-ci.yml @@ -0,0 +1,41 @@ +name: LaunchDarkly.ServerSdk.Ai CI +on: + push: + branches: [main, 'feat/**'] + paths-ignore: + - '**.md' # Do not need to run CI for markdown changes. + pull_request: + branches: [main, 'feat/**'] + paths-ignore: + - '**.md' + +jobs: + build-and-test: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + fail-fast: false + runs-on: ${{ matrix.os }} + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v4 + + - name: Setup Env from project's Env file + shell: bash + run: echo "$(cat pkgs/sdk/server-ai/github_actions.env)" >> $GITHUB_ENV + + - uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.2.0 + name: Get secrets + with: + aws_assume_role: ${{ vars.AWS_ROLE_ARN }} + + - uses: ./.github/actions/ci + with: + project_file: ${{ env.PROJECT_FILE}} + test_project_file: ${{ env.TEST_PROJECT_FILE}} + + - uses: ./.github/actions/build-docs + with: + workspace_path: ${{ env.WORKSPACE_PATH}} diff --git a/LaunchDarkly.ServerSdk.sln b/LaunchDarkly.ServerSdk.sln index f19b9c59..689b0249 100644 --- a/LaunchDarkly.ServerSdk.sln +++ b/LaunchDarkly.ServerSdk.sln @@ -21,6 +21,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaunchDarkly.ServerSdk.Tele EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestService", "pkgs\sdk\server\contract-tests\TestService.csproj", "{72D0898F-4CD9-42B7-B3B4-5CFD23796C47}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "server-ai", "server-ai", "{A52FE37A-BCDD-4FC0-A8BA-7576721EA217}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaunchDarkly.ServerSdk.Ai", "pkgs\sdk\server-ai\src\LaunchDarkly.ServerSdk.Ai.csproj", "{89B5D359-6BC8-4CD0-B17D-D68A435ABBB2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaunchDarkly.ServerSdk.Ai.Tests", "pkgs\sdk\server-ai\test\LaunchDarkly.ServerSdk.Ai.Tests.csproj", "{ECA96F40-101E-494B-971F-B1F6E0B9F78D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,6 +53,14 @@ Global {72D0898F-4CD9-42B7-B3B4-5CFD23796C47}.Debug|Any CPU.Build.0 = Debug|Any CPU {72D0898F-4CD9-42B7-B3B4-5CFD23796C47}.Release|Any CPU.ActiveCfg = Release|Any CPU {72D0898F-4CD9-42B7-B3B4-5CFD23796C47}.Release|Any CPU.Build.0 = Release|Any CPU + {89B5D359-6BC8-4CD0-B17D-D68A435ABBB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89B5D359-6BC8-4CD0-B17D-D68A435ABBB2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89B5D359-6BC8-4CD0-B17D-D68A435ABBB2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89B5D359-6BC8-4CD0-B17D-D68A435ABBB2}.Release|Any CPU.Build.0 = Release|Any CPU + {ECA96F40-101E-494B-971F-B1F6E0B9F78D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECA96F40-101E-494B-971F-B1F6E0B9F78D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECA96F40-101E-494B-971F-B1F6E0B9F78D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECA96F40-101E-494B-971F-B1F6E0B9F78D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -63,5 +77,8 @@ Global {35014C04-26CE-43B0-933D-35D80CF0E6B8} = {7A984A5D-0C83-42FA-8BF7-DCA2441F62DA} {71299584-BF0D-48A4-B2E1-D6292036D48D} = {7A984A5D-0C83-42FA-8BF7-DCA2441F62DA} {72D0898F-4CD9-42B7-B3B4-5CFD23796C47} = {FDA973CE-26F2-4745-AF19-0873F170C4CF} + {A52FE37A-BCDD-4FC0-A8BA-7576721EA217} = {0A3F3CFA-1CBB-49BD-BCD3-4A53E3D08665} + {89B5D359-6BC8-4CD0-B17D-D68A435ABBB2} = {A52FE37A-BCDD-4FC0-A8BA-7576721EA217} + {ECA96F40-101E-494B-971F-B1F6E0B9F78D} = {A52FE37A-BCDD-4FC0-A8BA-7576721EA217} EndGlobalSection EndGlobal diff --git a/pkgs/sdk/server-ai/.gitignore b/pkgs/sdk/server-ai/.gitignore new file mode 100644 index 00000000..993170da --- /dev/null +++ b/pkgs/sdk/server-ai/.gitignore @@ -0,0 +1,3 @@ +# docfx output directories +api +docs diff --git a/pkgs/sdk/server-ai/CONTRIBUTING.md b/pkgs/sdk/server-ai/CONTRIBUTING.md new file mode 100644 index 00000000..14866286 --- /dev/null +++ b/pkgs/sdk/server-ai/CONTRIBUTING.md @@ -0,0 +1,67 @@ +# Contributing to the LaunchDarkly AI SDK (server-side) for .NET + +LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/sdk/concepts/contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this SDK. + +## Submitting bug reports and feature requests + +The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/dotnet-core/issues) in the SDK repository. Bug reports and feature requests specific to this SDK should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days. + +## Submitting pull requests + +We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days. + +## Build instructions + +### Prerequisites + +To set up your SDK build time environment, you must [download .NET development tools and follow the instructions](https://dotnet.microsoft.com/download). + +The AI SDK wraps the [Server-Side](../server) SDK. + +### Building + +To install all required packages: + +```bash +dotnet restore +``` + +Then, to build the SDK for all target frameworks: + +```bash +dotnet build src/LaunchDarkly.ServerSdk.Ai +``` + +Or, in Linux: + +```bash +make +``` + +Or, to build for only one target framework (in this example, .NET Standard 2.0): + +```bash +dotnet build src/LaunchDarkly.ServerSdk.Ai -f netstandard2.0 +``` + +### Testing + +To run all unit tests: + +```bash +dotnet test test/LaunchDarkly.ServerSdk.Ai.Tests/LaunchDarkly.ServerSdk.Ai.Tests.csproj +``` + +Or, in Linux: + +```bash +make test +``` + +Note that the unit tests can only be run in Debug configuration. There is an `InternalsVisibleTo` directive that allows the test code to access internal members of the library, and assembly strong-naming in the Release configuration interferes with this. + +## Documentation in code + +All public types, methods, and properties should have documentation comments in the standard C# XML comment format. These will be automatically included in the documentation that is generated on release; this process also uses additional Markdown content from the respective packages `docs-src/` subdirectory. + +See [`docs-src/README.md`](./docs-src/README.md) for more details. diff --git a/pkgs/sdk/server-ai/LaunchDarkly.pk b/pkgs/sdk/server-ai/LaunchDarkly.pk new file mode 100644 index 00000000..fea9a27e Binary files /dev/null and b/pkgs/sdk/server-ai/LaunchDarkly.pk differ diff --git a/pkgs/sdk/server-ai/Makefile b/pkgs/sdk/server-ai/Makefile new file mode 100644 index 00000000..c016bf25 --- /dev/null +++ b/pkgs/sdk/server-ai/Makefile @@ -0,0 +1,8 @@ +build: + dotnet build + +test: + dotnet test + +clean: + dotnet clean diff --git a/pkgs/sdk/server-ai/README.md b/pkgs/sdk/server-ai/README.md new file mode 100644 index 00000000..685b3116 --- /dev/null +++ b/pkgs/sdk/server-ai/README.md @@ -0,0 +1,66 @@ +# LaunchDarkly AI SDK (server-side) for .NET + +The LaunchDarkly AI SDK (server-side) for .NET is designed primarily for use in multi-user systems such as web servers and applications. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications. + +Currently there is no client-side AI SDK for .NET. If you're interested, please let us know by filing an issue! + +## LaunchDarkly overview + +[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today! + +[![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly) + +## Supported .NET versions + +This version of the AI SDK is built for the following targets: + +* .NET 7.0: runs on .NET 7.0 and above (including higher major versions). +* .NET Framework 4.6.2: runs on .NET Framework 4.6.2 and above. +* .NET Standard 2.0: runs in any project that is targeted to .NET Standard 2.x rather than to a specific runtime platform. + +The .NET build tools should automatically load the most appropriate build of the SDK for whatever platform your application or library is targeted to. + +## Getting started + +Refer to the [SDK documentation](https://docs.launchdarkly.com/sdk/server-side/dotnet#getting-started) for instructions on getting started with using the SDK. + +## Signing + +The published version of this assembly is digitally signed with Authenticode and [strong-named](https://docs.microsoft.com/en-us/dotnet/framework/app-domains/strong-named-assemblies). Building the code locally in the default Debug configuration does not use strong-naming and does not require a key file. The public key file is in this repository at `LaunchDarkly.pk` as well as here: + +``` +Public Key: +0024000004800000940000000602000000240000525341310004000001000100f121bbf427e4d7 +edc64131a9efeefd20978dc58c285aa6f548a4282fc6d871fbebeacc13160e88566f427497b625 +56bf7ff01017b0f7c9de36869cc681b236bc0df0c85927ac8a439ecb7a6a07ae4111034e03042c +4b1569ebc6d3ed945878cca97e1592f864ba7cc81a56b8668a6d7bbe6e44c1279db088b0fdcc35 +52f746b4 + +Public Key Token: f86add69004e6885 +``` + +## Learn more + +TODO(cwaldren): update reference docs links + +Read our [documentation](https://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](https://docs.launchdarkly.com/sdk/server-side/dotnet). + +The authoritative description of all types, properties, and methods is in the [generated API documentation](https://launchdarkly.github.io/dotnet-core/pkgs/sdk/server). + +## Contributing + +We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this SDK. + +## About LaunchDarkly + +* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can: + * Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases. + * Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?). + * Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file. + * Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline. +* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list. +* Explore LaunchDarkly + * [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information + * [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides + * [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation + * [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates diff --git a/pkgs/sdk/server-ai/docfx.json b/pkgs/sdk/server-ai/docfx.json new file mode 100644 index 00000000..92803d64 --- /dev/null +++ b/pkgs/sdk/server-ai/docfx.json @@ -0,0 +1,48 @@ +{ + "metadata": [ + { + "src": [ + { + "src": "./src", + "files": [ + "**/*.csproj", + "**/bin/**/**LaunchDarkly**.dll" + ] + } + ], + "dest": "./api", + "properties" : { + "Configuration": "Debug" + }, + } + ], + "build": { + "content": [ + { + "files": [ + "**/*.{md,yml}" + ], + "exclude": [ + "docs/**" + ] + } + ], + "resource": [ + { + "files": [ + "images/**" + ] + } + ], + "output": "docs", + "template": [ + "default" + ], + "globalMetadata": { + "_appName": "LaunchDarkly Dotnet Server AI SDK", + "_appTitle": "LaunchDarkly Dotnet Server AI SDK", + "_enableSearch": true, + "pdf": false + } + } +} diff --git a/pkgs/sdk/server-ai/github_actions.env b/pkgs/sdk/server-ai/github_actions.env new file mode 100644 index 00000000..d672a472 --- /dev/null +++ b/pkgs/sdk/server-ai/github_actions.env @@ -0,0 +1,5 @@ +WORKSPACE_PATH=pkgs/sdk/server-ai +PROJECT_FILE=pkgs/sdk/server-ai/src/LaunchDarkly.ServerSdk.Ai.csproj +BUILD_OUTPUT_PATH=pkgs/sdk/server-ai/src/bin/Release/ +BUILD_OUTPUT_DLL_NAME=LaunchDarkly.ServerSdk.Ai.dll +TEST_PROJECT_FILE=pkgs/sdk/server-ai/test/LaunchDarkly.ServerSdk.Ai.Tests.csproj diff --git a/pkgs/sdk/server-ai/index.md b/pkgs/sdk/server-ai/index.md new file mode 100644 index 00000000..4cc720a9 --- /dev/null +++ b/pkgs/sdk/server-ai/index.md @@ -0,0 +1,19 @@ +--- +_layout: landing +--- + +# LaunchDarkly Server-Side AI SDK for .NET + +For first time users, visit our [LaunchDarkly Docs](https://docs.launchdarkly.com/sdk/server-side/dotnet) page. + + +This site contains the full API reference for the [`LaunchDarkly.ServerSdk.Ai`](https://www.nuget.org/packages/LaunchDarkly.ServerSdk.Ai). + +For source code, see the [GitHub repository](https://github.com/launchdarkly/dotnet-core). +The [developer notes](https://github.com/launchdarkly/dotnet-core/blob/main/CONTRIBUTING.md) there include links +to other repositories used in the SDK. + + +## Namespaces + +**[LaunchDarkly.Sdk.Ai](docs-src/namespaces/LaunchDarkly.Sdk.Ai.md):** The base namespace for all LaunchDarkly .NET-based SDKs, containing common types. diff --git a/pkgs/sdk/server-ai/src/LaunchDarkly.ServerSdk.Ai.csproj b/pkgs/sdk/server-ai/src/LaunchDarkly.ServerSdk.Ai.csproj new file mode 100644 index 00000000..4c784f1e --- /dev/null +++ b/pkgs/sdk/server-ai/src/LaunchDarkly.ServerSdk.Ai.csproj @@ -0,0 +1,52 @@ + + + + 0.0.0 + + + netstandard2.0;net462;net6.0 + $(BUILDFRAMEWORKS) + + portable + LaunchDarkly.ServerSdk.Ai + Library + LaunchDarkly.ServerSdk.Ai + LaunchDarkly.Sdk.Server.Ai + 7.3 + LaunchDarkly Server-Side .NET AI SDK + LaunchDarkly + LaunchDarkly + LaunchDarkly + Copyright 2024 LaunchDarkly + Apache-2.0 + https://github.com/launchdarkly/dotnet-core + https://github.com/launchdarkly/dotnet-core + main + true + snupkg + + + true + + + 1570,1571,1572,1573,1574,1580,1581,1584,1591,1710,1711,1712 + + + + + + + + ../../../../LaunchDarkly.snk + true + + + + bin\$(Configuration)\$(TargetFramework)\LaunchDarkly.ServerSdk.Ai.xml + + diff --git a/pkgs/sdk/server-ai/src/LdAiConfigTracker.cs b/pkgs/sdk/server-ai/src/LdAiConfigTracker.cs new file mode 100644 index 00000000..d9d506e4 --- /dev/null +++ b/pkgs/sdk/server-ai/src/LdAiConfigTracker.cs @@ -0,0 +1,29 @@ +using System; + +namespace LaunchDarkly.Sdk.Server.Ai +{ + /// + /// TBD + /// + public sealed class LdAiConfigTracker : IDisposable + { + private readonly LdClient _client; + + /// + /// TBD + /// + /// an LdClient instance + public LdAiConfigTracker(LdClient client) + { + _client = client; + } + + /// + /// THD + /// + public void Dispose() + { + _client?.Dispose(); + } + } +} diff --git a/pkgs/sdk/server-ai/test/LaunchDarkly.ServerSdk.Ai.Tests.csproj b/pkgs/sdk/server-ai/test/LaunchDarkly.ServerSdk.Ai.Tests.csproj new file mode 100644 index 00000000..caeb643e --- /dev/null +++ b/pkgs/sdk/server-ai/test/LaunchDarkly.ServerSdk.Ai.Tests.csproj @@ -0,0 +1,29 @@ + + + + net462;net6.0 + $(TESTFRAMEWORK) + LaunchDarkly.ServerSdk.Ai.Tests + LaunchDarkly.ServerSdk.Ai.Tests + false + true + LaunchDarkly.Sdk.Server.Ai + + + + + + + + + + + + + + + + diff --git a/pkgs/sdk/server-ai/test/LdAiConfigTrackerTest.cs b/pkgs/sdk/server-ai/test/LdAiConfigTrackerTest.cs new file mode 100644 index 00000000..2a6a9d7c --- /dev/null +++ b/pkgs/sdk/server-ai/test/LdAiConfigTrackerTest.cs @@ -0,0 +1,14 @@ +using Xunit; + +namespace LaunchDarkly.Sdk.Server.Ai +{ + public class LdAiTrackerTest + { + [Fact] + public void CanCallDispose() + { + var tracker = new LdAiConfigTracker(null); + tracker.Dispose(); + } + } +}