@qwen-code/web-shell 0.25.1-preview.0 → 0.25.1-preview.1
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.
- package/dist/agents-route-DAa1HKQE.js +1546 -0
- package/dist/daemon-react-sdk.js +1 -1
- package/dist/{index-D9Bc2Hcz.js → index-zUj3SlrB.js} +46696 -45366
- package/dist/index.js +22 -22
- package/dist/sw.js +1 -1
- package/dist/{toolNames-CDhDlFnq.js → toolNames-B_KiYcXs.js} +3633 -3746
- package/dist/transcript.js +9600 -9312
- package/dist/types/adapters/messageTypes.d.ts +8 -1
- package/dist/types/components/ChatContextHeader.d.ts +3 -1
- package/dist/types/components/agents/AgentCreatePage.d.ts +7 -1
- package/dist/types/components/agents/AgentsManagerPage.d.ts +4 -5
- package/dist/types/components/artifacts/ArtifactPanel.d.ts +1 -8
- package/dist/types/components/artifacts/TrajectoryFilters.d.ts +15 -0
- package/dist/types/components/artifacts/TrajectoryInspector.d.ts +3 -1
- package/dist/types/components/managed/generated/managed-agent-api.d.ts +9 -7
- package/dist/types/components/managed/java-managed-agent-client.d.ts +2 -0
- package/dist/types/components/messages/AssistantMessage.d.ts +3 -1
- package/dist/types/components/messages/UserMessage.d.ts +3 -1
- package/dist/types/components/messages/agent-message-details.d.ts +36 -0
- package/dist/types/components/messages/squad-tag.d.ts +16 -0
- package/dist/types/components/sidebar/WebShellSidebar.d.ts +2 -4
- package/dist/types/components/sidebar/WorkspaceSection.d.ts +1 -2
- package/dist/types/components/workspace-agents/ThreadsPage.d.ts +30 -54
- package/dist/types/components/workspace-agents/add-runtime-dialog.d.ts +30 -4
- package/dist/types/components/workspace-agents/agent-events.d.ts +4 -34
- package/dist/types/components/workspace-agents/agents-route.d.ts +19 -0
- package/dist/types/components/workspace-agents/agents-view-logic.d.ts +14 -163
- package/dist/types/components/workspace-agents/lazy-agents-route.d.ts +7 -0
- package/dist/types/components/workspace-agents/messages.d.ts +2 -2
- package/dist/types/components/workspace-agents/session-agent-live-runs.d.ts +96 -0
- package/dist/types/components/workspace-agents/session-agents-api.d.ts +39 -0
- package/dist/types/components/workspace-agents/squads-section.d.ts +28 -0
- package/dist/types/components/workspace-agents/threads-api.d.ts +24 -35
- package/dist/types/components/workspace-agents/use-session-agent-runs.d.ts +66 -0
- package/dist/types/components/workspace-agents/useAgentChatEntry.d.ts +74 -10
- package/dist/types/components/workspaces/WorkspaceHostProjects.d.ts +11 -0
- package/dist/types/components/workspaces/WorkspaceLocation.d.ts +7 -0
- package/dist/types/config/workspace-hosts.d.ts +11 -0
- package/dist/types/trajectory/filter-messages.d.ts +9 -0
- package/dist/types/trajectory/filter-messages.transcript-stub.d.ts +7 -0
- package/dist/types/trajectory/filterTrajectory.d.ts +22 -0
- package/package.json +2 -1
- package/dist/ThreadsRoute-CXAiD3t_.js +0 -2407
- package/dist/types/components/workspace-agents/LazyThreadsRoute.d.ts +0 -7
- package/dist/types/components/workspace-agents/ThreadChat.d.ts +0 -35
- package/dist/types/components/workspace-agents/ThreadView.d.ts +0 -72
- package/dist/types/components/workspace-agents/ThreadsRoute.d.ts +0 -23
- package/dist/types/components/workspace-agents/useProjectConversations.d.ts +0 -10
|
@@ -4,47 +4,17 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* Client for
|
|
7
|
+
* Client for the session-agents stream under `/workspaces/:ws/agent/`
|
|
8
|
+
* (`session-events?sessionId=`: a chat session's live agent runs). The roster
|
|
9
|
+
* has no stream; the Agents page polls it.
|
|
8
10
|
*
|
|
9
11
|
* `fetch` rather than `EventSource`: the daemon wants a bearer header, which
|
|
10
12
|
* `EventSource` cannot send. Frames are plain `event:` + one `data:` line.
|
|
11
13
|
*/
|
|
12
|
-
export interface AgentPermissionPromptView {
|
|
13
|
-
requestId: string;
|
|
14
|
-
title: string;
|
|
15
|
-
options: Array<{
|
|
16
|
-
optionId: string;
|
|
17
|
-
name: string;
|
|
18
|
-
kind?: string;
|
|
19
|
-
}>;
|
|
20
|
-
}
|
|
21
|
-
export interface AgentRunStepView {
|
|
22
|
-
id: string;
|
|
23
|
-
title: string;
|
|
24
|
-
status: 'running' | 'done' | 'failed';
|
|
25
|
-
}
|
|
26
|
-
export interface AgentRunProgressEvent {
|
|
27
|
-
type: 'progress';
|
|
28
|
-
threadId: string;
|
|
29
|
-
runId: string;
|
|
30
|
-
attempt: number;
|
|
31
|
-
sessionId: string;
|
|
32
|
-
stage: string;
|
|
33
|
-
detail: string;
|
|
34
|
-
outputText: string;
|
|
35
|
-
thoughtText: string;
|
|
36
|
-
activityAt: number;
|
|
37
|
-
permission?: AgentPermissionPromptView;
|
|
38
|
-
steps?: AgentRunStepView[];
|
|
39
|
-
}
|
|
40
|
-
export type AgentLiveEvent = {
|
|
41
|
-
type: 'changed';
|
|
42
|
-
threadId?: string;
|
|
43
|
-
} | AgentRunProgressEvent;
|
|
44
14
|
export type AgentStreamState = 'open' | 'closed';
|
|
45
15
|
/**
|
|
46
16
|
* Subscribes to a workspace's stream. Subscribers of the same URL share one
|
|
47
17
|
* connection: browsers allow only a handful per origin, and the sidebar plus
|
|
48
18
|
* an open conversation would otherwise hold several for the same workspace.
|
|
49
19
|
*/
|
|
50
|
-
export declare function subscribeAgentStream(url: string, token: string | undefined, onEvent: (event:
|
|
20
|
+
export declare function subscribeAgentStream<T = unknown>(url: string, token: string | undefined, onEvent: (event: T) => void, onState: (state: AgentStreamState) => void): () => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Qwen Team
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type AgentWorkspaceView } from './ThreadsPage';
|
|
7
|
+
export interface AgentsRouteProps {
|
|
8
|
+
/** `new-agent` opens straight into the New agent page. */
|
|
9
|
+
initialView?: AgentWorkspaceView | 'new-agent';
|
|
10
|
+
workspaceCwd?: string;
|
|
11
|
+
onOpenDefinitions?: () => void;
|
|
12
|
+
/** Puts `@name ` into the chat composer; absent hides the card button. */
|
|
13
|
+
onMentionAgent?: (name: string) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The Agents page with its data: the workspace's roster and runtimes, kept
|
|
17
|
+
* fresh by polling.
|
|
18
|
+
*/
|
|
19
|
+
export declare function AgentsRoute({ initialView, workspaceCwd: boundWorkspaceCwd, onOpenDefinitions, onMentionAgent, }: AgentsRouteProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,177 +4,28 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* @fileoverview Presentation logic for the
|
|
7
|
+
* @fileoverview Presentation logic for the Agents page (roster and runtimes).
|
|
8
8
|
*
|
|
9
9
|
* Everything here is pure and testable without a browser, following the same
|
|
10
|
-
* split as `agents-manager-logic.ts`.
|
|
11
|
-
*
|
|
12
|
-
* 1. **The server decides a thread's state; this file only renders it.** The
|
|
13
|
-
* thread resolver already returns a status *and* the sentence explaining it.
|
|
14
|
-
* Deriving a second, shorter vocabulary here would give the product two
|
|
15
|
-
* answers to "why is this blocked", and the shorter one would win because it
|
|
16
|
-
* is the one on screen.
|
|
17
|
-
* 2. **A label never asserts a cause its reason code does not carry.** Copy
|
|
18
|
-
* that conflates two causes sends people to fix the wrong thing — Multica
|
|
19
|
-
* learned this when "runtime offline" wording sent users to reconnect a
|
|
20
|
-
* machine that was already connected. Each refusal below names its own fix.
|
|
21
|
-
*/
|
|
22
|
-
import type { AgentPermissionPromptView, AgentRunStepView } from './agent-events';
|
|
23
|
-
/** The programs an agent can be bound to on a joined runtime. */
|
|
24
|
-
export declare const AGENT_PROGRAMS: readonly ["qwen"];
|
|
25
|
-
export type AgentProgramView = (typeof AGENT_PROGRAMS)[number];
|
|
26
|
-
export declare function programLabel(program: string | undefined): string;
|
|
27
|
-
/**
|
|
28
|
-
* Opens a thread body that carries the conversation it was started from. The
|
|
29
|
-
* agents read it as-is; the chat view shows it folded instead of as a message.
|
|
30
|
-
*/
|
|
31
|
-
export declare const CONVERSATION_CONTEXT_PREFIX = "Context from the conversation this was sent from:\n\n";
|
|
32
|
-
/** Wire shape of a thread row, as the REST layer returns it. */
|
|
33
|
-
export interface ThreadSummaryView {
|
|
34
|
-
id: string;
|
|
35
|
-
title: string;
|
|
36
|
-
status: 'open' | 'in_progress' | 'blocked' | 'in_review' | 'done' | 'cancelled';
|
|
37
|
-
/** The resolver's own sentence. Rendered verbatim; never re-derived. */
|
|
38
|
-
reason: string;
|
|
39
|
-
updatedAt: number;
|
|
40
|
-
liveRunCount: number;
|
|
41
|
-
assigneeName?: string;
|
|
42
|
-
parentThreadId?: string;
|
|
43
|
-
}
|
|
44
|
-
export interface ThreadGroup {
|
|
45
|
-
key: 'needs_you' | 'running' | 'idle' | 'done';
|
|
46
|
-
threads: ThreadSummaryView[];
|
|
47
|
-
/** Finished work is evidence, not a task, so it starts collapsed. */
|
|
48
|
-
collapsedByDefault: boolean;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Groups threads by what they need, not by recency.
|
|
52
|
-
*
|
|
53
|
-
* Recency is the default sort and it buries the two threads that need a person
|
|
54
|
-
* under twenty that do not. `blocked` and `in_review` share one group because
|
|
55
|
-
* they are the same query for the reader — this is waiting on me — even though
|
|
56
|
-
* one is a question and the other is finished work. What tells them apart is
|
|
57
|
-
* each thread's own sentence, which is already on the row.
|
|
58
|
-
*/
|
|
59
|
-
export declare function groupThreads(threads: readonly ThreadSummaryView[]): ThreadGroup[];
|
|
60
|
-
/** Which threads carry the single attention treatment. */
|
|
61
|
-
export declare function needsAttention(thread: ThreadSummaryView): boolean;
|
|
62
|
-
/** Wire shape of one run, as the REST layer returns it. */
|
|
63
|
-
export interface RunView {
|
|
64
|
-
progress?: {
|
|
65
|
-
attempt?: number;
|
|
66
|
-
receivedAt: number;
|
|
67
|
-
activityAt: number;
|
|
68
|
-
/** A code: starting, thinking, responding, tool, awaiting_approval, stream_lost. */
|
|
69
|
-
stage: string;
|
|
70
|
-
/** Raw text such as a tool title; never UI copy. */
|
|
71
|
-
detail: string;
|
|
72
|
-
outputText?: string;
|
|
73
|
-
thoughtText?: string;
|
|
74
|
-
permission?: AgentPermissionPromptView;
|
|
75
|
-
/** The turn's latest tool calls, oldest first. */
|
|
76
|
-
steps?: AgentRunStepView[];
|
|
77
|
-
};
|
|
78
|
-
id: string;
|
|
79
|
-
agentId: string;
|
|
80
|
-
agentName: string;
|
|
81
|
-
agentColor?: string;
|
|
82
|
-
status: 'queued' | 'running' | 'finishing' | 'cancelling' | 'completed' | 'failed' | 'cancelled';
|
|
83
|
-
closeKind?: 'waiting' | 'blocked' | 'review' | 'unclosed' | 'stranded';
|
|
84
|
-
closeAcknowledged: boolean;
|
|
85
|
-
failureStage?: string;
|
|
86
|
-
error?: string;
|
|
87
|
-
/** Why this run exists, e.g. "assigned by you", "mentioned by alice". */
|
|
88
|
-
trigger: string;
|
|
89
|
-
/** Queued runs of the same agent that start before this one. */
|
|
90
|
-
queueAhead?: number;
|
|
91
|
-
startedAt?: number;
|
|
92
|
-
endedAt?: number;
|
|
93
|
-
/** The agent session this run took its turn in, once one is bound. */
|
|
94
|
-
sessionId?: string;
|
|
95
|
-
}
|
|
96
|
-
export interface RunRow {
|
|
97
|
-
run: RunView;
|
|
98
|
-
/** What this run is doing or left behind, in the reader's words. */
|
|
99
|
-
state: string;
|
|
100
|
-
/** Live runs pin to the top; terminal runs collapse behind a count. */
|
|
101
|
-
live: boolean;
|
|
102
|
-
/** True when a person still owes this run an answer. */
|
|
103
|
-
outstanding: boolean;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Describes a run the way the reader asks about it.
|
|
107
|
-
*
|
|
108
|
-
* A failed run reports its failure whatever close it managed to record first,
|
|
109
|
-
* because the failure is the thing a person has to act on. A stranded run is
|
|
110
|
-
* the exception: nothing the agent did ended it.
|
|
111
|
-
*/
|
|
112
|
-
export declare function describeRun(run: RunView, t: Translate): string;
|
|
113
|
-
/**
|
|
114
|
-
* Orders runs for the side panel: live first in start order, then terminal
|
|
115
|
-
* runs newest-first behind their count.
|
|
116
|
-
*
|
|
117
|
-
* The row carries no agent-availability indicator. Whether an agent is
|
|
118
|
-
* reachable is not this row's story — the run's own state is, and a second
|
|
119
|
-
* signal beside it competes for the same glance.
|
|
120
|
-
*/
|
|
121
|
-
export declare function buildRunRows(runs: readonly RunView[], t: Translate): {
|
|
122
|
-
live: RunRow[];
|
|
123
|
-
past: RunRow[];
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* One line, not a bar. A budget is a limit you want to notice before it trips,
|
|
127
|
-
* not a goal you are filling, and a bar invites the second reading.
|
|
10
|
+
* split as `agents-manager-logic.ts`.
|
|
128
11
|
*/
|
|
129
|
-
export declare function formatBudget(budget: {
|
|
130
|
-
turnsUsed: number;
|
|
131
|
-
turnLimit: number;
|
|
132
|
-
tokensUsed: number;
|
|
133
|
-
tokenLimit: number;
|
|
134
|
-
}, t: Translate): {
|
|
135
|
-
turns: string;
|
|
136
|
-
tokens: string;
|
|
137
|
-
scope: string;
|
|
138
|
-
};
|
|
139
|
-
/** One target's fate for a draft reply, as the server previews it. */
|
|
140
|
-
export interface RoutingPreviewTarget {
|
|
141
|
-
agentName: string;
|
|
142
|
-
willWake: boolean;
|
|
143
|
-
kind?: 'dispatch' | 'coalesce' | 'skip';
|
|
144
|
-
into?: 'queued' | 'running';
|
|
145
|
-
/** Present when `willWake` is false. A skip reason from the rules layer. */
|
|
146
|
-
reason?: string;
|
|
147
|
-
/** True when the name matched no agent, so it renders as a warning. */
|
|
148
|
-
unknown?: boolean;
|
|
149
|
-
}
|
|
150
12
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* Each entry names its own fix. Two reasons that look alike but need different
|
|
154
|
-
* fixes stay apart: a missing definition is repaired by pointing the agent at
|
|
155
|
-
* one that exists, while a disabled agent is repaired by enabling it, and copy
|
|
156
|
-
* that merged them would send the reader to the wrong screen.
|
|
13
|
+
* The programs an agent can run as. Mirrors `SessionAgentProgram` in
|
|
14
|
+
* `@qwen-code/sdk/daemon`; a runtime reports which of them it can run.
|
|
157
15
|
*/
|
|
158
|
-
export declare
|
|
16
|
+
export declare const AGENT_PROGRAMS: readonly ["qwen", "claude", "codex"];
|
|
17
|
+
export type AgentProgramView = (typeof AGENT_PROGRAMS)[number];
|
|
18
|
+
export declare function programLabel(program: string | undefined): string;
|
|
19
|
+
/** Narrows a server-sent program id; anything unknown is dropped. */
|
|
20
|
+
export declare function isAgentProgram(value: unknown): value is AgentProgramView;
|
|
159
21
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* Says who *will* run, because that is the consequence of pressing send. When
|
|
163
|
-
* nobody will, that is the headline, since it is the case the system used to
|
|
164
|
-
* swallow silently.
|
|
22
|
+
* The programs a runtime offers, in display order. An omitted field keeps the
|
|
23
|
+
* older daemon's Qwen default; an explicit empty list offers no programs.
|
|
165
24
|
*/
|
|
166
|
-
export declare function
|
|
25
|
+
export declare function runtimePrograms(runtime: {
|
|
26
|
+
programs?: readonly string[];
|
|
27
|
+
}): AgentProgramView[];
|
|
167
28
|
type Translate = (key: string, vars?: Record<string, string | number>) => string;
|
|
168
29
|
/** "45 秒" or "6 分 45 秒": the one duration format the collaboration UI uses. */
|
|
169
30
|
export declare function formatElapsed(ms: number, t: Translate): string;
|
|
170
|
-
/**
|
|
171
|
-
* Why a run exists, in the reader's language. The server words this in
|
|
172
|
-
* English from a fixed set; anything outside it is shown as sent.
|
|
173
|
-
*/
|
|
174
|
-
export declare function triggerLabel(trigger: string, t: Translate): string;
|
|
175
|
-
/**
|
|
176
|
-
* A thread's status reason in the reader's language. The server words it in
|
|
177
|
-
* English from a fixed set; anything outside it is shown as sent.
|
|
178
|
-
*/
|
|
179
|
-
export declare function statusReasonLabel(reason: string, t: Translate): string;
|
|
180
31
|
export {};
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* Agent collaboration strings (the
|
|
8
|
-
* the @ picker's agent entries). Kept out of the main dictionary like Live
|
|
7
|
+
* Agent collaboration strings (the Agents page, agents' live runs in a chat
|
|
8
|
+
* session, the @ picker's agent entries). Kept out of the main dictionary like Live
|
|
9
9
|
* Voice's: an exported transcript never renders these surfaces, so
|
|
10
10
|
* `vite.lib.config.ts` resolves this module to `messages.transcript-stub.ts`
|
|
11
11
|
* in `--mode transcript` and the transcript bundle stays within its budget.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Qwen Team
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { SessionAgentPermissionPrompt, SessionAgentRunFrame } from '@qwen-code/sdk/daemon';
|
|
7
|
+
import type { PermissionRequest } from '../../adapters/types';
|
|
8
|
+
import { useI18n } from '../../i18n';
|
|
9
|
+
type Translate = ReturnType<typeof useI18n>['t'];
|
|
10
|
+
/** No agent activity for this long: say it may be stuck. */
|
|
11
|
+
export declare const STALL_NOTICE_MS: number;
|
|
12
|
+
/**
|
|
13
|
+
* One line saying where a live run is. Returns `attention` for the states the
|
|
14
|
+
* user should notice (stuck, failed, offline).
|
|
15
|
+
*/
|
|
16
|
+
export declare function describeRun(run: SessionAgentRunFrame, now: number, t: Translate): {
|
|
17
|
+
text?: string;
|
|
18
|
+
attention: boolean;
|
|
19
|
+
};
|
|
20
|
+
/** Client-side cap on a tool input preview (the daemon bounds it too). */
|
|
21
|
+
export declare const INPUT_PREVIEW_MAX_CHARS = 4000;
|
|
22
|
+
/**
|
|
23
|
+
* The run's permission prompt as the main chat's approval card reads it. A
|
|
24
|
+
* shell tool shows its command as the main chat's shell approval does; any
|
|
25
|
+
* other tool shows its input preview in the card's monospace content block.
|
|
26
|
+
*/
|
|
27
|
+
export declare function toApprovalRequest(permission: SessionAgentPermissionPrompt, agent: string, t: Translate): PermissionRequest;
|
|
28
|
+
/**
|
|
29
|
+
* A finished run the daemon offers to run again (`retryable`): failed by a
|
|
30
|
+
* restart, offline, or one whose record a restart lost. Never a stopped one.
|
|
31
|
+
*/
|
|
32
|
+
export declare function canRetryRun(run: SessionAgentRunFrame): boolean;
|
|
33
|
+
/** A delegated member in a squad engagement. */
|
|
34
|
+
export interface SquadMemberView {
|
|
35
|
+
name: string;
|
|
36
|
+
/** The agent's color, tinting its avatar as on its replies. */
|
|
37
|
+
color?: string;
|
|
38
|
+
/** `replied`: its run completed and its reply is on the way to the leader. */
|
|
39
|
+
state: 'working' | 'replied';
|
|
40
|
+
}
|
|
41
|
+
/** One squad engagement as the live runs show it. */
|
|
42
|
+
export interface SquadEngagementView {
|
|
43
|
+
squadId: string;
|
|
44
|
+
squadName: string;
|
|
45
|
+
/** The leader, while its squad-mode run is queued or running. */
|
|
46
|
+
leader?: string;
|
|
47
|
+
leaderColor?: string;
|
|
48
|
+
/** Delegated members, in arrival order. */
|
|
49
|
+
members: SquadMemberView[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Squad engagements under way in this session, derived from live run frames
|
|
53
|
+
* carrying `squadId`: a leader run names its squad on its author; a member
|
|
54
|
+
* run the leader waits on carries the squad id (and name) on the frame. A
|
|
55
|
+
* member's completed frame keeps them while its record is pending, which is
|
|
56
|
+
* the only time a finished run is still in the list: that member `replied`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function squadEngagements(runs: readonly SessionAgentRunFrame[]): SquadEngagementView[];
|
|
59
|
+
/**
|
|
60
|
+
* A small bar per active squad engagement: the squad's tag, then one entry per
|
|
61
|
+
* participant (avatar, name, state): the leader "deciding", a member working
|
|
62
|
+
* (spinner) or replied (check).
|
|
63
|
+
*/
|
|
64
|
+
export declare function SquadEngagementBar({ runs, }: {
|
|
65
|
+
runs: readonly SessionAgentRunFrame[];
|
|
66
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
67
|
+
/**
|
|
68
|
+
* The session's live agent runs, rendered at the bottom of the message list as
|
|
69
|
+
* the agents' messages-in-progress. Each is replaced by the agent's recorded
|
|
70
|
+
* reply once that lands in the transcript.
|
|
71
|
+
*
|
|
72
|
+
* Mounted only by App (through MessageList's `tailContent`), never by the
|
|
73
|
+
* exported transcript, so it may use the collaboration dictionary.
|
|
74
|
+
*/
|
|
75
|
+
export declare function SessionAgentLiveRuns({ runs, onCancel, onRespond, onRetry, }: {
|
|
76
|
+
runs: readonly SessionAgentRunFrame[];
|
|
77
|
+
onCancel: (runId: string) => Promise<void>;
|
|
78
|
+
onRespond: (runId: string, requestId: string, optionId: string) => Promise<void>;
|
|
79
|
+
/** Offered on a failed run the daemon marked retryable. */
|
|
80
|
+
onRetry?: (runId: string) => Promise<void>;
|
|
81
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
82
|
+
/**
|
|
83
|
+
* The user's @-mentions the daemon holds until the running main-model turn
|
|
84
|
+
* settles, shown as their messages until the recorded ones replace them.
|
|
85
|
+
*/
|
|
86
|
+
export declare function PendingAgentMentions({ mentions, }: {
|
|
87
|
+
mentions: ReadonlyArray<{
|
|
88
|
+
id: string;
|
|
89
|
+
text: string;
|
|
90
|
+
}>;
|
|
91
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
92
|
+
/** Shown near the composer while any agent in this session is working. */
|
|
93
|
+
export declare function StopAllAgentsButton({ onStopAll, }: {
|
|
94
|
+
onStopAll: () => Promise<void>;
|
|
95
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Qwen Team
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { SessionAgentEventFrame, SessionAgentRunFrame, SessionAgentRunStatus } from '@qwen-code/sdk/daemon';
|
|
7
|
+
import { type AgentStreamState } from './agent-events';
|
|
8
|
+
/** 202 body of `POST sessions/:sessionId/mentions`. */
|
|
9
|
+
export interface SessionMentionResult {
|
|
10
|
+
recordId: string;
|
|
11
|
+
deferred?: boolean;
|
|
12
|
+
runs: Array<{
|
|
13
|
+
runId: string;
|
|
14
|
+
agentId: string;
|
|
15
|
+
status: SessionAgentRunStatus;
|
|
16
|
+
}>;
|
|
17
|
+
/** Why some mentioned squads were not started (the others were). */
|
|
18
|
+
squadError?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The session-scoped collaboration routes: agents answering @-mentions inside
|
|
22
|
+
* an ordinary chat session.
|
|
23
|
+
*/
|
|
24
|
+
export interface SessionAgentsApi {
|
|
25
|
+
listRuns(sessionId: string): Promise<{
|
|
26
|
+
frames: SessionAgentRunFrame[];
|
|
27
|
+
}>;
|
|
28
|
+
mention(sessionId: string, input: {
|
|
29
|
+
text: string;
|
|
30
|
+
clientMessageId: string;
|
|
31
|
+
}): Promise<SessionMentionResult>;
|
|
32
|
+
cancelRun(sessionId: string, runId: string): Promise<unknown>;
|
|
33
|
+
/** Runs a failed run marked `retryable` again. */
|
|
34
|
+
retryRun(sessionId: string, runId: string): Promise<unknown>;
|
|
35
|
+
stopAll(sessionId: string): Promise<unknown>;
|
|
36
|
+
respondToPermission(sessionId: string, runId: string, requestId: string, optionId: string): Promise<unknown>;
|
|
37
|
+
subscribe(sessionId: string, onEvent: (event: SessionAgentEventFrame) => void, onState: (state: AgentStreamState) => void): () => void;
|
|
38
|
+
}
|
|
39
|
+
export declare function createSessionAgentsHttpApi(baseUrl: string, token: string | undefined, workspaceCwd: string): SessionAgentsApi;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Qwen Team
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { SessionSquadView } from '@qwen-code/sdk/daemon';
|
|
7
|
+
import type { WorkspaceAgentSummaryView } from './ThreadsPage';
|
|
8
|
+
import type { SquadInput } from './threads-api';
|
|
9
|
+
export interface SquadsSectionProps {
|
|
10
|
+
squads: readonly SessionSquadView[];
|
|
11
|
+
agents: readonly WorkspaceAgentSummaryView[];
|
|
12
|
+
pending?: boolean;
|
|
13
|
+
/** The New squad form is open (its button is in the page header). */
|
|
14
|
+
creating: boolean;
|
|
15
|
+
onCreatingChange: (creating: boolean) => void;
|
|
16
|
+
onCreate: (input: SquadInput) => Promise<boolean>;
|
|
17
|
+
onUpdate: (squadId: string, input: SquadInput) => Promise<boolean>;
|
|
18
|
+
onRetire: (squadId: string) => void;
|
|
19
|
+
/** Puts `@name ` into the chat composer; absent hides the button. */
|
|
20
|
+
onMention?: (name: string) => void;
|
|
21
|
+
}
|
|
22
|
+
/** No squads (or a daemon without squad routes). */
|
|
23
|
+
export declare function SquadsEmpty(): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* The Agents page's Squads view: list, create, edit, retire. A squad is
|
|
26
|
+
* addressed by `@name` in a chat, which wakes its leader (session-multi-agent design §11.5).
|
|
27
|
+
*/
|
|
28
|
+
export declare function SquadsSection({ squads, agents, pending, creating, onCreatingChange, onCreate, onUpdate, onRetire, onMention, }: SquadsSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,29 +3,30 @@
|
|
|
3
3
|
* Copyright 2026 Qwen Team
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type { RoutingPreviewTarget, ThreadSummaryView } from './agents-view-logic';
|
|
9
|
-
import { type AgentLiveEvent, type AgentStreamState } from './agent-events';
|
|
10
|
-
import type { JoinToken } from './add-runtime-dialog';
|
|
6
|
+
import type { AgentConfigPatch, NewWorkspaceAgent, WorkspaceAgentRuntimeView, WorkspaceAgentSummaryView } from './ThreadsPage';
|
|
7
|
+
import type { ConnectExistingInput, JoinCoordinatorInput, JoinToken } from './add-runtime-dialog';
|
|
11
8
|
import type { AgentShare, AgentShareSummary } from './share-agent-dialog';
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import type { SessionSquadView } from '@qwen-code/sdk/daemon';
|
|
10
|
+
/** Body of a squad create; on update, `null` clears a text field. */
|
|
11
|
+
export interface SquadInput {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string | null;
|
|
14
|
+
instructions: string | null;
|
|
15
|
+
leaderAgentId: string;
|
|
16
|
+
members: Array<{
|
|
17
|
+
agentId: string;
|
|
18
|
+
role?: string;
|
|
19
|
+
}>;
|
|
14
20
|
}
|
|
21
|
+
/** Agent roster, runtimes, enrollment and sharing for one workspace. */
|
|
15
22
|
export interface ThreadsApi {
|
|
16
|
-
connectRemoteHost?(input:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
remoteCwd: string;
|
|
20
|
-
serverUrl: string;
|
|
21
|
-
provider: 'qwen';
|
|
22
|
-
allowHttp: boolean;
|
|
23
|
-
}): Promise<unknown>;
|
|
23
|
+
connectRemoteHost?(input: ConnectExistingInput): Promise<unknown>;
|
|
24
|
+
/** Makes this daemon a runtime of another coordinator. */
|
|
25
|
+
joinCoordinator?(input: JoinCoordinatorInput): Promise<unknown>;
|
|
24
26
|
listAgents(): Promise<{
|
|
25
27
|
agents: WorkspaceAgentSummaryView[];
|
|
26
28
|
runtime?: WorkspaceAgentRuntimeView;
|
|
27
29
|
runtimes?: WorkspaceAgentRuntimeView[];
|
|
28
|
-
capabilities?: AgentCapabilitiesView;
|
|
29
30
|
}>;
|
|
30
31
|
/** A single-use token for `qwen serve --join` on another machine. */
|
|
31
32
|
createJoinToken?(supersedesHostId?: string): Promise<JoinToken>;
|
|
@@ -35,29 +36,17 @@ export interface ThreadsApi {
|
|
|
35
36
|
shares: AgentShareSummary[];
|
|
36
37
|
}>;
|
|
37
38
|
revokeShare?(agentId: string, callerId: string): Promise<unknown>;
|
|
38
|
-
listThreads(): Promise<{
|
|
39
|
-
threads: ThreadSummaryView[];
|
|
40
|
-
}>;
|
|
41
|
-
getThread(id: string): Promise<ThreadDetailView>;
|
|
42
39
|
createAgent(input: NewWorkspaceAgent): Promise<unknown>;
|
|
43
40
|
deleteAgent(id: string): Promise<unknown>;
|
|
44
41
|
setAgentEnabled(id: string, enabled: boolean): Promise<unknown>;
|
|
45
42
|
updateAgent(id: string, patch: AgentConfigPatch): Promise<unknown>;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}>;
|
|
50
|
-
assignThread(id: string, assignee?: string): Promise<unknown>;
|
|
51
|
-
previewReply(id: string, text: string): Promise<{
|
|
52
|
-
targets: RoutingPreviewTarget[];
|
|
43
|
+
/** Squads; absent on a daemon without them. */
|
|
44
|
+
listSquads?(): Promise<{
|
|
45
|
+
squads: SessionSquadView[];
|
|
53
46
|
}>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
subscribe?(onEvent: (event: AgentLiveEvent) => void, onState: (state: AgentStreamState) => void): () => void;
|
|
59
|
-
/** Answers a tool approval an agent is waiting on. */
|
|
60
|
-
respondToPermission?(sessionId: string, requestId: string, optionId: string): Promise<unknown>;
|
|
47
|
+
createSquad?(input: SquadInput): Promise<unknown>;
|
|
48
|
+
updateSquad?(id: string, input: Partial<SquadInput>): Promise<unknown>;
|
|
49
|
+
/** Retires the squad (it keeps its name and history). */
|
|
50
|
+
retireSquad?(id: string): Promise<unknown>;
|
|
61
51
|
}
|
|
62
52
|
export declare function createThreadsHttpApi(baseUrl: string, token: string | undefined, workspaceCwd: string): ThreadsApi;
|
|
63
|
-
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Qwen Team
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type DaemonTranscriptBlock, type SessionAgentRunFrame, type SessionAgentRunStatus } from '@qwen-code/sdk/daemon';
|
|
7
|
+
import type { SessionAgentsApi } from './session-agents-api';
|
|
8
|
+
export declare function isTerminalRunStatus(status: SessionAgentRunStatus): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The runs whose `agent_message` is already in the transcript, as one string
|
|
11
|
+
* (run ids joined by newlines) so a caller can memoize a Set on it: the blocks
|
|
12
|
+
* change on every streamed delta, the answer almost never.
|
|
13
|
+
*/
|
|
14
|
+
export declare function settledAgentRunKey(blocks: readonly DaemonTranscriptBlock[]): string;
|
|
15
|
+
interface TrackedFrame {
|
|
16
|
+
frame: SessionAgentRunFrame;
|
|
17
|
+
/** Arrival order, so the list does not reshuffle as frames update. */
|
|
18
|
+
order: number;
|
|
19
|
+
/**
|
|
20
|
+
* The run is off the screen for good: its record is in the transcript, or
|
|
21
|
+
* none will be written. Kept, slimmed, so that a stale snapshot cannot put
|
|
22
|
+
* the card back.
|
|
23
|
+
*/
|
|
24
|
+
settled?: true;
|
|
25
|
+
}
|
|
26
|
+
export type RunFrameMap = ReadonlyMap<string, TrackedFrame>;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a frame ends the run's card (contract `recorded`): a terminal frame
|
|
29
|
+
* keeps it only while `recorded` is `false` (record pending, or the run is
|
|
30
|
+
* retryable). `true` means the record now renders; absent means none will be
|
|
31
|
+
* written (cancelled while queued, dismissed, retried).
|
|
32
|
+
*/
|
|
33
|
+
export declare function isSettledRunFrame(frame: SessionAgentRunFrame): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Folds one frame into the map. A frame seen twice (the stream opens with a
|
|
36
|
+
* snapshot that a GET may already have delivered) is harmless; an older frame
|
|
37
|
+
* never overwrites a newer one, a terminal run never comes back to life, and
|
|
38
|
+
* a settled run stays settled (a snapshot polled before the record landed can
|
|
39
|
+
* arrive after the frame that settled it).
|
|
40
|
+
*/
|
|
41
|
+
export declare function applyRunFrame(current: RunFrameMap, frame: SessionAgentRunFrame, order: number): RunFrameMap;
|
|
42
|
+
/**
|
|
43
|
+
* Settles runs whose `agent_message` the transcript already shows (it can
|
|
44
|
+
* land before the frame that says so). Returns `current` when nothing
|
|
45
|
+
* changed.
|
|
46
|
+
*/
|
|
47
|
+
export declare function pruneRunFrames(current: RunFrameMap, settledRunIds: ReadonlySet<string>): RunFrameMap;
|
|
48
|
+
/**
|
|
49
|
+
* Live agent runs of one chat session: the `runs` snapshot, then the
|
|
50
|
+
* `session-events` stream. A run keeps its card, finished or not, until a
|
|
51
|
+
* frame settles it (see {@link isSettledRunFrame}) or its `agent_message`
|
|
52
|
+
* shows up in the transcript (`settledRunIds`), which is what replaces it on
|
|
53
|
+
* screen. A finished run whose record waits behind a main-model turn, or a
|
|
54
|
+
* run a daemon restart cut short, stays until then.
|
|
55
|
+
*/
|
|
56
|
+
export declare function useSessionAgentRuns({ api, sessionId, settledRunIds, }: {
|
|
57
|
+
api: SessionAgentsApi | undefined;
|
|
58
|
+
sessionId: string | undefined;
|
|
59
|
+
settledRunIds: ReadonlySet<string>;
|
|
60
|
+
}): {
|
|
61
|
+
runs: SessionAgentRunFrame[];
|
|
62
|
+
anyLive: boolean;
|
|
63
|
+
/** Runs a `retryable` run again; rejects when the daemon refuses. */
|
|
64
|
+
retry: (runId: string) => Promise<void>;
|
|
65
|
+
};
|
|
66
|
+
export {};
|