@qwen-code/web-shell 0.25.0 → 0.25.1-nightly.20261012.18f80f5666

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 (93) hide show
  1. package/README.md +6 -7
  2. package/dist/agents-route-DlEzBEU4.js +1546 -0
  3. package/dist/daemon-react-sdk.js +1 -1
  4. package/dist/{index-tVJkU24-.js → index-NuS7ToOq.js} +53556 -48611
  5. package/dist/index.js +22 -22
  6. package/dist/sw.js +1 -1
  7. package/dist/transcript.js +9991 -9580
  8. package/dist/types/adapters/messageTypes.d.ts +8 -1
  9. package/dist/types/adapters/transcriptAdapter.d.ts +2 -1
  10. package/dist/types/browser-turn-notifications.d.ts +2 -1
  11. package/dist/types/components/ChatContextHeader.d.ts +3 -1
  12. package/dist/types/components/ChatEditor.d.ts +4 -7
  13. package/dist/types/components/QueuedPromptDisplay.d.ts +4 -1
  14. package/dist/types/components/WorkspaceSelector.d.ts +9 -1
  15. package/dist/types/components/agents/AgentCreatePage.d.ts +7 -1
  16. package/dist/types/components/agents/AgentsManagerPage.d.ts +4 -5
  17. package/dist/types/components/artifacts/ArtifactPanel.d.ts +1 -8
  18. package/dist/types/components/artifacts/TrajectoryFilters.d.ts +15 -0
  19. package/dist/types/components/artifacts/TrajectoryInspector.d.ts +3 -1
  20. package/dist/types/components/artifacts/artifactUtils.d.ts +9 -0
  21. package/dist/types/components/managed/ManagedSessionCwdControl.d.ts +9 -0
  22. package/dist/types/components/managed/ManagedTaskPanel.d.ts +15 -0
  23. package/dist/types/components/managed/ManagedToolResultPanel.d.ts +6 -1
  24. package/dist/types/components/managed/generated/managed-agent-api.d.ts +273 -25
  25. package/dist/types/components/managed/java-managed-agent-client.d.ts +41 -1
  26. package/dist/types/components/managed/managed-agent-provider.d.ts +50 -1
  27. package/dist/types/components/managed/managed-request-error.d.ts +6 -0
  28. package/dist/types/components/managed/managed-task-messages.d.ts +9 -0
  29. package/dist/types/components/managed/managed-task-messages.transcript-stub.d.ts +7 -0
  30. package/dist/types/components/managed/managed-task.test-fixtures.d.ts +4 -0
  31. package/dist/types/components/managed/use-managed-actions.d.ts +6 -5
  32. package/dist/types/components/managed/use-managed-cwd-change.d.ts +21 -0
  33. package/dist/types/components/managed/use-managed-session.d.ts +15 -1
  34. package/dist/types/components/managed/use-managed-task-cancel.d.ts +12 -0
  35. package/dist/types/components/managed/use-managed-tasks.d.ts +49 -0
  36. package/dist/types/components/messages/AssistantMessage.d.ts +3 -1
  37. package/dist/types/components/messages/BrowserNotificationControl.d.ts +1 -0
  38. package/dist/types/components/messages/SelectionCopyMenu.d.ts +8 -0
  39. package/dist/types/components/messages/SelectionCopyMenu.transcript-stub.d.ts +2 -0
  40. package/dist/types/components/messages/ToolApproval.d.ts +2 -1
  41. package/dist/types/components/messages/UserMessage.d.ts +3 -1
  42. package/dist/types/components/messages/agent-message-details.d.ts +36 -0
  43. package/dist/types/components/messages/squad-tag.d.ts +16 -0
  44. package/dist/types/components/messages/toolFormatting.d.ts +3 -3
  45. package/dist/types/components/sidebar/WebShellSidebar.d.ts +8 -4
  46. package/dist/types/components/sidebar/WorkspaceSection.d.ts +9 -2
  47. package/dist/types/components/workspace-agents/ThreadsPage.d.ts +31 -55
  48. package/dist/types/components/workspace-agents/add-runtime-dialog.d.ts +34 -5
  49. package/dist/types/components/workspace-agents/agent-events.d.ts +4 -34
  50. package/dist/types/components/workspace-agents/agents-route.d.ts +19 -0
  51. package/dist/types/components/workspace-agents/agents-view-logic.d.ts +14 -163
  52. package/dist/types/components/workspace-agents/lazy-agents-route.d.ts +7 -0
  53. package/dist/types/components/workspace-agents/messages.d.ts +2 -2
  54. package/dist/types/components/workspace-agents/session-agent-live-runs.d.ts +96 -0
  55. package/dist/types/components/workspace-agents/session-agents-api.d.ts +39 -0
  56. package/dist/types/components/workspace-agents/squads-section.d.ts +28 -0
  57. package/dist/types/components/workspace-agents/threads-api.d.ts +25 -36
  58. package/dist/types/components/workspace-agents/use-session-agent-runs.d.ts +66 -0
  59. package/dist/types/components/workspace-agents/useAgentChatEntry.d.ts +74 -10
  60. package/dist/types/components/workspaces/HostLabel.d.ts +8 -0
  61. package/dist/types/components/workspaces/WorkspaceHostProjects.d.ts +18 -0
  62. package/dist/types/components/workspaces/WorkspaceLocation.d.ts +10 -0
  63. package/dist/types/config/daemon-target.d.ts +76 -0
  64. package/dist/types/config/daemon.d.ts +16 -0
  65. package/dist/types/config/host-fanout.d.ts +53 -0
  66. package/dist/types/config/remote-connections.d.ts +3 -0
  67. package/dist/types/config/workspace-hosts.d.ts +18 -0
  68. package/dist/types/constants/toolNames.d.ts +1 -0
  69. package/dist/types/daemon/session/turn-notification-context.d.ts +2 -1
  70. package/dist/types/daemon/session/types.d.ts +28 -4
  71. package/dist/types/hooks/useQueuedPrompts.d.ts +2 -0
  72. package/dist/types/trajectory/filter-messages.d.ts +9 -0
  73. package/dist/types/trajectory/filter-messages.transcript-stub.d.ts +7 -0
  74. package/dist/types/trajectory/filterTrajectory.d.ts +22 -0
  75. package/dist/types/trajectory/types.d.ts +1 -0
  76. package/dist/types/trajectory/useTrajectoryWindow.d.ts +21 -36
  77. package/dist/types/trajectory/window-messages.d.ts +9 -0
  78. package/dist/types/trajectory/window-messages.transcript-stub.d.ts +7 -0
  79. package/dist/types/utils/askUserPermission.d.ts +1 -1
  80. package/dist/types/utils/cancelledTurn.d.ts +17 -0
  81. package/dist/types/utils/selectionClipboard.d.ts +5 -0
  82. package/dist/types/utils/workspace.d.ts +10 -0
  83. package/dist/types/voice/messages.d.ts +9 -0
  84. package/dist/types/voice/messages.transcript-stub.d.ts +7 -0
  85. package/dist/types/voice/voice-error.d.ts +7 -0
  86. package/dist/{toolNames-CAeFJ9L9.js → useDaemonMidTurnInjected-snTFfPQ9.js} +4953 -4614
  87. package/package.json +4 -1
  88. package/dist/ThreadsRoute-CtecWS_K.js +0 -2358
  89. package/dist/types/components/workspace-agents/LazyThreadsRoute.d.ts +0 -7
  90. package/dist/types/components/workspace-agents/ThreadChat.d.ts +0 -35
  91. package/dist/types/components/workspace-agents/ThreadView.d.ts +0 -72
  92. package/dist/types/components/workspace-agents/ThreadsRoute.d.ts +0 -23
  93. package/dist/types/components/workspace-agents/useProjectConversations.d.ts +0 -10
