Chat: unnamed chats take the harness title, harness default per folder, word-safe tables, Send later
- New chat: a cleared Name creates the chat without an operator title; the list shows the harness's own title, or the default name until it has one. The server no longer records "New chat" for a blank title and OpenCode is created without a title so it names the session itself. - New chat harness defaults to the one last used in the chosen folder, else anywhere, else OpenCode; remembered on the device per server. - Markdown tables wrap at word boundaries and never go below a column's longest word (tokens over ~40 characters may break); a table whose words cannot fit scrolls sideways with the code block affordance. - Composer: right-click, long-press, Shift+F10 or the context menu key on Send opens Send later... (30 min, 1 h, tomorrow 9:00, usage reset, pick a time), sent through the same path with send_at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/// A chat's default name, shown until the operator or the harness names it.
|
||||
library;
|
||||
|
||||
/// The web's names for the chat harnesses; an unknown one shows as sent.
|
||||
String chatBackendLabel(String backend) => switch (backend) {
|
||||
'codex' => 'Codex',
|
||||
'claude' => 'Claude',
|
||||
'pi' => 'Pi',
|
||||
'opencode' => 'OpenCode',
|
||||
_ => backend,
|
||||
};
|
||||
|
||||
/// The default chat name: the directory's last folder and the harness, as in
|
||||
/// "Pipelines Codex".
|
||||
String defaultChatName(String directory, String harnessLabel) {
|
||||
final parts = directory
|
||||
.split('/')
|
||||
.where((part) => part.isNotEmpty && part != '~')
|
||||
.toList();
|
||||
final leaf = parts.isEmpty ? 'Home' : parts.last;
|
||||
final folder = leaf.isEmpty
|
||||
? 'Home'
|
||||
: '${leaf[0].toUpperCase()}${leaf.substring(1)}';
|
||||
return '$folder $harnessLabel';
|
||||
}
|
||||
|
||||
/// OpenCode's placeholder for a session it has not named yet
|
||||
/// ("New session - 2026-12-02T09:00:00.000Z").
|
||||
final RegExp _harnessPlaceholder = RegExp(
|
||||
r'^(New|Child) session - \d{4}-\d{2}-\d{2}T',
|
||||
);
|
||||
|
||||
/// The title a harness gave a chat, or null while it has none of its own
|
||||
/// (blank, or only its placeholder).
|
||||
String? chatHarnessTitle(String title) {
|
||||
final trimmed = title.trim();
|
||||
if (trimmed.isEmpty || _harnessPlaceholder.hasMatch(trimmed)) return null;
|
||||
return title;
|
||||
}
|
||||
Reference in New Issue
Block a user