feat: release 1.1.0 with responsive task control

This commit is contained in:
chenmingxuan committed 2026-09-24 03:31:17 +08:00
1 parent 057f0c3050
commit bfcd828fa8
37 files changed
+1601 -151

No files matched your search

@@ -23,7 +23,7 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { RouterLink } from '@angular/router';
import { HttpClient } from '@angular/common/http';
import { AgentService, StartupProgressEvent } from '../../services/agent.service';
import { AgentService, GuidanceEvent, StartupProgressEvent } from '../../services/agent.service';
import { Session, ModelInfo, SessionUsage } from '../../core/models/session.model';
import { MarkdownSegment, MarkdownLine, NoteMilestone, ParsedNote } from '../../core/models/markdown.model';
import { OverlayModule, ConnectedPosition } from '@angular/cdk/overlay';
@@ -247,6 +247,11 @@ export class AgentStreamComponent implements AfterViewInit {
private http = inject(HttpClient);
private destroyRef = inject(DestroyRef);
private zone = inject(NgZone);
public terminalFailureReason = signal('');
private selectedTerminalStatus = computed(() => {
const id = this.agentService.currentSessionId();
return this.agentService.sessions().find(session => session.session_id === id)?.status || '';
});
// Auto-scroll state tracking
public isUserAtBottom = true;
@@ -474,6 +479,23 @@ export class AgentStreamComponent implements AfterViewInit {
return consolidateLogsToBlocks(this.filteredLogs());
});
public awaitingGuidance = computed<GuidanceEvent[]>(() => {
const steps = this.consolidatedBlocks().filter(block => block.type === 'step');
return (this.agentService.guidanceEvents?.() || []).filter(event => !steps.some(block =>
new Date(block.timestamp).getTime() >= event.timestamp * 1000
&& String(block.data?.extra_metadata?.injected_instruction || '').includes(event.instruction)
));
});
public guidanceStatusLabel(event: GuidanceEvent): string {
const terminal = ['completed', 'failed', 'cancelled', 'interrupted']
.includes(this.agentService.currentSession()?.status || '');
if (event.status === 'pending') {
return terminal ? '任务结束前未进入模型' : '已接收,等待下一步';
}
return terminal ? '模型已读取,未留下后续动作记录' : '模型已读取,等待动作记录';
}
public phases = computed<PhaseBlock[]>(() => {
const currentSession = this.agentService.sessions().find(s => s.session_id === this.agentService.currentSessionId());
return groupBlocksToPhases(this.consolidatedBlocks(), currentSession?.start_time || 0);
@@ -541,6 +563,17 @@ export class AgentStreamComponent implements AfterViewInit {
}
constructor() {
effect((onCleanup) => {
const id = this.agentService.currentSessionId();
const status = this.selectedTerminalStatus();
this.terminalFailureReason.set('');
if (!id || !['failed', 'interrupted'].includes(status || '')) return;
const request = this.http.get<{error?: string}>(`/api/automation/reports/${encodeURIComponent(id)}`).subscribe({
next: report => this.terminalFailureReason.set(report.error || '任务未完成;请查看已记录的执行步骤。'),
error: () => this.terminalFailureReason.set('任务未完成,暂时无法读取异常详情。')
});
onCleanup(() => request.unsubscribe());
});
// Run info popover: fetch usage when opened or when the viewed session
// changes, and keep refreshing while that session is still running.
effect((onCleanup) => {
@@ -1327,6 +1360,11 @@ export class AgentStreamComponent implements AfterViewInit {
return isAndroidAction(action);
}
public hasRecordedDeviceAction(action: any): boolean {
const actions = Array.isArray(action) ? action : action ? [action] : [];
return actions.some(item => this.isAndroidAction(item) && !this.isReportStatusAction(item));
}
public getActionIcon(action: any): string {
return getActionIcon(action);
}
@@ -1813,6 +1851,7 @@ export class AgentStreamComponent implements AfterViewInit {
public hasVisibleContent(block: any): boolean {
if (!block) return false;
if (block.type === 'checker') return true;
if (block.data?.extra_metadata?.injected_instruction) return true;
const hasNative = Boolean(this.getNativeThinking(block));
const hasRaw = Boolean(this.getRawThinking(block));
const hasReset = this.hasBlockResets(block, false) || this.hasBlockResets(block, true);