aline-ai 0.6.0__py3-none-any.whl → 0.6.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aline_ai-0.6.0.dist-info → aline_ai-0.6.1.dist-info}/METADATA +1 -1
- {aline_ai-0.6.0.dist-info → aline_ai-0.6.1.dist-info}/RECORD +17 -12
- realign/__init__.py +1 -1
- realign/auth.py +21 -0
- realign/cli.py +44 -6
- realign/commands/auth.py +9 -0
- realign/dashboard/app.py +68 -6
- realign/dashboard/backends/__init__.py +6 -0
- realign/dashboard/backends/iterm2.py +599 -0
- realign/dashboard/backends/kitty.py +372 -0
- realign/dashboard/layout.py +320 -0
- realign/dashboard/terminal_backend.py +110 -0
- realign/dashboard/widgets/terminal_panel.py +566 -104
- {aline_ai-0.6.0.dist-info → aline_ai-0.6.1.dist-info}/WHEEL +0 -0
- {aline_ai-0.6.0.dist-info → aline_ai-0.6.1.dist-info}/entry_points.txt +0 -0
- {aline_ai-0.6.0.dist-info → aline_ai-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {aline_ai-0.6.0.dist-info → aline_ai-0.6.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""Terminal backend interface for native terminal support.
|
|
2
|
+
|
|
3
|
+
This module defines the protocol for terminal backends (iTerm2, Kitty)
|
|
4
|
+
that allow the Aline Dashboard to control native terminal windows
|
|
5
|
+
instead of using tmux for rendering.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from dataclasses import dataclass, field
|
|
11
|
+
from typing import Protocol, runtime_checkable
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class TerminalInfo:
|
|
16
|
+
"""Information about a terminal tab/window managed by a backend."""
|
|
17
|
+
|
|
18
|
+
terminal_id: str # Aline internal ID (UUID)
|
|
19
|
+
session_id: str # Backend-specific session ID (iTerm2 session_id or Kitty window_id)
|
|
20
|
+
name: str # Display name
|
|
21
|
+
active: bool = False # Whether this terminal is currently focused
|
|
22
|
+
claude_session_id: str | None = None # Claude Code session ID if applicable
|
|
23
|
+
context_id: str | None = None # Aline context ID
|
|
24
|
+
provider: str | None = None # Terminal provider (claude, codex, etc.)
|
|
25
|
+
attention: str | None = None # Attention state (permission_request, stop, etc.)
|
|
26
|
+
created_at: float | None = None # Unix timestamp when terminal was created
|
|
27
|
+
metadata: dict[str, str] = field(default_factory=dict) # Additional metadata
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@runtime_checkable
|
|
31
|
+
class TerminalBackend(Protocol):
|
|
32
|
+
"""Protocol for terminal backends.
|
|
33
|
+
|
|
34
|
+
Implementations must provide async methods to:
|
|
35
|
+
- Create new terminal tabs
|
|
36
|
+
- Focus/switch to existing tabs
|
|
37
|
+
- Close tabs
|
|
38
|
+
- List all managed tabs
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
async def create_tab(
|
|
42
|
+
self,
|
|
43
|
+
command: str,
|
|
44
|
+
terminal_id: str,
|
|
45
|
+
*,
|
|
46
|
+
name: str | None = None,
|
|
47
|
+
env: dict[str, str] | None = None,
|
|
48
|
+
cwd: str | None = None,
|
|
49
|
+
) -> str | None:
|
|
50
|
+
"""Create a new terminal tab.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
command: The command to run in the new tab
|
|
54
|
+
terminal_id: Aline internal terminal ID
|
|
55
|
+
name: Optional display name for the tab
|
|
56
|
+
env: Optional environment variables to set
|
|
57
|
+
cwd: Optional working directory
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
Backend-specific session ID, or None if creation failed
|
|
61
|
+
"""
|
|
62
|
+
...
|
|
63
|
+
|
|
64
|
+
async def focus_tab(self, session_id: str, *, steal_focus: bool = False) -> bool:
|
|
65
|
+
"""Switch to/focus a terminal tab.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
session_id: Backend-specific session ID
|
|
69
|
+
steal_focus: If True, also bring the terminal window to front.
|
|
70
|
+
If False, switch tab but keep focus on Dashboard.
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
True if successful, False otherwise
|
|
74
|
+
"""
|
|
75
|
+
...
|
|
76
|
+
|
|
77
|
+
async def close_tab(self, session_id: str) -> bool:
|
|
78
|
+
"""Close a terminal tab.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
session_id: Backend-specific session ID
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
True if successful, False otherwise
|
|
85
|
+
"""
|
|
86
|
+
...
|
|
87
|
+
|
|
88
|
+
async def list_tabs(self) -> list[TerminalInfo]:
|
|
89
|
+
"""List all terminal tabs managed by this backend.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
List of TerminalInfo objects for each managed tab
|
|
93
|
+
"""
|
|
94
|
+
...
|
|
95
|
+
|
|
96
|
+
async def is_available(self) -> bool:
|
|
97
|
+
"""Check if this backend is available and usable.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
True if the backend can be used, False otherwise
|
|
101
|
+
"""
|
|
102
|
+
...
|
|
103
|
+
|
|
104
|
+
def get_backend_name(self) -> str:
|
|
105
|
+
"""Get the human-readable name of this backend.
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
Backend name (e.g., "iTerm2", "Kitty")
|
|
109
|
+
"""
|
|
110
|
+
...
|