Skip to content

[Blazor] Version Components.AI independently as 0.1.0-alpha.1 - #68312

Merged
kotlarmilos merged 35 commits into
mainfrom
milosk/components-ai-oob-package
Aug 17, 2026
Merged

kotlarmilos merged 35 commits into
mainfrom
milosk/components-ai-oob-package

Conversation

@kotlarmilos

@kotlarmilos kotlarmilos commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

Description

Builds Microsoft.AspNetCore.Components.AI as an out of band package that versions independently from the shared framework, stays out of the .NET platform release, and builds on its own cadence through .azure/pipelines/components-ai-daily.yml.

Versioning

  • Package: Microsoft.AspNetCore.Components.AI
  • Components.AI version: 0.1.0-preview.1
  • Arcade build suffix example: 26413.3
  • Package example: Microsoft.AspNetCore.Components.AI.0.1.0-preview.1.26413.3
  • Feed: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11-transport/nuget/v3/index.json

Each successful build appends a unique suffix and produces a new package version.

Enabling shipping to nuget.org

Deferred to a follow up change. Enabling it requires the following.

  • Set IsShippingPackage back to true in the project file.
  • Restore the entry in eng/ShippingAssemblies.props by running ./eng/scripts/GenerateProjectList.ps1.
  • Exclude the assembly from PackageAssembliesHaveExpectedAssemblyVersions in src/Framework/test/PackageTests.cs, since 0.1.0.0 does not match the expected shared framework version.
  • Register the daily pipeline in dnceng and give it a darc channel with a nuget.org publishing target.
  • Complete release side onboarding for the new package identity, covering nuget.org ownership, release notes, and ship approval.

javiercn and others added 24 commits July 28, 2026 13:59
Add the foundational data model for Microsoft.AspNetCore.Components.AI:
- ContentBlock type hierarchy with lifecycle state and change notifications
- RichContentBlock with text segments and paragraph-based RichTextNode tree
- BlockMappingPipeline with active/inactive handler architecture
- TextBlockHandler for streaming text into RichContentBlock
- UIAgent for orchestrating IChatClient streaming into blocks
- ContentBlockHandler<TState> extensibility point for custom handlers
- UIAgentOptions for configuring handlers and chat options
- Project scaffolding, solution integration, and test framework
…backs, remove Hidden

- Make ContentBlock property setters internal (Id, LifecycleState, Role, AuthorName)
- Make RichContentBlock.Content setter internal
- Remove unused BlockLifecycleState.Hidden enum value
- Add null guard in ContentBlock.OnChanged
- Add null guard in UIAgent constructor for IChatClient
- Add null guard in UIAgentOptions.AddBlockHandler
- Add null guard in BlockMappingResult.Emit for block parameter
- Snapshot callback list in NotifyChanged to allow safe removal during iteration

Co-authored-by: Copilot <[email protected]>
… error handling

Add the full block engine with all handler types:
- AgentContext for turn assembly, status tracking, and error handling
- FunctionInvocationContentBlock and FunctionInvocationHandler for tool calls
- FunctionApprovalBlock and FunctionApprovalHandler for human-in-the-loop
- UIActionBlock and UIActionHandler for client-side tool invocation
- ReasoningContentBlock and ReasoningHandler for chain-of-thought tokens
- MediaContentBlock and MediaContentHandler for data content
- AgentState<T> and UIAgent<TState> for state management with StateMapper
- Source-generated logging for pipeline and UIAgent
- 10 integration sample tests and comprehensive engine unit tests
…rendering primitives

