mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 01:37:59 +00:00
Merge branch 'main' into chunk-data
This commit is contained in:
commit
9932b5870b
484 files changed
+45549
-2467
No files matched your search
@@ -0,0 +1,7 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>Request body used to start a Rust media normalization job.</summary>
|
||||
/// <param name="InputPath">Absolute source media path.</param>
|
||||
/// <param name="OutputPath">Absolute operation-owned output path.</param>
|
||||
/// <param name="MaxPassThroughBytes">Optional pass-through size ceiling.</param>
|
||||
public sealed record CreateMediaJobRequest(string InputPath, string OutputPath, ulong? MaxPassThroughBytes = null);
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>Response returned after a Rust media job is registered.</summary>
|
||||
/// <param name="JobId">Opaque runtime job identifier.</param>
|
||||
public sealed record CreateMediaJobResponse(string JobId);
|
||||
@@ -6,4 +6,5 @@ namespace AIStudio.Tools.Rust;
|
||||
/// <param name="Success">True, when the secret was successfully deleted or not found.</param>
|
||||
/// <param name="Issue">The issue, when the secret could not be deleted.</param>
|
||||
/// <param name="WasEntryFound">True, when the entry was found and deleted.</param>
|
||||
public readonly record struct DeleteSecretResponse(bool Success, string Issue, bool WasEntryFound);
|
||||
/// <param name="IssueCode">The structured issue reported by the native credential store.</param>
|
||||
public readonly record struct DeleteSecretResponse(bool Success, string Issue, bool WasEntryFound, SecretStoreIssueCode IssueCode = SecretStoreIssueCode.NONE);
|
||||
@@ -31,6 +31,11 @@ public static class FileTypes
|
||||
public static readonly FileTypeFilter LUA = FileTypeFilter.Leaf("Lua", "lua");
|
||||
public static readonly FileTypeFilter PHP = FileTypeFilter.Leaf("PHP", "php");
|
||||
public static readonly FileTypeFilter WEB = FileTypeFilter.Leaf("HTML/CSS", "html", "css");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the standalone HTML filter used for visual briefing import and export.
|
||||
/// </summary>
|
||||
public static readonly FileTypeFilter VISUAL_BRIEFING_HTML = FileTypeFilter.Leaf(TB("Visual briefing"), "html");
|
||||
public static readonly FileTypeFilter APP = FileTypeFilter.Leaf("Swift/Kotlin", "swift", "kt");
|
||||
public static readonly FileTypeFilter SHELL = FileTypeFilter.Leaf("Shell", "sh", "bash", "zsh");
|
||||
public static readonly FileTypeFilter LOG = FileTypeFilter.Leaf("Log", "log");
|
||||
@@ -48,7 +53,7 @@ public static class FileTypes
|
||||
public static readonly FileTypeFilter MS_WORD = FileTypeFilter.Leaf("Microsoft Word", "docx");
|
||||
public static readonly FileTypeFilter WORD = FileTypeFilter.Composite("Word", ["odt"], MS_WORD);
|
||||
public static readonly FileTypeFilter EXCEL = FileTypeFilter.Leaf("Excel", "xls", "xlsx");
|
||||
public static readonly FileTypeFilter POWER_POINT = FileTypeFilter.Leaf("PowerPoint", "ppt", "pptx");
|
||||
public static readonly FileTypeFilter POWER_POINT = FileTypeFilter.Leaf("PowerPoint", "ppt", "pptx", "odp");
|
||||
public static readonly FileTypeFilter MAIL = FileTypeFilter.Leaf(TB("Mail"), "eml", "msg", "mbox");
|
||||
public static readonly FileTypeFilter LATEX = FileTypeFilter.Leaf("LaTeX", "tex", "bib", "sty", "cls", "log");
|
||||
|
||||
@@ -60,8 +65,14 @@ public static class FileTypes
|
||||
// Media hierarchy
|
||||
public static readonly FileTypeFilter IMAGE = FileTypeFilter.Leaf(TB("Image"),
|
||||
"jpg", "jpeg", "png", "gif", "bmp", "tiff", "svg", "webp", "heic", "avif");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the prototype visual-asset image formats.
|
||||
/// </summary>
|
||||
public static readonly FileTypeFilter VISUAL_BRIEFING_IMAGE = FileTypeFilter.Leaf(TB("Visual briefing image"),
|
||||
"jpg", "jpeg", "png", "webp");
|
||||
public static readonly FileTypeFilter AUDIO = FileTypeFilter.Leaf(TB("Audio"),
|
||||
"mp3", "wav", "wave", "aac", "flac", "ogg", "m4a", "wma", "alac", "aiff", "m4b");
|
||||
"mp3", "wav", "wave", "aac", "flac", "ogg", "opus", "m4a", "m4b", "wma", "alac", "aif", "aiff", "caf");
|
||||
public static readonly FileTypeFilter VIDEO = FileTypeFilter.Leaf(TB("Video"),
|
||||
"mp4", "m4v", "avi", "mkv", "mov", "wmv", "flv", "webm");
|
||||
|
||||
@@ -117,7 +128,7 @@ public static class FileTypes
|
||||
|
||||
if (types.Any(t => t.ContainsType(SOURCE_LIKE_FILE_NAMES)))
|
||||
{
|
||||
if (SOURCE_LIKE_FILE_NAMES.FilterExtensions.Contains(fileName))
|
||||
if (SOURCE_LIKE_FILE_NAMES.FilterExtensions.Contains(fileName, StringComparer.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>
|
||||
/// Contains a locally prepared image.
|
||||
/// </summary>
|
||||
/// <param name="DataUrl">The prepared image as a Data URL.</param>
|
||||
/// <param name="MimeType">The preserved supported image MIME type.</param>
|
||||
/// <param name="Width">The prepared pixel width.</param>
|
||||
/// <param name="Height">The prepared pixel height.</param>
|
||||
/// <param name="WasResized">Whether the maximum-edge policy resized the image.</param>
|
||||
public sealed record ImagePrepareResponse(
|
||||
string DataUrl,
|
||||
string MimeType,
|
||||
uint Width,
|
||||
uint Height,
|
||||
bool WasResized);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>
|
||||
/// Runtime media error containing a stable code and an English log diagnostic.
|
||||
/// </summary>
|
||||
/// <param name="Code">Stable machine-readable error category.</param>
|
||||
/// <param name="Message">US-English diagnostic intended for logs.</param>
|
||||
public sealed record MediaJobError(MediaJobErrorCode Code, string Message);
|
||||
@@ -0,0 +1,85 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>
|
||||
/// Stable failure categories returned by the Rust media pipeline.
|
||||
/// </summary>
|
||||
public enum MediaJobErrorCode
|
||||
{
|
||||
/// <summary>The runtime returned an unrecognized code.</summary>
|
||||
UNKNOWN,
|
||||
|
||||
/// <summary>The input file does not exist.</summary>
|
||||
FILE_NOT_FOUND,
|
||||
|
||||
/// <summary>The file type could not be identified.</summary>
|
||||
UNKNOWN_FORMAT,
|
||||
|
||||
/// <summary>Executable input was rejected.</summary>
|
||||
UNSAFE_FILE,
|
||||
|
||||
/// <summary>The input is not media.</summary>
|
||||
NOT_MEDIA,
|
||||
|
||||
/// <summary>The input file could not be opened.</summary>
|
||||
FILE_OPEN_FAILED,
|
||||
|
||||
/// <summary>The container is unsupported.</summary>
|
||||
UNSUPPORTED_CONTAINER,
|
||||
|
||||
/// <summary>The media has no audio track.</summary>
|
||||
NO_AUDIO_TRACK,
|
||||
|
||||
/// <summary>No audio track has a supported decoder.</summary>
|
||||
UNSUPPORTED_CODEC,
|
||||
|
||||
/// <summary>Decoded audio parameters are absent or inconsistent.</summary>
|
||||
INVALID_AUDIO_PARAMETERS,
|
||||
|
||||
/// <summary>The Opus identification header is invalid.</summary>
|
||||
INVALID_OPUS_HEADER,
|
||||
|
||||
/// <summary>The Opus mapping requires unsupported multistream decoding.</summary>
|
||||
UNSUPPORTED_OPUS_MAPPING,
|
||||
|
||||
/// <summary>The decoder could not be initialized.</summary>
|
||||
DECODER_INIT_FAILED,
|
||||
|
||||
/// <summary>The encoder could not be initialized.</summary>
|
||||
ENCODER_INIT_FAILED,
|
||||
|
||||
/// <summary>The stream changed unexpectedly.</summary>
|
||||
STREAM_RESET,
|
||||
|
||||
/// <summary>The container is damaged.</summary>
|
||||
DAMAGED_CONTAINER,
|
||||
|
||||
/// <summary>Audio decoding failed.</summary>
|
||||
DECODE_FAILED,
|
||||
|
||||
/// <summary>Audio resampling failed.</summary>
|
||||
RESAMPLE_FAILED,
|
||||
|
||||
/// <summary>Opus encoding failed.</summary>
|
||||
ENCODE_FAILED,
|
||||
|
||||
/// <summary>The output directory or file could not be created.</summary>
|
||||
OUTPUT_CREATE_FAILED,
|
||||
|
||||
/// <summary>The output could not be written.</summary>
|
||||
OUTPUT_WRITE_FAILED,
|
||||
|
||||
/// <summary>The partial output could not be committed.</summary>
|
||||
OUTPUT_COMMIT_FAILED,
|
||||
|
||||
/// <summary>A WebM relative timestamp overflowed.</summary>
|
||||
WEBM_TIMESTAMP_OVERFLOW,
|
||||
|
||||
/// <summary>WebM serialization failed.</summary>
|
||||
WEBM_WRITE_FAILED,
|
||||
|
||||
/// <summary>The job was cancelled.</summary>
|
||||
CANCELLED,
|
||||
|
||||
/// <summary>The runtime worker failed unexpectedly.</summary>
|
||||
INTERNAL_ERROR,
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>Snapshot emitted by the Rust media job event stream.</summary>
|
||||
/// <param name="Phase">Current job phase.</param>
|
||||
/// <param name="Progress">Optional progress fraction.</param>
|
||||
/// <param name="Result">Completed result.</param>
|
||||
/// <param name="Error">Failure diagnostic.</param>
|
||||
public sealed record MediaJobEvent(
|
||||
MediaJobPhase Phase,
|
||||
double? Progress,
|
||||
MediaJobResult? Result,
|
||||
MediaJobError? Error);
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>Lifecycle phases exposed by the Rust media API.</summary>
|
||||
public enum MediaJobPhase
|
||||
{
|
||||
/// <summary>An unknown future value received from Rust.</summary>
|
||||
UNKNOWN,
|
||||
|
||||
/// <summary>The runtime is identifying the input and selecting audio.</summary>
|
||||
PROBING,
|
||||
|
||||
/// <summary>The runtime is normalizing audio.</summary>
|
||||
TRANSCODING,
|
||||
|
||||
/// <summary>The output was committed successfully.</summary>
|
||||
COMPLETED,
|
||||
|
||||
/// <summary>The job failed.</summary>
|
||||
FAILED,
|
||||
|
||||
/// <summary>Cancellation and temporary-output cleanup completed.</summary>
|
||||
CANCELLED,
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>Successful terminal result returned by Rust media normalization.</summary>
|
||||
/// <param name="OutputPath">Committed normalized output path.</param>
|
||||
/// <param name="OutputFormat">Stable normalized container used for provider uploads.</param>
|
||||
/// <param name="OutputCodec">Stable normalized audio codec used for provider uploads.</param>
|
||||
/// <param name="DetectedFormat">Detected container diagnostic.</param>
|
||||
/// <param name="DetectedCodec">Selected codec diagnostic.</param>
|
||||
/// <param name="DurationMs">Normalized duration in milliseconds.</param>
|
||||
/// <param name="PassThrough">Whether the source was copied unchanged.</param>
|
||||
/// <param name="HasAudibleSignal">Whether the normalized audio exceeds the practical-silence threshold.</param>
|
||||
public sealed record MediaJobResult(
|
||||
string OutputPath,
|
||||
string OutputFormat,
|
||||
string OutputCodec,
|
||||
string DetectedFormat,
|
||||
string DetectedCodec,
|
||||
ulong DurationMs,
|
||||
bool PassThrough,
|
||||
bool HasAudibleSignal);
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
public readonly record struct OpenPathRequest(string Path);
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
public readonly record struct OpenPathResponse(bool Success, string Issue);
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
public sealed record RegisterShortcutRequest(Shortcut Id, string Shortcut);
|
||||
public sealed record RegisterShortcutRequest(Shortcut Id, string Shortcut, string Description, bool Reconfigure);
|
||||
@@ -6,4 +6,5 @@ namespace AIStudio.Tools.Rust;
|
||||
/// <param name="Success">True, when the secret was successfully retrieved.</param>
|
||||
/// <param name="Secret">The secret, e.g., API key.</param>
|
||||
/// <param name="Issue">The issue, when the secret could not be retrieved.</param>
|
||||
public readonly record struct RequestedSecret(bool Success, EncryptedText Secret, string Issue);
|
||||
/// <param name="IssueCode">The structured issue reported by the native credential store.</param>
|
||||
public readonly record struct RequestedSecret(bool Success, EncryptedText Secret, string Issue, SecretStoreIssueCode IssueCode = SecretStoreIssueCode.NONE);
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>
|
||||
/// A structured issue reported by the native credential store.
|
||||
/// </summary>
|
||||
public enum SecretStoreIssueCode
|
||||
{
|
||||
NONE,
|
||||
SECRET_NOT_FOUND,
|
||||
NO_DEFAULT_COLLECTION,
|
||||
COLLECTION_LOCKED,
|
||||
PROMPT_DISMISSED,
|
||||
SERVICE_UNAVAILABLE,
|
||||
UNKNOWN,
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>
|
||||
/// Native backend used to register a global shortcut.
|
||||
/// </summary>
|
||||
public enum ShortcutBackend
|
||||
{
|
||||
NONE,
|
||||
PORTAL,
|
||||
TAURI,
|
||||
LOCAL,
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
/// <summary>
|
||||
/// Typed result of a global shortcut registration attempt.
|
||||
/// </summary>
|
||||
public sealed record ShortcutRegistrationResult(
|
||||
bool Success,
|
||||
string ErrorMessage,
|
||||
ShortcutBackend Backend,
|
||||
bool Cancelled,
|
||||
string EffectiveDisplayName)
|
||||
{
|
||||
public static ShortcutRegistrationResult Failed(string errorMessage) =>
|
||||
new(false, errorMessage, ShortcutBackend.NONE, false, string.Empty);
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
namespace AIStudio.Tools.Rust;
|
||||
|
||||
public sealed record ShortcutResponse(bool Success, string ErrorMessage);
|
||||
public sealed record ShortcutResponse(
|
||||
bool Success,
|
||||
string ErrorMessage,
|
||||
ShortcutBackend Backend,
|
||||
bool Cancelled,
|
||||
string EffectiveDisplayName);
|
||||
@@ -5,4 +5,5 @@ namespace AIStudio.Tools.Rust;
|
||||
/// </summary>
|
||||
/// <param name="Success">True, when the secret was successfully stored.</param>
|
||||
/// <param name="Issue">The issue, when the secret could not be stored.</param>
|
||||
public readonly record struct StoreSecretResponse(bool Success, string Issue);
|
||||
/// <param name="IssueCode">The structured issue reported by the native credential store.</param>
|
||||
public readonly record struct StoreSecretResponse(bool Success, string Issue, SecretStoreIssueCode IssueCode = SecretStoreIssueCode.NONE);
|
||||
@@ -29,6 +29,24 @@ public readonly record struct TauriEvent(TauriEventType EventType, List<string>
|
||||
return TryParseSnakeCase(this.Payload[0], out shortcut);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads a portal shortcut change and its effective display name.
|
||||
/// </summary>
|
||||
public bool TryGetShortcutChange(out Shortcut shortcut, out string effectiveDisplayName)
|
||||
{
|
||||
shortcut = default;
|
||||
effectiveDisplayName = string.Empty;
|
||||
if (this.EventType != TauriEventType.GLOBAL_SHORTCUT_CHANGED || this.Payload.Count < 2)
|
||||
return false;
|
||||
|
||||
if (!Enum.TryParse(this.Payload[0], ignoreCase: true, out shortcut)
|
||||
&& !TryParseSnakeCase(this.Payload[0], out shortcut))
|
||||
return false;
|
||||
|
||||
effectiveDisplayName = this.Payload[1];
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to parse a snake_case string into a ShortcutName enum value.
|
||||
/// </summary>
|
||||
@@ -42,4 +60,4 @@ public readonly record struct TauriEvent(TauriEventType EventType, List<string>
|
||||
// Try to match against enum names (which are in UPPER_SNAKE_CASE):
|
||||
return Enum.TryParse(upperSnakeCase, ignoreCase: false, out shortcut);
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -17,4 +17,5 @@ public enum TauriEventType
|
||||
FILE_DROP_CANCELED,
|
||||
|
||||
GLOBAL_SHORTCUT_PRESSED,
|
||||
}
|
||||
GLOBAL_SHORTCUT_CHANGED,
|
||||
}
|
||||
Reference in new issue
Block a user