Merge branch 'worktree-agent-a2791c24c562412e3'
# Conflicts: # app/lib/features/chat/conversation/chat_thread_view.dart # internal/protocol/message.go
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import '../../terminal/terminal_open_action.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -1412,6 +1413,15 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
chatShellRunMenuAction(onPressed: _runShellFromMenu),
|
||||
if (_shellRuns.finishedIds.isNotEmpty)
|
||||
chatShellDismissAllMenuAction(onPressed: _dismissFinishedShellRuns),
|
||||
?terminalOpenMenuAction(
|
||||
context,
|
||||
gateway: widget.gateway,
|
||||
directory: directory,
|
||||
onRefused: (refusal) => _showCommandNotice(
|
||||
"Couldn't open a terminal: $refusal",
|
||||
failed: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
controls: [
|
||||
if (hasModel)
|
||||
|
||||
@@ -14,6 +14,8 @@ import 'files_upload_notice.dart';
|
||||
import 'files_viewer.dart';
|
||||
import 'files_header.dart';
|
||||
import '../../../ui/layout/app_overflow_menu.dart';
|
||||
import '../../terminal/terminal_open_action.dart';
|
||||
import '../../terminal/terminal_scope.dart';
|
||||
|
||||
const double filesPanelMinWidth = 280;
|
||||
const double filesPanelMaxWidth = 420;
|
||||
@@ -23,8 +25,9 @@ double filesPanelWidth(double available) => (available * filesPanelFraction)
|
||||
.clamp(filesPanelMinWidth, filesPanelMaxWidth);
|
||||
|
||||
/// The actions of an entry's row or tile menu. Open and Download are for
|
||||
/// files; Rename, Move and Delete apply to files and folders alike.
|
||||
enum FileAction { open, download, rename, move, delete }
|
||||
/// files, Open in terminal for folders (where the app has a terminal);
|
||||
/// Rename, Move and Delete apply to files and folders alike.
|
||||
enum FileAction { open, download, terminal, rename, move, delete }
|
||||
|
||||
class FilesPanel extends StatefulWidget {
|
||||
const FilesPanel({
|
||||
@@ -180,6 +183,12 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
endpoint: _endpoint,
|
||||
entry: entry,
|
||||
),
|
||||
// A refusal shows in the terminal the surface opens.
|
||||
FileAction.terminal => openInTerminal(
|
||||
context,
|
||||
controller.gateway,
|
||||
entry.path,
|
||||
),
|
||||
FileAction.rename => renameEntry(context, controller, entry),
|
||||
FileAction.move => moveEntry(context, controller, entry),
|
||||
FileAction.delete => deleteEntry(context, controller, entry),
|
||||
@@ -189,6 +198,11 @@ class _FilesPanelState extends State<FilesPanel> {
|
||||
AppMenuAction(value: FileAction.open, label: 'Open'),
|
||||
AppMenuAction(value: FileAction.download, label: 'Download'),
|
||||
],
|
||||
if (entry.isDir && TerminalScope.maybeOf(context) != null)
|
||||
const AppMenuAction(
|
||||
value: FileAction.terminal,
|
||||
label: terminalOpenActionLabel,
|
||||
),
|
||||
const AppMenuAction(value: FileAction.rename, label: 'Rename…'),
|
||||
const AppMenuAction(value: FileAction.move, label: 'Move…'),
|
||||
const AppMenuAction(
|
||||
|
||||
@@ -28,7 +28,7 @@ class ChatShellTerminals {
|
||||
final void Function(String runId, Object error) onError;
|
||||
|
||||
final Map<String, ChatShellTerminalSession> _sessions = {};
|
||||
final Map<String, _InputPipe> _inputs = {};
|
||||
final Map<String, ChatShellInputPipe> _inputs = {};
|
||||
final Map<String, Timer> _resizes = {};
|
||||
final Map<String, (int, int)> _sentSizes = {};
|
||||
bool _disposed = false;
|
||||
@@ -74,7 +74,7 @@ class ChatShellTerminals {
|
||||
_inputs
|
||||
.putIfAbsent(
|
||||
runId,
|
||||
() => _InputPipe(
|
||||
() => ChatShellInputPipe(
|
||||
(data) => _repository.input(_sessionId, runId, data),
|
||||
(error) => onError(runId, error),
|
||||
),
|
||||
@@ -106,11 +106,12 @@ class ChatShellTerminals {
|
||||
}
|
||||
}
|
||||
|
||||
/// One run's typed input on its way to the server, in order: what arrives
|
||||
/// One terminal's typed input on its way to the server (a chat run's or a
|
||||
/// machine terminal's), in order: what arrives
|
||||
/// while a request is in flight goes in the next one. Nothing is kept once
|
||||
/// sent, and a refusal discards what was waiting rather than retyping it.
|
||||
class _InputPipe {
|
||||
_InputPipe(this._send, this._failed);
|
||||
class ChatShellInputPipe {
|
||||
ChatShellInputPipe(this._send, this._failed);
|
||||
|
||||
final Future<void> Function(String data) _send;
|
||||
final void Function(Object error) _failed;
|
||||
|
||||
Reference in New Issue
Block a user