Add the component layer for building AI chat UIs:
- MessageListContext with block renderer registration and cascading state
- AgentBoundary for scoping AgentContext and AgentState cascading values
- ConversationTurnRenderer for rendering user/assistant turn groups
- BlockContainer for dispatching blocks to registered renderers
- MessageList for rendering conversation turns with auto-scroll
- MessageInput for text input with send button
- BlockRenderer<TBlock> and BlockRenderer<TBlock, TRenderer> for custom block rendering
- Component unit tests for all new components
Add high-level layout components and stylesheet:
- ChatPage, ChatBubble, and ChatDrawer layout shells
- SuggestionList for suggested prompts
- BubblePosition and DrawerPosition configuration enums
- ai-chat.css vanilla stylesheet with CSS custom properties
- Default renderers for FunctionInvocationContentBlock and FunctionApprovalBlock
- SSR approval block rendering tests
- Shell component unit tests
Add cross-cutting features:
- IConversationThread for conversation storage, restore, and new conversation support
- RestoreAsync on UIAgent and AgentContext for replaying thread history
- AgentFormBoundary and FormMessageInput for SSR form-based input
- MessageInput attachment support using InputFile (no JS interop)
- Thread integration tests and form component tests
Add advanced features:
- ToolBlockGenerator source generator for generating tool block types from attributes
- ToolBlockAttribute, ToolParameterAttribute, ToolResultAttribute
- ActivityContentBlock and ActivityHandler for activity/progress tracking
- Complete RichTextNode hierarchy (25 node types for markdown representation)
- RichContentBlock and RichTextNode tests
- Tool block integration tests
- Source generator unit tests
Add end-to-end testing setup:
- AIApp test asset (Blazor Web App with ChatPage, Counter, Weather pages)
- AIApp.E2E.Tests project using Components.Testing E2E framework
- BaselineReplayClient for deterministic E2E test playback
- ChatClientOverrides service configuration for test injection
- E2E test baselines for single-turn echo, multi-turn, and streaming
- ChatPageTests covering basic chat flow E2E scenarios
- Vendor bootstrap assets and favicon for test app
Make the incremental pipeline model value-equatable and robust to
legitimate user code:

- ToolBlockCandidate and its info types are now immutable classes with
  manual IEquatable/Equals/GetHashCode (sequence equality for collections)
  so Roslyn can cache generator outputs correctly.
- Reference the annotated block type by its fully-qualified, keyword-escaped
  name everywhere in generated code, and escape emitted member/namespace
  identifiers, so keyword and verbatim identifiers no longer produce
  uncompilable output.
- Qualify generated hint names with the namespace so two ToolBlocks with the
  same simple name in different namespaces no longer collide.
- Diagnose invalid declarations instead of silently skipping them: parse
  results now carry value-equatable DiagnosticInfo entries reported in the
  source-output stage (partial/abstract/generic/base/tool-name), plus a new
  BAIC009 for nested types and BAIC006/BAIC007 for duplicate keys / missing
  setters.
- Match a FunctionResultContent by CallId while scanning, and guard generated
  argument/result deserialization with try/catch so malformed LLM values
  cannot fault the whole handler.

Co-authored-by: Copilot <[email protected]>
…TS leak

- AgentContext now surfaces cancellation requested through the caller's own
  CancellationToken by throwing from SendMessageAsync/RetryAsync, so the
  returned Task completes as canceled. Cancellation driven by CancelAsync()
  (the internal linked token only) remains a graceful stop that completes
  normally and returns to Idle.
- Dispose the previous streaming CancellationTokenSource before creating a new
  one on each send/retry, instead of leaking it until the context is disposed.
- Validate the ChatMessage argument at the public boundary.
- Document that a failing turn is intentionally surfaced as Error state (for the
  error banner + RetryAsync), not a silently swallowed exception.

Co-authored-by: Copilot <[email protected]>
MessageInput and SuggestionList registered a new AgentContext status callback
on every SetParametersAsync, accumulating handlers (and retaining the component)
on each parent re-render. Register once, matching the existing pattern in
FormMessageInput; the AgentContext cascade is fixed for the component lifetime.

Co-authored-by: Copilot <[email protected]>
- FunctionApprovalBlock.Approve/Reject are now single-use: they no-op unless the
  block is still Pending, so a second click cannot flip the displayed status
  after the underlying result has already been sent.
- AgentFormBoundary only accepts the 'approve' and 'reject' posted actions;
  any other (including tampered) value is ignored instead of defaulting to a
  rejection.
- The default MessageList error banner shows a generic message instead of the
  raw exception text, to avoid leaking internal details to end users. Updated
  DefaultFooter_ShowsErrorBannerOnError accordingly.

Co-authored-by: Copilot <[email protected]>
The recorded UIAgent tests replayed baselines when present but otherwise created
a real AzureOpenAIClient with DefaultAzureCredential and recorded new baselines
into the source tree. A missing baseline could therefore silently call a live
service using ambient credentials and write files during an ordinary test run.

Recording is now opt-in: the live/record path is only taken when both
COMPONENTS_AI_AZURE_OPENAI_ENDPOINT and COMPONENTS_AI_AZURE_OPENAI_DEPLOYMENT are
provided. Otherwise a missing baseline fails fast with a clear message instead of
reaching out to Azure or writing baselines.

