SIGN IN SIGN UP

fix: Moonshot chat rejects supported provider file references and inline text file parts (#19585)

## Background

The published Moonshot provider rejected inline text files and native
ms:// image or video references before request serialization, despite
Moonshot supporting those inputs.

## Root Cause

The Moonshot prompt converter unconditionally threw for reference and
text file-data variants. The recorded reproduction and converter tests
confirmed these branches failed before any HTTP request was sent.

## Summary

Updated Moonshot prompt conversion to serialize text file data as text
parts and validated Moonshot ms:// image and video references as native
URL parts while rejecting foreign, non-ms://, and unsupported-media
references. Added documentation, an example, and a patch changeset.

## Testing

Added converter and request-level regression coverage for text, image
references, video references, and invalid references while preserving
existing data and URL behavior.

## End-to-end Validation

- `pnpm -C examples/ai-functions exec tsx -e "$(git show
HEAD:examples/ai-functions/src/reproduction/issue-19549-moonshot-file-parts.ts)"`
— exited successfully without the recorded reproduction signal and
passed supported and rejected-input assertions.
- Moonshot Files upload followed by
`MOONSHOT_FILE_REFERENCE=ms://<uploaded-id> pnpm -C
examples/ai-functions exec tsx
src/generate-text/moonshotai/file-reference.ts` — the live API accepted
the uploaded image reference and text part and returned an accurate
image description; the uploaded file was cleaned up.

## Related Issues

Fixes #19549

Closes #19567

Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
8fca314f919045e519a9de67fed960c49bfc30a6
Parent: 8037158
Committed by GitHub <noreply@github.com> on 8/26/2026, 1:53:20 AM