@@ -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,61 +3,50 @@
3
3
  * Copyright 2026 Qwen Team
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import type { AgentCapabilitiesView, AgentConfigPatch, NewThread, NewWorkspaceAgent, WorkspaceAgentRuntimeView, WorkspaceAgentSummaryView } from './ThreadsPage';
7
- import type { ThreadDetailView } from './ThreadView';
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
- interface CreateThreadResult {
13
- id: string;
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
- remoteUrl: string;
18
- remoteToken: string;
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
- createJoinToken?(): Promise<JoinToken>;
32
+ createJoinToken?(supersedesHostId?: string): Promise<JoinToken>;
32
33
  removeHost?(hostId: string): Promise<unknown>;
33
34
  createShare?(agentId: string): Promise<AgentShare>;
34
35
  listShares?(agentId: string): Promise<{
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
- createThread(input: NewThread): Promise<CreateThreadResult>;
47
- previewThread(assignee?: string): Promise<{
48
- targets: RoutingPreviewTarget[];
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
- postReply(id: string, text: string): Promise<unknown>;
55
- markDone(id: string): Promise<unknown>;
56
- cancelRun(threadId: string, runId: string): Promise<unknown>;
57
- /** Live events; absent in tests and older daemons, which then poll. */
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 {};
@@ -2,27 +2,90 @@ import { type ComponentProps } from 'react';
2
2
  import type { ChatEditor } from '../ChatEditor';
3
3
  import type { WebShellAtProvider } from '../../customization';
4
4
  import type { useI18n } from '../../i18n';
5
+ import { type SessionAgentsApi } from './session-agents-api';
6
+ import type { WorkspaceAgentSummaryView } from './ThreadsPage';
7
+ import { type DaemonTranscriptBlock, type SessionSquadView } from '@qwen-code/sdk/daemon';
5
8
  type Submit = ComponentProps<typeof ChatEditor>['onSubmit'];
6
9
  /**
7
- * The tail of the conversation an agent was mentioned from, so a thread
8
- * started mid-conversation does not begin blind.
10
+ * The @tokens of a message, lowercased. Same rules as core's parseMentions: no
11
+ * ASCII word character before `@`, so "请@迁移助手" counts and "a@b.dev" does
12
+ * not; a token followed by `/` is a path, not a mention.
9
13
  */
10
- export declare function conversationContext(messages: readonly {
11
- role: string;
12
- content?: unknown;
13
- }[]): string;
14
- export declare function useAgentChatEntry({ enabled, cwd, baseUrl, token, onSubmit, onOpen, onError, getContext, onCreateAgent, t, }: {
14
+ export declare function mentionTokens(text: string): string[];
15
+ /**
16
+ * The agents a message addresses, in mention order. A name may run into the
17
+ * next word in scripts without spaces ("@迁移助手看一下"); the longest name the
18
+ * token starts with wins. Same addressability predicate as the picker: an
19
+ * agent the server would skip must not divert the message.
20
+ */
21
+ export declare function resolveMentionedAgents(tokens: readonly string[], agents: readonly WorkspaceAgentSummaryView[]): WorkspaceAgentSummaryView[];
22
+ /** A 32px "people" mask: squads get an icon in the picker, agents none. */
23
+ export declare const SQUAD_PICKER_ICON = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAVklEQVR42u2TMQ4AIAgD+f+ncXXRgKFWTC/pai8CZkKIJvgi1PKdRKlgRgDyU20ETkb1lwD0WqIPU88VdoaCOlsPhlo+S5QJOijU8rAEXeDGrggh3mEAQPbbJbEAqj0AAAAASUVORK5CYII=";
24
+ /**
25
+ * The squads a message addresses, by the same token rules as
26
+ * {@link resolveMentionedAgents}. A token that names an agent exactly is the
27
+ * agent's, as on the daemon.
28
+ */
29
+ export declare function resolveMentionedSquads(tokens: readonly string[], squads: readonly SessionSquadView[]): SessionSquadView[];
30
+ /** The chat session an @-mention goes to, and the workspace it lives in. */
31
+ export interface AgentMentionSession {
32
+ sessionId: string;
33
+ /** Unset: the hook's own `cwd`. */
34
+ workspaceCwd?: string;
35
+ }
36
+ /**
37
+ * An @-mention the daemon accepted but deferred behind a running main-model
38
+ * turn (`deferred: true`): its record, and so the user's message, only lands
39
+ * once that turn settles. Shown as the user's message until then.
40
+ */
41
+ export interface PendingAgentMention {
42
+ /** The post's `clientMessageId`. */
43
+ id: string;
44
+ sessionId: string;
45
+ text: string;
46
+ /**
47
+ * Recorded mentions with this text the session already had, plus earlier
48
+ * pending ones, when it was posted: the record that settles this one is
49
+ * the next.
50
+ */
51
+ recordedBefore: number;
52
+ }
53
+ /**
54
+ * The text of each recorded @-mention (`agent_mention` user message) in the
55
+ * transcript, in order. Compare with {@link isPendingMentionRecorded}.
56
+ */
57
+ export declare function recordedAgentMentionTexts(blocks: readonly DaemonTranscriptBlock[]): string[];
58
+ /** True once the record of `mention` is among the recorded mention texts. */
59
+ export declare function isPendingMentionRecorded(mention: PendingAgentMention, recordedTexts: readonly string[]): boolean;
60
+ export declare function useAgentChatEntry({ enabled, cwd, baseUrl, token, sessionApi, sessionApiFor, ensureSession, onSubmit, onError, onCreateAgent, sessionId, recordedMentionTexts, t, }: {
15
61
  enabled: boolean;
16
62
  cwd?: string;
17
63
  baseUrl: string;
18
64
  token?: string;
65
+ /** The session routes of the same workspace (`cwd`). */
66
+ sessionApi?: SessionAgentsApi;
67
+ /**
68
+ * The session routes of another workspace, for a session that lives
69
+ * elsewhere. Defaults to the HTTP routes of that workspace.
70
+ */
71
+ sessionApiFor?: (workspaceCwd: string) => SessionAgentsApi;
72
+ /**
73
+ * The current chat session, creating it first when this is a new chat (the
74
+ * same lazy creation an ordinary first prompt goes through), with the
75
+ * workspace it was created in.
76
+ */
77
+ ensureSession: () => Promise<AgentMentionSession | string | undefined>;
19
78
  onSubmit: Submit;
20
- onOpen: (id: string, cwd: string) => void;
21
79
  onError: (message: string) => void;
22
- /** The conversation so far, when mentioning from a chat that has one. */
23
- getContext?: () => string;
24
80
  /** Offered as the picker's last item: open the New agent page. */
25
81
  onCreateAgent?: () => void;
82
+ /** The session the chat shows; only its pending @-mentions are returned. */
83
+ sessionId?: string;
84
+ /**
85
+ * {@link recordedAgentMentionTexts} of that session's transcript, memoized:
86
+ * a pending @-mention is dropped once its record shows up here.
87
+ */
88
+ recordedMentionTexts?: readonly string[];
26
89
  /**
27
90
  * The caller's translator. App calls this hook above its I18nProvider, where
28
91
  * useI18n() would hand back the default that echoes keys.
@@ -32,5 +95,6 @@ export declare function useAgentChatEntry({ enabled, cwd, baseUrl, token, onSubm
32
95
  providers: WebShellAtProvider[];
33
96
  submit: (text: string, images?: import("../../adapters/promptTypes").PromptImage[], files?: import("../../adapters/promptTypes").PromptFile[], commitAccepted?: import("../../hooks/useComposerCore").ComposerSubmitCommit, metadata?: import("../../hooks/useComposerCore").ComposerSubmitMetadata) => boolean | void;
34
97
  pending: boolean;
98
+ pendingMentions: PendingAgentMention[];
35
99
  };
36
100
  export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Icon + short name for one daemon host: the page origin reads as "Local",
3
+ * anything else shows its URL host. Shared by the sidebar host groups and
4
+ * the composer workspace picker so every surface names hosts identically.
5
+ */
6
+ export declare function HostLabel({ origin }: {
7
+ origin: string;
8
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Names the connected host above its live project list. Until another host is
3
+ * saved there is nothing to tell apart, so the plain list stays unlabeled.
4
+ */
5
+ export declare function WorkspaceHostHeading(): import("react/jsx-runtime").JSX.Element | null;
6
+ export type OpenHostSessionHandler = (origin: string, sessionId: string, workspaceCwd?: string) => void;
7
+ /**
8
+ * Live projects on the other hosts, grouped by host among the focused one's
9
+ * rank (#13727): when `rankOf` is provided, every group carries its own
10
+ * flex order inside the sidebar's host container, so a focused switch keeps
11
+ * all groups in place. Each group polls its own daemon; a host that drops
12
+ * offline or rejects the saved credential keeps its last known projects
13
+ * with a muted status hint.
14
+ */
15
+ export declare function OtherHostProjects({ onOpenHostSession, rankOf, }: {
16
+ onOpenHostSession?: OpenHostSessionHandler;
17
+ rankOf?: (origin: string) => number;
18
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Compact label naming the host a chat runs on, with the working directory in
3
+ * its tooltip. Hidden until a project can live on more than one host.
4
+ * `hostOrigin` names the ACTIVE session's host on multi-daemon pages; without
5
+ * it the page daemon (the behavior before fan-out) decides.
6
+ */
7
+ export declare function WorkspaceLocation({ cwd, hostOrigin, }: {
8
+ cwd?: string;
9
+ hostOrigin?: string;
10
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { ReactNode } from 'react';
7
+ export interface FocusHostTarget {
8
+ origin: string;
9
+ /** Preselect this workspace on the new host (by id), or clear otherwise. */
10
+ workspaceId?: string;
11
+ }
12
+ /**
13
+ * One-shot intent carried across a focused-host switch: the remounted app
14
+ * performs it against the NEW host's provider (composer create on a picked
15
+ * workspace, or open an existing session). Kept here because this provider
16
+ * sits outside the interactive provider's remount boundary.
17
+ */
18
+ export interface HostHandoff {
19
+ kind: 'create' | 'open';
20
+ /** The focused host this intent belongs to — stale intents are dropped. */
21
+ origin: string;
22
+ workspaceCwd?: string;
23
+ sessionId?: string;
24
+ /** Composer text to restore on the new host (attachments cannot carry). */
25
+ draftText?: string;
26
+ }
27
+ export interface DaemonTargetController {
28
+ /** The focused daemon origin (page origin when no `?daemon=` is active). */
29
+ activeOrigin: string;
30
+ /** Origins the current document may open network connections to. */
31
+ coveredOrigins: ReadonlySet<string>;
32
+ coversOrigin(origin: string): boolean;
33
+ /**
34
+ * Focus another CSP-covered host: remounts the interactive provider at the
35
+ * new origin and rewrites `?daemon=` (+ optional `?workspace=`) in place.
36
+ * Never navigates; throws on an uncovered origin — callers must route those
37
+ * through the navigation-based connect flow instead.
38
+ */
39
+ focusHost(target: FocusHostTarget): void;
40
+ /** Token for the focused host, refreshed when the focused origin (or any
41
+ * controller dependency) changes; a token edit alone does not re-key it. */
42
+ activeToken: string | undefined;
43
+ /**
44
+ * Focus another host and hand an intent to the remounted app. The app
45
+ * drains it via `takePendingHandoff` once the new provider is connected
46
+ * (create a session in that workspace / open that session there).
47
+ */
48
+ focusHostWithHandoff(target: FocusHostTarget, handoff: HostHandoff): void;
49
+ /** Pending intent from the latest focus switch; consumed exactly once. */
50
+ pendingHandoff: HostHandoff | undefined;
51
+ takePendingHandoff(): HostHandoff | undefined;
52
+ }
53
+ export declare function DaemonTargetProvider({ children, }: {
54
+ children: ReactNode;
55
+ }): ReactNode;
56
+ export declare function useDaemonTarget(): DaemonTargetController;
57
+ /** Optional-context variant for components rendered both inside and outside
58
+ * the standalone tree (tests, embedded shells without the provider). */
59
+ export declare function useDaemonTargetOptional(): DaemonTargetController | undefined;
60
+ /**
61
+ * Intercept same-origin anchor clicks that point at another connected host
62
+ * (#13727): a transcript/session link with `?daemon=B` would otherwise
63
+ * hard-reload the document, losing all sidebar and composer state. When the
64
+ * target is inside the CSP-covered set the click becomes an in-app focus
65
+ * switch (open that session there); anything uncovered keeps the default
66
+ * navigation, which still re-serves the shell widened for the host.
67
+ */
68
+ export declare function useInterceptHostLinks(): void;
69
+ /**
70
+ * Keep the URL's `fanout` params equal to the saved-host set minus the
71
+ * focused daemon (which `?daemon=` already covers). Runs on mount, on host
72
+ * catalog changes, on focus switches, on cross-tab storage writes, and when
73
+ * the tab regains focus (settings flows that edited catalogs in place).
74
+ * `replaceState` only — the current document's CSP is unaffected.
75
+ */
76
+ export declare function useFanoutUrlSync(): void;
@@ -1,4 +1,20 @@
1
1
  export declare function getDaemonBaseUrl(): string;
2
+ /**
3
+ * Repeated `?fanout=` values validated into daemon origins. Fanout params
4
+ * name the hosts this page connects to simultaneously (multi-daemon view,
5
+ * #13727): the served CSP covers exactly the `daemon` + `fanout` set, so a
6
+ * focused-host switch inside that set never reloads the document. The page
7
+ * origin is dropped — `'self'` already covers it.
8
+ */
9
+ export declare function getFanoutOrigins(): string[];
10
+ /**
11
+ * Point the URL's `fanout` params at exactly `origins`, preserving every
12
+ * other param. `replaceState` only: this cannot widen the CURRENT document's
13
+ * CSP (the header is fixed at load) — it keeps the NEXT load in sync, so the
14
+ * host set stays covered without a reload. A newly-connected host therefore
15
+ * navigates once before it can be used; every switch after that is in-app.
16
+ */
17
+ export declare function syncFanoutParams(origins: readonly string[]): void;
2
18
  /**
3
19
  * Whether host-local affordances are safe to offer here: true only when this
4
20
  * page was served from a loopback host AND the shell is not pointed at a
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { DaemonClient } from '@qwen-code/sdk/daemon';
7
+ import type { DaemonCapabilities } from '@qwen-code/sdk/daemon';
8
+ export type HostConnectionStatus = 'connecting' | 'online' | 'offline' | 'unauthorized';
9
+ /**
10
+ * Stable read-only client for `origin`. Recreated only when the stored
11
+ * per-origin token changed; a client whose daemon vanished stays online as an
12
+ * instance (its next request fails) and its entry is dropped when the host
13
+ * loses its last subscriber.
14
+ */
15
+ export declare function getHostClient(origin: string): DaemonClient;
16
+ export declare const HOST_FANOUT_POLL_MS = 30000;
17
+ export interface HostCapabilitiesState {
18
+ workspaces: DaemonCapabilities['workspaces'];
19
+ status: HostConnectionStatus;
20
+ /** Bumps on every content-changed refresh so poll consumers resubscribe. */
21
+ generation: number;
22
+ }
23
+ /**
24
+ * Live `capabilities().workspaces` + connection status for one fan-out host.
25
+ * Shares the store's single poll round with every other consumer; the last
26
+ * successful payload survives later failures (status flips to
27
+ * offline/unauthorized but the rows keep rendering) and hosts are always
28
+ * polled with their own per-origin client.
29
+ */
30
+ export declare function useHostCapabilities(origin: string): HostCapabilitiesState & {
31
+ refresh: () => void;
32
+ };
33
+ /**
34
+ * The single ordered host set both the sidebar fan-out and App composers
35
+ * render from: every saved workspace host and connected remote origin, minus
36
+ * the focused daemon (its own UI comes from the interactive provider), plus
37
+ * the page origin when focused remote — the "way back" group. Memoized on
38
+ * content so consumers can pass it straight into `useHostFanout`.
39
+ */
40
+ export declare function useFanoutOrigins(): string[];
41
+ /**
42
+ * Live connection state + a client for every `origins` entry, drawn from the
43
+ * shared per-origin store: subscribing here never adds a second poller — the
44
+ * composer picker and the sidebar groups observe the same rounds. Failed
45
+ * hosts keep their last-known snapshot; hosts that lose their last
46
+ * subscriber are dropped from the client pool.
47
+ */
48
+ export declare function useHostFanout(origins: readonly string[]): {
49
+ clientsByOrigin: ReadonlyMap<string, DaemonClient>;
50
+ statusByOrigin: ReadonlyMap<string, HostConnectionStatus>;
51
+ workspacesByOrigin: ReadonlyMap<string, DaemonCapabilities['workspaces'] | undefined>;
52
+ refreshAll: () => void;
53
+ };
@@ -1,7 +1,10 @@
1
+ export declare const REMOTE_CONNECTIONS_CHANGE_EVENT = "qwen-remote-connections";
1
2
  export declare function formatOriginHost(origin: string): string;
2
3
  export declare function readRemoteConnections(): string[];
3
4
  export declare function rememberRemoteConnection(origin: string): void;
4
5
  export declare function forgetRemoteConnection(origin: string): string[];
6
+ /** Saved connection origins, kept in sync with catalog updates. */
7
+ export declare function useRemoteConnections(): string[];
5
8
  export declare function isRemoteConnectionKnown(origin: string): boolean;
6
9
  /**
7
10
  * Remote computers offered as a workspace location: the persisted catalog plus
@@ -0,0 +1,18 @@
1
+ import type { DaemonWorkspaceCapability } from '@qwen-code/sdk/daemon';
2
+ export declare const WorkspaceHostsEnabled: import("react").Context<boolean>;
3
+ export declare const WORKSPACE_HOSTS_CHANGE_EVENT = "qwen-workspace-hosts";
4
+ export interface WorkspaceHost {
5
+ origin: string;
6
+ workspaces: Pick<DaemonWorkspaceCapability, 'id' | 'cwd' | 'displayName'>[];
7
+ }
8
+ export declare function readWorkspaceHosts(): WorkspaceHost[];
9
+ export declare function rememberWorkspaceHost(origin: string, workspaces: WorkspaceHost['workspaces']): void;
10
+ /**
11
+ * Drop a host from the saved workspace catalog, e.g. when its connection is
12
+ * removed from Settings: the fan-out group must disappear in the same tab,
13
+ * not just on the next load.
14
+ */
15
+ export declare function forgetWorkspaceHost(origin: string): void;
16
+ /** Saved hosts, kept in sync with catalog updates from this and other tabs. */
17
+ export declare function useWorkspaceHosts(): WorkspaceHost[];
18
+ export declare function openHostedWorkspace(origin: string, workspaceId?: string): void;
@@ -7,3 +7,4 @@
7
7
  export declare const AGENT_TOOL_NAME = "agent";
8
8
  /** Whether a tool name identifies the Agent (sub-agent) tool. */
9
9
  export declare function isAgentTool(toolName: string | undefined): boolean;
10
+ export declare function isAskUserQuestionToolName(toolName: string): boolean;
@@ -15,10 +15,11 @@ export interface TurnNotificationContent {
15
15
  sessionTitle?: string;
16
16
  promptText?: string;
17
17
  responseText?: string;
18
+ attention?: 'approval' | 'question';
18
19
  }
19
20
  export interface TurnNotification extends TurnNotificationContent {
20
21
  key: string;
21
- outcome: 'completed' | 'failed' | 'ended' | 'cancelled';
22
+ outcome: 'completed' | 'failed' | 'ended' | 'cancelled' | 'approval' | 'question';
22
23
  }
23
24
  export interface TurnNotificationObserver {
24
25
  retain(scope: string): () => void;
@@ -4,7 +4,7 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { ReactNode } from 'react';
7
- import type { CreateSessionRequest, DaemonBranchSessionRequest, DaemonCapabilities, DaemonBackgroundTurn, DaemonEvent, DaemonApprovalMode, DaemonApprovalModeResult, DaemonAvailableCommand, DaemonForkSessionResult, DaemonInputAnnotation, DaemonSessionBtwResult, DaemonSessionGenerationEvent, DaemonSessionAttachmentReference, DaemonSessionAttachmentData, DaemonMidTurnMessageResult, DaemonMidTurnMessagesResult, DaemonRemoveMidTurnMessageResult, DaemonPendingPromptsResult, DaemonRemovePendingPromptResult, DaemonSessionContextStatus, DaemonSessionSavedWorkflowDetail, DaemonSessionContextUsageStatus, DaemonSessionRecapResult, DaemonRewindResult, DaemonRewindSnapshotInfo, DaemonSession, DaemonSessionSummary, DaemonSessionSupportedCommandsStatus, DaemonSessionTaskWithWorkflowStatus, DaemonSessionTasksStatus, DaemonSessionWorkflowTaskStatus, DaemonSessionWorkflowTasksStatus, DaemonSessionStatsStatus, DaemonSessionArtifactsEnvelope, DaemonSessionArtifactInput, DaemonSessionArtifactMutationResult, SessionSourceInput, SessionSourcesResult, SessionSourceUpsertResult, SessionSourceRemoveResult, DaemonSkillToggleMutation, DaemonShellCommandResult, DaemonTranscriptBlock, DaemonTranscriptStore, DaemonWorkspaceGitStatus, DaemonWorkspaceProvidersStatus, DaemonStandaloneCreationRecovery, DaemonStandaloneWorkingDirectory, HeartbeatResult, GoalControlRequest, GoalSnapshotV2, GoalStateResponse, PermissionResponse, PromptContentBlock, PromptResult, ReasoningSelection, SessionMetadataResult, SetModelResult } from '@qwen-code/sdk/daemon';
7
+ import type { CreateSessionRequest, DaemonBranchSessionRequest, DaemonCapabilities, DaemonBackgroundTurn, DaemonEvent, DaemonApprovalMode, DaemonApprovalModeResult, DaemonAvailableCommand, DaemonForkSessionResult, DaemonInputAnnotation, DaemonSessionBtwResult, DaemonSessionGenerationEvent, DaemonSessionAttachmentReference, DaemonSessionAttachmentData, DaemonMidTurnMessageResult, DaemonMidTurnMessagesResult, DaemonRemoveMidTurnMessageResult, DaemonSendMidTurnMessagesNowResult, DaemonPendingPromptsResult, DaemonRemovePendingPromptResult, DaemonSessionContextStatus, DaemonSessionSavedWorkflowDetail, DaemonSessionContextUsageStatus, DaemonSessionRecapResult, DaemonRewindResult, DaemonRewindSnapshotInfo, DaemonSession, DaemonSessionSummary, DaemonSessionSupportedCommandsStatus, DaemonSessionTaskWithWorkflowStatus, DaemonSessionTasksStatus, DaemonSessionWorkflowTaskStatus, DaemonSessionWorkflowTasksStatus, DaemonSessionStatsStatus, DaemonSessionArtifactsEnvelope, DaemonSessionArtifactInput, DaemonSessionArtifactMutationResult, SessionSourceInput, SessionSourcesResult, SessionSourceUpsertResult, SessionSourceRemoveResult, DaemonSkillToggleMutation, DaemonShellCommandResult, DaemonTranscriptBlock, DaemonTranscriptStore, DaemonWorkspaceGitStatus, DaemonWorkspaceProvidersStatus, DaemonStandaloneCreationRecovery, DaemonStandaloneWorkingDirectory, HeartbeatResult, GoalControlRequest, GoalSnapshotV2, GoalStateResponse, PermissionResponse, PromptContentBlock, PromptResult, ReasoningSelection, SessionMetadataResult, SetModelResult } from '@qwen-code/sdk/daemon';
8
8
  export type DaemonConnectionStatus = 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error';
9
9
  export interface DaemonSessionOwnerSnapshot {
10
10
  isCurrent(): boolean;
@@ -202,6 +202,12 @@ export interface DaemonPromptSettledEvent {
202
202
  sessionId: string;
203
203
  promptId: string;
204
204
  outcome: DaemonPromptSettlementOutcome;
205
+ /**
206
+ * The client that submitted the prompt, from the terminal frame's
207
+ * envelope. Lets a submitter recognise its own turn when the admission
208
+ * response never reached it.
209
+ */
210
+ originatorClientId?: string;
205
211
  /** Daemon terminal reason. Present for completed and cancelled turns. */
206
212
  stopReason?: string;
207
213
  error?: {
@@ -277,9 +283,12 @@ export interface SendPromptOptions {
277
283
  * runs to completion. Lets a caller act on "the prompt reached the session"
278
284
  * without waiting for the whole turn — e.g. the scheduled-tasks "run now",
279
285
  * which records the run at admission so a long/stalled turn or a closed tab
280
- * can't lose the record.
286
+ * can't lose the record. Carries the daemon's id for the prompt, the key
287
+ * its terminal `turn_complete` / `turn_error` settles under.
281
288
  */
282
- onAdmitted?: () => void;
289
+ onAdmitted?: (admission: {
290
+ promptId: string;
291
+ }) => void;
283
292
  }
284
293
  export interface SubmitPromptOptions extends SendPromptOptions {
285
294
  sessionId?: string;
@@ -440,11 +449,18 @@ export interface DaemonSessionActions {
440
449
  generateSessionContent(prompt: string, opts?: {
441
450
  signal?: AbortSignal;
442
451
  }): AsyncGenerator<DaemonSessionGenerationEvent>;
443
- getRewindSnapshots(): Promise<{
452
+ getRewindSnapshots(opts?: {
453
+ /** Rethrow failures raw instead of recording a notice; for best-effort
454
+ * callers that fall back on their own. */
455
+ silent?: boolean;
456
+ }): Promise<{
444
457
  snapshots: DaemonRewindSnapshotInfo[];
445
458
  }>;
446
459
  rewindSession(promptId: string, opts?: {
447
460
  rewindFiles?: boolean;
461
+ /** Rethrow failures raw instead of recording a notice; for best-effort
462
+ * callers that fall back on their own. */
463
+ silent?: boolean;
448
464
  }): Promise<DaemonRewindResult>;
449
465
  btwSession(question: string, opts?: {
450
466
  signal?: AbortSignal;
@@ -473,6 +489,14 @@ export interface DaemonSessionActions {
473
489
  onAdmissionStarted?: () => void;
474
490
  }): Promise<DaemonMidTurnMessageResult>;
475
491
  removeMidTurnMessage(messageId: string, opts?: PendingPromptActionOptions): Promise<DaemonRemoveMidTurnMessageResult>;
492
+ /**
493
+ * Ask the daemon to deliver the queued mid-turn messages now, cutting short
494
+ * a model response that a foreground turn is streaming, unless it has
495
+ * started a tool call.
496
+ * Pre-flight the daemon's `session_mid_turn_send_now` capability: older
497
+ * daemons lack the route.
498
+ */
499
+ sendMidTurnMessagesNow(opts?: PendingPromptActionOptions): Promise<DaemonSendMidTurnMessagesNowResult>;
476
500
  /**
477
501
  * Best-effort reconciliation snapshot (queue + delivery-state rings) from the
478
502
  * daemon. Resolves `undefined` (never throws/raises a notice) when there
@@ -70,6 +70,8 @@ export interface UseQueuedPromptsResult {
70
70
  enqueuePrompt: (text: string, images?: PromptImage[], files?: PromptFile[], onComplete?: () => void, inputAnnotations?: DaemonInputAnnotation[], onAdmitted?: () => void, submittedPrompt?: string) => boolean;
71
71
  removeQueuedPrompt: (id: number) => void;
72
72
  insertQueuedPrompt: (id: number) => Promise<void>;
73
+ /** Ask the daemon to deliver the queued mid-turn messages now. */
74
+ sendQueuedPromptNow: (id: number) => Promise<void>;
73
75
  editQueuedPrompt: (id: number) => Promise<void>;
74
76
  editLastQueuedPrompt: () => boolean;
75
77
  clearQueuedPrompts: () => boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ type FilterMessage = string | ((vars?: Record<string, string | number>) => string);
7
+ export declare const TRAJECTORY_FILTER_MESSAGES_EN: Record<string, FilterMessage>;
8
+ export declare const TRAJECTORY_FILTER_MESSAGES_ZH: Record<string, FilterMessage>;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export declare const TRAJECTORY_FILTER_MESSAGES_EN: {};
7
+ export declare const TRAJECTORY_FILTER_MESSAGES_ZH: {};