feat(java): add streaming ASR SDK - #1113
Mason Chen (jiec-msft) wants to merge 18 commits into
Conversation
Add a Java 17 JNA binding for reusable-model PCM transcription, final results, cancellation, and deterministic cleanup. Package a normal Maven SDK and sources JAR while keeping native runtimes and model weights external. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build and test the Java 17 SDK from the team preview branch, derive a fixed version from the source tag, reject shaded JNA or Gson classes, and upload the exact first-party JAR with checksum evidence. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move checkout, Java setup, and artifact upload to their current Node 24-based major versions so preview builds do not rely on deprecated action runtimes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Mason Chen (@jiec-msft) is attempting to deploy a commit to the MSFT-AIP Team on Vercel. A member of the Team first needs to authorize it. |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟡 Changes recommended
Download cancellation has a race that can misreport success, and model-ID validation diverges from the native contract.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a Java 17/JNA SDK for streaming ASR, including lifecycle management, packaging, validation, and five-platform CI.
Changes:
- Implements reusable models, audio sessions, streaming PCM/WAV transcription, cancellation, and timing.
- Adds unit and native integration tests plus Maven packaging.
- Integrates Java builds into repository development and Azure pipelines.
File summaries
| File | Description |
|---|---|
sdk_v2/java/THIRD_PARTY_NOTICES.md |
Documents Java dependencies and licensing. |
sdk_v2/java/src/test/java/com/microsoft/foundry/local/TranscriptionStateTest.java |
Tests transcription state and cancellation races. |
sdk_v2/java/src/test/java/com/microsoft/foundry/local/NativeContractTest.java |
Validates native ABI contracts. |
sdk_v2/java/src/test/java/com/microsoft/foundry/local/NativeAsrTest.java |
Adds opt-in native ASR integration coverage. |
sdk_v2/java/src/test/java/com/microsoft/foundry/local/AudioValidationTest.java |
Tests PCM, WAV, and configuration validation. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/WavAudio.java |
Implements bounded WAV parsing. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/TranscriptionTiming.java |
Exposes request timing metrics. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/TranscriptionResult.java |
Defines final transcription results. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/Transcription.java |
Implements streaming request lifecycle. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/SpeechEvent.java |
Defines streaming speech events. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/PcmFormat.java |
Validates supported PCM input. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/NativeApi.java |
Provides the JNA C-ABI binding. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/ModelNotFoundException.java |
Adds exact-model lookup errors. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/ModelInfo.java |
Defines detached model metadata. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/Model.java |
Implements model operations and downloads. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/FoundryLocalManager.java |
Manages native ownership and cleanup. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/FoundryLocalException.java |
Exposes native error codes. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/Configuration.java |
Defines explicit runtime paths. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/Catalog.java |
Implements model discovery and lookup. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/CancellationToken.java |
Adds download cancellation state. |
sdk_v2/java/src/main/java/com/microsoft/foundry/local/AudioSession.java |
Owns sequential transcription sessions. |
sdk_v2/java/README.md |
Documents setup and streaming usage. |
sdk_v2/java/pom.xml |
Configures Maven compilation and packaging. |
sdk_v2/java/build.ps1 |
Adds Maven bootstrap and build support. |
sdk_v2/java/.gitignore |
Ignores Java build artifacts. |
sdk_v2/DEVELOPMENT.md |
Adds Java prerequisites and workflow. |
sdk_v2/build_and_test_all.ps1 |
Includes Java in aggregate validation. |
.pipelines/templates/steps-build-java.yml |
Builds and native-tests Java. |
.pipelines/templates/steps-bootstrap-maven.yml |
Bootstraps pinned Maven. |
.pipelines/templates/stages-sdk-v2.yml |
Registers Java pipeline stages. |
.pipelines/templates/stages-java.yml |
Adds five-platform CI and packaging. |
.pipelines/templates/fetch-models-from-artifacts-feed.yml |
Supports focused ASR model retrieval. |
Review details
- Files reviewed: 32/32 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The CI bootstrap can ignore Maven 3.9.9 when an agent already defines M2_HOME.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
.pipelines/templates/steps-bootstrap-maven.yml:40
Maven@4checksM2_HOMEbefore searchingPATHwhenmavenVersionOptionisDefault. On a self-hosted agent that already definesM2_HOME, both Java Maven tasks will therefore ignore this downloaded 3.9.9 installation, defeating the pinned bootstrap. Publish this directory asM2_HOME(or configure both tasks withmavenVersionOption: Path) so the selected Maven version is deterministic.
- Files reviewed: 32/32 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The new native ABI, concurrent lifecycle management, and five-platform packaging pipeline warrant final human validation.
Review details
Suppressed comments (3)
sdk_v2/java/README.md:31
- The immutable-release command also uses a Windows-only POM path and fails when copied into PowerShell on Linux or macOS. Use the cross-platform separator here as well.
mvn -f sdk_v2\java\pom.xml -Drevision=0.1.0 package
sdk_v2/java/README.md:153
- The opt-in integration-test command has the same cross-platform path issue, so Unix users cannot run the documented validation verbatim. Use forward slashes for the POM path.
mvn -f sdk_v2\java\pom.xml test `
sdk_v2/java/README.md:147
- This test command passes a backslash-containing filename to Maven, which is not a valid path on the supported Unix platforms. Use a forward-slash path.
mvn -f sdk_v2\java\pom.xml test
- Files reviewed: 32/32 changed files
- Comments generated: 2
- Review effort level: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. |
|
Superseded by #1120, which uses the same exact history from a branch in this repository. |
Adds a Java 17 SDK for Foundry Local streaming ASR through JNA.
The existing preview release remains unchanged.
Earlier PRs: #1094 and #1100.