Skip to content

Advanced Paste additional customizations and PhiSilica provider - #46727

Open
Gleb Khmyznikov (khmyznikov) wants to merge 109 commits into
mainfrom
gleb/advanced-paste
Open

Advanced Paste additional customizations and PhiSilica provider#46727
Gleb Khmyznikov (khmyznikov) wants to merge 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

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread doc/devdocs/modules/advancedpaste.md Fixed
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@khmyznikov
Gleb Khmyznikov (khmyznikov) marked this pull request as ready for review June 13, 2026 04:28
@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.

Comment thread src/modules/AdvancedPaste/AdvancedPaste/Program.cs Outdated
@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.101 Product-Advanced Paste Refers to the Advanced Paste module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants