@qwen-code/web-shell 0.24.7 → 0.25.0-nightly.20261009.085a44f336

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 (94) hide show
  1. package/README.md +65 -2
  2. package/dist/agents-route-D7hp7io8.js +1546 -0
  3. package/dist/daemon-react-sdk.js +1 -1
  4. package/dist/index-BEPcxy4Z.js +125142 -0
  5. package/dist/index.js +69 -120254
  6. package/dist/sw.js +1 -1
  7. package/dist/{toolNames-B0O1UjKB.js → toolNames-D4oueGGC.js} +5956 -5252
  8. package/dist/transcript.js +10276 -9739
  9. package/dist/types/App.d.ts +2 -2
  10. package/dist/types/ManagedAgentWebShell.d.ts +1 -0
  11. package/dist/types/adapters/messageTypes.d.ts +23 -1
  12. package/dist/types/adapters/transcriptAdapter.d.ts +1 -0
  13. package/dist/types/components/ChatContextHeader.d.ts +3 -1
  14. package/dist/types/components/ChatEditor.d.ts +1 -0
  15. package/dist/types/components/DesktopRelayControl.d.ts +2 -1
  16. package/dist/types/components/LocalFilesControl.d.ts +3 -1
  17. package/dist/types/components/MessageItem.d.ts +1 -0
  18. package/dist/types/components/MessageList.d.ts +1 -0
  19. package/dist/types/components/agents/AgentCreatePage.d.ts +35 -1
  20. package/dist/types/components/agents/AgentsManagerPage.d.ts +5 -1
  21. package/dist/types/components/artifacts/TrajectoryFilters.d.ts +15 -0
  22. package/dist/types/components/artifacts/TrajectoryInspector.d.ts +5 -1
  23. package/dist/types/components/artifacts/TrajectoryOverview.d.ts +3 -1
  24. package/dist/types/components/artifacts/TrajectoryWaterfallCell.d.ts +15 -0
  25. package/dist/types/components/artifacts/artifactUtils.d.ts +9 -0
  26. package/dist/types/components/channels/ChannelsManagerPage.d.ts +1 -1
  27. package/dist/types/components/extensions/extensions-manager-logic.d.ts +3 -3
  28. package/dist/types/components/managed/ManagedToolResultPanel.d.ts +9 -0
  29. package/dist/types/components/managed/ManagedToolResultSummary.d.ts +5 -0
  30. package/dist/types/components/managed/generated/managed-agent-api.d.ts +915 -18
  31. package/dist/types/components/managed/java-managed-agent-client.d.ts +29 -1
  32. package/dist/types/components/managed/java-managed-agent-provider.d.ts +4 -0
  33. package/dist/types/components/managed/managed-agent-provider.d.ts +43 -1
  34. package/dist/types/components/managed/managed-agent-sse.test-fixtures.d.ts +8 -0
  35. package/dist/types/components/managed/managed-approval.d.ts +10 -0
  36. package/dist/types/components/managed/managed-artifact-download.d.ts +2 -0
  37. package/dist/types/components/managed/managed-request-error.d.ts +14 -0
  38. package/dist/types/components/managed/managed-tool-result-types.d.ts +24 -0
  39. package/dist/types/components/managed/managed-tool-result.test-fixtures.d.ts +6 -0
  40. package/dist/types/components/managed/use-managed-actions.d.ts +34 -0
  41. package/dist/types/components/messages/AssistantMessage.d.ts +6 -1
  42. package/dist/types/components/messages/AuthorAvatar.d.ts +16 -0
  43. package/dist/types/components/messages/ContextUsageMessage.d.ts +5 -1
  44. package/dist/types/components/messages/StatsMessage.d.ts +6 -1
  45. package/dist/types/components/messages/ToolApproval.d.ts +9 -1
  46. package/dist/types/components/messages/ToolGroup.d.ts +2 -0
  47. package/dist/types/components/messages/UserMessage.d.ts +3 -1
  48. package/dist/types/components/messages/agent-message-details.d.ts +36 -0
  49. package/dist/types/components/messages/squad-tag.d.ts +16 -0
  50. package/dist/types/components/sidebar/UpdateControl.d.ts +3 -1
  51. package/dist/types/components/sidebar/WebShellSidebar.d.ts +16 -5
  52. package/dist/types/components/sidebar/WorkspaceSection.d.ts +2 -1
  53. package/dist/types/components/sidebar/sessionSearch.d.ts +2 -1
  54. package/dist/types/components/workspace-agents/ThreadsPage.d.ts +122 -0
  55. package/dist/types/components/workspace-agents/add-runtime-dialog.d.ts +76 -0
  56. package/dist/types/components/workspace-agents/agent-events.d.ts +20 -0
  57. package/dist/types/components/workspace-agents/agents-route.d.ts +19 -0
  58. package/dist/types/components/workspace-agents/agents-view-logic.d.ts +31 -0
  59. package/dist/types/components/workspace-agents/lazy-agents-route.d.ts +7 -0
  60. package/dist/types/components/workspace-agents/messages.d.ts +16 -0
  61. package/dist/types/components/workspace-agents/messages.transcript-stub.d.ts +12 -0
  62. package/dist/types/components/workspace-agents/session-agent-live-runs.d.ts +96 -0
  63. package/dist/types/components/workspace-agents/session-agents-api.d.ts +39 -0
  64. package/dist/types/components/workspace-agents/share-agent-dialog.d.ts +33 -0
  65. package/dist/types/components/workspace-agents/squads-section.d.ts +28 -0
  66. package/dist/types/components/workspace-agents/threads-api.d.ts +52 -0
  67. package/dist/types/components/workspace-agents/use-session-agent-runs.d.ts +66 -0
  68. package/dist/types/components/workspace-agents/useAgentChatEntry.d.ts +100 -0
  69. package/dist/types/components/workspaces/WorkspaceHostProjects.d.ts +11 -0
  70. package/dist/types/components/workspaces/WorkspaceLocation.d.ts +7 -0
  71. package/dist/types/config/workspace-hosts.d.ts +11 -0
  72. package/dist/types/customization.d.ts +10 -0
  73. package/dist/types/daemon/session/types.d.ts +19 -3
  74. package/dist/types/daemon/workspace/hooks/useDaemonMemory.d.ts +4 -0
  75. package/dist/types/daemon/workspace/types.d.ts +6 -2
  76. package/dist/types/index.d.ts +2 -1
  77. package/dist/types/live/LiveVoiceButton.d.ts +2 -1
  78. package/dist/types/navigation.d.ts +1 -0
  79. package/dist/types/settings.d.ts +1 -0
  80. package/dist/types/trajectory/buildTrajectoryLayout.d.ts +27 -0
  81. package/dist/types/trajectory/filter-messages.d.ts +9 -0
  82. package/dist/types/trajectory/filter-messages.transcript-stub.d.ts +7 -0
  83. package/dist/types/trajectory/filterTrajectory.d.ts +22 -0
  84. package/dist/types/trajectory/types.d.ts +3 -1
  85. package/dist/types/trajectory/useTimelineViewport.d.ts +19 -0
  86. package/dist/types/trajectory/useTrajectoryWindow.d.ts +21 -36
  87. package/dist/types/trajectory/window-messages.d.ts +9 -0
  88. package/dist/types/trajectory/window-messages.transcript-stub.d.ts +7 -0
  89. package/dist/types/utils/cancelledTurn.d.ts +17 -0
  90. package/dist/types/utils/composerTag.d.ts +6 -1
  91. package/dist/types/utils/modelEncoding.d.ts +6 -0
  92. package/dist/types/utils/navigationUrl.d.ts +1 -1
  93. package/dist/types/utils/workspace.d.ts +1 -0
  94. package/package.json +2 -1
