refactor(web): consume owner remote events directly

This commit is contained in:
imccyu
2026-08-11 16:50:03 +08:00
parent 80f1a064f5
commit e0bbe42242
75 changed files with 353 additions and 350 deletions
+11 -3
View File
@@ -32,7 +32,8 @@ import { discoverPresets } from './discovery.ts'
import { copyComposition, deleteComposition, readComposition } from './authoring.ts'
import { mountPreset, serviceForAgent, standingMountFor } from './mount.ts'
import { PresetExistsError } from './authoring.ts'
import { PresetMountError, UnknownPresetError, type AgentPreset, type Config } from './types.ts'
import { PresetMountError, UnknownPresetError, type AgentPreset, type Config } from './preset.ts'
import type {} from './types.ts'
/** Settings namespace carrying the user's chosen default preset. */
export const SETTINGS_NAMESPACE = 'agent-presets'
@@ -61,8 +62,8 @@ export {
PresetNotWritableError, readComposition, writableRoot,
} from './authoring.ts'
export { resolveSessionPreset, type PresetBearingSession } from './session.ts'
export { PresetMountError, UnknownPresetError } from './types.ts'
export type { AgentPreset, Config, PresetRoot, PresetTrust } from './types.ts'
export { PresetMountError, UnknownPresetError } from './preset.ts'
export type { AgentPreset, Config, PresetRoot, PresetTrust } from './preset.ts'
declare module '@deepseek-ai/cordis' {
interface Context {
@@ -154,6 +155,13 @@ export class AgentPresets extends Service {
+ '(join through AgentPresets.mount() or composeFrom() in the agent factory setup)',
)
})
// The durable record is the commit point. Its public notification carries
// only the stable identity needed by clients, never the live Session.
ctx.on('session/event', (session, event) => {
if (event.type !== 'agent-preset/selected') return
ctx.emit('agent-preset/selected', session.id, event.data.agentPreset)
})
}
/**