@qwen-code/web-shell 0.25.1-preview.2 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,13 +44,16 @@ export interface QueuedPrompt {
44
44
  isRemoving?: boolean;
45
45
  payloadCompleteness?: 'complete' | 'summary-only';
46
46
  }
47
- export declare function QueuedPromptDisplay({ prompts, t, canMutateMidTurn, canInsertMidTurn, onDelete, onInsert, onEdit, onImagePreview, onAttachmentPreview, }: {
47
+ export declare function QueuedPromptDisplay({ prompts, t, canMutateMidTurn, canInsertMidTurn, canSendMidTurnNow, onDelete, onInsert, onSendNow, onEdit, onImagePreview, onAttachmentPreview, }: {
48
48
  prompts: readonly QueuedPrompt[];
49
49
  t: ReturnType<typeof getTranslator>;
50
50
  canMutateMidTurn?: boolean;
51
51
  canInsertMidTurn?: boolean;
52
+ /** The daemon can deliver queued mid-turn messages on request. */
53
+ canSendMidTurnNow?: boolean;
52
54
  onDelete: (id: number) => void;
53
55
  onInsert: (id: number) => void;
56
+ onSendNow?: (id: number) => void;
54
57
  onEdit: (id: number) => void;
55
58
  onImagePreview?: (src: string, alt?: string) => void;
56
59
  onAttachmentPreview?: (file: AttachmentPreviewRequest) => void;
@@ -0,0 +1,9 @@
1
+ import type { ManagedAgentSessionSummary } from './managed-agent-provider';
2
+ import type { useManagedCwdChange } from './use-managed-cwd-change';
3
+ export declare function ManagedSessionCwdControl({ summary, supported, cwd, disabledReason, onSubmit, }: {
4
+ summary: ManagedAgentSessionSummary;
5
+ supported: boolean;
6
+ cwd: ReturnType<typeof useManagedCwdChange>;
7
+ disabledReason?: string;
8
+ onSubmit: (path: string, revision: number) => Promise<boolean | void>;
9
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -74,7 +74,7 @@ export interface paths {
74
74
  };
75
75
  get?: never;
76
76
  put?: never;
77
- /** @description Maps workspaceId/cwdRelative to public Workspace selection without using environmentId or absolute cwd. Shares G0's opt-in initial file-tool Turn admission and fixed server-owned profile with public Session creation. Any caller holding the OPERATOR role may submit later Turns and rename the Session under the same opt-in, while the Workspace registry row stays ACTIVE and still backs the binding, the actor recorded by the Workspace create command keeps OPERATOR or above, and the Session is an active, undeleted qwen-code Session on the frozen execution profile; Workspace close follows its separate close capability and lifecycle admission; the same caller may cancel a running Turn (its delivery re-checks no grants); archive and unarchive follow their separate retention capabilities after reliable Workspace close; delete supports either L3 idle ACTIVE files Sessions or L2 CLOSED/ARCHIVED Sessions; controlled same-Workspace cwd changes ship through the durable cwd_change operations (v1.32). The per-caller workspaceTurns capability on this surface advertises the same submit/rename admission rule; it does not gate cancellation. Freeze selection with the original idempotency key; admission does not prove physical directory readiness. */
77
+ /** @description Maps workspaceId/cwdRelative to public Workspace selection without using environmentId or absolute cwd. Shares G0's opt-in initial file-tool Turn admission with public Session creation: the fixed server-owned profile for the built-in qwen-code agent, and the profile selected by a stored definition's single allowlisted hosted_profile tools entry for a definition-pinned Session. Any caller holding the OPERATOR role may submit later Turns and rename the Session under the same opt-in, while the Workspace registry row stays ACTIVE and still backs the binding, the actor recorded by the Workspace create command keeps OPERATOR or above, and the Session is active and undeleted and is either a qwen-code Session on the frozen execution profile or pinned to a stored definition; Workspace close follows its separate close capability and lifecycle admission; the same caller may cancel a running Turn (its delivery re-checks no grant it needs survives the cancellation), and the Session's own liveness keeps OPERATOR access even when its Workspace's background-exit observation closes some other bound Session; cancel is always allowed for its own running Turn even outside the Workspace files opt-in. A definition-pinned Session keeps its pinned revision's tool profile, model and instructions for its whole life, and a replay of the create command reuses the original pin; a WebShell Session inherits its Workspace's default Workspace selection when the request omits one. */
78
78
  post: operations["webShellCreateSession"];
79
79
  delete?: never;
80
80
  options?: never;
@@ -541,10 +541,15 @@ export interface components {
541
541
  capabilities: components["schemas"]["WebShellSessionCapabilities"];
542
542
  };
543
543
  WebShellSessionCapabilities: {
544
+ /**
545
+ * @description True when Workspace files are enabled, the bound Session is active and undeleted, the caller holds OPERATOR or above on the Workspace and the exact ACTIVE Registry generation/storage and create-command-actor OPERATOR/OWNER grant still hold, matching cwd admission. This does not promise an idle Session and is independent of workspaceTurns execution-profile gates. Missing means false. Existing operations remain queryable under read authorization even when this capability is false.
546
+ * @default false
547
+ */
548
+ cwdChange?: boolean;
544
549
  /** @default false */
545
550
  actions: boolean;
546
551
  /**
547
- * @description True when the caller may submit later Turns of this Workspace-bound Session or rename it: the deployment enables Workspace files, the caller holds the OPERATOR role on a Workspace registry row whose state is ACTIVE and still backs the Session's binding, the actor recorded by the Workspace create command keeps OPERATOR or above, and the Session is an active qwen-code Session on the frozen execution profile. Cancelling only aborts work already running, so an OPERATOR caller may cancel a running Turn even when this is false; the capability does not gate cancellation. False for every other caller and for unbound Sessions, which do not use it.
552
+ * @description True when the caller may submit later Turns of this Workspace-bound Session or rename it: the deployment enables Workspace files, the caller holds the OPERATOR role on a Workspace registry row whose state is ACTIVE and still backs the Session's binding, the actor recorded by the Workspace create command keeps OPERATOR or above, and the Session is active and undeleted and is either a qwen-code Session or a Session pinned to a stored definition (both on the Workspace's frozen execution profile). Cancelling only aborts work already running, so an OPERATOR caller may cancel a running Turn even when this is false; the capability does not gate cancellation. False for every other caller and for unbound Sessions, which do not use it.
548
553
  * @default false
549
554
  */
550
555
  workspaceTurns: boolean;
@@ -662,6 +667,8 @@ export interface components {
662
667
  replay_floor_sequence?: number | null;
663
668
  /** Format: int64 */
664
669
  snapshot_through_sequence?: number | null;
670
+ /** @description Names the definition field that cannot take effect on 409 agent_definition_unsupported; other errors may omit this field. */
671
+ field?: string;
665
672
  };
666
673
  };
667
674
  /**
@@ -60,6 +60,7 @@ export declare class JavaManagedAgentClient {
60
60
  respondAction(request: Schemas['WebShellActionRespondRequest'], signal?: AbortSignal): Promise<Schemas['WebShellCommandOperation']>;
61
61
  /** Reads an operation's latest durable status; polling is not a replay. */
62
62
  queryOperation(request: Schemas['WebShellOperationRequest'], signal?: AbortSignal): Promise<Schemas['WebShellOperation']>;
63
+ changeCwd(request: Schemas['WebShellChangeCwdRequest'], signal?: AbortSignal): Promise<Schemas['WebShellCwdOperation']>;
63
64
  getToolResult(sessionId: string, itemId: string, signal?: AbortSignal): Promise<{
64
65
  result: components["schemas"]["PublicToolResult"];
65
66
  access: components["schemas"]["ArtifactAccess"];
@@ -80,7 +81,7 @@ export declare class JavaManagedAgentClient {
80
81
  readArtifactRange(artifact: ManagedArtifact, offset: number, length: number, signal?: AbortSignal): Promise<Uint8Array>;
81
82
  openArtifactStream(artifact: ManagedArtifact, signal?: AbortSignal): Promise<ReadableStream<Uint8Array>>;
82
83
  private artifactContent;
83
- streamEvents(request: Schemas['WebShellStreamRequest'], signal?: AbortSignal, onOpen?: () => void): AsyncGenerator<JavaAgentEvent | JavaAgentResyncRequired>;
84
+ streamEvents(request: Schemas['WebShellStreamRequest'], signal?: AbortSignal, onOpen?: () => void, onAlive?: () => void): AsyncGenerator<JavaAgentEvent | JavaAgentResyncRequired>;
84
85
  private post;
85
86
  private request;
86
87
  }
@@ -10,6 +10,8 @@ export interface ManagedAgentSessionSummary {
10
10
  workspace?: {
11
11
  workspaceId: string;
12
12
  cwdRelative: string;
13
+ contextRevision?: number;
14
+ state?: 'ready' | 'changing' | 'recovery_blocked';
13
15
  };
14
16
  createdAt: number;
15
17
  admittedAt: number;
@@ -24,13 +26,14 @@ export interface ManagedAgentSessionSummary {
24
26
  artifacts?: boolean;
25
27
  /** The caller may submit later Turns to this Workspace-bound Session. */
26
28
  workspaceTurns?: boolean;
29
+ cwdChange?: boolean;
27
30
  };
28
31
  failure?: {
29
32
  code: string;
30
33
  message: string;
31
34
  };
32
35
  }
33
- export type ManagedAgentSessionEventType = 'accepted' | 'runtime_starting' | 'runtime_ready' | 'runtime_failed' | 'runtime_released' | 'agent_started' | 'assistant_thought' | 'assistant_delta' | 'tool_requested' | 'tool_started' | 'tool_completed' | 'tool_result_updated' | 'completed' | 'failed' | 'cancelling' | 'cancelled' | 'action_updated' | 'stream_gap';
36
+ export type ManagedAgentSessionEventType = 'accepted' | 'runtime_starting' | 'runtime_ready' | 'runtime_failed' | 'runtime_released' | 'agent_started' | 'assistant_thought' | 'assistant_delta' | 'tool_requested' | 'tool_started' | 'tool_completed' | 'tool_result_updated' | 'completed' | 'failed' | 'cancelling' | 'cancelled' | 'action_updated' | 'context_changed' | 'stream_gap';
34
37
  export interface ManagedAgentSessionEvent {
35
38
  id: number;
36
39
  at: number;
@@ -61,6 +64,7 @@ export interface ManagedAgentRequestOptions {
61
64
  export interface ManagedAgentCommandOptions extends ManagedAgentRequestOptions {
62
65
  idempotencyKey: string;
63
66
  }
67
+ export type ManagedCwdOperation = components['schemas']['WebShellCwdOperation'];
64
68
  /** A Hosted tool approval waiting for the Session owner's answer. */
65
69
  export interface ManagedAgentPendingAction {
66
70
  actionId: string;
@@ -89,6 +93,13 @@ export interface ManagedAgentProvider {
89
93
  respond(action: ManagedAgentPendingAction, optionId: string, options: ManagedAgentCommandOptions): Promise<void>;
90
94
  };
91
95
  readonly toolResults?: ManagedToolResultReader;
96
+ readonly cwdChange?: {
97
+ submit(sessionId: string, request: {
98
+ cwdRelative: string;
99
+ expectedContextRevision: number;
100
+ }, options: ManagedAgentCommandOptions): Promise<ManagedCwdOperation>;
101
+ query(sessionId: string, operationId: string, options: ManagedAgentRequestOptions): Promise<ManagedCwdOperation>;
102
+ };
92
103
  readonly workspaceBinding?: {
93
104
  readonly agentId: string;
94
105
  list(options: ManagedAgentRequestOptions & {
@@ -139,6 +150,12 @@ export interface ManagedAgentProvider {
139
150
  * depend on stream activity.
140
151
  */
141
152
  onEstablished?(): void;
153
+ /**
154
+ * Called for each complete heartbeat or comment frame the stream
155
+ * delivers. Heartbeats never decode into events, so on an idle
156
+ * Session this is the only sign of life an established stream gives.
157
+ */
158
+ onAlive?(): void;
142
159
  }): AsyncIterable<ManagedAgentSessionEvent>;
143
160
  }
144
161
  export interface ManagedAgentWorkspace {
@@ -12,3 +12,9 @@
12
12
  * are worth another attempt.
13
13
  */
14
14
  export declare function isNonRetryableClientError(error: unknown): boolean;
15
+ /**
16
+ * A 401/403. This client re-derives its credentials on every request, so an
17
+ * expired short-lived token gets a fresh answer on the very next attempt
18
+ * once the host refreshes — never a terminal condition.
19
+ */
20
+ export declare function isAuthFailure(error: unknown): boolean;
@@ -0,0 +1,21 @@
1
+ import type { ManagedAgentProvider, ManagedAgentSessionSummary } from './managed-agent-provider';
2
+ interface CwdIntent {
3
+ sessionId: string;
4
+ workspaceId: string;
5
+ cwdRelative: string;
6
+ expectedContextRevision: number;
7
+ idempotencyKey: string;
8
+ operationId?: string;
9
+ }
10
+ export declare function useManagedCwdChange(provider: ManagedAgentProvider, clientId: string, sessionId: string | undefined, summary: ManagedAgentSessionSummary | undefined, refreshSummary: (signal?: AbortSignal) => Promise<ManagedAgentSessionSummary | undefined>): {
11
+ blocked: boolean;
12
+ submit: (cwdRelative: string, expectedContextRevision: number) => Promise<true | undefined>;
13
+ confirm: () => Promise<void>;
14
+ isBlocked: () => boolean;
15
+ key: string;
16
+ pending?: CwdIntent;
17
+ busy: boolean;
18
+ errorCode?: string;
19
+ target?: string;
20
+ };
21
+ export {};
@@ -1,12 +1,26 @@
1
1
  import type { ManagedAgentProvider, ManagedAgentSessionEvent, ManagedAgentSessionSummary } from './managed-agent-provider';
2
+ type SignalLeg = 'session' | 'transcript' | 'stream';
3
+ interface SignalEntry {
4
+ readonly message: string;
5
+ readonly final: boolean;
6
+ readonly seq: number;
7
+ readonly leg: SignalLeg;
8
+ readonly stall?: boolean;
9
+ }
10
+ export declare function failureRetryDelayMs(failures: number): number;
2
11
  export declare function useManagedSession(provider: ManagedAgentProvider, clientId: string, sessionId: string | undefined): {
12
+ stoppedReason: string | undefined;
13
+ stoppedLeg: SignalLeg | undefined;
14
+ error: string | undefined;
3
15
  loadingOlder: boolean;
4
16
  loadOlder: () => Promise<void>;
5
17
  reload: () => void;
18
+ refreshSummary: (signal?: AbortSignal) => Promise<ManagedAgentSessionSummary | undefined>;
6
19
  sessionId?: string;
7
20
  summary?: ManagedAgentSessionSummary;
8
21
  events: ManagedAgentSessionEvent[];
9
22
  olderCursor?: string;
10
23
  loading: boolean;
11
- error?: string;
24
+ signals?: Partial<Record<SignalLeg, SignalEntry>>;
12
25
  };
26
+ export {};
@@ -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;
@@ -489,6 +489,14 @@ export interface DaemonSessionActions {
489
489
  onAdmissionStarted?: () => void;
490
490
  }): Promise<DaemonMidTurnMessageResult>;
491
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>;
492
500
  /**
493
501
  * Best-effort reconciliation snapshot (queue + delivery-state rings) from the
494
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwen-code/web-shell",
3
- "version": "0.25.1-preview.2",
3
+ "version": "0.25.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/QwenLM/qwen-code.git",