@qwen-code/web-shell 0.24.1-preview.1 → 0.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -4
- package/dist/daemon-react-sdk.js +1 -1
- package/dist/index.js +54062 -49941
- package/dist/sw.js +1 -1
- package/dist/{toolNames-DgCpmhML.js → toolNames-DQad2xSu.js} +6114 -5488
- package/dist/transcript.js +10297 -9531
- package/dist/types/App.d.ts +13 -2
- package/dist/types/adapters/messageTypes.d.ts +12 -1
- package/dist/types/adapters/reported-artifacts.d.ts +2 -0
- package/dist/types/adapters/transcriptToMessages.d.ts +16 -0
- package/dist/types/assistant-turn-settlement.d.ts +12 -0
- package/dist/types/components/BranchPickerPopover.d.ts +3 -1
- package/dist/types/components/ChatContextHeader.d.ts +10 -1
- package/dist/types/components/ChatEditor.d.ts +10 -0
- package/dist/types/components/GoalStatusStrip.d.ts +12 -0
- package/dist/types/components/MessageItem.d.ts +7 -1
- package/dist/types/components/SplitView.d.ts +3 -1
- package/dist/types/components/StandaloneAuth.d.ts +3 -1
- package/dist/types/components/artifacts/ArtifactPanel.d.ts +22 -1
- package/dist/types/components/artifacts/TrajectoryPanel.d.ts +14 -0
- package/dist/types/components/artifacts/TurnOutputs.d.ts +7 -0
- package/dist/types/components/artifacts/artifactUtils.d.ts +1 -1
- package/dist/types/components/composer/AddMenu.d.ts +24 -2
- package/dist/types/components/dialogs/AddWorkspaceDialog.d.ts +11 -1
- package/dist/types/components/dialogs/DaemonStatusDialog.d.ts +4 -0
- package/dist/types/components/dialogs/WorkspaceAddStatusDialog.d.ts +11 -0
- package/dist/types/components/messages/AssistantMessage.d.ts +5 -1
- package/dist/types/components/messages/SettingsMessage.d.ts +4 -1
- package/dist/types/components/messages/tools/ShellToolOutput.d.ts +4 -0
- package/dist/types/components/messages/tools/shellLiveOutput.d.ts +13 -0
- package/dist/types/components/panels/EnvironmentPanel.d.ts +2 -1
- package/dist/types/components/sidebar/WorkspaceSection.d.ts +2 -1
- package/dist/types/components/ui/alert-dialog.d.ts +1 -1
- package/dist/types/components/ui/field.d.ts +1 -1
- package/dist/types/components/ui/toggle-group.d.ts +1 -1
- package/dist/types/components/workspaces/CapacityRecoveryDialog.d.ts +11 -0
- package/dist/types/config/daemon.d.ts +3 -1
- package/dist/types/config/remote-connections.d.ts +18 -0
- package/dist/types/config/remote-workspace-add.d.ts +17 -0
- package/dist/types/customization.d.ts +59 -1
- package/dist/types/daemon/session/DaemonSessionProvider.d.ts +3 -2
- package/dist/types/daemon/session/actions.d.ts +1 -1
- package/dist/types/daemon/session/httpErrors.d.ts +1 -0
- package/dist/types/daemon/session/types.d.ts +30 -1
- package/dist/types/daemon/workspace/hooks/useDaemonMemory.d.ts +3 -1
- package/dist/types/daemon/workspace/types.d.ts +8 -1
- package/dist/types/hooks/useAssistantFeedback.d.ts +16 -0
- package/dist/types/hooks/useCapacityRecovery.d.ts +8 -0
- package/dist/types/hooks/useComposerCore.d.ts +6 -1
- package/dist/types/hooks/useContextCompressionReconcile.d.ts +38 -0
- package/dist/types/hooks/useQueuedPrompts.d.ts +2 -1
- package/dist/types/hooks/useReportedArtifactRegistration.d.ts +20 -0
- package/dist/types/hooks/useSessionArtifacts.d.ts +2 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/live/LiveLevelMeter.d.ts +31 -0
- package/dist/types/live/LiveVoiceButton.d.ts +7 -1
- package/dist/types/live/LiveVoiceMenuItem.d.ts +9 -0
- package/dist/types/live/live-model-options.d.ts +24 -0
- package/dist/types/live/messages.d.ts +16 -0
- package/dist/types/live/messages.transcript-stub.d.ts +12 -0
- package/dist/types/live/pcm-player.d.ts +34 -0
- package/dist/types/live/screen-share.d.ts +25 -0
- package/dist/types/live/useLiveBrowserHost.d.ts +92 -0
- package/dist/types/live/useLiveVoice.d.ts +6 -0
- package/dist/types/session-catalog/session-catalog-store.d.ts +9 -0
- package/dist/types/settings.d.ts +6 -4
- package/dist/types/trajectory/buildTrajectory.d.ts +15 -0
- package/dist/types/trajectory/projectTrajectoryWindow.d.ts +23 -0
- package/dist/types/trajectory/transcriptPageLoader.d.ts +31 -0
- package/dist/types/trajectory/types.d.ts +130 -0
- package/dist/types/trajectory/useTrajectoryWindow.d.ts +75 -0
- package/dist/types/utils/assistantFeedback.d.ts +71 -0
- package/dist/types/utils/commitGraph.d.ts +39 -0
- package/dist/types/utils/contextCompression.d.ts +38 -0
- package/dist/types/utils/sessionPreparation.d.ts +3 -1
- package/dist/types/voice/capture-utils.d.ts +22 -0
- package/dist/types/voice/useVoiceCapture.d.ts +2 -1
- package/package.json +9 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function isRemoteWorkspaceAddActive(): boolean;
|
|
2
|
+
export declare function clearRemoteWorkspaceAddStep(): void;
|
|
3
|
+
export declare function startRemoteWorkspaceAdd(daemonOrigin: string, token?: string): boolean;
|
|
4
|
+
export declare function selectRemoteWorkspaceLocation(daemonOrigin: string, token?: string): boolean;
|
|
5
|
+
export declare function leaveRemoteWorkspaceAdd(): boolean;
|
|
6
|
+
export declare function completeRemoteWorkspaceAdd(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Drops a return location whose flow was abandoned rather than finished.
|
|
9
|
+
*
|
|
10
|
+
* The key is only ever written immediately before a navigation that carries
|
|
11
|
+
* `FLOW_PARAM` (see startRemoteWorkspaceAdd and navigateToDaemon), so booting
|
|
12
|
+
* without that marker means the hand-over was abandoned — a reload or the
|
|
13
|
+
* browser's Back button strips the dialog but leaves this key behind, and the
|
|
14
|
+
* next Cancel in any Add-workspace dialog would consume the stale location and
|
|
15
|
+
* navigate the whole shell back to it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function discardAbandonedRemoteWorkspaceAdd(): void;
|
|
@@ -127,7 +127,7 @@ export interface WebShellChatHeaderOptions {
|
|
|
127
127
|
/** Built-in header actions to show. Token and context usage are opt-in. */
|
|
128
128
|
items?: readonly WebShellChatHeaderItem[];
|
|
129
129
|
}
|
|
130
|
-
export type WebShellRightPanelItem = 'review' | 'sideTask' | 'terminal' | 'webPreview';
|
|
130
|
+
export type WebShellRightPanelItem = 'review' | 'sideTask' | 'terminal' | 'webPreview' | 'trajectory';
|
|
131
131
|
export interface WebShellRightPanelOptions {
|
|
132
132
|
/** Empty-state actions to show. Defaults to review and sideTask. */
|
|
133
133
|
items?: readonly WebShellRightPanelItem[];
|
|
@@ -212,6 +212,21 @@ export interface WebShellAssistantMessageInfo {
|
|
|
212
212
|
isStreaming?: boolean;
|
|
213
213
|
timestamp?: number;
|
|
214
214
|
}
|
|
215
|
+
export type WebShellAssistantTurnOutcome = 'completed' | 'cancelled' | 'failed';
|
|
216
|
+
export interface WebShellAssistantTurnSettledEvent {
|
|
217
|
+
sessionId: string;
|
|
218
|
+
/** Daemon terminal prompt identifier and stable host idempotency key. */
|
|
219
|
+
promptId: string;
|
|
220
|
+
outcome: WebShellAssistantTurnOutcome;
|
|
221
|
+
/** Daemon terminal reason. Present for completed and cancelled turns. */
|
|
222
|
+
stopReason?: string;
|
|
223
|
+
/** Final visible assistant message when retained in the mounted transcript. */
|
|
224
|
+
message?: WebShellAssistantMessageInfo;
|
|
225
|
+
error?: {
|
|
226
|
+
message: string;
|
|
227
|
+
code?: string;
|
|
228
|
+
};
|
|
229
|
+
}
|
|
215
230
|
export interface WebShellAssistantTurnFooterRenderInfo {
|
|
216
231
|
/** User-message id for the head of the completed turn. */
|
|
217
232
|
turnId: string;
|
|
@@ -226,6 +241,44 @@ export interface WebShellSessionArtifactsChange {
|
|
|
226
241
|
artifactsByTurn: ReadonlyMap<string, readonly DaemonSessionArtifact[]>;
|
|
227
242
|
}
|
|
228
243
|
export type AssistantTurnFooterRenderer = (info: WebShellAssistantTurnFooterRenderInfo) => ReactNode | null | undefined;
|
|
244
|
+
export type WebShellAssistantFeedbackRating = 'up' | 'down';
|
|
245
|
+
/** The prompt that started a marked turn. */
|
|
246
|
+
export interface WebShellAssistantFeedbackUserMessage {
|
|
247
|
+
/**
|
|
248
|
+
* The prompt's most recent characters, or a placeholder naming what the
|
|
249
|
+
* prompt carried when it had no text at all.
|
|
250
|
+
*/
|
|
251
|
+
text: string;
|
|
252
|
+
/** Wall-clock epoch ms of the prompt, when the transcript knows it. */
|
|
253
|
+
timestamp?: number;
|
|
254
|
+
}
|
|
255
|
+
export interface WebShellAssistantFeedbackInfo {
|
|
256
|
+
/** The new mark; `null` when the user cleared it by clicking the lit icon. */
|
|
257
|
+
rating: WebShellAssistantFeedbackRating | null;
|
|
258
|
+
/** The mark the turn carried before this change, when there was one. */
|
|
259
|
+
previousRating?: WebShellAssistantFeedbackRating;
|
|
260
|
+
/** The session the marked turn belongs to. */
|
|
261
|
+
sessionId?: string;
|
|
262
|
+
/**
|
|
263
|
+
* Admitted prompt id of the marked turn. This is the daemon's own per-turn
|
|
264
|
+
* identity: unlike a transcript block id it survives a reload, and it is
|
|
265
|
+
* what the daemon addresses a turn by (`/session/:id/turns/:promptId`).
|
|
266
|
+
*/
|
|
267
|
+
promptId: string;
|
|
268
|
+
/** The prompt that started the marked turn. */
|
|
269
|
+
userMessage: WebShellAssistantFeedbackUserMessage;
|
|
270
|
+
}
|
|
271
|
+
export type AssistantFeedbackHandler = (info: WebShellAssistantFeedbackInfo) => void;
|
|
272
|
+
export interface WebShellAssistantFeedbackOptions {
|
|
273
|
+
/** Passing the object shows the icons; `false` hides them again. */
|
|
274
|
+
enabled?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Notified after every change, including clearing a mark. This is a
|
|
277
|
+
* notification, not a gate: the icon is already lit (or dark) when it runs,
|
|
278
|
+
* and neither a throw nor a later rejection changes that.
|
|
279
|
+
*/
|
|
280
|
+
onRate?: AssistantFeedbackHandler;
|
|
281
|
+
}
|
|
229
282
|
/** Return custom artifact artwork, or null/undefined/false for the built-in icon. */
|
|
230
283
|
export type ArtifactImageRenderer = (artifact: DaemonSessionArtifact) => ReactNode | null | undefined;
|
|
231
284
|
export interface WebShellArtifactCustomization {
|
|
@@ -458,6 +511,11 @@ export interface WebShellCustomization {
|
|
|
458
511
|
renderComposerTagTooltip?: ComposerTagRenderer;
|
|
459
512
|
onComposerTagClick?: ComposerTagClickHandler;
|
|
460
513
|
renderAssistantTurnFooter?: AssistantTurnFooterRenderer;
|
|
514
|
+
/**
|
|
515
|
+
* Satisfied / not-satisfied marks on each completed assistant turn. Omit the
|
|
516
|
+
* object to leave Web Shell's answer footer unchanged.
|
|
517
|
+
*/
|
|
518
|
+
assistantFeedback?: WebShellAssistantFeedbackOptions;
|
|
461
519
|
getAssistantSourcesIcon?: WebShellSourceIconResolver;
|
|
462
520
|
sourceReferences?: readonly WebShellSourceReference[];
|
|
463
521
|
renderComposerToolbarStart?: ComposerToolbarStartRenderer;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { type DaemonTranscriptBlock, type DaemonTranscriptState, type DaemonTranscriptStore, type DaemonUiEvent } from '@qwen-code/sdk/daemon';
|
|
7
|
-
import type { DaemonConnectionState, DaemonPromptStatus, DaemonSessionActions, DaemonSessionContextValue, DaemonSessionNotice, DaemonSessionOwnerGuard, DaemonSessionProviderProps, DaemonWorkspaceEventSignals } from './types.js';
|
|
7
|
+
import type { DaemonConnectionState, DaemonPromptStatus, DaemonSessionActions, DaemonSessionContextValue, DaemonSessionNotice, DaemonSessionOwnerGuard, DaemonSessionProviderProps, DaemonPromptSettledListener, DaemonWorkspaceEventSignals } from './types.js';
|
|
8
8
|
import { type DaemonTurnNavigationSnapshot, type DaemonTurnNavigationStore, type DaemonHistoryNavigationStore } from './turn-navigation-store.js';
|
|
9
|
-
export type { DaemonCommandInfo, DaemonConnectionState, DaemonConnectionStatus, DaemonModelInfo, DaemonProductSessionContext, DaemonStandaloneConnectionState, DaemonNoticeCategory, DaemonNoticeOperation, DaemonNoticeSeverity, DaemonPromptImage, DaemonPromptStatus, DaemonSessionActions, DaemonSessionContextValue, DaemonSessionNotice, DaemonSessionProviderProps, DaemonTodoItem, DaemonTodoList, DaemonTodoPriority, DaemonTodoStatus, DaemonWorkspaceEventSignals, SendPromptOptions, } from './types.js';
|
|
9
|
+
export type { DaemonCommandInfo, DaemonConnectionState, DaemonConnectionStatus, DaemonModelInfo, DaemonProductSessionContext, DaemonStandaloneConnectionState, DaemonNoticeCategory, DaemonNoticeOperation, DaemonNoticeSeverity, DaemonPromptImage, DaemonPromptSettledEvent, DaemonPromptSettledListener, DaemonPromptSettlementOutcome, DaemonPromptStatus, DaemonSessionActions, DaemonSessionContextValue, DaemonSessionNotice, DaemonSessionProviderProps, DaemonTodoItem, DaemonTodoList, DaemonTodoPriority, DaemonTodoStatus, DaemonWorkspaceEventSignals, SendPromptOptions, } from './types.js';
|
|
10
10
|
export type { DaemonTurnNavigationSnapshot } from './turn-navigation-store.js';
|
|
11
11
|
export interface DaemonTranscriptHistory {
|
|
12
12
|
hasMore: boolean;
|
|
@@ -37,6 +37,7 @@ export declare function useOptionalDaemonActions(): DaemonSessionActions | undef
|
|
|
37
37
|
export declare function useDaemonSessionOwnerGuard(): DaemonSessionOwnerGuard;
|
|
38
38
|
export declare function useDaemonWorkspaceEventSignals(): DaemonWorkspaceEventSignals | undefined;
|
|
39
39
|
export declare function useDaemonPromptStatus(): DaemonPromptStatus;
|
|
40
|
+
export declare function useDaemonPromptSettled(listener: DaemonPromptSettledListener | undefined): void;
|
|
40
41
|
export declare function useDaemonConnection(): DaemonConnectionState;
|
|
41
42
|
export declare function useDaemonSessionNotices(): {
|
|
42
43
|
notices: readonly DaemonSessionNotice[];
|
|
@@ -75,7 +75,7 @@ export interface CreateDaemonSessionActionsArgs {
|
|
|
75
75
|
blockId?: string;
|
|
76
76
|
}) => void;
|
|
77
77
|
onContinuationAdmitted?: (owner: DaemonSessionClient, promptId: string) => void;
|
|
78
|
-
onPromptRemoved?: (owner: DaemonSessionClient, promptId: string) => void;
|
|
78
|
+
onPromptRemoved?: (owner: DaemonSessionClient, promptId: string, sessionId?: string) => void;
|
|
79
79
|
}
|
|
80
80
|
export declare function getWorkspaceModelsAfterSessionClear(current: DaemonConnectionState): DaemonConnectionState['models'];
|
|
81
81
|
export declare function getConnectionAfterSessionClear(current: DaemonConnectionState, clearedSessionId: string | undefined, preserveWorkspaceMetadata?: boolean): DaemonConnectionState;
|
|
@@ -7,3 +7,4 @@ export declare function extractHttpStatus(error: unknown): number | undefined;
|
|
|
7
7
|
export declare function isInvalidClientIdError(error: unknown): boolean;
|
|
8
8
|
export declare function isAcpChildCapacityError(error: unknown): boolean;
|
|
9
9
|
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
10
|
+
export declare function isRecoverableAcpCapacityError(error: unknown): boolean;
|
|
@@ -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, 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, 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, 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';
|
|
8
8
|
export type DaemonConnectionStatus = 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error';
|
|
9
9
|
export interface DaemonSessionOwnerSnapshot {
|
|
10
10
|
isCurrent(): boolean;
|
|
@@ -30,6 +30,14 @@ export interface DaemonStandaloneConnectionState {
|
|
|
30
30
|
}
|
|
31
31
|
export interface DaemonConnectionState {
|
|
32
32
|
status: DaemonConnectionStatus;
|
|
33
|
+
runtimeStopped?: boolean;
|
|
34
|
+
runtimeStopPersistenceUnconfirmed?: boolean;
|
|
35
|
+
capacityRecovery?: {
|
|
36
|
+
error: unknown;
|
|
37
|
+
sessionId: string;
|
|
38
|
+
sessionContext?: DaemonProductSessionContext;
|
|
39
|
+
mode: 'load' | 'resume';
|
|
40
|
+
};
|
|
33
41
|
sessionId?: string;
|
|
34
42
|
/**
|
|
35
43
|
* Daemon-confirmed client identity bound to this session (the value sent as
|
|
@@ -189,6 +197,20 @@ export interface DaemonSessionProviderProps {
|
|
|
189
197
|
children: ReactNode;
|
|
190
198
|
}
|
|
191
199
|
export type DaemonPromptStatus = 'idle' | 'waiting' | 'streaming';
|
|
200
|
+
export type DaemonPromptSettlementOutcome = 'completed' | 'cancelled' | 'failed';
|
|
201
|
+
export interface DaemonPromptSettledEvent {
|
|
202
|
+
sessionId: string;
|
|
203
|
+
promptId: string;
|
|
204
|
+
outcome: DaemonPromptSettlementOutcome;
|
|
205
|
+
/** Daemon terminal reason. Present for completed and cancelled turns. */
|
|
206
|
+
stopReason?: string;
|
|
207
|
+
error?: {
|
|
208
|
+
message: string;
|
|
209
|
+
code?: string;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
export type DaemonPromptSettledListener = (event: DaemonPromptSettledEvent) => void;
|
|
213
|
+
export type DaemonPromptSettlementSubscribe = (listener: DaemonPromptSettledListener) => () => void;
|
|
192
214
|
export type DaemonNoticeSeverity = 'info' | 'warning' | 'error';
|
|
193
215
|
export type DaemonNoticeCategory = 'validation' | 'user_action' | 'connection' | 'protocol' | 'lifecycle' | 'system';
|
|
194
216
|
export type DaemonNoticeOperation = 'send_prompt' | 'continue_session' | 'send_shell_command' | 'switch_model' | 'set_reasoning_effort' | 'set_approval_mode' | 'submit_permission' | 'cancel_prompt' | 'attach_session' | 'load_session' | 'resume_session' | 'create_session' | 'close_session' | 'rename_session' | 'release_session' | 'list_sessions' | 'load_context' | 'load_context_usage' | 'load_tasks' | 'load_artifacts' | 'read_attachment' | 'remove_attachment' | 'cancel_task' | 'control_workflow' | 'run_saved_workflow' | 'read_saved_workflow' | 'load_goal' | 'control_goal' | 'clear_goal' | 'load_stats' | 'rewind_snapshots' | 'rewind_session' | 'refresh_commands' | 'recap_session' | 'generate_session_content' | 'btw_session' | 'branch_session' | 'fork_session' | 'record_session' | 'stream' | 'normalize_event';
|
|
@@ -384,6 +406,7 @@ export interface DaemonSessionActions {
|
|
|
384
406
|
*/
|
|
385
407
|
createSession(options?: {
|
|
386
408
|
workspaceCwd?: string;
|
|
409
|
+
getCurrentWorkspaceCwd?: () => string | undefined;
|
|
387
410
|
sessionContext?: DaemonProductSessionContext;
|
|
388
411
|
modelServiceId?: string;
|
|
389
412
|
approvalMode?: DaemonApprovalMode;
|
|
@@ -497,6 +520,12 @@ export interface DaemonSessionActions {
|
|
|
497
520
|
}>;
|
|
498
521
|
getStats(): Promise<DaemonSessionStatsStatus>;
|
|
499
522
|
loadArtifacts(): Promise<DaemonSessionArtifactsEnvelope>;
|
|
523
|
+
/**
|
|
524
|
+
* Register an artifact this client knows about — a file a slash command
|
|
525
|
+
* reported it wrote, for example. The store owns identity, so re-registering
|
|
526
|
+
* the same workspace path updates the existing entry instead of duplicating.
|
|
527
|
+
*/
|
|
528
|
+
addArtifact(artifact: DaemonSessionArtifactInput): Promise<DaemonSessionArtifactMutationResult>;
|
|
500
529
|
listSources(): Promise<SessionSourcesResult>;
|
|
501
530
|
upsertSource(source: SessionSourceInput): Promise<SessionSourceUpsertResult>;
|
|
502
531
|
removeSource(sourceId: string): Promise<SessionSourceRemoveResult>;
|
|
@@ -7,7 +7,9 @@ import type { DaemonResourceOptions } from '../types.js';
|
|
|
7
7
|
export declare function useDaemonMemory(options?: DaemonResourceOptions): {
|
|
8
8
|
status: import("@qwen-code/sdk/daemon").DaemonWorkspaceMemoryStatus | undefined;
|
|
9
9
|
files: import("@qwen-code/sdk/daemon").DaemonWorkspaceMemoryFile[];
|
|
10
|
-
readFile: (filePath: string
|
|
10
|
+
readFile: (filePath: string, opts?: {
|
|
11
|
+
maxBytes?: number;
|
|
12
|
+
}) => Promise<import("@qwen-code/sdk/daemon").DaemonWorkspaceFile>;
|
|
11
13
|
writeMemory: (req: import("@qwen-code/sdk/daemon").DaemonWriteMemoryRequest) => Promise<import("@qwen-code/sdk/daemon").DaemonWriteMemoryResult>;
|
|
12
14
|
reload: () => Promise<import("@qwen-code/sdk/daemon").DaemonWorkspaceMemoryStatus | undefined>;
|
|
13
15
|
data: import("@qwen-code/sdk/daemon").DaemonWorkspaceMemoryStatus | undefined;
|
|
@@ -341,7 +341,14 @@ export interface DaemonWorkspaceActions {
|
|
|
341
341
|
};
|
|
342
342
|
}): Promise<DaemonSettingUpdateResult>;
|
|
343
343
|
loadMemoryStatus(): Promise<DaemonWorkspaceMemoryStatus>;
|
|
344
|
-
|
|
344
|
+
/**
|
|
345
|
+
* `opts.maxBytes` is how a caller accepts partial content: without a window
|
|
346
|
+
* argument the daemon refuses any file above its own read cap instead of
|
|
347
|
+
* silently handing back a truncated file.
|
|
348
|
+
*/
|
|
349
|
+
readWorkspaceFile(filePath: string, opts?: {
|
|
350
|
+
maxBytes?: number;
|
|
351
|
+
}): Promise<DaemonWorkspaceFile>;
|
|
345
352
|
writeMemory(req: DaemonWriteMemoryRequest): Promise<DaemonWriteMemoryResult>;
|
|
346
353
|
generateContent(prompt: string, opts?: {
|
|
347
354
|
signal?: AbortSignal;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type AssistantFeedbackRating } from '../utils/assistantFeedback';
|
|
2
|
+
export interface UseAssistantFeedbackResult {
|
|
3
|
+
/** Marks for the current session, keyed by turn prompt id. */
|
|
4
|
+
ratings: Readonly<Record<string, AssistantFeedbackRating>>;
|
|
5
|
+
/** Marks `promptId` with `rating`, or clears it when `rating` is null. */
|
|
6
|
+
rate(promptId: string, rating: AssistantFeedbackRating | null): void;
|
|
7
|
+
/** Current mark for a turn, for the host payload's `previousRating`. */
|
|
8
|
+
ratingForTurn(promptId: string | undefined): AssistantFeedbackRating | undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Owns the satisfied / not-satisfied marks for one transcript.
|
|
12
|
+
*
|
|
13
|
+
* State lives here rather than in a message row because the transcript
|
|
14
|
+
* virtualizes: a row that scrolls out is unmounted and rebuilt.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useAssistantFeedback(sessionId: string | undefined): UseAssistantFeedbackResult;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DaemonClient } from '@qwen-code/sdk/daemon';
|
|
2
|
+
import type { DaemonConnectionState, DaemonSessionActions } from '../daemon/session/types';
|
|
3
|
+
import type { CapacityRecoveryIntent } from '../components/workspaces/CapacityRecoveryDialog';
|
|
4
|
+
export declare function useCapacityRecovery(client: DaemonClient | undefined, features: readonly string[] | undefined, connection: DaemonConnectionState, actions: Pick<DaemonSessionActions, 'loadSession' | 'resumeSession'>): {
|
|
5
|
+
intent: CapacityRecoveryIntent | undefined;
|
|
6
|
+
offer: (error: unknown, continuation: Omit<CapacityRecoveryIntent, "client">) => boolean;
|
|
7
|
+
dismiss: () => void;
|
|
8
|
+
};
|
|
@@ -55,6 +55,10 @@ export declare function getFollowupCompletion(text: string, suggestion: string |
|
|
|
55
55
|
export declare function mapRestoredInputAnnotationsAfterTextChange(annotations: readonly DaemonInputAnnotation[], previousText: string, nextText: string): DaemonInputAnnotation[];
|
|
56
56
|
export type ComposerSubmitCommit = () => void;
|
|
57
57
|
export interface ComposerSubmitMetadata {
|
|
58
|
+
retainDraftDuringSessionCreation?: (operation: (onSessionAllocated: (sessionId: string) => void) => Promise<unknown>) => Promise<unknown>;
|
|
59
|
+
isCurrentDraft?: (options?: {
|
|
60
|
+
allowSessionAssignment?: boolean;
|
|
61
|
+
}) => boolean;
|
|
58
62
|
inputAnnotations?: DaemonInputAnnotation[];
|
|
59
63
|
}
|
|
60
64
|
export interface UseComposerCoreOptions {
|
|
@@ -147,13 +151,14 @@ export interface SlashMenuState extends SlashCommandCompletionResult {
|
|
|
147
151
|
*/
|
|
148
152
|
export interface MobileComposerBackend {
|
|
149
153
|
textareaRef: React.RefObject<HTMLTextAreaElement | null>;
|
|
154
|
+
expandedTextareaRef: React.RefObject<HTMLTextAreaElement | null>;
|
|
150
155
|
value: string;
|
|
151
156
|
onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
152
157
|
onBlur: () => void;
|
|
153
158
|
placeholder: string;
|
|
154
159
|
}
|
|
155
160
|
export interface ComposerImageTransferHandlers {
|
|
156
|
-
onPasteCapture: ClipboardEventHandler<HTMLDivElement>;
|
|
161
|
+
onPasteCapture: ClipboardEventHandler<HTMLDivElement | HTMLTextAreaElement>;
|
|
157
162
|
onDragEnterCapture: DragEventHandler<HTMLDivElement>;
|
|
158
163
|
onDragOverCapture: DragEventHandler<HTMLDivElement>;
|
|
159
164
|
onDragLeaveCapture: DragEventHandler<HTMLDivElement>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Qwen Team
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { DaemonTranscriptBlock } from '@qwen-code/sdk/daemon';
|
|
7
|
+
import type { DaemonSessionActions } from '@qwen-code/web-shell/daemon-react-sdk';
|
|
8
|
+
/**
|
|
9
|
+
* Refreshes the composer's context counters after a compression the client did
|
|
10
|
+
* not initiate.
|
|
11
|
+
*
|
|
12
|
+
* `useContextUsageControls` reconciles the counters for its own button, but the
|
|
13
|
+
* command can just as well be typed into the composer, and the daemon emits no
|
|
14
|
+
* usage frame for a compression — so the transcript outcome is the only signal
|
|
15
|
+
* both entry points share.
|
|
16
|
+
*
|
|
17
|
+
* A read is only ever issued on a live session: `syncCounters` refuses the
|
|
18
|
+
* write while the session is catching up (`session/actions.ts`) and never
|
|
19
|
+
* retries, so one issued during the replay would be discarded. The first live
|
|
20
|
+
* render therefore reconciles an attach the replay's own counters misdescribe
|
|
21
|
+
* — they are the last usage-bearing frame in the replay, and a compression
|
|
22
|
+
* emits none — and after that a compression arriving live reconciles the same
|
|
23
|
+
* way.
|
|
24
|
+
*
|
|
25
|
+
* A panel-initiated compression therefore reads usage twice — once for its own
|
|
26
|
+
* controls, once here. That repetition is the price of not coupling the two
|
|
27
|
+
* paths, and the extra read is silent and idempotent.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useContextCompressionReconcile({ blocks, sessionId, live, currentModel, contextWindow, getContextUsage, }: {
|
|
30
|
+
blocks: readonly DaemonTranscriptBlock[];
|
|
31
|
+
sessionId: string | undefined;
|
|
32
|
+
/** False while the transcript is replaying, or the session is not connected. */
|
|
33
|
+
live: boolean;
|
|
34
|
+
/** Model the counters are measured against; undefined until it resolves. */
|
|
35
|
+
currentModel: string | undefined;
|
|
36
|
+
contextWindow: number | undefined;
|
|
37
|
+
getContextUsage: DaemonSessionActions['getContextUsage'];
|
|
38
|
+
}): void;
|
|
@@ -15,6 +15,7 @@ interface RefBox<T> {
|
|
|
15
15
|
interface UseQueuedPromptsArgs {
|
|
16
16
|
connected: boolean;
|
|
17
17
|
writeBlocked?: boolean;
|
|
18
|
+
runtimeStopped?: boolean;
|
|
18
19
|
sessionId?: string;
|
|
19
20
|
workspaceCwd?: string;
|
|
20
21
|
clientId?: string;
|
|
@@ -70,5 +71,5 @@ export interface UseQueuedPromptsResult {
|
|
|
70
71
|
editLastQueuedPrompt: () => boolean;
|
|
71
72
|
clearQueuedPrompts: () => boolean;
|
|
72
73
|
}
|
|
73
|
-
export declare function useQueuedPrompts({ connected, writeBlocked, sessionId, workspaceCwd, clientId, canMutateMidTurn, canQueryMidTurn, canInjectMidTurnMedia, workspaceFileActions, streamingState, sessionHasActivePrompt, holdQueuedPromptsLocally, sessionActions, store, editorRef, reportError, t, }: UseQueuedPromptsArgs): UseQueuedPromptsResult;
|
|
74
|
+
export declare function useQueuedPrompts({ connected, writeBlocked, runtimeStopped, sessionId, workspaceCwd, clientId, canMutateMidTurn, canQueryMidTurn, canInjectMidTurnMedia, workspaceFileActions, streamingState, sessionHasActivePrompt, holdQueuedPromptsLocally, sessionActions, store, editorRef, reportError, t, }: UseQueuedPromptsArgs): UseQueuedPromptsResult;
|
|
74
75
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DaemonSessionArtifactInput, DaemonSessionArtifact, DaemonTranscriptBlock } from '@qwen-code/sdk/daemon';
|
|
2
|
+
export type RegistrationErrorTranslator = (key: string, vars?: Record<string, string | number>) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Files that slash commands reported writing, read back off the transcript.
|
|
5
|
+
*
|
|
6
|
+
* They ride the assistant block's raw ACP metadata, which is the only place
|
|
7
|
+
* arbitrary `_meta` survives on its way to a rendered message.
|
|
8
|
+
*/
|
|
9
|
+
export declare function collectReportedArtifacts(blocks: readonly DaemonTranscriptBlock[]): DaemonSessionArtifactInput[];
|
|
10
|
+
/**
|
|
11
|
+
* Registers the files slash commands reported writing with the session
|
|
12
|
+
* artifact store, so they show up in the artifact panel next to the files the
|
|
13
|
+
* agent produced. Wait for the catalog before registering to avoid claiming
|
|
14
|
+
* an existing artifact from another browser client.
|
|
15
|
+
*
|
|
16
|
+
* `translateError`: App's own hook body runs above the `<I18nProvider>` it
|
|
17
|
+
* renders, where the i18n context is the key-passthrough default; App passes
|
|
18
|
+
* its own translator so the failure toast is localized on the main view too.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useReportedArtifactRegistration(registered: readonly DaemonSessionArtifact[], hydrated: boolean, refresh: () => Promise<void>, translateError?: RegistrationErrorTranslator): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DaemonSessionArtifact } from '@qwen-code/sdk/daemon';
|
|
2
|
+
import { type RegistrationErrorTranslator } from './useReportedArtifactRegistration';
|
|
2
3
|
export interface SessionArtifactsState {
|
|
3
4
|
artifacts: DaemonSessionArtifact[];
|
|
4
5
|
artifactById: ReadonlyMap<string, DaemonSessionArtifact>;
|
|
@@ -7,4 +8,4 @@ export interface SessionArtifactsState {
|
|
|
7
8
|
hydrated: boolean;
|
|
8
9
|
refresh: () => Promise<void>;
|
|
9
10
|
}
|
|
10
|
-
export declare function useSessionArtifacts(): SessionArtifactsState;
|
|
11
|
+
export declare function useSessionArtifacts(translateError?: RegistrationErrorTranslator): SessionArtifactsState;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export type { WebShellTheme } from './themeContext';
|
|
|
59
59
|
export type { WebShellBrand, WebShellResolvedBrand } from './brandContext';
|
|
60
60
|
export type { CommandDisplayCategory, CommandDisplayCategoryOrder, } from './utils/commandDisplay';
|
|
61
61
|
export type { ComposerToolbarAction } from './components/ChatEditor';
|
|
62
|
-
export type { CodeBlockRenderer, MarkdownContentSource, MarkdownTableMode, MarkdownRenderContext, ToolHeaderExtraRenderer, ToolHeaderExtraRenderInfo, ToolHeaderKind, ComposerTagClickHandler, ComposerTagRenderer, AssistantTurnFooterRenderer, UserMessageContentRenderer, UserMessageContentRenderInfo, UserMessageContentParser, ComposerHeaderRenderer, ComposerFooterRenderer, ComposerToolbarStartRenderer, ComposerToolbarRightRenderer, WebShellAtItemRenderInfo, WebShellAtItemRenderer, WebShellComposerApi, WebShellBuiltinComposerTagKind, WebShellBuiltinAtProviderId, WebShellBuiltinAtProvidersConfig, WebShellComposerInput, WebShellComposerTag, WebShellComposerTagIconMap, WebShellComposerTagKind, WebShellComposerTagOptions, WebShellComposerTagPlacement, WebShellComposerToolbarRenderInfo, WebShellComposerToolbarStartRenderInfo, WebShellComposerToolbarRightRenderInfo, WebShellComposerTextOptions, WelcomeFooterRenderer, WelcomeHeaderRenderer, ChatHeaderRenderer, ChatHeaderRenderInfo, WebShellChatHeaderItem, WebShellChatHeaderOptions, WebShellRightPanelItem, WebShellRightPanelOptions, WebShellEnvironmentPanelItem, WebShellEnvironmentPanelOptions, WebShellFooterRenderInfo, FooterRenderer, LoadingPhrasesResolver, WebShellAtProviderTab, WebShellAtItem, WebShellAtProvider, WebShellBottomStatusItem, WebShellCodeBlockRenderInfo, WebShellMarkdownChartCustomization, WebShellMarkdownCustomization, WebShellFootnote, WebShellSource, WebShellSourceReference, WebShellSourceIconResolver, WebShellFootnoteIconResolver, WebShellFootnotePreviewInfo, WebShellFootnotePreviewHandle, WebShellFootnotePreviewMount, WebShellAssistantMessageInfo, WebShellAssistantTurnFooterRenderInfo, ArtifactImageRenderer, WebShellArtifactCustomization, WebShellIconSource, WebShellTaskInfo, WebShellUserMessagePart, WebShellAgentTask, WebShellShellTask, WebShellMonitorTask, WebShellWorkflowTask, WebShellPreparedSubmit, WebShellSubmitSnapshot, WebShellSessionArtifactsChange, WebShellSessionArtifactsChangeReason, WebShellModelInfo, WebShellSkillInfo, } from './customization';
|
|
62
|
+
export type { CodeBlockRenderer, MarkdownContentSource, MarkdownTableMode, MarkdownRenderContext, ToolHeaderExtraRenderer, ToolHeaderExtraRenderInfo, ToolHeaderKind, ComposerTagClickHandler, ComposerTagRenderer, AssistantTurnFooterRenderer, UserMessageContentRenderer, UserMessageContentRenderInfo, UserMessageContentParser, ComposerHeaderRenderer, ComposerFooterRenderer, ComposerToolbarStartRenderer, ComposerToolbarRightRenderer, WebShellAtItemRenderInfo, WebShellAtItemRenderer, WebShellComposerApi, WebShellBuiltinComposerTagKind, WebShellBuiltinAtProviderId, WebShellBuiltinAtProvidersConfig, WebShellComposerInput, WebShellComposerTag, WebShellComposerTagIconMap, WebShellComposerTagKind, WebShellComposerTagOptions, WebShellComposerTagPlacement, WebShellComposerToolbarRenderInfo, WebShellComposerToolbarStartRenderInfo, WebShellComposerToolbarRightRenderInfo, WebShellComposerTextOptions, WelcomeFooterRenderer, WelcomeHeaderRenderer, ChatHeaderRenderer, ChatHeaderRenderInfo, WebShellChatHeaderItem, WebShellChatHeaderOptions, WebShellRightPanelItem, WebShellRightPanelOptions, WebShellEnvironmentPanelItem, WebShellEnvironmentPanelOptions, WebShellFooterRenderInfo, FooterRenderer, LoadingPhrasesResolver, WebShellAtProviderTab, WebShellAtItem, WebShellAtProvider, WebShellBottomStatusItem, WebShellCodeBlockRenderInfo, WebShellMarkdownChartCustomization, WebShellMarkdownCustomization, WebShellFootnote, WebShellSource, WebShellSourceReference, WebShellSourceIconResolver, WebShellFootnoteIconResolver, WebShellFootnotePreviewInfo, WebShellFootnotePreviewHandle, WebShellFootnotePreviewMount, WebShellAssistantMessageInfo, WebShellAssistantTurnOutcome, WebShellAssistantTurnSettledEvent, WebShellAssistantTurnFooterRenderInfo, ArtifactImageRenderer, WebShellArtifactCustomization, WebShellIconSource, WebShellTaskInfo, WebShellUserMessagePart, WebShellAgentTask, WebShellShellTask, WebShellMonitorTask, WebShellWorkflowTask, WebShellPreparedSubmit, WebShellSubmitSnapshot, WebShellSessionArtifactsChange, WebShellSessionArtifactsChangeReason, WebShellModelInfo, WebShellSkillInfo, WebShellAssistantFeedbackInfo, WebShellAssistantFeedbackOptions, WebShellAssistantFeedbackRating, WebShellAssistantFeedbackUserMessage, AssistantFeedbackHandler, } from './customization';
|
|
63
63
|
export type { WelcomeHeaderProps } from './components/WelcomeHeader';
|
|
64
64
|
export type { PaneHeaderActionsInfo, PaneHeaderActionsRenderer, } from './components/ChatPane';
|
|
65
65
|
export type { TurnOutputKind, TurnOutputOpenRequest, } from './components/artifacts/TurnOutputs';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Qwen
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type RefObject } from 'react';
|
|
7
|
+
import type { LiveInputLevel } from './useLiveBrowserHost';
|
|
8
|
+
/**
|
|
9
|
+
* Microphone level while this tab is the Live Voice endpoint: the one thing
|
|
10
|
+
* that tells a caller whether the daemon is hearing them at all, when a call
|
|
11
|
+
* that looks connected produces no answer.
|
|
12
|
+
*
|
|
13
|
+
* Reads a ref on an animation frame and writes the DOM directly. Turning ~16
|
|
14
|
+
* audio frames a second into React state would re-render the whole dialog at
|
|
15
|
+
* that rate and compete with the capture callback for the main thread.
|
|
16
|
+
*/
|
|
17
|
+
export declare const LIVE_LEVEL_PROPERTY = "--live-input-level";
|
|
18
|
+
export declare function LiveLevelMeter({ level, muted, label, droppingLabel, onDroppingChange, }: {
|
|
19
|
+
level: RefObject<LiveInputLevel>;
|
|
20
|
+
/** Input is muted: hold the meter at zero instead of animating it. */
|
|
21
|
+
muted: boolean;
|
|
22
|
+
label: string;
|
|
23
|
+
/** Shown while frames are being dropped instead of sent. */
|
|
24
|
+
droppingLabel: string;
|
|
25
|
+
/**
|
|
26
|
+
* Called when the dropping state flips, never per frame. The bar is
|
|
27
|
+
* decorative and hidden from assistive technology; "the daemon is not
|
|
28
|
+
* hearing you" is status, and the dialog says it in text.
|
|
29
|
+
*/
|
|
30
|
+
onDroppingChange?: (dropping: boolean) => void;
|
|
31
|
+
}): React.JSX.Element;
|
|
@@ -4,4 +4,10 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type React from 'react';
|
|
7
|
-
export declare function LiveVoiceButton(
|
|
7
|
+
export declare function LiveVoiceButton({ hideInactiveTrigger, open, onOpenChange, onSupportedChange, onRequestFocusFallback, }?: {
|
|
8
|
+
hideInactiveTrigger?: boolean;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
onSupportedChange?: (supported: boolean) => void;
|
|
12
|
+
onRequestFocusFallback?: () => void;
|
|
13
|
+
}): React.JSX.Element | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Qwen
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { DaemonLiveSetupStatus } from '@qwen-code/sdk';
|
|
7
|
+
export interface LiveModelOption {
|
|
8
|
+
/** What `experimental.liveVoice.model` is set to when this is picked. */
|
|
9
|
+
value: string;
|
|
10
|
+
label: string;
|
|
11
|
+
/** False for a configured model that names no `realtimeOnly` route. */
|
|
12
|
+
route: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Choices for the Live Voice model picker, from the `realtimeOnly` routes the
|
|
16
|
+
* daemon lists. An id is written bare unless two providers share it — a bare
|
|
17
|
+
* id is then ambiguous to the daemon, so those are qualified `provider:id`.
|
|
18
|
+
* The configured model is always present and selected, even when it names no
|
|
19
|
+
* route (a hand-written id on the free-standing endpoint/key path).
|
|
20
|
+
*/
|
|
21
|
+
export declare function liveModelOptions(status: Pick<DaemonLiveSetupStatus, 'model' | 'models'>): {
|
|
22
|
+
options: LiveModelOption[];
|
|
23
|
+
selected: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Qwen
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Live Voice strings: the call dialog and its setup card. Kept out of the
|
|
8
|
+
* main dictionary so the read-only transcript build can drop them — an
|
|
9
|
+
* exported transcript can never render these surfaces, yet every reader of an
|
|
10
|
+
* exported file downloads the whole dictionary. `vite.lib.config.ts` resolves
|
|
11
|
+
* this module to `messages.transcript-stub.ts` in `--mode transcript`.
|
|
12
|
+
*/
|
|
13
|
+
type LiveMessage = string | ((vars?: Record<string, string | number>) => string);
|
|
14
|
+
export declare const LIVE_MESSAGES_EN: Record<string, LiveMessage>;
|
|
15
|
+
export declare const LIVE_MESSAGES_ZH: Record<string, LiveMessage>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Qwen
|
|
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 Live Voice surface, so its dictionary
|
|
9
|
+
* carries none of those strings.
|
|
10
|
+
*/
|
|
11
|
+
export declare const LIVE_MESSAGES_EN: {};
|
|
12
|
+
export declare const LIVE_MESSAGES_ZH: {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Qwen
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Gapless playback of the 24 kHz PCM16 frames a Live Voice call streams down.
|
|
8
|
+
*
|
|
9
|
+
* Frames are scheduled back to back on the AudioContext clock rather than
|
|
10
|
+
* played as they arrive, so network jitter does not become audible gaps. When
|
|
11
|
+
* playback underruns the schedule restarts from "now": latency must not pile
|
|
12
|
+
* up over a long answer. `clear` is the barge-in path — the daemon sends it
|
|
13
|
+
* the moment the user starts talking over the model.
|
|
14
|
+
*/
|
|
15
|
+
export declare const LIVE_OUTPUT_SAMPLE_RATE = 24000;
|
|
16
|
+
export type PcmPlayerContext = Pick<AudioContext, 'currentTime' | 'destination' | 'createBuffer' | 'createBufferSource'>;
|
|
17
|
+
export declare class PcmPlayer {
|
|
18
|
+
private readonly context;
|
|
19
|
+
private readonly scheduled;
|
|
20
|
+
private nextStartTime;
|
|
21
|
+
private muted;
|
|
22
|
+
constructor(context: PcmPlayerContext);
|
|
23
|
+
/** Number of frames scheduled and not yet finished. */
|
|
24
|
+
get pending(): number;
|
|
25
|
+
setMuted(muted: boolean): void;
|
|
26
|
+
/** Queue one little-endian PCM16 mono frame belonging to `epoch`. */
|
|
27
|
+
enqueue(epoch: number, pcm16: ArrayBuffer): void;
|
|
28
|
+
/**
|
|
29
|
+
* Drop everything still queued — for one call `epoch`, or for all of them.
|
|
30
|
+
* Audio of a different epoch is left alone: a `clear` for the call that just
|
|
31
|
+
* ended must not cut into the next one.
|
|
32
|
+
*/
|
|
33
|
+
clear(epoch?: number): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Qwen Team
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export interface LiveScreenFrame {
|
|
7
|
+
image: string;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
export interface LiveScreenShareHandle {
|
|
12
|
+
readonly label: string;
|
|
13
|
+
stop(): void;
|
|
14
|
+
grab(): Promise<LiveScreenFrame>;
|
|
15
|
+
}
|
|
16
|
+
export type LiveScreenShareEnded = () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Browsers without `getDisplayMedia`, and any page outside a secure context,
|
|
19
|
+
* never offer the share at all rather than failing at the first request.
|
|
20
|
+
*/
|
|
21
|
+
export declare function canShareScreen(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Must be called from a user gesture: `getDisplayMedia` rejects without one.
|
|
24
|
+
*/
|
|
25
|
+
export declare function startScreenShare(onEnded: LiveScreenShareEnded): Promise<LiveScreenShareHandle>;
|