@@ -12,6 +12,37 @@ struct Recording;
1212 * @brief Stable engine/session boundary for embedded transcription backends.
1313 */
1414
15+ /* *
16+ * @brief Immutable loaded-model interface created by a transcription engine.
17+ *
18+ * Handles own validated backend assets and may be shared across multiple
19+ * independent sessions without exposing backend-specific state to app code.
20+ */
21+ class TranscriptionModelHandle
22+ {
23+ public:
24+ virtual ~TranscriptionModelHandle () = default ;
25+ TranscriptionModelHandle (const TranscriptionModelHandle &) = delete ;
26+ TranscriptionModelHandle &operator =(const TranscriptionModelHandle &) = delete ;
27+ TranscriptionModelHandle (TranscriptionModelHandle &&) = delete ;
28+ TranscriptionModelHandle &operator =(TranscriptionModelHandle &&) = delete ;
29+
30+ /* *
31+ * @brief Returns the backend identifier for this loaded model.
32+ * @return Short backend name used in diagnostics.
33+ */
34+ [[nodiscard]] virtual QString backendName () const = 0;
35+
36+ /* *
37+ * @brief Returns a human-readable description of the loaded model.
38+ * @return Diagnostic model description such as the resolved model path.
39+ */
40+ [[nodiscard]] virtual QString modelDescription () const = 0;
41+
42+ protected:
43+ TranscriptionModelHandle () = default ;
44+ };
45+
1546/* *
1647 * @brief Mutable per-session transcription interface.
1748 *
@@ -47,6 +78,14 @@ class TranscriptionSession
4778 */
4879 [[nodiscard]] virtual TranscriptionResult transcribe (const Recording &recording) = 0;
4980
81+ /* *
82+ * @brief Requests cooperative cancellation of any active decode.
83+ *
84+ * Implementations should stop in-flight backend work best-effort without
85+ * using thread interruption.
86+ */
87+ virtual void cancel () = 0;
88+
5089protected:
5190 TranscriptionSession () = default ;
5291};
@@ -73,10 +112,19 @@ class TranscriptionEngine
73112 [[nodiscard]] virtual BackendCapabilities capabilities () const = 0;
74113
75114 /* *
76- * @brief Creates a new isolated transcription session.
77- * @return Newly constructed session that owns its backend state.
115+ * @brief Loads an immutable validated model handle for this engine.
116+ * @param error Optional destination for a structured failure reason.
117+ * @return Shared loaded-model handle suitable for multiple sessions.
118+ */
119+ [[nodiscard]] virtual std::shared_ptr<const TranscriptionModelHandle> loadModel (RuntimeError *error = nullptr ) const = 0;
120+
121+ /* *
122+ * @brief Creates a new isolated transcription session from a loaded model.
123+ * @param model Shared immutable model handle created by this engine.
124+ * @return Newly constructed session that owns only mutable backend state.
78125 */
79- [[nodiscard]] virtual std::unique_ptr<TranscriptionSession> createSession () const = 0;
126+ [[nodiscard]] virtual std::unique_ptr<TranscriptionSession>
127+ createSession (std::shared_ptr<const TranscriptionModelHandle> model) const = 0 ;
80128
81129protected:
82130 TranscriptionEngine () = default ;
0 commit comments