mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-11-07 06:19:43 -10:00
* feat(web-shell): 增加 managed-host 构建入口与托管会话页 为产品侧集成提供独立的 managed-host 产物(--mode managed-host)与托管会话页: 不挂 daemon workspace/session context,托管会话由 provider 直接渲染列表、会话与输入框。 包含:vite lib 构建模式、managed-host 渲染入口及测试、ManagedSessionsPage 托管分支与 测试、provider 类型调整、README 与中英文设计说明。本次不涉及宿主注入能力。 * feat(web-shell): 托管宿主可注入侧栏导航 props ManagedAgentWebShell 增加可选导航 props 并原样透传给 ManagedSessionsPage: navigationTarget / archivedNavigationTarget / onArchivedSessionsStatusChange / navigationActive / navigationSearch。 宿主据此决定是否把官方会话列表 portal 到自己的侧栏(navigationTarget 为 null 时 仍走 home 布局但不 portal),并同步搜索词与归档计数。类型复用 ManagedSessionsPage 现有 props,不新增重复定义;新增 2 个用例覆盖原样透传与未传时保持 undefined。 * feat(web-shell): add full-page app-host entry and align managed empty-state layout - Add app-host mount entry (renderWebShellApp) so a non-React host can render the complete WebShell (sidebar + welcome + composer) by injecting baseUrl/provider; no shell is hand-drawn and no backend address is hardcoded. - Center the managed empty state like the standalone chat (content shrinks so the chatPane centers it) instead of pinning the welcome to the top and composer to the bottom; gate the welcome header off when a failed session is selected. - Surface session failure and unconfirmed-submission notices together above the composer, dedupe the same message across channels, and style them as callouts. - A pending prompt owned by another session now offers a redirect to the owning conversation instead of retry/discard from a foreign session; reconcile tests. - Build app-host with global (unscoped) CSS so root-level state classes match. * test(web-shell): align managed status smoke assertions Co-authored-by: Qwen-Coder <[email protected]> * test(web-shell): reach the owning conversation before retrying a foreign pending A pending prompt owned by another conversation no longer offers retry in the foreign session: it renders "Open the original conversation" instead. The spec still clicked "Retry the same request" straight from the foreign session, so the two foreign variants timed out waiting for a button that is deliberately absent from this head while the owner variant passed. Follow the redirect first, then retry. Owner variant unchanged. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmvwo8rnm58 * docs(web-shell): document the app-host entry and drop ignored e2e links The review on head932a61d8dcread `app-host` as undocumented: no README section, no mention in either design doc. Document it the same way `managed-host` is documented -- entry API, build mode, served directory -- and record the unscoped-CSS behaviour as a deliberate decision narrowed to that bundle, naming the entries that keep scoped CSS. Also state that neither host mode is part of `npm run build`, which is what the wiring actually does. Both design docs linked `.qwen/e2e-tests/managed-host-webshell.md`, which `.gitignore` excludes (`.qwen/*`), so the links are dropped and the statement they supported stays. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmvxdyp0v69 * fix(web-shell): revert breaking changes to existing consumers - Revert `isChatEmptyState` to `!managedMode &&` (was: `!connection.sessionId && !(managedAgentProvider !== undefined && managedSessionId)`), restoring the original behavior where managed mode is never empty state. The head condition broke existing managed consumers by making them hit empty-state layout when no session was selected. - Revert `sidebarRailEnabled` to drop `managedAgentProvider === undefined &&`, restoring rail for existing managed consumers. The condition was app-host-specific and should not affect hosts that already pass a provider. - Revert `ManagedSessionsPage` inline `flex: 0 0 auto` (was unconditional in empty state), restoring `flex: 1 1 auto` for the managed entry. The shrink was only correct when paired with `.appChatEmpty .chatPane { justify-content: center }`, which only exists in the full-page `renderWebShellApp` entry. In `renderManagedAgentWebShell` the class is absent, so the shrink alone produced a 136px content block pinned to the top with 550px dead space below. - Remove `skipScope` from `vite.lib.config.ts`: the justification ("scoped selectors use [data-web-shell-root] as an ancestor anchor") is factually incorrect. `COMPONENT_SCOPE` includes `:where([data-web-shell-root][data-web-shell-shadcn], ...)` which matches the element itself, so scoped bundles already apply state classes on the root element. Keep scoping for all modes. - Update README and both design docs to reflect the corrected scoping behavior. Co-authored-by: Qwen-Coder <[email protected]> * chore(web-shell): remove app-host entry The app-host entry (renderWebShellApp) had no build wiring (absent from build script, exports, files, and no CI job invoked --mode app-host), no test coverage, and hardcoded a specific host's sidebar/footer configuration. Remove it from this PR; it can be reintroduced in a follow-up with proper packaging and tests once a named consumer exists. Co-authored-by: Qwen-Coder <[email protected]> * fix(web-shell): drop unused mode parameter from injectCssModules The mode parameter became unused after the skipScope removal. Remove it to fix the ESLint no-unused-vars error. Co-authored-by: Qwen-Coder <[email protected]> * docs(web-shell): scope the managed-host entry and correct stale layout notes - README: say plainly that `managed-host` is source-only (no `build`, `exports` or `files` wiring, so it is not in the npm package), and record that one shell per shadow root is the contract. - package.json: keep the orphan `dist/types/managed-host.d.ts` out of the published tree so the package does not ship a type with no implementation. - ManagedSessionsPage: point the `summary.failure` dedupe comment at the current failure block above the composer, and record why a session switch resets failure and discard notices. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmvy1jgjo76 * docs(web-shell): state the real consequence of the session-switch reset The comment claimed the list error is re-derived on a session switch. It is not: the list effect's deps exclude sessionId, so a catalog-load error is hidden until provider/listRevision changes. Say what actually happens. Co-authored-by: Qwen-Coder <[email protected]> Patrol-Run: qwen-pr-closeout/jmvy1jgjo76 * fix(web-shell): keep managed sessions visible when workspaces collapse Co-authored-by: Qwen-Coder <[email protected]> * fix(web-shell): address doudouOUC review feedback - Remove shadow-DOM style adoption from renderManagedAgentWebShell: the shared CSSStyleSheet cache caused cross-contamination when two shells shared one shadow root. Hosts using shadow DOM should adopt styles themselves or use a plain container. - Scope the error/discard reset effect to hostSessionOnly only: the unconditional clear on [provider, sessionId] hid the catalog-load error for existing managed consumers on every session switch without retrying. - Update the managed-host test to match the removed shadow-DOM behavior. - Drop the stale shadow-root note from README. Co-authored-by: Qwen-Coder <[email protected]> * fix(web-shell): preserve styles for managed hosts in shared shadow roots Restore the documented managed-host ShadowRoot style lifecycle and keep the shared package sheet until its last owner unmounts. Cover both fallback and constructable sheet behavior. Co-authored-by: Qwen-Coder <[email protected]> * fix(web-shell): center the managed host empty conversation as one group The host mount entry has no .appChatEmpty ancestor, so the managed empty conversation kept its full-height content box and pinned the composer to the bottom. Give host-mounted empty conversations the same shrink-to-content centering, mount the entry through the managedHome fill wrapper, and drop the empty trailing status row below the composer. Co-authored-by: Qwen-Coder <[email protected]> * fix(web-shell): let a host-mode session clear through without an echo channel hostSessionOnly alone marks the shell controlled, so the page's clear signal after deleting or archiving the current session was dropped when the host passed no onSessionChange (the README-documented mount). The deleted conversation stayed on screen and sendable. Allow the internal write for a clear (undefined) when no echo channel exists; new selections stay host-owned, preserving the existing 'unrequested selection is suppressed' contract. The bot's suggested controlled-expression rewrite would have broken that contract, so the gate lives in the handler instead. Witness: the new no-echo test fails at5683eed0without this change (sessionId stays 's1') and passes with it; the echo-channel test pins that the fix does not leak internal writes into echo-owned hosts. --------- Co-authored-by: Shaojin Wen <[email protected]> Co-authored-by: Qwen-Coder <[email protected]>
758 lines
23 KiB
TypeScript
758 lines
23 KiB
TypeScript
import type {
|
|
ManagedExtensionManifest,
|
|
ManagedExtensionPin,
|
|
ManagedExtensionCatalog,
|
|
ManagedExtensionPackageOperation,
|
|
ManagedExtensionSettings,
|
|
ManagedExtensionSnapshot,
|
|
ManagedExtensionSelection,
|
|
} from './managed-extension-types';
|
|
import type { components } from './generated/managed-agent-api';
|
|
import type {
|
|
ManagedMcpManagementCommand,
|
|
ManagedMcpManagementSnapshot,
|
|
} from './managed-mcp-management-types';
|
|
import type { ManagedToolResultReader } from './managed-tool-result-types';
|
|
|
|
export type ManagedAgentSessionPhase =
|
|
| 'created'
|
|
| 'admitted'
|
|
| 'runtime_starting'
|
|
| 'agent_running'
|
|
| 'waiting_runtime'
|
|
| 'tool_running'
|
|
| 'cancelling'
|
|
| 'completed'
|
|
| 'failed'
|
|
| 'cancelled';
|
|
|
|
export function isManagedSessionRunning(
|
|
phase: ManagedAgentSessionPhase,
|
|
): boolean {
|
|
return !['created', 'completed', 'failed', 'cancelled'].includes(phase);
|
|
}
|
|
|
|
export type ManagedAgentRuntimeState =
|
|
| 'unknown'
|
|
| 'starting'
|
|
| 'ready'
|
|
| 'failed';
|
|
|
|
export interface ManagedPermissionRules {
|
|
readonly allow: readonly string[];
|
|
readonly ask: readonly string[];
|
|
readonly deny: readonly string[];
|
|
}
|
|
|
|
export type ManagedApprovalMode = 'default' | 'auto-edit' | 'auto' | 'yolo';
|
|
export type ManagedInputBlock = components['schemas']['InputBlock'];
|
|
export type ManagedSessionSkills =
|
|
components['schemas']['WebShellSessionSkills'];
|
|
export type ManagedSessionMcp = components['schemas']['PublicMcpCatalog'];
|
|
export type ManagedWorkspaceFileLocator =
|
|
| { sessionId: string; workspaceId?: never; cwdRelative?: never }
|
|
| { sessionId?: never; workspaceId: string; cwdRelative: string };
|
|
|
|
export type ManagedWorkspaceFileQueryRequest = ManagedWorkspaceFileLocator &
|
|
Omit<
|
|
components['schemas']['WebShellWorkspaceFileQueryRequest'],
|
|
'sessionId' | 'workspaceId' | 'cwdRelative'
|
|
>;
|
|
|
|
export type ManagedWorkspaceFileReadRequest = ManagedWorkspaceFileLocator &
|
|
Omit<
|
|
components['schemas']['WebShellWorkspaceFileReadRequest'],
|
|
'sessionId' | 'workspaceId' | 'cwdRelative'
|
|
>;
|
|
|
|
export type ManagedWorkspaceFileUploadRequest = ManagedWorkspaceFileLocator & {
|
|
path: string;
|
|
expectedScopeRevision: string;
|
|
uploadId: string;
|
|
};
|
|
|
|
export function isManagedApprovalMode(
|
|
value: unknown,
|
|
): value is ManagedApprovalMode {
|
|
return (
|
|
value === 'default' ||
|
|
value === 'auto-edit' ||
|
|
value === 'auto' ||
|
|
value === 'yolo'
|
|
);
|
|
}
|
|
|
|
export function isManagedInitialApprovalMode(
|
|
value: unknown,
|
|
): value is Exclude<ManagedApprovalMode, 'auto'> {
|
|
return isManagedApprovalMode(value) && value !== 'auto';
|
|
}
|
|
|
|
export function managedPermissionRulesEqual(
|
|
left: ManagedPermissionRules | undefined,
|
|
right: ManagedPermissionRules | undefined,
|
|
): boolean {
|
|
return (['allow', 'ask', 'deny'] as const).every((kind) => {
|
|
const a = left?.[kind] ?? [];
|
|
const b = right?.[kind] ?? [];
|
|
return a.length === b.length && a.every((rule, index) => rule === b[index]);
|
|
});
|
|
}
|
|
|
|
export type ManagedSessionSkill = components['schemas']['SessionCreationSkill'];
|
|
export type ManagedSessionRecovery = components['schemas']['SessionRecovery'];
|
|
export type ManagedTurnCancelOperation =
|
|
components['schemas']['WebShellCommandOperation'];
|
|
|
|
export interface ManagedModelPreset {
|
|
agentId: string;
|
|
label: string;
|
|
modelId?: string;
|
|
}
|
|
|
|
export interface ManagedSessionOptions {
|
|
approvalMode: ManagedApprovalMode;
|
|
availableApprovalModes: ManagedApprovalMode[];
|
|
planModeSupported?: boolean;
|
|
inputAttachments?: boolean;
|
|
skillsSupported?: boolean;
|
|
modelSelectionSupported?: boolean;
|
|
}
|
|
|
|
export interface ManagedSessionApproval extends ManagedSessionOptions {
|
|
approvalRevision: number;
|
|
supported: boolean;
|
|
planMode?: boolean;
|
|
liveSupported?: boolean;
|
|
permissionRulesSupported?: boolean;
|
|
permissionRules?: ManagedPermissionRules;
|
|
}
|
|
|
|
export interface ManagedApprovalChangeResult {
|
|
sessionId: string;
|
|
approvalMode: ManagedApprovalMode;
|
|
approvalRevision: number;
|
|
replayed: boolean;
|
|
planMode?: boolean;
|
|
permissionRules?: ManagedPermissionRules;
|
|
}
|
|
|
|
export interface ManagedModelContext {
|
|
modelId: string;
|
|
inputTokens?: number;
|
|
contextWindowSize?: number;
|
|
observedAt: number;
|
|
}
|
|
|
|
export interface ManagedModelSelection {
|
|
modelId?: string;
|
|
revision: number;
|
|
}
|
|
|
|
export interface ManagedSessionModels {
|
|
models: { modelId: string; label: string }[];
|
|
modelSelection: ManagedModelSelection;
|
|
supported: boolean;
|
|
}
|
|
|
|
export interface ManagedModelChangeResult {
|
|
sessionId: string;
|
|
modelSelection: ManagedModelSelection;
|
|
replayed: boolean;
|
|
}
|
|
|
|
export type ManagedLifecycleKind = 'close' | 'archive' | 'delete';
|
|
export type ManagedLifecycleAction =
|
|
| ManagedLifecycleKind
|
|
| 'unarchive'
|
|
| 'close_archive';
|
|
export type ManagedLifecycleOperation =
|
|
components['schemas']['WebShellCommandOperation'];
|
|
export type ManagedExportPage = components['schemas']['WebShellExportPage'];
|
|
export type ManagedExportItem = components['schemas']['WebShellItem'];
|
|
|
|
export type ManagedSessionWorktree =
|
|
components['schemas']['WebShellSessionWorktree'];
|
|
export type ManagedSessionWorktreeOptions =
|
|
components['schemas']['WebShellSessionWorktreeOptions'];
|
|
|
|
export interface ManagedAgentSessionSummary {
|
|
sessionId: string;
|
|
agentId?: string;
|
|
worktree?: ManagedSessionWorktree | null;
|
|
approvalMode?: ManagedApprovalMode;
|
|
initialApprovalMode?: ManagedApprovalMode;
|
|
approvalRevision?: number;
|
|
planMode?: boolean;
|
|
planModeSupported?: boolean;
|
|
modelContext?: ManagedModelContext;
|
|
modelSelection?: ManagedModelSelection;
|
|
compactionRevision?: number;
|
|
contextCompressionOperationId?: string;
|
|
lifecycleStatus?: string;
|
|
lastSequence?: number;
|
|
lifecycleOperation?: components['schemas']['WebShellLifecycleOperation'];
|
|
activeTurnId?: string;
|
|
title: string;
|
|
workspace?: {
|
|
workspaceId: string;
|
|
cwdRelative: string;
|
|
contextRevision?: number;
|
|
state?: 'ready' | 'changing' | 'recovery_blocked';
|
|
};
|
|
createdAt: number;
|
|
admittedAt: number;
|
|
updatedAt: number;
|
|
phase: ManagedAgentSessionPhase;
|
|
runtimeReady: boolean;
|
|
runtimeState: ManagedAgentRuntimeState;
|
|
capabilities: {
|
|
canSend: boolean;
|
|
canCancel: boolean;
|
|
canRename?: boolean;
|
|
sessionClose?: boolean;
|
|
sessionArchive?: boolean;
|
|
sessionUnarchive?: boolean;
|
|
sessionDelete?: boolean;
|
|
actions?: boolean;
|
|
childAgents?: boolean;
|
|
tasks?: boolean;
|
|
artifacts?: boolean;
|
|
/** The caller may submit later Turns to this Workspace-bound Session. */
|
|
workspaceTurns?: boolean;
|
|
modelChange?: boolean;
|
|
contextCompression?: boolean;
|
|
approvalModeChange?: boolean;
|
|
inputAttachments?: boolean;
|
|
};
|
|
failure?: { code: string; message: string };
|
|
recovery?: ManagedSessionRecovery;
|
|
}
|
|
|
|
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';
|
|
|
|
export interface ManagedAgentSessionEvent {
|
|
id: number;
|
|
at: number;
|
|
type: ManagedAgentSessionEventType;
|
|
sessionId: string;
|
|
turnId: string;
|
|
data?: unknown;
|
|
/**
|
|
* Projected from a materialized Item rather than a raw event. The
|
|
* server can retract its items (reconciliation), after which these
|
|
* projections must not survive a resync.
|
|
*/
|
|
assembledFromItem?: boolean;
|
|
}
|
|
|
|
export interface ManagedAgentSessionTranscript {
|
|
events: ManagedAgentSessionEvent[];
|
|
olderCursor?: string;
|
|
lastEventId: number;
|
|
history?: 'items';
|
|
}
|
|
|
|
export interface ManagedAgentTurnAdmission {
|
|
sessionId: string;
|
|
turnId: string;
|
|
}
|
|
|
|
export interface ManagedAgentRequestOptions {
|
|
clientId: string;
|
|
signal?: AbortSignal;
|
|
}
|
|
|
|
export interface ManagedAgentCommandOptions extends ManagedAgentRequestOptions {
|
|
idempotencyKey: string;
|
|
}
|
|
|
|
export type ManagedContextCompressionOperation =
|
|
components['schemas']['WebShellContextCompressionOperation'];
|
|
export type ManagedTask = components['schemas']['WebShellTask'];
|
|
export type ManagedTaskPage = components['schemas']['WebShellTaskPage'];
|
|
export type ManagedTaskEvent = components['schemas']['WebShellTaskEvent'];
|
|
export type ManagedTaskEventPage =
|
|
components['schemas']['WebShellTaskEventPage'];
|
|
export type ManagedTaskCancelOperation =
|
|
components['schemas']['WebShellCommandOperation'] & { type: 'task_cancel' };
|
|
|
|
export type ManagedRuntimeNode = components['schemas']['WebShellRuntimeNode'];
|
|
|
|
export type ManagedWorkspaceDirectory =
|
|
components['schemas']['WebShellWorkspaceDirectory'];
|
|
|
|
export type ManagedWorkspaceCreateOperation =
|
|
components['schemas']['WebShellWorkspaceCreateOperation'];
|
|
|
|
export interface ManagedWorkspaceRegistration {
|
|
listNodes(
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<components['schemas']['WebShellRuntimeNodePage']>;
|
|
checkDirectory(
|
|
request: components['schemas']['WebShellWorkspaceDirectoryRequest'],
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedWorkspaceDirectory>;
|
|
create(
|
|
request: Omit<
|
|
components['schemas']['WebShellWorkspaceRegisterRequest'],
|
|
'idempotencyKey' | 'requestId'
|
|
>,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedWorkspaceCreateOperation>;
|
|
query(
|
|
operationId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedWorkspaceCreateOperation>;
|
|
}
|
|
|
|
/** A Hosted tool approval waiting for the Session owner's answer. */
|
|
export interface ManagedAgentPendingAction {
|
|
actionId: string;
|
|
sessionId: string;
|
|
/** Public Turn ID; absent when the Turn could not be resolved. */
|
|
turnId?: string;
|
|
functionCallId: string;
|
|
toolName: string;
|
|
inputRevision: number;
|
|
policyRevision: string;
|
|
expiresAt: number;
|
|
options: Array<{ id: string; label: string }>;
|
|
inputPreview?: components['schemas']['WebShellActionInputPreview'];
|
|
}
|
|
|
|
export interface ManagedAgentProvider {
|
|
readonly userMessages?: {
|
|
query(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<
|
|
import('./use-managed-user-messages').ManagedUserMessageSnapshot
|
|
>;
|
|
command(
|
|
sessionId: string,
|
|
command: import('./use-managed-user-messages').ManagedUserMessageCommand,
|
|
options: { idempotencyKey: string; signal?: AbortSignal },
|
|
): Promise<
|
|
import('./use-managed-user-messages').ManagedUserMessageSnapshot
|
|
>;
|
|
};
|
|
|
|
readonly lifecycle?: {
|
|
submit(
|
|
kind: ManagedLifecycleKind,
|
|
sessionId: string,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedLifecycleOperation>;
|
|
unarchive(
|
|
sessionId: string,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedAgentSessionSummary>;
|
|
query(
|
|
sessionId: string,
|
|
operationId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedLifecycleOperation>;
|
|
};
|
|
exportSnapshot?(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions & { cursor?: string },
|
|
): Promise<ManagedExportPage>;
|
|
readonly exportConsistency?: 'live';
|
|
readonly storageKey: string;
|
|
readonly canCancel: boolean;
|
|
/** Present when the provider can filter the complete Session history by title. */
|
|
readonly titleSearch?: boolean;
|
|
readonly recovery?: {
|
|
query(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedSessionRecovery>;
|
|
recheck(
|
|
sessionId: string,
|
|
turnId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedSessionRecovery>;
|
|
};
|
|
queryCancelOperation(
|
|
sessionId: string,
|
|
operationId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedTurnCancelOperation>;
|
|
readonly skills?: {
|
|
list(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedSessionSkills>;
|
|
};
|
|
readonly mcp?: {
|
|
list(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedSessionMcp>;
|
|
};
|
|
readonly extensions?: {
|
|
readonly storageScope?: string;
|
|
list(
|
|
workspaceId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedExtensionCatalog>;
|
|
publish(
|
|
workspaceId: string,
|
|
extensionId: string | undefined,
|
|
packageDigest: string,
|
|
manifest: ManagedExtensionManifest,
|
|
archive: Blob,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedExtensionPackageOperation>;
|
|
settings(
|
|
workspaceId: string,
|
|
extensionId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedExtensionSettings>;
|
|
saveSettings(
|
|
workspaceId: string,
|
|
extensionId: string,
|
|
expectedRevision: number,
|
|
values: Record<string, string>,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedExtensionPackageOperation>;
|
|
query(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedExtensionSnapshot>;
|
|
apply(
|
|
sessionId: string,
|
|
selection: ManagedExtensionSelection,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedExtensionSnapshot>;
|
|
operation(
|
|
sessionId: string,
|
|
operationId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedExtensionSnapshot>;
|
|
resume(
|
|
sessionId: string,
|
|
operationId: string,
|
|
recoverPrevious: boolean,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedExtensionSnapshot>;
|
|
package(
|
|
workspaceId: string,
|
|
pin: ManagedExtensionPin,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedExtensionCatalog['extensions'][number]>;
|
|
};
|
|
readonly mcpManagement?: {
|
|
/** Explicit tenant/actor namespace for pending commands saved in this tab. */
|
|
readonly storageScope?: string;
|
|
query(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedMcpManagementSnapshot>;
|
|
submit(
|
|
sessionId: string,
|
|
command: ManagedMcpManagementCommand,
|
|
options: ManagedAgentCommandOptions & { requestId: string },
|
|
): Promise<ManagedMcpManagementSnapshot>;
|
|
operation(
|
|
sessionId: string,
|
|
operationId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedMcpManagementSnapshot>;
|
|
};
|
|
/** Present when the provider can serve Hosted permission Actions. */
|
|
readonly actions?: {
|
|
listPending(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions & { includeChildren?: boolean },
|
|
): Promise<ManagedAgentPendingAction[]>;
|
|
respond(
|
|
action: ManagedAgentPendingAction,
|
|
optionId: string,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<void>;
|
|
};
|
|
readonly toolResults?: ManagedToolResultReader;
|
|
readonly toolDetails?: {
|
|
get(
|
|
sessionId: string,
|
|
itemId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<components['schemas']['WebShellToolDetails']>;
|
|
};
|
|
readonly tasks?: {
|
|
list(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions & { cursor?: string; limit?: number },
|
|
): Promise<ManagedTaskPage>;
|
|
get(
|
|
sessionId: string,
|
|
taskId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedTask>;
|
|
listEvents(
|
|
sessionId: string,
|
|
taskId: string,
|
|
options: ManagedAgentRequestOptions & { after?: string; limit?: number },
|
|
): Promise<ManagedTaskEventPage>;
|
|
readonly cancel?: {
|
|
submit(
|
|
sessionId: string,
|
|
taskId: string,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedTaskCancelOperation>;
|
|
query(
|
|
sessionId: string,
|
|
taskId: string,
|
|
operationId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedTaskCancelOperation>;
|
|
};
|
|
};
|
|
readonly contextCompression?: {
|
|
submit(
|
|
sessionId: string,
|
|
request: { expectedCompactionRevision: number },
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedContextCompressionOperation>;
|
|
query(
|
|
sessionId: string,
|
|
operationId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedContextCompressionOperation>;
|
|
};
|
|
readonly approvalChange?: {
|
|
queryOptions(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedSessionApproval>;
|
|
submit(
|
|
sessionId: string,
|
|
request: {
|
|
approvalMode: ManagedApprovalMode;
|
|
expectedRevision: number;
|
|
planMode?: boolean;
|
|
permissionRules?: ManagedPermissionRules;
|
|
},
|
|
options: ManagedAgentCommandOptions & { requestId: string },
|
|
): Promise<ManagedApprovalChangeResult>;
|
|
};
|
|
readonly modelChange?: {
|
|
queryOptions(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedSessionModels>;
|
|
submit(
|
|
sessionId: string,
|
|
request: { modelId: string; expectedRevision: number },
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedModelChangeResult>;
|
|
};
|
|
readonly workspaceFiles?: {
|
|
query(
|
|
request: ManagedWorkspaceFileQueryRequest,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<components['schemas']['WebShellWorkspaceFilePage']>;
|
|
read(
|
|
request: ManagedWorkspaceFileReadRequest,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<components['schemas']['WebShellWorkspaceFileSnapshot']>;
|
|
upload?(
|
|
request: ManagedWorkspaceFileUploadRequest,
|
|
data: Blob,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<components['schemas']['WebShellWorkspaceFileUploadResult']>;
|
|
queryUpload?(
|
|
uploadId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<components['schemas']['WebShellWorkspaceFileUploadStatus']>;
|
|
};
|
|
readonly workspaceBinding?: {
|
|
readonly agentId: string;
|
|
readonly registration?: ManagedWorkspaceRegistration;
|
|
/** Host-published models and legacy AgentDefinition presets for new Sessions. */
|
|
readonly modelPresets?: readonly ManagedModelPreset[];
|
|
list(
|
|
options: ManagedAgentRequestOptions & { cursor?: string; limit?: number },
|
|
): Promise<{
|
|
data: ManagedAgentWorkspace[];
|
|
defaultWorkspace?: ManagedAgentWorkspace | null;
|
|
nextCursor?: string;
|
|
supported: boolean;
|
|
canCreateWorkspace?: boolean;
|
|
canSelectDirectory?: boolean;
|
|
canImportLocalDirectory?: boolean;
|
|
supportsApprovalModeSelection?: boolean;
|
|
}>;
|
|
get(
|
|
workspaceId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedAgentWorkspace>;
|
|
createWorkspace?(
|
|
request: {
|
|
displayName: string;
|
|
sourceWorkspaceId?: string;
|
|
cwdRelative?: string;
|
|
localPath?: string;
|
|
},
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedAgentWorkspace>;
|
|
directories?(
|
|
request:
|
|
| { workspaceId: string; cwdRelative: string; localPath?: never }
|
|
| { localPath: string; workspaceId?: never; cwdRelative?: never },
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<components['schemas']['WebShellWorkspaceDirectoryPage']>;
|
|
getSessionOptions?(
|
|
agentId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedSessionOptions>;
|
|
createEmpty(
|
|
request: {
|
|
agentId: string;
|
|
modelId?: string;
|
|
workspaceId: string;
|
|
cwdRelative: string;
|
|
approvalMode?: ManagedApprovalMode;
|
|
planMode?: boolean;
|
|
skills?: ManagedSessionSkill[];
|
|
extensionPins?: ManagedExtensionPin[];
|
|
worktree?: { baseRef?: string };
|
|
},
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<{ sessionId: string }>;
|
|
createSession?(
|
|
request: {
|
|
agentId: string;
|
|
modelId?: string;
|
|
workspaceId: string;
|
|
cwdRelative: string;
|
|
text: string;
|
|
input?: ManagedInputBlock[];
|
|
approvalMode?: ManagedApprovalMode;
|
|
planMode?: boolean;
|
|
skills?: ManagedSessionSkill[];
|
|
extensionPins?: ManagedExtensionPin[];
|
|
worktree?: { baseRef?: string };
|
|
},
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<{ sessionId: string }>;
|
|
};
|
|
readonly sessionWorktrees?: {
|
|
options(
|
|
request: { workspaceId: string; cwdRelative: string; baseRef?: string },
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedSessionWorktreeOptions>;
|
|
list(
|
|
workspaceId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<{ data: ManagedSessionWorktree[] }>;
|
|
inspect(
|
|
workspaceId: string,
|
|
worktreeId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<components['schemas']['WebShellSessionWorktreeInspection']>;
|
|
cleanup(
|
|
workspaceId: string,
|
|
worktreeId: string,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedSessionWorktree>;
|
|
};
|
|
listSessions(
|
|
options: ManagedAgentRequestOptions & {
|
|
archiveState?: 'unarchived' | 'archived' | 'all';
|
|
titleQuery?: string;
|
|
limit?: number;
|
|
cursor?: string;
|
|
},
|
|
): Promise<{
|
|
sessions: ManagedAgentSessionSummary[];
|
|
nextCursor?: string;
|
|
}>;
|
|
getSession(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions,
|
|
): Promise<ManagedAgentSessionSummary>;
|
|
renameSession?(
|
|
sessionId: string,
|
|
displayName: string,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<{ displayName: string }>;
|
|
getTranscript(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions & {
|
|
before?: string;
|
|
limit?: number;
|
|
},
|
|
): Promise<ManagedAgentSessionTranscript>;
|
|
createSession(
|
|
request: {
|
|
text: string;
|
|
input?: ManagedInputBlock[];
|
|
},
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedAgentTurnAdmission>;
|
|
submitPrompt(
|
|
sessionId: string,
|
|
request: { text: string; input?: ManagedInputBlock[] },
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<ManagedAgentTurnAdmission & { operationId?: string }>;
|
|
cancel(
|
|
sessionId: string,
|
|
turnId: string,
|
|
options: ManagedAgentCommandOptions,
|
|
): Promise<{
|
|
sessionId: string;
|
|
turnId: string;
|
|
operationId: string;
|
|
}>;
|
|
subscribeEvents(
|
|
sessionId: string,
|
|
options: ManagedAgentRequestOptions & {
|
|
lastEventId?: number;
|
|
/**
|
|
* Called once the stream connection has been (re-)established. An
|
|
* established stream can stay silent indefinitely — heartbeats are
|
|
* not events — so this is the only liveness signal that does not
|
|
* depend on stream activity.
|
|
*/
|
|
onEstablished?(): void;
|
|
/**
|
|
* Called for each complete heartbeat or comment frame the stream
|
|
* delivers. Heartbeats never decode into events, so on an idle
|
|
* Session this is the only sign of life an established stream gives.
|
|
*/
|
|
onAlive?(): void;
|
|
},
|
|
): AsyncIterable<ManagedAgentSessionEvent>;
|
|
}
|
|
|
|
export interface ManagedAgentWorkspace {
|
|
workspaceId: string;
|
|
displayName: string;
|
|
state: string;
|
|
canCreateSession: boolean;
|
|
defaultCwdRelative?: string;
|
|
canSelectDirectory?: boolean;
|
|
}
|