@qwen-code/web-shell 0.28.7 → 0.29.0-preview.0

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 (71) hide show
  1. package/README.md +15 -2
  2. package/dist/{PierreFilePreview-mjl-NyoO.js → PierreFilePreview-DNzgLsKu.js} +1 -1
  3. package/dist/{SpreadsheetPreview-CLwpWAHt.js → SpreadsheetPreview-B0lqDTmC.js} +2 -2
  4. package/dist/{WorkspaceFileBrowser-BUHjDcz5.js → WorkspaceFileBrowser-Ceci_Ofu.js} +2 -2
  5. package/dist/{WorkspacePdfRangePreview-T1wFDszO.js → WorkspacePdfRangePreview-BQY92M0Z.js} +2 -2
  6. package/dist/{agents-route-Cko0LJBS.js → agents-route-C5I-mPuv.js} +2 -2
  7. package/dist/daemon-react-sdk.js +1 -1
  8. package/dist/{i18n-ru-zX2HBIQv.js → i18n-ru-LoTd6Qm6.js} +36 -30
  9. package/dist/{i18n-zh-cn-CqjpUMZJ.js → i18n-zh-cn-69yYbjuK.js} +34 -18
  10. package/dist/{i18n-zh-tw-DyTerQIj.js → i18n-zh-tw-BaBS2zL1.js} +41 -6
  11. package/dist/{index-BO8CdGLJ.js → index-D4vi6zJI.js} +79426 -74596
  12. package/dist/index.js +3 -3
  13. package/dist/sw.js +1 -1
  14. package/dist/transcript.js +4825 -4770
  15. package/dist/types/App.d.ts +1 -1
  16. package/dist/types/chat-core/ChatSurface.d.ts +47 -3
  17. package/dist/types/components/ChatContextHeader.d.ts +11 -3
  18. package/dist/types/components/ChatEditor.d.ts +2 -0
  19. package/dist/types/components/ComposerTaskChips.d.ts +4 -0
  20. package/dist/types/components/ComposerUsageStats.d.ts +4 -4
  21. package/dist/types/components/LocalFilesControl.d.ts +2 -48
  22. package/dist/types/components/LocalFilesPanel.d.ts +52 -0
  23. package/dist/types/components/artifacts/ArtifactPanel.d.ts +19 -2
  24. package/dist/types/components/artifacts/TokenUsageTrend.d.ts +2 -11
  25. package/dist/types/components/artifacts/TurnOutputs.d.ts +9 -0
  26. package/dist/types/components/artifacts/artifact-mime.d.ts +10 -0
  27. package/dist/types/components/artifacts/artifactUtils.d.ts +2 -4
  28. package/dist/types/components/artifacts/tokenUsageTotals.d.ts +60 -11
  29. package/dist/types/components/artifacts/turnOutputSelectors.d.ts +6 -0
  30. package/dist/types/components/artifacts/useArtifactWorkspaceTarget.d.ts +1 -0
  31. package/dist/types/components/composer/composer-integrations.d.ts +14 -0
  32. package/dist/types/components/composer/daemon-composer-integrations.d.ts +7 -0
  33. package/dist/types/components/dialogs/ScheduledTasksDialog.d.ts +21 -1
  34. package/dist/types/components/dialogs/scheduledTasksSchedule.d.ts +8 -0
  35. package/dist/types/components/managed/ManagedDiagnosticsPanel.d.ts +3 -1
  36. package/dist/types/components/managed/chat-controller.d.ts +1 -0
  37. package/dist/types/components/managed/managed-diagnostics-messages.d.ts +1 -1
  38. package/dist/types/components/managed/managed-usage-stats.d.ts +18 -0
  39. package/dist/types/components/managed/use-managed-actions.d.ts +6 -2
  40. package/dist/types/components/managed/use-managed-chat-controller.d.ts +32 -1
  41. package/dist/types/components/panels/EnvironmentPanel.d.ts +13 -1
  42. package/dist/types/components/sidebar/ArchivedSessionsPanel.d.ts +53 -0
  43. package/dist/types/components/sidebar/StandaloneRecents.d.ts +8 -1
  44. package/dist/types/components/sidebar/WebShellSidebar.d.ts +6 -1
  45. package/dist/types/components/sidebar/archived-session-sort.d.ts +14 -0
  46. package/dist/types/components/sidebar/archived-sessions-messages.d.ts +10 -0
  47. package/dist/types/components/sidebar/archived-sessions-messages.transcript-stub.d.ts +8 -0
  48. package/dist/types/components/workspace-agents/useAgentChatEntry.d.ts +3 -1
  49. package/dist/types/customization.d.ts +12 -2
  50. package/dist/types/daemon/availability-context.d.ts +2 -1
  51. package/dist/types/daemon/availability.d.ts +4 -3
  52. package/dist/types/daemon/permission-signals.d.ts +0 -12
  53. package/dist/types/daemon/remotePromptSidechannel.d.ts +1 -8
  54. package/dist/types/daemon/session/DaemonSessionProvider.d.ts +1 -0
  55. package/dist/types/daemon/session/httpErrors.d.ts +1 -0
  56. package/dist/types/daemon/session/types.d.ts +10 -5
  57. package/dist/types/daemon/timing.d.ts +1 -1
  58. package/dist/types/daemon/useDaemonChatController.d.ts +21 -1
  59. package/dist/types/daemon/workspace/hooks/useDaemonOverloadPause.d.ts +41 -0
  60. package/dist/types/daemon/workspace/types.d.ts +10 -3
  61. package/dist/types/hooks/useBackgroundTasks.d.ts +7 -2
  62. package/dist/types/hooks/useInputHistory.d.ts +3 -1
  63. package/dist/types/hooks/useSessionScheduledTasks.d.ts +97 -0
  64. package/dist/types/utils/action-timeout.d.ts +6 -0
  65. package/dist/types/utils/remote-prompt-sidechannel.d.ts +13 -0
  66. package/dist/types/utils/scheduledTaskManualRun.d.ts +29 -0
  67. package/dist/types/utils/service-availability.d.ts +20 -0
  68. package/dist/types/utils/shell-result-display.d.ts +26 -0
  69. package/dist/types/utils/taskActivity.d.ts +6 -0
  70. package/dist/{useDaemonMidTurnInjected-K7Sl7y1O.js → useDaemonMidTurnInjected-BItW6Ibf.js} +4705 -4489
  71. package/package.json +1 -1
