Files
tutti/packages/agent/gui/agentGUIPerformanceEvents.ts
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

156 lines
4.4 KiB
TypeScript

import type {
PendingActivationCommandOutcome,
PendingActivationLastObservedStage,
PendingActivationSnapshotOutcome
} from "@tutti-os/agent-activity-core";
export type AgentGUIPerformanceDurationBucket =
| "lt_1s"
| "1s_to_3s"
| "3s_to_10s"
| "10s_to_30s"
| "30s_to_60s"
| "gte_60s";
export type AgentGUIFirstTokenKind = "other" | "plan" | "reasoning" | "text";
export type AgentGUIComposerOptionsLoadSource = "runtime" | "session-engine";
export type AgentGUIPerformanceFailureStage =
| "options_load"
| "session_activation"
| "prompt_admission"
| "turn_settlement"
| "unknown";
interface AgentGUIPerformanceEventBase {
agentSessionId: string;
durationBucket: AgentGUIPerformanceDurationBucket;
durationMs: number;
observedAtUnixMs: number;
operationId: string;
provider: string;
startedAtUnixMs: number;
workspaceId: string;
}
export type AgentGUIPerformanceEvent =
| (AgentGUIPerformanceEventBase & {
commandDurationMs?: number;
commandOutcome: PendingActivationCommandOutcome;
errorCategory?: string;
errorCode?: string;
failureStage?: AgentGUIPerformanceFailureStage;
hasInitialPrompt: boolean;
lastObservedStage: PendingActivationLastObservedStage;
mode: "existing" | "new";
outcome: "confirmed" | "failed";
snapshotDurationMs?: number;
snapshotOutcome: PendingActivationSnapshotOutcome;
type: "session_activation_settled";
})
| (AgentGUIPerformanceEventBase & {
errorCategory?: string;
errorCode?: string;
failureStage?: AgentGUIPerformanceFailureStage;
outcome: "accepted" | "failed";
queued: boolean;
source: "activation" | "submit";
turnId: string | null;
type: "prompt_admission_settled";
})
| (AgentGUIPerformanceEventBase & {
firstTokenKind: AgentGUIFirstTokenKind;
queued: boolean;
source: "activation" | "submit";
turnId: string;
type: "prompt_first_token_received";
})
| (AgentGUIPerformanceEventBase & {
errorCategory?: string;
errorCode?: string;
failureStage?: AgentGUIPerformanceFailureStage;
outcome: "canceled" | "completed" | "failed" | "interrupted";
source: "activation" | "submit";
turnId: string;
type: "turn_settled";
})
| {
agentTargetId: string;
force: boolean;
hasDirectory: boolean;
observedAtUnixMs: number;
operationId: string;
provider: string;
source: AgentGUIComposerOptionsLoadSource;
startedAtUnixMs: number;
type: "composer_options_load_started";
workspaceId: string;
}
| {
agentTargetId: string;
durationBucket: AgentGUIPerformanceDurationBucket;
durationMs: number;
errorCategory?: string;
errorCode?: string;
failureStage?: AgentGUIPerformanceFailureStage;
force: boolean;
hasDirectory: boolean;
modelCount?: number;
modelNames?: string[];
observedAtUnixMs: number;
operationId: string;
outcome: "completed" | "failed";
provider: string;
source: AgentGUIComposerOptionsLoadSource;
startedAtUnixMs: number;
type: "composer_options_load_settled";
workspaceId: string;
}
| {
agentTargetId: string;
force: boolean;
hasDirectory: boolean;
observedAtUnixMs: number;
operationId: string;
provider: string;
section: string;
source: AgentGUIComposerOptionsLoadSource;
stage: string;
startedAtUnixMs: number;
type: "composer_options_stage_started";
workspaceId: string;
}
| {
agentTargetId: string;
durationBucket: AgentGUIPerformanceDurationBucket;
durationMs: number;
errorCategory?: string;
errorCode?: string;
failureStage?: AgentGUIPerformanceFailureStage;
force: boolean;
hasDirectory: boolean;
modelNames?: string[];
observedAtUnixMs: number;
operationId: string;
outcome: "completed" | "failed";
provider: string;
section: string;
source: AgentGUIComposerOptionsLoadSource;
stage: string;
startedAtUnixMs: number;
type: "composer_options_stage_settled";
workspaceId: string;
};
export type AgentGUIComposerOptionsPerformanceEvent = Extract<
AgentGUIPerformanceEvent,
{
type:
| "composer_options_load_settled"
| "composer_options_load_started"
| "composer_options_stage_settled"
| "composer_options_stage_started";
}
>;