Co-authored-by: Copilot <[email protected]>
MessageInput.SubmitAsync returned early whenever the text box was empty, so a
message consisting only of file attachments was silently discarded. Submit now
proceeds when there is either text or at least one attachment, and omits the
empty TextContent when no text was entered.

Co-authored-by: Copilot <[email protected]>
… consumer assemblies

The generated handler assigned ContentBlock.Id, whose setter is internal to the
library assembly. In a consumer project (e.g. an app using [ToolBlock]) that code
did not compile (CS0200). Unit tests masked it because the test assembly has
InternalsVisibleTo.

Derive the Id from the call instead: FunctionInvocationContentBlock.Call now sets
Id (when unset) from CallId, so the generated handler only assigns the public
Call property and no longer touches the internal Id setter.

Co-authored-by: Copilot <[email protected]>
MessageInput bound the textarea value to _text but its oninput handler updated
_text without re-rendering, so Blazor's render tree kept the initial empty value
while the typed text lived only in the DOM. On submit, setting _text back to
empty produced no diff (the last rendered value was already empty), so the
textarea was never cleared. Re-render on input so the rendered value tracks the
DOM value and the clear-on-submit takes effect.

Fixes the SendMessage_ClearsTextarea E2E test.

Co-authored-by: Copilot <[email protected]>
Each conversation turn (a user message plus its assistant response) renders as a
single .sc-ai-turn element; user/assistant differentiation is at the message
level (.sc-ai-message--user/--assistant), not the turn level. The test asserted
4 .sc-ai-turn elements for 2 exchanges; the correct count is 2. Assert 2 turns
plus 2 user and 2 assistant message bubbles.

Co-authored-by: Copilot <[email protected]>
The AIApp E2E test project lives outside src/Components/Testing/testassets, so it
never picked up the development-layout settings from that folder's
Directory.Build.props:

- _E2ETasksAssembly was unset, so the e2e-manifest.json was never generated and no
  test could launch the app under test.
- The Components.Testing source generator was not referenced as an analyzer, so the
  service-override startup hook was not emitted.

It also ran under Arcade's RunTests during regular CI builds even though it needs
Playwright browsers, and it launched the app with 'dotnet run', so concurrent test
instances rebuilt the same project and failed on file locks. Publish the app instead
and opt out of RunTests/Helix, matching Microsoft.AspNetCore.Components.E2ETests.

Finally, the server fixture reuses one app process per distinct service override, so
the singleton baseline replay client was exhausted by the first test that sent a
message. Register it as scoped so each circuit replays from the start.

Co-authored-by: Copilot App <[email protected]>
- Allow src/Components/test/testassets/AIApp to be restored by the repo
  build (it was excluded by the blanket testassets filter, causing
  NETSDK1004 in every build leg).
- Add Microsoft.Extensions.AI/.Abstractions to DependabotDiscovery so the
  Code check stays in sync with eng/Dependencies.props.
- Make AIApp.E2E.Tests resolve the Components.Testing tasks assembly via a
  ProjectReference so the e2e manifest is generated on clean CI machines,
  and skip Arcade's Test target (no xUnit v3 RunTests target).

Co-authored-by: Copilot App <[email protected]>
Arcade replaces Build with an empty target for ExcludeFromBuild projects
(e.g. -p:SkipTestBuild=true), but AfterTargets hooks still fire. That made
PrepareE2EApps publish the referenced E2E app even though neither project
was restored, failing every build leg with NETSDK1004.

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2cee1d73-7093-43d1-9ff0-33e7508a373e
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2cee1d73-7093-43d1-9ff0-33e7508a373e
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2cee1d73-7093-43d1-9ff0-33e7508a373e
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2cee1d73-7093-43d1-9ff0-33e7508a373e
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2cee1d73-7093-43d1-9ff0-33e7508a373e
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2cee1d73-7093-43d1-9ff0-33e7508a373e
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 2cee1d73-7093-43d1-9ff0-33e7508a373e
@kotlarmilos
kotlarmilos force-pushed the milosk/components-ai-oob-package branch from 4772ae2 to 415807a Compare August 10, 2026 12:05
@kotlarmilos
kotlarmilos changed the base branch from javiercn/components-ai-full to milosk/components-ai-poc-cleanup August 10, 2026 12:05
@kotlarmilos
kotlarmilos changed the base branch from milosk/components-ai-poc-cleanup to javiercn/components-ai-full August 10, 2026 12:53
@kotlarmilos
kotlarmilos changed the base branch from javiercn/components-ai-full to javiercn/components-ai-01-chat August 12, 2026 09:06
Preserve the reviewed out-of-band package changes while adopting the rewritten base branch history.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 80cbb933-9bd4-4ff0-9a7d-7a3f9fe25692
Base automatically changed from javiercn/components-ai-01-chat to main August 12, 2026 16:47

