Skip to content

Advanced Paste additional customizations and PhiSilica provider - #46727

Merged
Niels Laute (niels9001) merged 109 commits into
mainfrom
gleb/advanced-paste
Aug 8, 2026
Merged

Niels Laute (niels9001) merged 109 commits into
mainfrom
gleb/advanced-paste

Conversation

@khmyznikov

@khmyznikov Gleb Khmyznikov (khmyznikov) commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds an on-device Phi Silica (Windows AI) paste provider to Advanced Paste and richer
per-action customization, plus the package-identity plumbing that lets the unpackaged
Advanced Paste app use Windows AI APIs.

Note: this supersedes the earlier "self-contained MSIX package installed/registered by the
WiX installer" approach. Advanced Paste is not packaged or installed as a standalone
MSIX. It keeps shipping as the existing unpackaged, self-contained WinUI 3 executable in
WinUI3Apps/ and acquires package identity at runtime from the existing PowerToys sparse
package
— there are no installer or ESRP MSIX repack changes.

Advanced Paste features

  • New Phi Silica paste provider (CustomActions/PhiSilicaPasteProvider.cs): an on-device
    AI provider backed by the Windows AI Phi Silica language model — no cloud endpoint or API
    key required. Registered as a new AIServiceType via PasteAIProviderFactory /
    AIServiceTypeRegistry.
  • Additional custom actions (AdvancedPasteAdditionalAction): user-defined actions with
    their own prompt, system prompt, AI provider, and shortcut — plus an optional "coaching"
    prompt/system-prompt/provider/shortcut and shortcut-conflict detection.
  • Built-in default prompts (AdvancedPasteDefaultPrompts) and updates to
    AdvancedPasteCustomAction, PasteFormat(s), OptionsViewModel, and
    PasteFormatExecutor to support per-action provider selection and system prompts.
  • Settings UI (AdvancedPastePage.xaml/.xaml.cs, Resources.resw): configure the
    Phi Silica provider, choose a provider per action, edit system/coaching prompts, and a
    Phi Silica availability/readiness experience — Settings queries the Advanced Paste
    executable via --check-phi-silica, and a "Download model" action triggers
    --prepare-phi-silica to fetch the model and then re-probes.

Package identity for Windows AI (replaces the MSIX-install approach)

  • Phi Silica is a Limited Access Feature (LAF) that can only be unlocked by a process
    with a registered package identity. Advanced Paste runs unpackaged, so it obtains
    identity from the existing Microsoft.PowerToys.SparseApp sparse package
    (src/PackageIdentity/): a new <Application Id="PowerToys.AdvancedPasteUI"> entry in
    AppxManifest.xml maps it to PowerToys.AdvancedPaste.exe, with matching updates to
    BuildSparsePackage.ps1.
  • LAF unlock at runtime via PhiSilicaLafHelper.cs. The token/attestation are baked at
    build time by the GeneratePhiSilicaLafCredentials MSBuild target into
    PhiSilicaLafCredentials.g.cs — local dev defaults live in src/PhiSilicaLaf.props
    (imported from Directory.Build.props) and the production secret is injected via
    /p: in the release pipeline.
  • New AdvancedPaste.dev.manifest / AdvancedPaste.prod.manifest application manifests
    (selected by CIBuild) declaring full-trust and the system AI models capability.

Build & pipeline

  • Windows App SDK moved to the coherent stable 2.2.0 line and added
    Microsoft.WindowsAppSDK.AI 2.2.3
    (the Phi Silica APIs). Foundation 2.1.0 carries the
    sparse-identity PRI fix, and the stable AI build matches the OS Windows AI runtime.
  • Independent versioning for Advanced Paste (src/modules/AdvancedPaste/custom.props,
    XES one-store versioning, AdvancedPasteVersion). A steps-setup-versioning.yml step is
    added for Advanced Paste in job-build-project.yml, ordered before CmdPal to avoid a
    version-collision installer failure (WIX0103).
  • release.yml passes PhiSilicaLafToken/PhiSilicaLafAttestation into the main build;
    spell-check allow-list/patterns updated.
  • Removed now-unneeded dependencies: the Microsoft.Windows.Compatibility reference and the
    Common.UI "force matching DLL versions" hack.
image image image image

Video clip internal

Build internal

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown

check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

Unrecognized words (1)

SCL

Some files were automatically ignored 🙈

These sample patterns would exclude them:

^src/modules/ZoomIt/ZoomIt/rnnoise/rnnoise_data_little\.c$
^src/modules/ZoomIt/ZoomIt/selfie_segmentation\.onnx$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct and update file exclusions, you could run the following commands

