fix: @-reference button no-ops — read conversation via ctx.get, not the ctx property

Cordis only grants property reads for services declared in the plugin's
inject list; every other read throws "cannot get property X without
inject" (the app's own plugins read 'conversation' through ctx.get for
this reason). referenceInChat now resolves the conversation service lazily
via ctx.get('conversation') and no-ops when absent. Verified end-to-end in
headless Chrome: clicking the @file button on root/dir/file rows now
appends the at-relative-path mention to the composer draft with no
console errors.
This commit is contained in:
Menghuan1918
2026-08-09 00:01:56 +08:00
parent f091ac322b
commit c81de3374f
2 changed files with 14 additions and 10 deletions
+4 -3
View File
@@ -9,7 +9,9 @@
* - httpServer: @deepseek-ai/dsh-host-webserver
* - sessions: host side @deepseek-ai/dsh-session (SessionStore), client
* side the runtime ISessions list feed
* - conversation: client side ui-conversation's IConversation (composer draft)
* - conversation: client side ui-conversation's IConversation (composer
* draft), read lazily through `ctx.get` — cross-plugin service reads need
* an inject declaration, so the direct property is never typed here
* - loader: @cordisjs/plugin-loader (entry options)
* - slots: the client runtime SlotsService
* - effect: the DSH-vendored cordis lifecycle helper
@@ -116,7 +118,7 @@ export interface SidebarSessionInput {
setDraft(text: string): void
}
/** The conversation service face (mirror of ui-conversation's IConversation). */
/** The composer draft face the sidebar reaches through `ctx.get('conversation')`. */
export interface SidebarConversation {
input: {
for(actx: Context): SidebarSessionInput
@@ -127,7 +129,6 @@ declare module 'cordis' {
interface Context {
httpServer: SidebarHttpServer
sessions: SidebarSessionStore & SidebarSessionsService
conversation: SidebarConversation
loader: SidebarLoader
slots: SidebarSlotsService
/**