fix(gui): harden multimodal image attachments

This commit is contained in:
Yichen Jiang
2026-07-23 19:38:37 +08:00
parent eea595fcb4
commit 580e05b794
61 files changed
+1700 -214

No files matched your search

@@ -148,6 +148,7 @@ export function apply(ctx: Context): void {
const loop = connection.start({
onMuxEnvelope: (envelope) => { sessions.manager.handleMuxEnvelope(envelope) },
onHostEnvelope: (envelope) => { sessions.manager.handleHostEnvelope(envelope) },
onDescription: (description) => { sessions.handleDescription(description) },
onConnected: () => { sessions.manager.handleConnected() },
})
ctx.effect(() => () => { loop.stop() }, 'runtime: connection stream loop')
@@ -14,7 +14,7 @@
* read-only view).
*/
import type { Context, Fiber } from 'cordis'
import type { IApiClient, SessionId } from '@deepseek-ai/dsh-client-connection/client'
import type { HostDescription, IApiClient, SessionId } from '@deepseek-ai/dsh-client-connection/client'
import type { SessionCell } from '@deepseek-ai/dsh-client-ui-slots'
import type { SnapshotStore } from '../contract/store.ts'
import { createSnapshotStore } from '../contract/store.ts'
@@ -101,6 +101,7 @@ export class SessionsService {
private watched: SessionId | undefined
/** Removed-while-watched sessions whose teardown waits for the watch to move away. */
private readonly deferredRemovals = new Set<SessionId>()
private description: HostDescription | undefined
/**
* @param ctx - client root context (scope fibers mount under it).
@@ -118,6 +119,22 @@ export class SessionsService {
rootCtx.reflect.provide('sessions', this, undefined)
}
/**
* Store the latest successful connection-generation host description.
* @param description - capability and deployment snapshot from `host.describe`.
*/
handleDescription(description: HostDescription): void {
this.description = description
}
/**
* Read the latest host capability snapshot.
* @returns the last successful description, or undefined before connection.
*/
hostDescription(): HostDescription | undefined {
return this.description
}
/**
* Select a session as current. Unknown ids fail loud instead of navigating
* nowhere (the sole selection write path).