generate App Intents SSU training assets during bundling - #2
Draft
markvasiv wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generate App Intents SSU training assets during bundling
Problem
Apps built with rules_apple are invisible to Siri's App Intents natural-language matching. App Shortcut phrases ("Play something on ${applicationName}") are never recognized, and on iOS 26+ assistant schema requests (e.g.
@AssistantIntent(schema: .media.playAudio)) are not routed to the app - Siri's planner reports the app as not supporting the intent and falls back to just launching it:Root cause
Xcode runs two tools for App Intents, rules_apple only runs the first:
appintentsmetadataprocessor- producesMetadata.appintents/extract.actionsdata.appintentsnltrainingprocessor- runs on the built product and produces the NL training assets:Metadata.appintents/root.ssu.yamlplus one compiled<locale>.lproj/nlu.appintentsarchive per localization.Siri's utterance matching runs against the compiled
nlu.appintentsarchives, so without them the metadata alone only feeds touch surfaces (Shortcuts app, Spotlight), not voice.I found it by building Apple's sample project and inspecting produced archives:
https://developer.apple.com/documentation/appintents/integrating-your-music-app-with-apple-intelligence
Design
The tool must run against the assembled bundle - it reads the merged Info.plist and derives the locale set from the bundle's
.lprojdirectories - so it can't be an ordinary analysis-time action over partial inputs. It runs in the existing post-assembly, pre-signing stage (whereipa_post_processorruns), so the generated assets are sealed into the code signature:app_intents_metadata_bundlepartial: acceptsbundle_idand requests SSU training via a new partial output field (app_intents_ssu_training).processor.bzl: collects the request (same pattern assigned_frameworks), builds the invocation with archive-relative paths, and threads it into both bundling modes:%ssu_training_command_lines%block inprocess_and_sign.sh.template, after the post-processor, before signing.ssu_training_commandscontrol field executed bybundletool_experimental.pybetween post-processing and signing. It runs with the action's environment - the existing signing command lines run withenv={}, which can't hostxcrun.Metadata.appintentsor the toolchain lacksappintentsnltrainingprocessor(older Xcode), it does nothing. The tool can printerror: Could not archive SSU artifactswhile exiting 0, so output is scanned forerror:like the metadata processor action already does.For now, it's opt-in via
--features=apple.app_intents_ssu_trainingand only supported inios_application.Follow-ups
AppShortcuts.stringsvia--source-file(Xcode'sLM_STRINGS_FILE_PATH_LIST) for localized phrase training.--deployment-postprocessingfor release archives.