feat: add support for Claude CLI tool and enhance memory features

- Added new CLI tool "Claude" with command handling in cli-executor.ts.
- Implemented session discovery for Claude in native-session-discovery.ts.
- Enhanced memory view with active memory controls, including sync functionality and configuration options.
- Introduced zoom and fit view controls for memory graph visualization.
- Updated i18n.js for new memory-related translations.
- Improved error handling and migration for CLI history store.
This commit is contained in:
catlog22
2025-12-13 22:44:42 +08:00
parent 52935d4b8e
commit d3a522f3e8
15 changed files with 2087 additions and 237 deletions

View File

@@ -1863,3 +1863,238 @@
}
}
/* ==========================================
UPDATE TASKS SECTION - In CLI Tab
========================================== */
/* Section Container */
.update-tasks-section {
border-bottom: 1px solid hsl(var(--border));
padding-bottom: 12px;
margin-bottom: 12px;
}
.update-tasks-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
margin-bottom: 8px;
}
.update-tasks-title {
font-size: 0.8125rem;
font-weight: 600;
color: hsl(var(--foreground));
}
.update-tasks-clear-btn {
width: 28px;
height: 28px;
border: none;
background: transparent;
color: hsl(var(--muted-foreground));
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.15s;
}
.update-tasks-clear-btn:hover {
background: hsl(var(--destructive) / 0.1);
color: hsl(var(--destructive));
}
.update-tasks-list {
padding: 0 12px;
}
.update-tasks-empty {
display: flex;
flex-direction: column;
align-items: center;
padding: 16px;
text-align: center;
color: hsl(var(--muted-foreground));
}
.update-tasks-empty span {
font-size: 0.8125rem;
font-weight: 500;
}
.update-tasks-empty p {
font-size: 0.75rem;
margin: 4px 0 0;
}
/* CLI History Section */
.cli-history-section {
padding-top: 4px;
}
.cli-history-header {
display: flex;
align-items: center;
padding: 8px 12px;
margin-bottom: 8px;
}
.cli-history-title {
font-size: 0.8125rem;
font-weight: 600;
color: hsl(var(--foreground));
}
.cli-history-list {
padding: 0 12px;
}
/* Individual Update Task Item */
.update-task-item {
background: hsl(var(--background));
border: 1px solid hsl(var(--border));
border-radius: 8px;
padding: 10px 12px;
margin-bottom: 8px;
transition: all 0.15s ease;
}
.update-task-item:last-child {
margin-bottom: 0;
}
.update-task-item.status-pending {
border-left: 3px solid hsl(var(--muted-foreground));
}
.update-task-item.status-running {
border-left: 3px solid hsl(var(--warning));
background: hsl(var(--warning) / 0.05);
}
.update-task-item.status-completed {
border-left: 3px solid hsl(var(--success));
background: hsl(var(--success) / 0.05);
opacity: 0.8;
}
.update-task-item.status-failed {
border-left: 3px solid hsl(var(--destructive));
background: hsl(var(--destructive) / 0.05);
}
.update-task-header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 8px;
}
.update-task-status {
font-size: 14px;
flex-shrink: 0;
}
.update-task-item.status-running .update-task-status {
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.update-task-name {
flex: 1;
font-size: 0.8125rem;
font-weight: 500;
color: hsl(var(--foreground));
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.update-task-strategy {
font-size: 14px;
flex-shrink: 0;
}
.update-task-controls {
display: flex;
align-items: center;
gap: 6px;
}
.update-task-cli-select {
height: 28px;
padding: 0 8px;
font-size: 0.75rem;
border: 1px solid hsl(var(--border));
border-radius: 6px;
background: hsl(var(--background));
color: hsl(var(--foreground));
cursor: pointer;
transition: all 0.15s;
}
.update-task-cli-select:hover:not(:disabled) {
border-color: hsl(var(--primary));
}
.update-task-cli-select:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.update-task-btn {
width: 28px;
height: 28px;
border: none;
border-radius: 6px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.15s;
}
.update-task-start {
background: hsl(var(--primary));
color: hsl(var(--primary-foreground));
}
.update-task-start:hover {
background: hsl(var(--primary) / 0.9);
transform: scale(1.05);
}
.update-task-remove {
background: transparent;
color: hsl(var(--muted-foreground));
}
.update-task-remove:hover {
background: hsl(var(--destructive) / 0.1);
color: hsl(var(--destructive));
}
.update-task-stop {
background: hsl(var(--warning));
color: white;
}
.update-task-stop:hover {
background: hsl(var(--warning) / 0.9);
}
.update-task-message {
font-size: 0.6875rem;
color: hsl(var(--muted-foreground));
margin-top: 6px;
padding-top: 6px;
border-top: 1px solid hsl(var(--border));
}

View File

@@ -484,6 +484,11 @@
color: hsl(142 71% 35%);
}
.history-tool-tag.tool-claude {
background: hsl(25 90% 50% / 0.12);
color: hsl(25 90% 40%);
}
.history-mode-tag {
font-size: 0.625rem;
font-weight: 500;
@@ -713,6 +718,14 @@
border-color: hsl(142 71% 45% / 0.7);
}
.cli-tool-card.tool-claude.available {
border-color: hsl(25 90% 50% / 0.5);
}
.cli-tool-card.tool-claude.available:hover {
border-color: hsl(25 90% 50% / 0.7);
}
.cli-tool-card.unavailable {
border-color: hsl(var(--border));
opacity: 0.6;
@@ -1006,6 +1019,11 @@
color: hsl(142 71% 35%);
}
.cli-tool-claude {
background: hsl(25 90% 50% / 0.12);
color: hsl(25 90% 40%);
}
.cli-history-time {
font-size: 0.6875rem;
color: hsl(var(--muted-foreground));
@@ -3187,6 +3205,11 @@
color: hsl(145 60% 35%);
}
.cli-queue-tool-tag.cli-tool-claude {
background: hsl(25 90% 50% / 0.15);
color: hsl(25 90% 40%);
}
.cli-queue-status {
font-size: 0.75rem;
}

View File

@@ -9,6 +9,10 @@
.memory-view {
height: 100%;
min-height: 600px;
max-height: calc(100vh - 150px);
overflow: hidden;
display: flex;
flex-direction: column;
}
.memory-view.loading {
@@ -18,11 +22,241 @@
justify-content: center;
}
/* Memory Header with Active Memory Toggle */
.memory-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.75rem 0;
margin-bottom: 1rem;
border-bottom: 1px solid hsl(var(--border));
flex-shrink: 0;
}
.memory-header-left {
display: flex;
align-items: center;
gap: 0.5rem;
}
.memory-header-left h2 {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.125rem;
font-weight: 600;
color: hsl(var(--foreground));
margin: 0;
}
.memory-header-right {
display: flex;
align-items: center;
gap: 1rem;
}
/* Active Memory Controls Container */
.active-memory-controls {
display: flex;
align-items: center;
gap: 1rem;
}
/* Active Memory Toggle */
.active-memory-toggle {
display: flex;
align-items: center;
gap: 0.75rem;
}
/* Active Memory Config */
.active-memory-config {
display: flex;
align-items: center;
gap: 0.75rem;
padding-left: 0.75rem;
border-left: 1px solid hsl(var(--border));
}
.config-item {
display: flex;
align-items: center;
gap: 0.375rem;
}
.config-item label {
font-size: 0.75rem;
color: hsl(var(--muted-foreground));
white-space: nowrap;
}
.config-item select {
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
color: hsl(var(--foreground));
background: hsl(var(--background));
border: 1px solid hsl(var(--border));
border-radius: 0.25rem;
cursor: pointer;
outline: none;
min-width: 80px;
}
.config-item select:focus {
border-color: hsl(var(--primary));
}
.config-item select:hover {
border-color: hsl(var(--primary) / 0.5);
}
/* Active Memory Actions */
.active-memory-actions {
display: flex;
align-items: center;
gap: 0.5rem;
padding-left: 0.75rem;
border-left: 1px solid hsl(var(--border));
}
.last-sync {
font-size: 0.6875rem;
color: hsl(var(--muted-foreground));
white-space: nowrap;
}
.toggle-label {
font-size: 0.8125rem;
font-weight: 500;
color: hsl(var(--muted-foreground));
}
.toggle-switch {
position: relative;
display: inline-block;
width: 44px;
height: 24px;
}
.toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
.toggle-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: hsl(var(--muted));
border-radius: 24px;
transition: all 0.3s ease;
}
.toggle-slider::before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
border-radius: 50%;
transition: all 0.3s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.toggle-switch input:checked + .toggle-slider {
background-color: hsl(var(--primary));
}
.toggle-switch input:checked + .toggle-slider::before {
transform: translateX(20px);
}
.toggle-switch input:focus + .toggle-slider {
box-shadow: 0 0 0 2px hsl(var(--primary) / 0.3);
}
.toggle-status {
font-size: 0.75rem;
font-weight: 500;
color: hsl(var(--muted-foreground));
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
background: hsl(var(--muted) / 0.5);
}
.toggle-status.active {
display: flex;
align-items: center;
gap: 0.25rem;
color: hsl(142 76% 36%);
background: hsl(142 76% 36% / 0.1);
}
/* Auto-sync indicator */
.auto-sync-indicator {
display: flex;
align-items: center;
gap: 0.25rem;
font-size: 0.6875rem;
color: hsl(var(--primary));
background: hsl(var(--primary) / 0.1);
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
white-space: nowrap;
}
.auto-sync-indicator svg {
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
/* Sync Button */
.btn-sync {
padding: 0.5rem;
border-radius: 0.375rem;
background: hsl(var(--primary) / 0.1);
border: 1px solid hsl(var(--primary) / 0.3);
color: hsl(var(--primary));
cursor: pointer;
transition: all 0.2s ease;
}
.btn-sync:hover {
background: hsl(var(--primary) / 0.2);
border-color: hsl(var(--primary));
}
.btn-sync.syncing {
opacity: 0.7;
cursor: not-allowed;
}
.btn-sync.syncing i {
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.memory-columns {
display: grid;
grid-template-columns: 280px 1fr 320px;
gap: 1.5rem;
height: 100%;
flex: 1;
min-height: 0;
max-height: calc(100vh - 230px);
}
.memory-column {
@@ -33,6 +267,7 @@
border-radius: 0.75rem;
overflow: hidden;
min-width: 0;
max-height: 100%;
}
/* Memory Section inside columns */
@@ -40,6 +275,7 @@
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
}
.section-header {
@@ -110,10 +346,15 @@
flex: 1;
overflow-y: auto;
padding: 0.75rem;
display: flex;
flex-direction: column;
gap: 0.75rem;
min-height: 0;
}
.hotspot-list-container {
margin-bottom: 1rem;
display: flex;
flex-direction: column;
}
.hotspot-list-container:last-child {
@@ -130,6 +371,7 @@
margin: 0 0 0.5rem 0;
padding-bottom: 0.375rem;
border-bottom: 1px solid hsl(var(--border));
flex-shrink: 0;
}
/* Hotspot List Items */
@@ -267,8 +509,8 @@
}
.legend-dot.file { background: hsl(var(--primary)); }
.legend-dot.module { background: hsl(var(--muted-foreground)); }
.legend-dot.component { background: hsl(var(--success)); }
.legend-dot.module { background: hsl(var(--muted-foreground)); border: 1px dashed hsl(var(--muted-foreground)); }
.legend-dot.component { background: hsl(142 76% 36%); }
/* Graph Container */
.graph-container,
@@ -277,9 +519,11 @@
position: relative;
background: hsl(var(--background));
min-height: 300px;
max-height: 100%;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.memory-graph-container svg {
@@ -425,8 +669,10 @@
flex: 1;
overflow-y: auto;
padding: 0.75rem;
min-height: 0;
}
/* Context Timeline Card Style */
.timeline-item {
display: flex;
gap: 0.75rem;
@@ -436,10 +682,21 @@
border: 1px solid hsl(var(--border));
border-radius: 0.5rem;
transition: all 0.15s ease;
cursor: pointer;
min-height: 60px;
max-height: 120px;
overflow: hidden;
}
.timeline-item:hover {
border-color: hsl(var(--primary) / 0.3);
background: hsl(var(--hover));
}
.timeline-item.expanded {
max-height: none;
background: hsl(var(--muted) / 0.3);
border-color: hsl(var(--primary) / 0.5);
}
.timeline-item:last-child {
@@ -641,6 +898,12 @@
.memory-columns {
grid-template-columns: 1fr;
gap: 1rem;
max-height: none;
overflow-y: auto;
}
.memory-column {
max-height: 500px;
}
}
@@ -654,6 +917,7 @@
border: 1px solid hsl(var(--border));
border-radius: 0.75rem;
overflow: hidden;
max-height: 100%;
}
.hotspots-header {
@@ -683,6 +947,7 @@
flex: 1;
overflow-y: auto;
padding: 0.5rem;
min-height: 0;
}
.hotspot-item {
@@ -793,6 +1058,7 @@
border: 1px solid hsl(var(--border));
border-radius: 0.75rem;
overflow: hidden;
max-height: 100%;
}
.graph-header {
@@ -828,7 +1094,9 @@
flex: 1;
position: relative;
background: hsl(var(--background));
min-height: 400px;
min-height: 300px;
max-height: 100%;
overflow: hidden;
}
/* D3 Graph Elements */
@@ -943,6 +1211,111 @@
}
}
/* Graph Zoom/Pan Styles */
.memory-graph-svg {
cursor: grab;
}
.memory-graph-svg:active {
cursor: grabbing;
}
.graph-content {
transition: transform 0.1s ease-out;
}
/* Graph Node Groups */
.graph-node-group {
cursor: pointer;
}
.graph-node-group:hover circle {
filter: brightness(1.2);
}
.graph-node-group.file circle {
fill: hsl(var(--primary));
stroke: hsl(var(--primary));
stroke-width: 2;
}
.graph-node-group.module circle {
fill: hsl(var(--muted));
stroke: hsl(var(--muted-foreground));
stroke-width: 2;
stroke-dasharray: 4 2;
}
.graph-node-group.component circle {
fill: hsl(142 76% 36%);
stroke: hsl(142 76% 36%);
stroke-width: 2;
}
/* Individual graph-node circles (for legacy support) */
.graph-node.file {
fill: hsl(var(--primary));
stroke: hsl(var(--primary));
stroke-width: 2;
}
.graph-node.module {
fill: hsl(var(--muted));
stroke: hsl(var(--muted-foreground));
stroke-width: 2;
stroke-dasharray: 4 2;
}
.graph-node.component {
fill: hsl(142 76% 36%);
stroke: hsl(142 76% 36%);
stroke-width: 2;
}
/* Selected Node */
.graph-node.selected {
stroke: hsl(var(--foreground));
stroke-width: 3;
filter: drop-shadow(0 0 8px hsl(var(--primary)));
}
/* Graph Labels */
.graph-label {
font-family: var(--font-sans);
font-size: 11px;
fill: hsl(var(--foreground));
pointer-events: none;
user-select: none;
text-shadow:
1px 1px 2px hsl(var(--background)),
-1px -1px 2px hsl(var(--background)),
1px -1px 2px hsl(var(--background)),
-1px 1px 2px hsl(var(--background));
}
/* Graph Controls */
.graph-controls {
display: flex;
align-items: center;
gap: 0.25rem;
}
.graph-controls .btn-icon {
padding: 0.375rem;
border-radius: 0.375rem;
background: transparent;
border: 1px solid transparent;
color: hsl(var(--muted-foreground));
cursor: pointer;
transition: all 0.15s ease;
}
.graph-controls .btn-icon:hover {
background: hsl(var(--muted));
border-color: hsl(var(--border));
color: hsl(var(--foreground));
}
/* ========================================
* Context Timeline (Right Column)
* ======================================== */
@@ -953,6 +1326,7 @@
border: 1px solid hsl(var(--border));
border-radius: 0.75rem;
overflow: hidden;
max-height: 100%;
}
.context-header {
@@ -982,37 +1356,10 @@
flex: 1;
overflow-y: auto;
padding: 0.75rem;
min-height: 0;
}
.timeline-item {
position: relative;
padding-left: 1.5rem;
padding-bottom: 1rem;
border-left: 2px solid hsl(var(--border));
}
.timeline-item:last-child {
border-left-color: transparent;
padding-bottom: 0;
}
.timeline-item::before {
content: '';
position: absolute;
left: -6px;
top: 0;
width: 10px;
height: 10px;
border-radius: 50%;
background: hsl(var(--primary));
border: 2px solid hsl(var(--card));
}
.timeline-item.recent::before {
background: hsl(0 84% 60%);
box-shadow: 0 0 8px hsl(0 84% 60% / 0.5);
animation: timelinePulse 2s infinite;
}
/* Timeline item styles moved to Context Timeline Card Style section (line ~445) */
.timeline-timestamp {
font-size: 0.6875rem;