... in a clone of the git@github.com:microsoft/PowerToys.git repository
on the gleb/advanced-paste branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/27480011503/attempts/1' &&
git commit -m 'Update check-spelling metadata'

OR

To have the bot accept them for you, comment in the PR quoting the following line:
check-spelling-bot apply updates.

Forbidden patterns 🙅 (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

Should be a
\san (?=(?:[b-dfgjklpqtvwz]|h(?!onou?r|our|s[lv]|tml|ttp|ref)|n(?!ginx|grok|pm)|r(?!c)|s(?!s[ho]|vg))[a-z]|x(?!\b|[-\d]|ml))
Errors and Warnings ❌ (4)

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

❌ Errors and Warnings Count
⚠️ binary-file 1
⚠️ duplicate-pattern 2
❌ forbidden-pattern 1
⚠️ large-file 1

See ❌ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

_SECURE_SCL is still present in deps/vcpkg-overlays/spdlog/msvc-14.51-stdext-checked-array-iterator.patch,
so dropping SCL from expect.txt made check-spelling fail on the unrecognized word. Restore the entry.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@MuyuanMS Muyuan Li (MuyuanMS) 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.

Review findings for the current head. Two comments include directly applicable suggestions.

@khmyznikov

Copy link
Copy Markdown
Contributor Author

Muyuan Li (@MuyuanMS) thanks for a review 😊

@MuyuanMS Muyuan Li (MuyuanMS) 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.

LGTM

@niels9001
Niels Laute (niels9001) merged commit a87f5b0 into main Aug 8, 2026
8 checks passed
@niels9001
Niels Laute (niels9001) deleted the gleb/advanced-paste branch August 8, 2026 05:44
Gordon Lam (yeelam-gordon) added a commit that referenced this pull request Aug 13, 2026
#49840)

…roviders

PR #46727 added `ReasoningEffort = "minimal"` to
OpenAIPromptExecutionSettings in
SemanticKernelPasteProvider.CreateExecutionSettings(). The value is not
user-configurable, so every OpenAI/Azure OpenAI request now fails on
models that don't accept 'minimal':

HTTP 400 (invalid_request_error: unsupported_value) Parameter:
reasoning_effort
Unsupported value: 'reasoning_effort' does not support 'minimal' with
this
  model. Supported values are: 'medium'.

This is the same class of regression PR #43766 previously fixed by
removing hardcoded Temperature/tuning properties. Remove the property so
the service default applies, and add a comment to prevent it being
reintroduced.

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Boliang Zhang (LegendaryBlair) pushed a commit that referenced this pull request Aug 14, 2026
#49840)

…roviders

PR #46727 added `ReasoningEffort = "minimal"` to
OpenAIPromptExecutionSettings in
SemanticKernelPasteProvider.CreateExecutionSettings(). The value is not
user-configurable, so every OpenAI/Azure OpenAI request now fails on
models that don't accept 'minimal':

HTTP 400 (invalid_request_error: unsupported_value) Parameter:
reasoning_effort
Unsupported value: 'reasoning_effort' does not support 'minimal' with
this
  model. Supported values are: 'medium'.

This is the same class of regression PR #43766 previously fixed by
removing hardcoded Temperature/tuning properties. Remove the property so
the service default applies, and add a comment to prevent it being
reintroduced.

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7b3fb20d-6e9d-4fef-a5cd-f8921d28c220
Yu Leng (moooyo) pushed a commit that referenced this pull request Aug 18, 2026
## Summary of the Pull Request

Adds a regression test guarding against re-introduction of a hardcoded
`ReasoningEffort` value in
`SemanticKernelPasteProvider.CreateExecutionSettings()`. This value
previously broke every OpenAI/Azure OpenAI custom paste action for
models that don't support `reasoning_effort: minimal`, causing HTTP 400
errors (see #49838).

The underlying fix already exists on `main` —
`CreateExecutionSettings()` no longer sets `ReasoningEffort`, and the
Phi Silica on-device provider has since been split into its own
`PhiSilicaPasteProvider` class. This PR does not modify provider logic;
it adds test coverage to prevent this specific regression from being
reintroduced.

## PR Checklist

- [x] Closes: #xxx
_(Not applicable — this PR does not close #49838, since the underlying
fix already landed separately. Filed to add regression coverage only.)_
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
_(Not yet discussed with core contributors — flagging that this is a
test-only addition in response to already-observed regression risk, and
happy to adjust scope/approach based on maintainer feedback.)_
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end-user-facing strings can be localized
  _(N/A — no user-facing strings changed.)_
- [x] **Dev docs:** Added/updated
  _(N/A — internal test-only change, no dev docs affected.)_
- [x] **New binaries:** Added on the required places
  _(N/A — no new binaries introduced.)_
- [x] **Documentation updated:** If checked, please file a pull request
on our docs repo and link it here: #xxx
  _(N/A — no user-facing documentation changes.)_

## Detailed Description of the Pull Request / Additional comments

Issue #49838 reported that Advanced Paste custom actions fail with HTTP
400 for OpenAI/Azure OpenAI models that don't support `reasoning_effort:
minimal`, a value that was hardcoded in
`SemanticKernelPasteProvider.CreateExecutionSettings()` (originally
introduced in #46727 alongside the Phi Silica on-device provider).

By the time this was investigated, the hardcoded value had already been
removed from `main`, and the code now includes an explicit comment
warning against reintroducing model-specific tuning properties in this
shared method. However, there was no test enforcing that guarantee —
meaning a future change could silently reintroduce the same class of bug
(this is the second time this exact pattern has caused a regression; see
#43766 for the first).

This PR adds a unit test in `AdvancedPaste.UnitTests` that constructs an
OpenAI-configured `SemanticKernelPasteProvider` and asserts that
`CreateExecutionSettings()` returns an `OpenAIPromptExecutionSettings`
object with `ReasoningEffort` left unset. No production code is
modified.

## Validation Steps Performed

- Added the new unit test to `AdvancedPaste.UnitTests`.
- Ran the test locally against the current `main` branch and confirmed
it passes.
- Confirmed no other tests in the `AdvancedPaste.UnitTests` project were
affected by this change.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Boliang Zhang (LegendaryBlair) pushed a commit that referenced this pull request Aug 19, 2026
## Summary of the Pull Request

Adds a regression test guarding against re-introduction of a hardcoded
`ReasoningEffort` value in
`SemanticKernelPasteProvider.CreateExecutionSettings()`. This value
previously broke every OpenAI/Azure OpenAI custom paste action for
models that don't support `reasoning_effort: minimal`, causing HTTP 400
errors (see #49838).

The underlying fix already exists on `main` —
`CreateExecutionSettings()` no longer sets `ReasoningEffort`, and the
Phi Silica on-device provider has since been split into its own
`PhiSilicaPasteProvider` class. This PR does not modify provider logic;
it adds test coverage to prevent this specific regression from being
reintroduced.

## PR Checklist

- [x] Closes: #xxx
_(Not applicable — this PR does not close #49838, since the underlying
fix already landed separately. Filed to add regression coverage only.)_
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
_(Not yet discussed with core contributors — flagging that this is a
test-only addition in response to already-observed regression risk, and
happy to adjust scope/approach based on maintainer feedback.)_
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end-user-facing strings can be localized
  _(N/A — no user-facing strings changed.)_
- [x] **Dev docs:** Added/updated
  _(N/A — internal test-only change, no dev docs affected.)_
- [x] **New binaries:** Added on the required places
  _(N/A — no new binaries introduced.)_
- [x] **Documentation updated:** If checked, please file a pull request
on our docs repo and link it here: #xxx
  _(N/A — no user-facing documentation changes.)_

## Detailed Description of the Pull Request / Additional comments

Issue #49838 reported that Advanced Paste custom actions fail with HTTP
400 for OpenAI/Azure OpenAI models that don't support `reasoning_effort:
minimal`, a value that was hardcoded in
`SemanticKernelPasteProvider.CreateExecutionSettings()` (originally
introduced in #46727 alongside the Phi Silica on-device provider).

By the time this was investigated, the hardcoded value had already been
removed from `main`, and the code now includes an explicit comment
warning against reintroducing model-specific tuning properties in this
shared method. However, there was no test enforcing that guarantee —
meaning a future change could silently reintroduce the same class of bug
(this is the second time this exact pattern has caused a regression; see
#43766 for the first).

This PR adds a unit test in `AdvancedPaste.UnitTests` that constructs an
OpenAI-configured `SemanticKernelPasteProvider` and asserts that
`CreateExecutionSettings()` returns an `OpenAIPromptExecutionSettings`
object with `ReasoningEffort` left unset. No production code is
modified.

## Validation Steps Performed

- Added the new unit test to `AdvancedPaste.UnitTests`.
- Ran the test locally against the current `main` branch and confirmed
it passes.
- Confirmed no other tests in the `AdvancedPaste.UnitTests` project were
affected by this change.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7b3fb20d-6e9d-4fef-a5cd-f8921d28c220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.101 Good to Merge Product-Advanced Paste Refers to the Advanced Paste module

6 participants