@@ -0,0 +1,122 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { type ConnectExistingInput, type JoinCoordinatorInput, type JoinToken } from './add-runtime-dialog';
7
+ import { type AgentShare, type AgentShareSummary } from './share-agent-dialog';
8
+ import { type AgentProgramView } from './agents-view-logic';
9
+ import { type SquadsSectionProps } from './squads-section';
10
+ /**
11
+ * A change to one agent's configuration. Absent leaves a field alone; `null`
12
+ * clears the override and returns the agent to what its definition says.
13
+ */
14
+ export interface AgentConfigPatch {
15
+ description?: string | null;
16
+ color?: string | null;
17
+ model?: string | null;
18
+ instructions?: string | null;
19
+ agentType?: string | null;
20
+ maxConcurrentRuns?: number | null;
21
+ execution?: {
22
+ mode: 'local';
23
+ /** Program on this computer; Qwen Code when absent. */
24
+ provider?: AgentProgramView;
25
+ } | {
26
+ mode: 'managed-host';
27
+ hostIds: string[];
28
+ provider?: AgentProgramView;
29
+ };
30
+ }
31
+ export interface ThreadsPageProps {
32
+ onConnectRemoteHost?: (input: ConnectExistingInput) => Promise<boolean>;
33
+ /** Joins this daemon to another coordinator as one of its runtimes. */
34
+ onJoinCoordinator?: (input: JoinCoordinatorInput) => Promise<boolean>;
35
+ agents: readonly WorkspaceAgentSummaryView[];
36
+ runtimes?: readonly WorkspaceAgentRuntimeView[];
37
+ view: AgentWorkspaceView;
38
+ onViewChange: (view: AgentWorkspaceView) => void;
39
+ /**
40
+ * Puts `@name ` into the chat composer. Absent hides the agent card's
41
+ * mention button.
42
+ */
43
+ onMentionAgent?: (name: string) => void;
44
+ onDeleteAgent: (agentId: string) => void;
45
+ onSetAgentEnabled: (agentId: string, enabled: boolean) => void;
46
+ onUpdateAgent?: (agentId: string, patch: AgentConfigPatch) => void;
47
+ onOpenAgentBuilder?: (hostId?: string) => void;
48
+ onOpenDefinitions?: () => void;
49
+ /** Issues a single-use join token for the Add runtime dialog. */
50
+ onCreateJoinToken?: (supersedesHostId?: string) => Promise<JoinToken>;
51
+ onRemoveRuntime?: (hostId: string) => void;
52
+ hostServerUrl?: string;
53
+ /** A2A shares of one agent; absent hides Share. */
54
+ shares?: {
55
+ create: (agentId: string) => Promise<AgentShare>;
56
+ list: (agentId: string) => Promise<AgentShareSummary[]>;
57
+ revoke: (agentId: string, callerId: string) => Promise<unknown>;
58
+ };
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'>;
64
+ pending?: boolean;
65
+ }
66
+ export interface WorkspaceAgentSummaryView {
67
+ id: string;
68
+ name: string;
69
+ description?: string;
70
+ color?: string;
71
+ /** Definition supplying the persona. Absent uses the workspace default. */
72
+ agentType?: string;
73
+ model?: string;
74
+ /** What this identity is told on top of its definition's prompt. */
75
+ instructions?: string;
76
+ maxConcurrentRuns?: number;
77
+ execution?: AgentConfigPatch['execution'];
78
+ enabled: boolean;
79
+ status: 'offline' | 'idle' | 'working' | 'error';
80
+ /** Absent from a daemon older than runtimes; that agent runs here. */
81
+ runtime?: WorkspaceAgentRuntimeView;
82
+ /** Set once the identity is retired: it keeps its posts and takes no work. */
83
+ retiredAt?: number;
84
+ /** Queued session-agent runs waiting for this agent. */
85
+ waiting: number;
86
+ }
87
+ export interface WorkspaceAgentRuntimeView {
88
+ id: string;
89
+ kind: 'local' | 'external';
90
+ label: string;
91
+ provider: string;
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
+ */
96
+ programs?: readonly string[];
97
+ status: 'online' | 'offline';
98
+ workspaceId?: string;
99
+ workspaceCwd?: string;
100
+ lastSeenAt?: number;
101
+ agentCount?: number;
102
+ sessionCount?: number;
103
+ runningTaskCount?: number;
104
+ queuedTaskCount?: number;
105
+ }
106
+ export type AgentWorkspaceView = 'agents' | 'squads' | 'runtime';
107
+ export interface NewWorkspaceAgent {
108
+ name: string;
109
+ description?: string;
110
+ agentType?: string;
111
+ model?: string;
112
+ instructions?: string;
113
+ maxConcurrentRuns?: number;
114
+ execution?: AgentConfigPatch['execution'];
115
+ }
116
+ /**
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.
121
+ */
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;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export interface RuntimeSummary {
7
+ id: string;
8
+ kind: 'local' | 'external';
9
+ label: string;
10
+ provider: string;
11
+ /** Program ids the runtime reported it can run. */
12
+ programs?: readonly string[];
13
+ status: 'online' | 'offline';
14
+ }
15
+ export interface JoinToken {
16
+ token: string;
17
+ workspaceId: string;
18
+ expiresAt: number;
19
+ replacementHostId?: string;
20
+ }
21
+ export interface ConnectExistingInput {
22
+ remoteUrl: string;
23
+ remoteToken: string;
24
+ remoteCwd: string;
25
+ serverUrl: string;
26
+ allowHttp: boolean;
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;
53
+ export declare function joinCommands(address: string, join: JoinToken): {
54
+ qwen: string;
55
+ npx: string;
56
+ insecure: boolean;
57
+ };
58
+ /**
59
+ * "Add runtime": hand another machine a one-line command, then wait for it to
60
+ * show up. The dialog notices the new runtime through the same roster poll
61
+ * that updates the Runtime tab, so it flips from waiting to connected by
62
+ * itself (the Tailscale/Vercel "add device" pattern).
63
+ */
64
+ export declare function AddRuntimeDialog({ open, onOpenChange, serverUrl, runtimes, onCreateJoinToken, onConnectExisting, onJoinCoordinator, onCreateAgentOn, replacementTarget, }: {
65
+ open: boolean;
66
+ onOpenChange: (open: boolean) => void;
67
+ /** The coordinator address this page talks to; the link's default. */
68
+ serverUrl: string;
69
+ runtimes: readonly RuntimeSummary[];
70
+ onCreateJoinToken: (supersedesHostId?: string) => Promise<JoinToken>;
71
+ onConnectExisting?: (input: ConnectExistingInput) => Promise<boolean>;
72
+ /** Joins THIS daemon to another coordinator; absent hides that entry. */
73
+ onJoinCoordinator?: (input: JoinCoordinatorInput) => Promise<boolean>;
74
+ onCreateAgentOn?: (runtimeId: string) => void;
75
+ replacementTarget?: RuntimeSummary;
76
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
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.
10
+ *
11
+ * `fetch` rather than `EventSource`: the daemon wants a bearer header, which
12
+ * `EventSource` cannot send. Frames are plain `event:` + one `data:` line.
13
+ */
14
+ export type AgentStreamState = 'open' | 'closed';
15
+ /**
16
+ * Subscribes to a workspace's stream. Subscribers of the same URL share one
17
+ * connection: browsers allow only a handful per origin, and the sidebar plus
18
+ * an open conversation would otherwise hold several for the same workspace.
19
+ */
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;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * @fileoverview Presentation logic for the Agents page (roster and runtimes).
8
+ *
9
+ * Everything here is pure and testable without a browser, following the same
10
+ * split as `agents-manager-logic.ts`.
11
+ */
12
+ /**
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.
15
+ */
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;
21
+ /**
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.
24
+ */
25
+ export declare function runtimePrograms(runtime: {
26
+ programs?: readonly string[];
27
+ }): AgentProgramView[];
28
+ type Translate = (key: string, vars?: Record<string, string | number>) => string;
29
+ /** "45 秒" or "6 分 45 秒": the one duration format the collaboration UI uses. */
30
+ export declare function formatElapsed(ms: number, t: Translate): string;
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;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
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
+ * Voice's: an exported transcript never renders these surfaces, so
10
+ * `vite.lib.config.ts` resolves this module to `messages.transcript-stub.ts`
11
+ * in `--mode transcript` and the transcript bundle stays within its budget.
12
+ */
13
+ type CollabMessage = string | ((vars?: Record<string, string | number>) => string);
14
+ export declare const COLLAB_MESSAGES_EN: Record<string, CollabMessage>;
15
+ export declare const COLLAB_MESSAGES_ZH: Record<string, CollabMessage>;
16
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Stands in for `./messages` in the transcript build (`--mode transcript`).
8
+ * The transcript renderer has no collaboration surface, so its dictionary
9
+ * carries none of those strings.
10
+ */
11
+ export declare const COLLAB_MESSAGES_EN: {};
12
+ export declare const COLLAB_MESSAGES_ZH: {};
@@ -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,33 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /** What the daemon returns for a new share; the secret is shown once. */
7
+ export interface AgentShare {
8
+ endpoint: string;
9
+ workspaceId: string;
10
+ callerId: string;
11
+ agentId: string;
12
+ secret: string;
13
+ expiresAt?: number;
14
+ }
15
+ export interface AgentShareSummary {
16
+ callerId: string;
17
+ createdAt: number;
18
+ expiresAt?: number;
19
+ }
20
+ /**
21
+ * Share one agent with a caller outside this workspace over A2A. The agent
22
+ * runs under its live workspace configuration; the caller gets an endpoint,
23
+ * a token shown once and a one-line test. Each share is its own grant, so
24
+ * revoking one leaves the others working.
25
+ */
26
+ export declare function ShareAgentDialog({ agentName, open, onOpenChange, onCreate, onList, onRevoke, }: {
27
+ agentName: string;
28
+ open: boolean;
29
+ onOpenChange: (open: boolean) => void;
30
+ onCreate: () => Promise<AgentShare>;
31
+ onList: () => Promise<AgentShareSummary[]>;
32
+ onRevoke: (callerId: string) => Promise<unknown>;
33
+ }): import("react/jsx-runtime").JSX.Element;
@@ -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;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { AgentConfigPatch, NewWorkspaceAgent, WorkspaceAgentRuntimeView, WorkspaceAgentSummaryView } from './ThreadsPage';
7
+ import type { ConnectExistingInput, JoinCoordinatorInput, JoinToken } from './add-runtime-dialog';
8
+ import type { AgentShare, AgentShareSummary } from './share-agent-dialog';
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
+ }>;
20
+ }
21
+ /** Agent roster, runtimes, enrollment and sharing for one workspace. */
22
+ export interface ThreadsApi {
23
+ connectRemoteHost?(input: ConnectExistingInput): Promise<unknown>;
24
+ /** Makes this daemon a runtime of another coordinator. */
25
+ joinCoordinator?(input: JoinCoordinatorInput): Promise<unknown>;
26
+ listAgents(): Promise<{
27
+ agents: WorkspaceAgentSummaryView[];
28
+ runtime?: WorkspaceAgentRuntimeView;
29
+ runtimes?: WorkspaceAgentRuntimeView[];
30
+ }>;
31
+ /** A single-use token for `qwen serve --join` on another machine. */
32
+ createJoinToken?(supersedesHostId?: string): Promise<JoinToken>;
33
+ removeHost?(hostId: string): Promise<unknown>;
34
+ createShare?(agentId: string): Promise<AgentShare>;
35
+ listShares?(agentId: string): Promise<{
36
+ shares: AgentShareSummary[];
37
+ }>;
38
+ revokeShare?(agentId: string, callerId: string): Promise<unknown>;
39
+ createAgent(input: NewWorkspaceAgent): Promise<unknown>;
40
+ deleteAgent(id: string): Promise<unknown>;
41
+ setAgentEnabled(id: string, enabled: boolean): Promise<unknown>;
42
+ updateAgent(id: string, patch: AgentConfigPatch): Promise<unknown>;
43
+ /** Squads; absent on a daemon without them. */
44
+ listSquads?(): Promise<{
45
+ squads: SessionSquadView[];
46
+ }>;
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>;
51
+ }
52
+ export declare function createThreadsHttpApi(baseUrl: string, token: string | undefined, workspaceCwd: string): ThreadsApi;
@@ -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 {};