fix(plugins): resolve handoff issues found in live hosts

This commit is contained in:
kartik-mem0
2026-09-10 19:50:21 +05:30
parent 2e784b76d2
commit d33b6604a4
23 changed files with 53 additions and 17 deletions
+2 -1
View File
@@ -109,7 +109,6 @@ export function apply(ctx: Context, config: Config): void {
if (!session.header.cwd) throw new Error("The native session project directory is unavailable.");
if (action === "list" || action === "resume") return await runHandoffAction(new URL("./session_handoff.py", import.meta.url), action, session.header.cwd, resource);
if (action !== "save") throw new Error("Handoff action must be save, list, or resume.");
const attachments = (ctx as unknown as { attachments?: { readImage(ref: unknown): Promise<{ref: {mediaType: string}; data: Uint8Array}> } }).attachments;
// dsh-session-title persists user renames and generated titles as last-wins log events.
const titleEvent = [...session.events].reverse().find(event => String(event.type) === "session/title");
const nativeTitle = (titleEvent?.data as {title?: unknown} | undefined)?.title;
@@ -120,6 +119,8 @@ export function apply(ctx: Context, config: Config): void {
}, session.deriveMessages(), {
excludeCallId: exec.callId,
readImage: async (ref) => {
// Optional services must use Cordis lookup; direct access requires inject.
const attachments = ctx.get("attachments") as { readImage(ref: unknown): Promise<{ref: {mediaType: string}; data: Uint8Array}> } | undefined;
if (!attachments) throw new Error("DeepSeek image attachment storage is unavailable.");
const image = await attachments.readImage(ref);
return { data: image.data, mediaType: image.ref.mediaType };