@qwen-code/web-shell 0.25.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.
Files changed (52) hide show
  1. package/dist/agents-route-DAa1HKQE.js +1546 -0
  2. package/dist/daemon-react-sdk.js +1 -1
  3. package/dist/{index-tVJkU24-.js → index-zUj3SlrB.js} +45814 -44258
  4. package/dist/index.js +22 -22
  5. package/dist/sw.js +1 -1
  6. package/dist/{toolNames-CAeFJ9L9.js → toolNames-B_KiYcXs.js} +3679 -3764
  7. package/dist/transcript.js +9608 -9312
  8. package/dist/types/adapters/messageTypes.d.ts +8 -1
  9. package/dist/types/adapters/transcriptAdapter.d.ts +1 -0
  10. package/dist/types/components/ChatContextHeader.d.ts +3 -1
  11. package/dist/types/components/agents/AgentCreatePage.d.ts +7 -1
  12. package/dist/types/components/agents/AgentsManagerPage.d.ts +4 -5
  13. package/dist/types/components/artifacts/ArtifactPanel.d.ts +1 -8
  14. package/dist/types/components/artifacts/TrajectoryFilters.d.ts +15 -0
  15. package/dist/types/components/artifacts/TrajectoryInspector.d.ts +3 -1
  16. package/dist/types/components/managed/generated/managed-agent-api.d.ts +191 -9
  17. package/dist/types/components/managed/java-managed-agent-client.d.ts +3 -1
  18. package/dist/types/components/managed/managed-agent-provider.d.ts +9 -0
  19. package/dist/types/components/messages/AssistantMessage.d.ts +3 -1
  20. package/dist/types/components/messages/UserMessage.d.ts +3 -1
  21. package/dist/types/components/messages/agent-message-details.d.ts +36 -0
  22. package/dist/types/components/messages/squad-tag.d.ts +16 -0
  23. package/dist/types/components/sidebar/WebShellSidebar.d.ts +2 -4
  24. package/dist/types/components/sidebar/WorkspaceSection.d.ts +1 -2
  25. package/dist/types/components/workspace-agents/ThreadsPage.d.ts +31 -55
  26. package/dist/types/components/workspace-agents/add-runtime-dialog.d.ts +34 -5
  27. package/dist/types/components/workspace-agents/agent-events.d.ts +4 -34
  28. package/dist/types/components/workspace-agents/agents-route.d.ts +19 -0
  29. package/dist/types/components/workspace-agents/agents-view-logic.d.ts +14 -163
  30. package/dist/types/components/workspace-agents/lazy-agents-route.d.ts +7 -0
  31. package/dist/types/components/workspace-agents/messages.d.ts +2 -2
  32. package/dist/types/components/workspace-agents/session-agent-live-runs.d.ts +96 -0
  33. package/dist/types/components/workspace-agents/session-agents-api.d.ts +39 -0
  34. package/dist/types/components/workspace-agents/squads-section.d.ts +28 -0
  35. package/dist/types/components/workspace-agents/threads-api.d.ts +25 -36
  36. package/dist/types/components/workspace-agents/use-session-agent-runs.d.ts +66 -0
  37. package/dist/types/components/workspace-agents/useAgentChatEntry.d.ts +74 -10
  38. package/dist/types/components/workspaces/WorkspaceHostProjects.d.ts +11 -0
  39. package/dist/types/components/workspaces/WorkspaceLocation.d.ts +7 -0
  40. package/dist/types/config/workspace-hosts.d.ts +11 -0
  41. package/dist/types/daemon/session/types.d.ts +19 -3
  42. package/dist/types/trajectory/filter-messages.d.ts +9 -0
  43. package/dist/types/trajectory/filter-messages.transcript-stub.d.ts +7 -0
  44. package/dist/types/trajectory/filterTrajectory.d.ts +22 -0
  45. package/dist/types/utils/cancelledTurn.d.ts +17 -0
  46. package/package.json +2 -1
  47. package/dist/ThreadsRoute-CtecWS_K.js +0 -2358
  48. package/dist/types/components/workspace-agents/LazyThreadsRoute.d.ts +0 -7
  49. package/dist/types/components/workspace-agents/ThreadChat.d.ts +0 -35
  50. package/dist/types/components/workspace-agents/ThreadView.d.ts +0 -72
  51. package/dist/types/components/workspace-agents/ThreadsRoute.d.ts +0 -23
  52. package/dist/types/components/workspace-agents/useProjectConversations.d.ts +0 -10
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * "This belongs to squad X": a small muted pill, the squad's counterpart to
8
+ * AuthorAvatar. Used on a leader's and a member's author line, the leader's
9
+ * no-action line and the live engagement bar, so a reader learns it once.
10
+ *
11
+ * Renders in exported transcripts: no collaboration strings here.
12
+ */
13
+ export declare function SquadTag({ name, className, }: {
14
+ name: string;
15
+ className?: string;
16
+ }): import("react/jsx-runtime").JSX.Element;
@@ -58,8 +58,6 @@ export interface WebShellSidebarWorkspaceOverviewOptions {
58
58
  }
