qwen-code/docs/design/web-shell-session-created-callback.md
ytahdn e6bd1b1c12
feat(web-shell): add session created callback (#6703)
* feat(web-shell): add session created callback

* fix(web-shell): bound session callback setup

* fix(web-shell): serialize session preparation

* fix(web-shell): clarify session preparation diagnostics

* fix(web-shell): handle session preparation races

---------

Co-authored-by: ytahdn <ytahdn@gmail.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-07-13 07:04:42 +00:00

18 lines
749 B
Markdown

# Web Shell session-created callback
## Goal
Let an embedding host run asynchronous work with a newly created session ID
before Web Shell continues session initialization or submits the first prompt.
## Design
Add an optional `onSessionCreated(sessionId)` prop to `WebShell`. The lazy
session-creation path awaits it immediately after `createSession` succeeds and
before attaching the session. A rejected callback aborts the first prompt and
uses the existing unattached-session cleanup path. The callback times out after
30 seconds so a host cannot permanently block setup or leak the unattached
session.
Existing sessions loaded through the `sessionId` prop or session picker do not
invoke the callback because Web Shell did not create them.