@@ -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, DaemonWorktreeBranchResult, DaemonWorktreeHandoffResult, 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, DaemonSessionClient, DaemonSessionPrInfo, DaemonSessionSummary, DaemonSessionSupportedCommandsStatus, DaemonSessionTaskRuntimeStatus, DaemonSessionTaskWithWorkflowStatus, DaemonSessionTasksStatus, DaemonSessionWorkflowTaskStatus, DaemonSessionWorkflowTasksStatus, DaemonSessionStatsStatus, DaemonSessionArtifact, 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, DaemonWorktreeBranchResult, DaemonWorktreeHandoffResult, 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, DaemonSessionClient, DaemonSessionPrInfo, DaemonSessionSummary, DaemonSessionSupportedCommandsStatus, DaemonSessionCancelableTaskKind, DaemonSessionTaskRuntimeStatus, DaemonSessionTasksStatus, DaemonSessionWorkflowTaskStatus, DaemonSessionWorkflowTasksStatus, DaemonSessionStatsStatus, DaemonSessionArtifact, 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;
@@ -335,8 +335,8 @@ export interface SendPromptOptions {
335
335
  onAdmissionStarted?: () => void;
336
336
  /** Caller-generated key used to deduplicate retried prompt admissions. */
337
337
  idempotencyKey?: string;
338
- /** Revalidates the caller before every HTTP attempt, including client recovery. */
339
- beforeDispatch?: (clientId: string | undefined) => void;
338
+ /** Client-only revalidation, awaited before every HTTP attempt including recovery. */
339
+ beforeDispatch?: (clientId: string | undefined) => void | Promise<void>;
340
340
  /**
341
341
  * Fired once the daemon has ACCEPTED the prompt (admission), before the turn
342
342
  * runs to completion. Lets a caller act on "the prompt reached the session"
@@ -438,7 +438,10 @@ export interface DaemonSessionActions {
438
438
  * prompt status, or connection. The turn runs on the daemon after the
439
439
  * client detaches; a later loadSession attaches fresh.
440
440
  */
441
- sendDetachedPrompt(session: DaemonSessionClient, text: string, options?: Pick<SendPromptOptions, 'submittedPrompt' | 'suppressInputHistory' | 'images' | 'files' | 'inputAnnotations' | 'retry' | 'idempotencyKey' | 'onAdmissionStarted' | 'onAdmitted'>): Promise<SubmitPromptResult>;
441
+ sendDetachedPrompt(session: DaemonSessionClient, text: string, options?: Pick<SendPromptOptions, 'submittedPrompt' | 'suppressInputHistory' | 'images' | 'files' | 'inputAnnotations' | 'retry' | 'idempotencyKey' | 'onAdmissionStarted' | 'onAdmitted'> & {
442
+ /** Extra guard for an operation during detached client recovery. */
443
+ beforeDetachedDispatch?: SendPromptOptions['beforeDispatch'];
444
+ }): Promise<SubmitPromptResult>;
442
445
  cancel(): Promise<void>;
443
446
  setModel(modelId: string): Promise<SetModelResult>;
444
447
  refreshModels(beforeRefresh?: (target: {
@@ -647,7 +650,7 @@ export interface DaemonSessionActions {
647
650
  getTasks(opts?: GetTasksActionOptions): Promise<DaemonSessionTasksStatus>;
648
651
  getTaskRuntime(taskId: string): Promise<DaemonSessionTaskRuntimeStatus>;
649
652
  getWorkflowTasks(opts?: GetTasksActionOptions): Promise<DaemonSessionWorkflowTasksStatus>;
650
- cancelTask(taskId: string, kind: DaemonSessionTaskWithWorkflowStatus['kind']): Promise<{
653
+ cancelTask(taskId: string, kind: DaemonSessionCancelableTaskKind, source?: 'cron' | 'wakeup'): Promise<{
651
654
  cancelled: boolean;
652
655
  }>;
653
656
  controlWorkflowTask(taskId: string, action: 'pause' | 'resume' | 'retry' | 'rerun' | 'delete-history'): Promise<{
@@ -693,6 +696,8 @@ export interface DaemonSessionActions {
693
696
  sessionId: string;
694
697
  displayName: string;
695
698
  switchStarted: boolean;
699
+ /** False when an initiated switch fails to load or is aborted. */
700
+ switchCompleted?: Promise<boolean>;
696
701
  sourceWarnings?: string[];
697
702
  }>;
698
703
  /** "Create branch here" on the session's detached managed worktree. */
@@ -4,11 +4,11 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
  import type { DaemonTranscriptStore } from '@qwen-code/sdk/daemon';
7
+ export { withActionTimeout } from '../utils/action-timeout.js';
7
8
  export interface TimerRef {
8
9
  current: ReturnType<typeof setTimeout> | undefined;
9
10
  }
10
11
  export declare function getReconnectDelayMs(attempt: number, reconnectDelayMs: number, maxReconnectDelayMs: number): number;
11
- export declare function withActionTimeout<T>(promise: Promise<T>, message: string, timeoutMs?: number): Promise<T>;
12
12
  export declare function delay(delayMs: number, signal: AbortSignal): Promise<void>;
13
13
  export declare function clearPassiveAssistantDoneTimer(timerRef: TimerRef): void;
14
14
  export declare function schedulePassiveAssistantDone(store: DaemonTranscriptStore, timerRef: TimerRef, reason?: string, delayMs?: number, onDone?: () => void): void;
@@ -1,4 +1,24 @@
1
- import type { SessionChatController } from '../chat-core/contract.js';
1
+ import type { Admission, PendingApproval, PendingQuestion, SessionChatController } from '../chat-core/contract.js';
2
+ import type { DaemonConnectionState, DaemonSessionActions } from './session/types.js';
3
+ import { useDaemonTranscriptHistory } from './session/DaemonSessionProvider.js';
4
+ export interface DaemonChatControllerFromStateOptions {
5
+ readonly connection: Pick<DaemonConnectionState, 'sessionId' | 'workspaceCwd' | 'capabilities' | 'loadingTranscript' | 'missingSession' | 'planExecutionMode'>;
6
+ readonly actions: Pick<DaemonSessionActions, 'cancel' | 'submitPermission' | 'respondToPermission'> & Partial<Pick<DaemonSessionActions, 'submitPrompt'>>;
7
+ readonly transcriptHistory: Pick<ReturnType<typeof useDaemonTranscriptHistory>, 'hasMore' | 'loading' | 'capacityReached' | 'paginationError' | 'loadMore'>;
8
+ readonly messages: SessionChatController['messages'];
9
+ readonly pendingApprovals: readonly PendingApproval[];
10
+ readonly pendingQuestions: readonly PendingQuestion[];
11
+ readonly pendingSignature: string;
12
+ readonly transcriptState?: SessionChatController['transcriptState'];
13
+ readonly submitPermission?: (requestId: string, optionId: string) => Promise<Admission>;
14
+ }
15
+ /**
16
+ * Binds caller-owned daemon session state (already read from
17
+ * `DaemonSessionProvider` / `daemon-react-sdk` and frame-throttled transcript
18
+ * hooks) to {@link SessionChatController} without re-projecting messages or
19
+ * requiring a second context subscription stack.
20
+ */
21
+ export declare function useDaemonChatControllerFromState(options: DaemonChatControllerFromStateOptions): SessionChatController;
2
22
  /**
3
23
  * Binds the daemon session provider to the backend-neutral chat controller
4
24
  * (slice 2d). It constructs {@link createDaemonChatController} once per session
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export interface OverloadRefusal {
7
+ message: string;
8
+ expiresAt: number;
9
+ }
10
+ export declare const OVERLOAD_REFUSAL_TTL_MS = 15000;
11
+ export declare const OVERLOAD_POLL_INTERVAL_MS = 5000;
12
+ /**
13
+ * Combines the two load-admission pause sources: the proactive status poll
14
+ * (`runtime.loadAdmission.overloaded`) and an unexpired `system_overloaded`
15
+ * refusal hint. The poll side is derived each render; the refusal side is a
16
+ * single expiring value owned by the caller, cleared through
17
+ * `onRefusalExpired` so a poll gap cannot hide a fresh refusal and the UI
18
+ * never stays paused longer than the daemon's retry hint without poll
19
+ * confirmation.
20
+ *
21
+ * Best-effort by design: without an ancestor workspace provider (embedded
22
+ * pickers, provider-less renders) the poll simply never runs instead of
23
+ * throwing, and the reactive refusal hint still works.
24
+ */
25
+ export declare function useDaemonOverloadPause(options: {
26
+ enabled: boolean;
27
+ refusal: OverloadRefusal | null;
28
+ onRefusalExpired: () => void;
29
+ }): {
30
+ paused: boolean;
31
+ pollOverloaded: boolean;
32
+ loadAdmission: {
33
+ enabled: boolean;
34
+ overloaded: boolean;
35
+ reason: string | null;
36
+ loadRatio: number;
37
+ eventLoopLagP99Ms: number;
38
+ sampledAtMs: number;
39
+ } | undefined;
40
+ refusalMessage: string | undefined;
41
+ };
@@ -170,6 +170,8 @@ export interface DaemonChannelPairingActions {
170
170
  /** One recorded fire of a recurring scheduled task, newest last in
171
171
  * {@link DaemonScheduledTask.runs}. Mirrors the daemon's wire shape. */
172
172
  export interface DaemonScheduledTaskRun {
173
+ /** Distinguishes runs of the same task at the same timestamp. */
174
+ runId?: string;
173
175
  /** Fire time (epoch ms). */
174
176
  at: number;
175
177
  /** `'scheduled'` (on-time), `'catch-up'` (fired late), or `'manual'` (user
@@ -539,11 +541,16 @@ export interface DaemonWorkspaceActions extends Pick<DaemonClient, 'getSubscript
539
541
  listDirectory(dirPath: string): Promise<DaemonDirectoryListing>;
540
542
  listScheduledTasks(workspaceId?: string): Promise<DaemonScheduledTask[]>;
541
543
  createScheduledTask(req: DaemonCreateScheduledTaskRequest, workspaceId?: string): Promise<DaemonScheduledTask>;
542
- updateScheduledTask(id: string, patch: DaemonUpdateScheduledTaskRequest, workspaceId?: string): Promise<DaemonScheduledTask>;
544
+ /** Reject before executing a prompt or recording a run when this daemon
545
+ * cannot safely select the exact expected owner. */
546
+ assertScheduledTaskOwnerSelection(expectedSessionId?: string | null): Promise<void>;
547
+ /** The optional expected owner disambiguates same-id records; null means
548
+ * unbound, while omitting it retains compatibility for unique ids. */
549
+ updateScheduledTask(id: string, patch: DaemonUpdateScheduledTaskRequest, workspaceId?: string, expectedSessionId?: string | null): Promise<DaemonScheduledTask>;
543
550
  /** Run now. Persistent tasks are only recorded here and are executed by the
544
551
  * caller; per-run tasks are dispatched into a fresh daemon session. */
545
- runScheduledTask(id: string, workspaceId?: string): Promise<DaemonScheduledTask>;
546
- deleteScheduledTask(id: string, workspaceId?: string): Promise<void>;
552
+ runScheduledTask(id: string, workspaceId?: string, expectedSessionId?: string | null): Promise<DaemonScheduledTask>;
553
+ deleteScheduledTask(id: string, workspaceId?: string, expectedSessionId?: string | null): Promise<void>;
547
554
  /** The `/autofix-pr` watches of a workspace's clone; `workspaceId` as for
548
555
  * `listScheduledTasks`. Only to a daemon advertising `autofix_pr_watches`. */
549
556
  listAutofixPrWatches(workspaceId?: string): Promise<DaemonAutofixPrWatchList>;
@@ -1,8 +1,13 @@
1
- import type { DaemonSessionTaskWithWorkflowStatus } from '@qwen-code/sdk/daemon';
1
+ import type { DaemonSessionScheduledTaskStatus, DaemonSessionTaskWithWorkflowStatus } from '@qwen-code/sdk/daemon';
2
2
  export declare function useBackgroundTasks(sessionId: string | undefined, taskActivityKey: string,
3
3
  /**
4
4
  * Whether any background task tool call is still running. Passed in as a
5
5
  * fact rather than re-parsed out of `taskActivityKey`, whose rendering is
6
6
  * not injective (callId is unconstrained text).
7
7
  */
8
- taskActivityActive: boolean, connected: boolean, refreshTrigger?: number, workflowsEnabled?: boolean): DaemonSessionTaskWithWorkflowStatus[];
8
+ taskActivityActive: boolean, connected: boolean, refreshTrigger?: number, workflowsEnabled?: boolean, onScheduledTasks?: (tasks: readonly DaemonSessionScheduledTaskStatus[]) => void,
9
+ /**
10
+ * Session cron / loop activity. Shares the one request-driven snapshot
11
+ * channel instead of opening an independent session-status request path.
12
+ */
13
+ scheduledTaskActivityKey?: string): DaemonSessionTaskWithWorkflowStatus[];
@@ -8,7 +8,9 @@ export declare function getShellHistoryStorageKey(workspaceCwd?: string): string
8
8
  export declare function mergeRemoteInputHistory(localEntries: readonly string[], remoteEntries: readonly string[], previousRemoteEntries?: readonly string[] | null): string[];
9
9
  export declare function pushInputHistoryEntry(storageKey: string, text: string, fallbackStorageKey?: string): void;
10
10
  export declare function useInputHistory(storageKey?: string, fallbackStorageKey?: string, remoteHistoryEnabled?: boolean): {
11
- push: (text: string) => void;
11
+ push: (text: string, { keepLocalOnRemoteMiss }?: {
12
+ keepLocalOnRemoteMiss?: boolean | undefined;
13
+ }) => void;
12
14
  applyRemoteEntries: (remoteEntries: readonly string[], expectedMutationVersion?: number, remoteRevision?: string) => boolean;
13
15
  getMutationVersion: () => number;
14
16
  navigateUp: (currentText: string) => string | null;
@@ -0,0 +1,97 @@
1
+ import type { DaemonSessionScheduledTaskStatus } from '@qwen-code/sdk/daemon';
2
+ import { type DaemonScheduledTask } from '@qwen-code/web-shell/daemon-react-sdk';
3
+ import { scheduledTaskRuntimeKey } from '../components/dialogs/scheduledTasksSchedule';
4
+ import { type ScheduledTaskRunPrompt } from '../utils/scheduledTaskManualRun';
5
+ export type ScheduledTaskActionErrorHandler = (err: unknown, fallback: string) => void;
6
+ export interface SessionDurableScheduledTask {
7
+ scope: 'durable';
8
+ id: string;
9
+ title: string;
10
+ prompt: string;
11
+ cronExpr: string;
12
+ recurring: boolean;
13
+ enabled: boolean;
14
+ createdAt: number;
15
+ lastFiredAt: number | null;
16
+ nextRunAt: number | null;
17
+ gate: string | null;
18
+ workspaceId?: string;
19
+ task: DaemonScheduledTask;
20
+ }
21
+ export interface SessionScopedScheduledTask {
22
+ scope: 'session';
23
+ source: 'cron' | 'wakeup';
24
+ id: string;
25
+ title: string;
26
+ prompt: string;
27
+ cronExpr: string;
28
+ recurring: boolean;
29
+ enabled: boolean;
30
+ createdAt: number;
31
+ lastFiredAt: number | null;
32
+ nextRunAt: number | null;
33
+ expiresAt: number | null;
34
+ gate?: string;
35
+ task: DaemonSessionScheduledTaskStatus;
36
+ }
37
+ export type SessionScheduledTask = SessionDurableScheduledTask | SessionScopedScheduledTask;
38
+ export { scheduledTaskRuntimeKey };
39
+ export type SessionScheduledTaskLiveState = 'active' | 'paused';
40
+ export interface SessionScheduledTasksResult {
41
+ tasks: readonly SessionScheduledTask[];
42
+ activeCount: number;
43
+ activeSessionCount: number;
44
+ nextRunAt: number | null;
45
+ taskStatusById: ReadonlyMap<string, SessionScheduledTaskLiveState>;
46
+ liveSessionTaskById: ReadonlyMap<string, DaemonSessionScheduledTaskStatus>;
47
+ confirmedDeletedDurableTaskKeys: ReadonlySet<string>;
48
+ isDurableTaskDeletionConfirmed: (task: {
49
+ id: string;
50
+ workspaceId?: string;
51
+ sessionId?: string | null;
52
+ }) => boolean;
53
+ confirmedCancelledSessionTaskIds: ReadonlySet<string>;
54
+ confirmSessionCancellation: (taskId: string, expectedSessionId?: string, source?: 'cron' | 'wakeup') => void;
55
+ confirmDurableDeletion: (task: {
56
+ id: string;
57
+ workspaceId?: string;
58
+ sessionId?: string | null;
59
+ }) => void;
60
+ hasLiveDurableSnapshot: boolean;
61
+ hasLiveSessionSnapshot: boolean;
62
+ busyIds: ReadonlySet<string>;
63
+ manualRunActive: boolean;
64
+ syncSessionTasks: (tasks: readonly DaemonSessionScheduledTaskStatus[]) => void;
65
+ refresh: () => void;
66
+ toggleDurableTask: (task: SessionDurableScheduledTask) => Promise<void>;
67
+ runDurableTask: (task: SessionDurableScheduledTask) => Promise<void>;
68
+ deleteDurableTask: (task: SessionDurableScheduledTask) => Promise<boolean>;
69
+ cancelSessionTask: (task: SessionScopedScheduledTask) => Promise<boolean>;
70
+ cancelSessionTaskById: (taskId: string, source?: 'cron' | 'wakeup') => Promise<boolean>;
71
+ }
72
+ export declare function useSessionScheduledTasks(options: {
73
+ sessionId: string | undefined;
74
+ workspaceId: string | undefined;
75
+ workspaceCwd?: string;
76
+ connected: boolean;
77
+ durableEnabled: boolean;
78
+ /**
79
+ * Actual evidence of scheduling in this conversation. Empty means silent:
80
+ * no always-on durable HTTP probe on ordinary conversation opens.
81
+ */
82
+ activityKey: string;
83
+ /** Session is a dedicated persistent scheduled-task conversation. */
84
+ durableSeeded?: boolean;
85
+ /** Actual bound-session prompt admission, not the record-only /run route. */
86
+ onRunPrompt: ScheduledTaskRunPrompt;
87
+ shouldRefuseManualRun?: (task: DaemonScheduledTask) => boolean;
88
+ onOverloadRefused?: () => void;
89
+ onError: ScheduledTaskActionErrorHandler;
90
+ /**
91
+ * App calls this hook above the `<I18nProvider>` it renders, where `useI18n()`
92
+ * falls back to key passthrough. Passing App's translator localizes errors
93
+ * constructed inside the hook and manual-run helper too.
94
+ */
95
+ translate?: (key: string) => string;
96
+ refreshTrigger?: number;
97
+ }): SessionScheduledTasksResult;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export declare function withActionTimeout<T>(promise: Promise<T>, message: string, timeoutMs?: number): Promise<T>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export interface RemotePromptSidechannelEvent {
7
+ sessionId: string;
8
+ kind: 'prompt';
9
+ }
10
+ type RemotePromptListener = (event: RemotePromptSidechannelEvent) => void;
11
+ export declare function subscribeSidechannelRemotePrompt(listener: RemotePromptListener): () => void;
12
+ export declare function publishSidechannelRemotePrompt(event: RemotePromptSidechannelEvent): void;
13
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { DaemonScheduledTask, DaemonWorkspaceActions } from '@qwen-code/web-shell/daemon-react-sdk';
7
+ import type { TranslateFn } from '../components/dialogs/scheduledTasksSchedule.js';
8
+ export type ScheduledTaskRunPrompt = (prompt: string, sessionId: string | null, workspaceCwd?: string, isStale?: () => boolean, beforeDispatch?: () => void | Promise<void>) => void | Promise<void>;
9
+ export declare function createScheduledTaskCancellation(message: string): DOMException;
10
+ export declare function isScheduledTaskCancellation(error: unknown): boolean;
11
+ export interface ScheduledTaskManualRunErrorHandlers {
12
+ reload: () => void | Promise<void>;
13
+ onError: (err: unknown, fallback: string) => void;
14
+ isCurrent?: () => boolean;
15
+ /** Checks the direct daemon path selected by the fresh task mode. */
16
+ isDirectDispatchCurrent?: () => boolean;
17
+ /** Optional stronger guard for the original SDK owner of a one-shot. */
18
+ isOwnerCurrent?: () => boolean;
19
+ /** Reports a consumed one-shot even when its original UI scope is gone. */
20
+ onOneShotError?: (error: unknown, fallback: string) => void;
21
+ /** True once this owner/task deletion has been confirmed. */
22
+ isStale?: () => boolean;
23
+ /** Re-read live App state after refresh, before a manual run consumes a
24
+ * one-shot or dispatches a fresh-session attempt that must be refused. */
25
+ shouldRefuseManualRun?: (task: DaemonScheduledTask) => boolean;
26
+ overloadDetail?: string;
27
+ onOverloadRefused?: () => void;
28
+ }
29
+ export declare function runScheduledTaskManually(task: DaemonScheduledTask, actions: Pick<DaemonWorkspaceActions, 'listScheduledTasks' | 'runScheduledTask' | 'assertScheduledTaskOwnerSelection'>, onRunPrompt: ScheduledTaskRunPrompt, t: TranslateFn, { reload, onError, isCurrent, isStale, isDirectDispatchCurrent, isOwnerCurrent, onOneShotError, shouldRefuseManualRun, overloadDetail, onOverloadRefused, }: ScheduledTaskManualRunErrorHandlers): Promise<void>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export type ServiceAvailabilityState = 'available' | 'unavailable' | 'auth-required';
7
+ export interface ServiceAvailabilityController {
8
+ getSnapshot(): ServiceAvailabilityState;
9
+ subscribe(listener: () => void): () => void;
10
+ assertAvailable(): void;
11
+ getGeneration(): number;
12
+ reportFailure(error: unknown, signal?: AbortSignal, generation?: number, source?: 'fetch' | 'consumer'): void;
13
+ }
14
+ export declare class ServiceUnavailableError extends Error {
15
+ constructor(message?: string);
16
+ }
17
+ export declare function isServiceUnavailableError(error: unknown): boolean;
18
+ export declare const ServiceAvailabilityContext: import("react").Context<ServiceAvailabilityController | undefined>;
19
+ export declare function useServiceAvailabilityController(): ServiceAvailabilityController | undefined;
20
+ export declare function useServiceAvailability(): ServiceAvailabilityState;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Qwen Team
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Browser-safe runtime guard for `ShellResultDisplay` matching
8
+ * `@qwen-code/qwen-code-core/shellResult` so shared tool-output renderers do
9
+ * not pull `@qwen-code/sdk/daemon` into the managed-only bundle.
10
+ */
11
+ export interface ShellResultDisplay {
12
+ type: 'shell_result';
13
+ version: 1;
14
+ text: string;
15
+ output: string;
16
+ directory: string;
17
+ exitCode: number | null;
18
+ signal: number | null;
19
+ pid: number | null;
20
+ error: string | null;
21
+ outcome: 'completed' | 'failed' | 'cancelled' | 'timed_out';
22
+ notices: string[];
23
+ truncated: boolean;
24
+ outputFiles: string[];
25
+ }
26
+ export declare function isShellResultDisplay(value: unknown): value is ShellResultDisplay;
@@ -16,3 +16,9 @@ export declare function getTaskActivityKey(messages: readonly Message[]): string
16
16
  export declare function hasActiveTaskActivity(messages: readonly Message[], options?: {
17
17
  workflowsEnabled?: boolean;
18
18
  }): boolean;
19
+ /**
20
+ * Change-detection key for cron/loop activity in a session's transcript.
21
+ * Covers tool invocations and cron/loop-triggered user turns so live session
22
+ * scheduled task views re-sync after creates, deletes, wakeups, and fires.
23
+ */
24
+ export declare function getScheduledTaskActivityKey(messages: readonly Message[]): string;