59
59
  export type { WorkspaceManagementTarget, WorkspaceOverviewItem };
60
60
  interface WebShellSidebarProps {
61
- selectedCollaborationId?: string;
62
- onOpenCollaboration?: (id: string, cwd: string) => void;
63
61
  collapsed: boolean;
64
62
  layout?: 'single' | 'rail';
65
63
  activePage?: string;
@@ -67,7 +65,7 @@ interface WebShellSidebarProps {
67
65
  onOpenHome?: () => void;
68
66
  onCollapsedChange: (collapsed: boolean) => void;
69
67
  onOpenSettings: () => void;
70
- onOpenAgents?: (view?: 'agents' | 'tasks' | 'runtime') => void;
68
+ onOpenAgents?: (view?: 'agents' | 'squads' | 'runtime') => void;
71
69
  onOpenPlugins: () => void;
72
70
  onOpenChannels: () => void;
73
71
  onOpenLive?: () => void;
@@ -158,4 +156,4 @@ interface WebShellSidebarProps {
158
156
  onLoadStandaloneSession?: (sessionId: string) => Promise<void> | void;
159
157
  onStandaloneNotice?: (message: string) => void;
160
158
  }
161
- export declare function WebShellSidebar({ selectedCollaborationId, onOpenCollaboration, collapsed, layout, activePage, containerWidth, onOpenHome, onCollapsedChange, onOpenSettings, onOpenAgents, onOpenPlugins, onOpenChannels, onOpenLive, onLiveVoiceSlotChange, onOpenManagedSessions, onOpenDaemonStatus, onOpenScheduledTasks, onOpenWorkflows, onOpenGoals, onOpenSessions, canOpenSessionsOverview, onOpenWorkspacesOverview, onOpenSplitView, canOpenSplitView, onNewSession, onNewStandaloneSession, onLoadSession, onSelectCurrentSession, onSessionRenameConfirmed, onSessionsDeleted, onError, theme, onThemeChange, mobileOpen, onMobileClose, selectedWorkspaceCwd, onSelectWorkspace, onOpenGitDiff, onOpenCommit, onOpenAddWorkspace, workspaces: providedWorkspaces, lockedWorkspaceCwd, lockedWorkspace: lockedWorkspaceOptions, branding, primaryNav: primaryNavOptions, showSessionSourceSwitch, showLive, hideProjectHeader, sessionActions: sessionActionsOptions, footer, workspaceOverview, onOpenWorkspaceManagement, onNewWorktreeSession, projectFeaturesEnabled, onLoadStandaloneSession, onStandaloneNotice, }: WebShellSidebarProps): import("react/jsx-runtime").JSX.Element;
159
+ export declare function WebShellSidebar({ collapsed, layout, activePage, containerWidth, onOpenHome, onCollapsedChange, onOpenSettings, onOpenAgents, onOpenPlugins, onOpenChannels, onOpenLive, onLiveVoiceSlotChange, onOpenManagedSessions, onOpenDaemonStatus, onOpenScheduledTasks, onOpenWorkflows, onOpenGoals, onOpenSessions, canOpenSessionsOverview, onOpenWorkspacesOverview, onOpenSplitView, canOpenSplitView, onNewSession, onNewStandaloneSession, onLoadSession, onSelectCurrentSession, onSessionRenameConfirmed, onSessionsDeleted, onError, theme, onThemeChange, mobileOpen, onMobileClose, selectedWorkspaceCwd, onSelectWorkspace, onOpenGitDiff, onOpenCommit, onOpenAddWorkspace, workspaces: providedWorkspaces, lockedWorkspaceCwd, lockedWorkspace: lockedWorkspaceOptions, branding, primaryNav: primaryNavOptions, showSessionSourceSwitch, showLive, hideProjectHeader, sessionActions: sessionActionsOptions, footer, workspaceOverview, onOpenWorkspaceManagement, onNewWorktreeSession, projectFeaturesEnabled, onLoadStandaloneSession, onStandaloneNotice, }: WebShellSidebarProps): import("react/jsx-runtime").JSX.Element;
@@ -9,7 +9,6 @@ export interface WorkspaceHeaderActionsContext {
9
9
  gitBranch: string | null | undefined;
10
10
  }
11
11
  interface WorkspaceSectionProps {
12
- additionalSessions?: readonly DaemonSessionSummary[];
13
12
  workspace: DaemonWorkspaceCapability;
14
13
  remote?: boolean;
15
14
  renderHeader?: (expanded: boolean) => ReactNode;
@@ -118,5 +117,5 @@ interface WorkspaceSectionProps {
118
117
  /** Commit entry for the same picker; the row still opens without it. */
119
118
  onOpenCommit?: (workspaceCwd: string) => void;
120
119
  }
121
- export declare function WorkspaceSection({ additionalSessions, workspace, remote, renderHeader, hideHeader, client, reloadToken, untrustedLabel, readOnlyLabel, trustToOpenLabel, noSessionsLabel, loadErrorLabel, organizationEnabled, sessionCatalogRequestsEnabled, sessionGroupCatalog, sessionLiveStateEnabled, sourceType, channelGroupingEnabled, ungroupedLabel, searchQuery, expanded: controlledExpanded, autoExpandKey, forceAutoExpand, onExpandedChange, renderSessions, renderSession, pendingSession, mapSession, showSessionDetails, headerActions, overviewEnabled, overviewMenuOpen, overviewItems, gitBranchWanted, sessionStats, onRenameGroup, onDeleteGroup, renameGroupLabel, deleteGroupLabel, groupActionsDisabled, excludePinned, limitSessions, isPinnedSectionMember, onOpenPathLocally, onOpenTerminalLocally, onOpenGitDiff, onOpenCommit, }: WorkspaceSectionProps): import("react/jsx-runtime").JSX.Element;
120
+ export declare function WorkspaceSection({ workspace, remote, renderHeader, hideHeader, client, reloadToken, untrustedLabel, readOnlyLabel, trustToOpenLabel, noSessionsLabel, loadErrorLabel, organizationEnabled, sessionCatalogRequestsEnabled, sessionGroupCatalog, sessionLiveStateEnabled, sourceType, channelGroupingEnabled, ungroupedLabel, searchQuery, expanded: controlledExpanded, autoExpandKey, forceAutoExpand, onExpandedChange, renderSessions, renderSession, pendingSession, mapSession, showSessionDetails, headerActions, overviewEnabled, overviewMenuOpen, overviewItems, gitBranchWanted, sessionStats, onRenameGroup, onDeleteGroup, renameGroupLabel, deleteGroupLabel, groupActionsDisabled, excludePinned, limitSessions, isPinnedSectionMember, onOpenPathLocally, onOpenTerminalLocally, onOpenGitDiff, onOpenCommit, }: WorkspaceSectionProps): import("react/jsx-runtime").JSX.Element;
122
121
  export {};
@@ -3,9 +3,10 @@
3
3
  * Copyright 2026 Qwen Team
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { type JoinToken } from './add-runtime-dialog';
6
+ import { type ConnectExistingInput, type JoinCoordinatorInput, type JoinToken } from './add-runtime-dialog';
7
7
  import { type AgentShare, type AgentShareSummary } from './share-agent-dialog';
8
- import { type AgentProgramView, type RoutingPreviewTarget, type ThreadSummaryView } from './agents-view-logic';
8
+ import { type AgentProgramView } from './agents-view-logic';
9
+ import { type SquadsSectionProps } from './squads-section';
9
10
  /**
10
11
  * A change to one agent's configuration. Absent leaves a field alone; `null`
11
12
  * clears the override and returns the agent to what its definition says.
@@ -19,41 +20,34 @@ export interface AgentConfigPatch {
19
20
  maxConcurrentRuns?: number | null;
20
21
  execution?: {
21
22
  mode: 'local';
23
+ /** Program on this computer; Qwen Code when absent. */
24
+ provider?: AgentProgramView;
22
25
  } | {
23
26
  mode: 'managed-host';
24
27
  hostIds: string[];
25
28
  provider?: AgentProgramView;
26
29
  };
27
30
  }
28
- /** What every agent in this workspace may do. A property of the subsystem. */
29
- export interface AgentCapabilitiesView {
30
- readOnly: boolean;
31
- allowed: readonly string[];
32
- threadTools: readonly string[];
33
- }
34
31
  export interface ThreadsPageProps {
35
- onConnectRemoteHost?: (input: {
36
- remoteUrl: string;
37
- remoteToken: string;
38
- remoteCwd: string;
39
- serverUrl: string;
40
- provider: 'qwen';
41
- allowHttp: boolean;
42
- }) => Promise<boolean>;
43
- createError?: string;
32
+ onConnectRemoteHost?: (input: ConnectExistingInput) => Promise<boolean>;
33
+ /** Joins this daemon to another coordinator as one of its runtimes. */
34
+ onJoinCoordinator?: (input: JoinCoordinatorInput) => Promise<boolean>;
44
35
  agents: readonly WorkspaceAgentSummaryView[];
45
- threads: readonly ThreadSummaryView[];
46
36
  runtimes?: readonly WorkspaceAgentRuntimeView[];
47
37
  view: AgentWorkspaceView;
48
38
  onViewChange: (view: AgentWorkspaceView) => void;
49
- onOpenThread: (threadId: string) => void;
39
+ /**
40
+ * Puts `@name ` into the chat composer. Absent hides the agent card's
41
+ * mention button.
42
+ */
43
+ onMentionAgent?: (name: string) => void;
50
44
  onDeleteAgent: (agentId: string) => void;
51
45
  onSetAgentEnabled: (agentId: string, enabled: boolean) => void;
52
46
  onUpdateAgent?: (agentId: string, patch: AgentConfigPatch) => void;
53
47
  onOpenAgentBuilder?: (hostId?: string) => void;
54
48
  onOpenDefinitions?: () => void;
55
49
  /** Issues a single-use join token for the Add runtime dialog. */
56
- onCreateJoinToken?: () => Promise<JoinToken>;
50
+ onCreateJoinToken?: (supersedesHostId?: string) => Promise<JoinToken>;
57
51
  onRemoveRuntime?: (hostId: string) => void;
58
52
  hostServerUrl?: string;
59
53
  /** A2A shares of one agent; absent hides Share. */
@@ -62,15 +56,11 @@ export interface ThreadsPageProps {
62
56
  list: (agentId: string) => Promise<AgentShareSummary[]>;
63
57
  revoke: (agentId: string, callerId: string) => Promise<unknown>;
64
58
  };
65
- capabilities?: AgentCapabilitiesView;
66
- onCreateThread: (input: NewThread) => Promise<boolean> | void;
67
- workspaceCwd?: string;
68
- workspaces?: readonly {
69
- cwd: string;
70
- }[];
71
- onWorkspaceChange?: (cwd: string) => void;
72
- onPreviewThread?: (assignee?: string) => void;
73
- createPreview?: readonly RoutingPreviewTarget[];
59
+ /**
60
+ * The workspace's squads and their actions. Absent (a daemon without squad
61
+ * routes, or not loaded yet) shows the Squads view empty, with no New squad.
62
+ */
63
+ squads?: Pick<SquadsSectionProps, 'squads' | 'onCreate' | 'onUpdate' | 'onRetire'>;
74
64
  pending?: boolean;
75
65
  }
76
66
  export interface WorkspaceAgentSummaryView {
@@ -86,16 +76,12 @@ export interface WorkspaceAgentSummaryView {
86
76
  maxConcurrentRuns?: number;
87
77
  execution?: AgentConfigPatch['execution'];
88
78
  enabled: boolean;
89
- status: 'offline' | 'idle' | 'working' | 'blocked' | 'error';
79
+ status: 'offline' | 'idle' | 'working' | 'error';
90
80
  /** Absent from a daemon older than runtimes; that agent runs here. */
91
81
  runtime?: WorkspaceAgentRuntimeView;
92
82
  /** Set once the identity is retired: it keeps its posts and takes no work. */
93
83
  retiredAt?: number;
94
- workingOn?: {
95
- id: string;
96
- title: string;
97
- state: 'working' | 'finishing' | 'stopping';
98
- };
84
+ /** Queued session-agent runs waiting for this agent. */
99
85
  waiting: number;
100
86
  }
101
87
  export interface WorkspaceAgentRuntimeView {
@@ -103,19 +89,21 @@ export interface WorkspaceAgentRuntimeView {
103
89
  kind: 'local' | 'external';
104
90
  label: string;
105
91
  provider: string;
106
- /** Program ids the runtime reported it can run. */
92
+ /**
93
+ * Program ids (`qwen` | `claude` | `codex`) the runtime reported it can run,
94
+ * the local daemon included (from its program probe). None means Qwen Code.
95
+ */
107
96
  programs?: readonly string[];
108
97
  status: 'online' | 'offline';
109
98
  workspaceId?: string;
110
99
  workspaceCwd?: string;
111
- hostSessionId?: string;
112
100
  lastSeenAt?: number;
113
101
  agentCount?: number;
114
102
  sessionCount?: number;
115
103
  runningTaskCount?: number;
116
104
  queuedTaskCount?: number;
117
105
  }
118
- export type AgentWorkspaceView = 'agents' | 'tasks' | 'runtime';
106
+ export type AgentWorkspaceView = 'agents' | 'squads' | 'runtime';
119
107
  export interface NewWorkspaceAgent {
120
108
  name: string;
121
109
  description?: string;
@@ -125,22 +113,10 @@ export interface NewWorkspaceAgent {
125
113
  maxConcurrentRuns?: number;
126
114
  execution?: AgentConfigPatch['execution'];
127
115
  }
128
- export type ThreadPriorityChoice = 'urgent' | 'high' | 'normal' | 'low';
129
- export interface NewThread {
130
- title: string;
131
- body: string;
132
- /** What "done" means. Sent only when written, so a blank stays absent. */
133
- acceptanceCriteria?: string;
134
- priority?: ThreadPriorityChoice;
135
- assignee?: string;
136
- /** The first post; the assignee starts from it. */
137
- message?: string;
138
- }
139
116
  /**
140
- * The thread list, grouped by what each thread needs.
141
- *
142
- * Recency sorting is the obvious default and it buries the two threads that
143
- * need a person under twenty that do not. Grouping answers the question
144
- * someone actually opens this page with.
117
+ * The Agents page: the workspace's agent roster, its squads, and the runtimes
118
+ * agents run on.
119
+ * Agents are addressed by @-mention in a chat session; this page only manages
120
+ * who they are and where they run.
145
121
  */
146
- export declare function ThreadsPage({ agents, threads, runtimes, view, onViewChange, onOpenThread, onDeleteAgent, onSetAgentEnabled, onUpdateAgent, onOpenAgentBuilder, onOpenDefinitions, onCreateJoinToken, onRemoveRuntime, onConnectRemoteHost, hostServerUrl, shares, capabilities, onCreateThread, workspaceCwd, workspaces, onWorkspaceChange, createError, onPreviewThread, createPreview, pending, }: ThreadsPageProps): import("react/jsx-runtime").JSX.Element;
122
+ export declare function ThreadsPage({ agents, runtimes, view, onViewChange, onMentionAgent, onDeleteAgent, onSetAgentEnabled, onUpdateAgent, onOpenAgentBuilder, onOpenDefinitions, onCreateJoinToken, onRemoveRuntime, onConnectRemoteHost, onJoinCoordinator, hostServerUrl, shares, squads, pending, }: ThreadsPageProps): import("react/jsx-runtime").JSX.Element;
@@ -8,22 +8,48 @@ export interface RuntimeSummary {
8
8
  kind: 'local' | 'external';
9
9
  label: string;
10
10
  provider: string;
11
- providers?: readonly string[];
11
+ /** Program ids the runtime reported it can run. */
12
+ programs?: readonly string[];
12
13
  status: 'online' | 'offline';
13
14
  }
14
15
  export interface JoinToken {
15
16
  token: string;
16
17
  workspaceId: string;
17
18
  expiresAt: number;
19
+ replacementHostId?: string;
18
20
  }
19
21
  export interface ConnectExistingInput {
20
22
  remoteUrl: string;
21
23
  remoteToken: string;
22
24
  remoteCwd: string;
23
25
  serverUrl: string;
24
- provider: 'qwen';
25
26
  allowHttp: boolean;
26
27
  }
28
+ /** `POST /hosts/connect`: this daemon joins another coordinator as a runtime. */
29
+ export interface JoinCoordinatorInput {
30
+ serverUrl: string;
31
+ workspaceId: string;
32
+ enrollmentToken: string;
33
+ allowHttp: boolean;
34
+ }
35
+ /**
36
+ * Reads the link a coordinator shows under Runtime › Add runtime,
37
+ * `<coordinator URL>/join/<workspace id>`. Same rules as `parseJoinLink` in
38
+ * `packages/cli/src/serve/agent-host-join.ts` (keep the two in step); returns
39
+ * undefined instead of throwing so a form can validate as the user types.
40
+ */
41
+ export declare function parseJoinLink(link: string): {
42
+ serverUrl: string;
43
+ workspaceId: string;
44
+ } | undefined;
45
+ /**
46
+ * The terminal equivalent of "Join a coordinator": `qwen agents join <link>`
47
+ * asks the running local `qwen serve` to join with the same link (it calls
48
+ * that daemon's `/hosts/connect`, exactly as this dialog does). The token
49
+ * rides in the environment, never in argv.
50
+ */
51
+ export declare function joinCoordinatorCommand(link: string, token: string, allowHttp: boolean): string;
52
+ export declare function findReplacementRuntime(runtimes: readonly RuntimeSummary[], knownIds: ReadonlySet<string>, supersededHostId: string, replacementHostId?: string): RuntimeSummary | undefined;
27
53
  export declare function joinCommands(address: string, join: JoinToken): {
28
54
  qwen: string;
29
55
  npx: string;
@@ -31,17 +57,20 @@ export declare function joinCommands(address: string, join: JoinToken): {
31
57
  };
32
58
  /**
33
59
  * "Add runtime": hand another machine a one-line command, then wait for it to
34
- * show up. The dialog notices the new runtime through the same live stream
60
+ * show up. The dialog notices the new runtime through the same roster poll
35
61
  * that updates the Runtime tab, so it flips from waiting to connected by
36
62
  * itself (the Tailscale/Vercel "add device" pattern).
37
63
  */
38
- export declare function AddRuntimeDialog({ open, onOpenChange, serverUrl, runtimes, onCreateJoinToken, onConnectExisting, onCreateAgentOn, }: {
64
+ export declare function AddRuntimeDialog({ open, onOpenChange, serverUrl, runtimes, onCreateJoinToken, onConnectExisting, onJoinCoordinator, onCreateAgentOn, replacementTarget, }: {
39
65
  open: boolean;
40
66
  onOpenChange: (open: boolean) => void;
41
67
  /** The coordinator address this page talks to; the link's default. */
42
68
  serverUrl: string;
43
69
  runtimes: readonly RuntimeSummary[];
44
- onCreateJoinToken: () => Promise<JoinToken>;
70
+ onCreateJoinToken: (supersedesHostId?: string) => Promise<JoinToken>;
45
71
  onConnectExisting?: (input: ConnectExistingInput) => Promise<boolean>;
72
+ /** Joins THIS daemon to another coordinator; absent hides that entry. */
73
+ onJoinCoordinator?: (input: JoinCoordinatorInput) => Promise<boolean>;
46
74
  onCreateAgentOn?: (runtimeId: string) => void;
75
+ replacementTarget?: RuntimeSummary;
47
76
  }): import("react/jsx-runtime").JSX.Element;
@@ -4,47 +4,17 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  /**
7
- * Client for `GET /workspaces/:ws/agent/events`, the collaboration stream.
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: AgentLiveEvent) => void, onState: (state: AgentStreamState) => void): () => void;
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 agents-and-threads surface.
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`. Two rules it exists to enforce:
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
- * What a refusal means, and what to do about it.
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 function explainSkip(reason: string, target: string, t: Translate): string;
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
- * A one-line summary of a preview, for the composer's collapsed state.
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 summarizePreview(targets: readonly RoutingPreviewTarget[], t: Translate): string;
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 {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { AgentsRouteProps } from './agents-route';
7
+ export declare function LazyAgentsRoute(props: AgentsRouteProps): import("react/jsx-runtime").JSX.Element;
@@ -4,8 +4,8 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  /**
7
- * Agent collaboration strings (the Agent page, collaboration conversations,
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.