@javiercn javiercn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't speak yaml, but I didn't spot anything immediately wrong. @akoeplinger can check too

Components.AI is already packed, signed, registered in BAR, and published by aspnetcore-ci-official, so remove the dedicated pipeline definition.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 80cbb933-9bd4-4ff0-9a7d-7a3f9fe25692
Copilot AI lite review requested due to automatic review settings August 13, 2026 11:55
@kotlarmilos kotlarmilos changed the title [Blazor] Ship Components.AI as an out-of-band preview package [Blazor] Ship Components.AI as an independently versioned preview package Aug 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR independently versions the Microsoft.AspNetCore.Components.AI package as a 0.1.0-preview.7.<official-build> preview package while continuing to use the existing aspnetcore-ci-official publishing/signing/BAR flow.

Changes:

  • Sets an explicit VersionPrefix (0.1.0) for Microsoft.AspNetCore.Components.AI to decouple its versioning from the repo-wide $(VersionPrefix).
  • Updates TreatAsLocalProperty to include VersionPrefix so the project-local value wins even when the build passes global version properties.
Show a summary per file
File Description
src/Components/AI/src/Microsoft.AspNetCore.Components.AI.csproj Overrides version prefix so Components.AI ships as an independently versioned preview package under the existing official pipeline.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

Set the package-owned prerelease label and iteration to alpha.1 while retaining the Arcade official-build suffix for unique daily versions.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 80cbb933-9bd4-4ff0-9a7d-7a3f9fe25692
@kotlarmilos kotlarmilos changed the title [Blazor] Ship Components.AI as an independently versioned preview package [Blazor] Version Components.AI independently as 0.1.0-alpha.1 Aug 13, 2026
kotlarmilos and others added 4 commits August 13, 2026 18:18
Set IsShippingPackage=false so the package leaves the .NET 11 shipping
asset set and lands in artifacts/packages/Release/NonShipping. The
official build still packs, signs, and publishes it, and the package
stays off the release path to nuget.org until that is enabled
deliberately. IsShipping is left unset so the assembly itself is still
treated as shipping. Change the prerelease label from alpha to preview,
so the version reads 0.1.0-preview.1.<build>, and drop
Microsoft.AspNetCore.Components.AI from eng/ShippingAssemblies.props,
which eng/CodeGen.proj generates from IsShippingPackage.

Moving the package out of the shipping folder also avoids a failure in
PackageTests.PackageAssembliesHaveExpectedAssemblyVersions, which reads
every package under ArtifactsShippingPackagesDir and asserts that each
lib assembly carries the shared framework major and minor version. A
VersionPrefix of 0.1.0 gives Microsoft.AspNetCore.Components.AI.dll an
AssemblyVersion of 0.1.0.0 against an expected 11.0, and that check runs
when OfficialBuild is true.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 1a1f3d0f-4d6d-457c-8a36-c578554f6c19
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 1a1f3d0f-4d6d-457c-8a36-c578554f6c19
Components.AI versions independently and is not part of the .NET
platform release, so it does not need to wait for a platform release to
produce a new preview. This pipeline builds, tests, signs, and publishes
only Microsoft.AspNetCore.Components.AI on a daily schedule, which
decouples its build cadence from aspnetcore-ci-official.

The job builds the Blazor JavaScript bundles first because Components.AI
carries static web assets that depend on them, runs the Components.AI
tests, clears artifacts/packages so the packages produced while building
project references do not reach the manifest, then packs with
-noBuildDeps and publishes a components-ai.xml asset manifest.
publishAssetsImmediately keeps darc publishing in the same run rather
than a separate promotion stage.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 1a1f3d0f-4d6d-457c-8a36-c578554f6c19
Aligns the file header with the other pipelines in .azure/pipelines and
removes the inline step comments.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 1a1f3d0f-4d6d-457c-8a36-c578554f6c19
@kotlarmilos
kotlarmilos requested a review from javiercn August 14, 2026 12:28
@kotlarmilos
kotlarmilos enabled auto-merge August 17, 2026 12:02
@kotlarmilos
kotlarmilos merged commit 9eca0e1 into main Aug 17, 2026
29 checks passed
@kotlarmilos
kotlarmilos deleted the milosk/components-ai-oob-package branch August 17, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants