feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:cutdex_sdk/mcp.dart';
|
||||
|
||||
import 'local_mcp_bridge.dart';
|
||||
|
||||
/// Serializes endpoint replacement so late cleanup cannot close its successor.
|
||||
class EditorMcpEndpoint {
|
||||
Future<void> _tail = Future.value();
|
||||
LocalMcpBridge? _current;
|
||||
bool _closed = false;
|
||||
|
||||
Future<T> _run<T>(Future<T> Function() action) {
|
||||
final result = _tail.then((_) => action());
|
||||
_tail = result.then<void>((_) {}, onError: (Object _, StackTrace _) {});
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<LocalMcpBridge> open(
|
||||
CutdexMcpServer server, {
|
||||
required int port,
|
||||
required String token,
|
||||
}) => _run(() async {
|
||||
if (_closed) throw StateError('MCP endpoint owner is closed');
|
||||
await _current?.close();
|
||||
_current = null;
|
||||
return _current = await LocalMcpBridge.start(
|
||||
server,
|
||||
port: port,
|
||||
token: token,
|
||||
);
|
||||
});
|
||||
|
||||
Future<void> release(LocalMcpBridge bridge) => _run(() async {
|
||||
if (!identical(_current, bridge)) return;
|
||||
await bridge.close();
|
||||
_current = null;
|
||||
});
|
||||
|
||||
Future<void> close() {
|
||||
_closed = true;
|
||||
return _run(() async {
|
||||
await _current?.close();
|
||||
_current = null;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> stop() => _run(() async {
|
||||
await _current?.close();
|
||||
_current = null;
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user