mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-04 14:40:45 +00:00
feat(desktop): complete session websocket chat loop
This commit is contained in:
parent
9b0ec190e7
commit
bbab16f3b8
13 changed files with 1723 additions and 31 deletions
72
packages/desktop/src/shared/desktopProtocol.ts
Normal file
72
packages/desktop/src/shared/desktopProtocol.ts
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2026 Qwen Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
export type DesktopClientMessage =
|
||||
| { type: 'ping' }
|
||||
| { type: 'stop_generation' }
|
||||
| { type: 'user_message'; content: string };
|
||||
|
||||
export interface DesktopPlanEntry {
|
||||
content: string;
|
||||
priority?: 'high' | 'medium' | 'low';
|
||||
status: 'pending' | 'in_progress' | 'completed';
|
||||
}
|
||||
|
||||
export interface DesktopToolCallUpdate {
|
||||
toolCallId: string;
|
||||
kind?: string;
|
||||
title?: string;
|
||||
status?: string;
|
||||
rawInput?: unknown;
|
||||
rawOutput?: unknown;
|
||||
content?: unknown[];
|
||||
locations?: Array<{ path: string; line?: number | null }>;
|
||||
timestamp?: number;
|
||||
}
|
||||
|
||||
export interface DesktopUsageStats {
|
||||
usage?: {
|
||||
inputTokens?: number | null;
|
||||
outputTokens?: number | null;
|
||||
thoughtTokens?: number | null;
|
||||
totalTokens?: number | null;
|
||||
cachedReadTokens?: number | null;
|
||||
cachedWriteTokens?: number | null;
|
||||
promptTokens?: number | null;
|
||||
completionTokens?: number | null;
|
||||
thoughtsTokens?: number | null;
|
||||
cachedTokens?: number | null;
|
||||
} | null;
|
||||
durationMs?: number | null;
|
||||
tokenLimit?: number | null;
|
||||
cost?: unknown;
|
||||
}
|
||||
|
||||
export interface DesktopAvailableCommand {
|
||||
name: string;
|
||||
description: string;
|
||||
input?: unknown;
|
||||
}
|
||||
|
||||
export type DesktopServerMessage =
|
||||
| { type: 'connected'; sessionId: string }
|
||||
| { type: 'pong' }
|
||||
| {
|
||||
type: 'message_delta';
|
||||
role: 'assistant' | 'thinking' | 'user';
|
||||
text: string;
|
||||
}
|
||||
| { type: 'tool_call'; data: DesktopToolCallUpdate }
|
||||
| { type: 'plan'; entries: DesktopPlanEntry[] }
|
||||
| { type: 'usage'; data: DesktopUsageStats }
|
||||
| { type: 'mode_changed'; mode: string }
|
||||
| {
|
||||
type: 'available_commands';
|
||||
commands: DesktopAvailableCommand[];
|
||||
skills: string[];
|
||||
}
|
||||
| { type: 'message_complete'; stopReason?: string }
|
||||
| { type: 'error'; code: string; message: string; retryable?: boolean };
|
||||
Loading…
Add table
Add a link
Reference in a new issue