Selaa lähdekoodia

fix(ui-tool): address review wording and JSDoc accuracy on the image card

Chinesezjc 2 viikkoa sitten
vanhempi
sitoutus
6e5ed52aed

+ 4 - 1
packages/client/ui-tool/src/client/contract/slots.ts

@@ -32,7 +32,10 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
      * loader it received in its owner, and the attachment plugin fills the
      * gallery. Composing no attachment presentation plugin renders nothing,
      * which is why the image card keeps its own envelope text beside the
-     * gallery.
+     * gallery. A child slot is declared by exactly one entry: registering a
+     * second toolview that declares the same child throws at load, so a
+     * future image-bearing tool must reuse this entry or own a distinct
+     * slot.
      */
     'tool.call.images': { kind: 'single'; scope: 'session'; owner: ToolImagesOwnerProps }
   }

+ 3 - 1
packages/client/ui-tool/src/client/tool/models/image-card-model.ts

@@ -29,7 +29,9 @@ export interface ImageCardModel {
 }
 
 /**
- * The persisted `presentationMeta` this card reads: the authored path only.
+ * The persisted `presentationMeta` this card reads: the resolved display path only
+ * (the value `read_image` persisted from its target's display path, not the
+ * author-typed `file_path` argument).
  *
  * Root calls persist it; a nested call (a read_image dispatched from inside
  * run_code) settles without `meta`, so the card falls back to the call's own

+ 0 - 1
packages/client/ui-tool/tests/image-card.client.spec.tsx

@@ -46,7 +46,6 @@ const sampleImage = {
   name: 'card.png',
 }
 
-/** The persisted presentationMeta payload. */
 /** The persisted presentationMeta payload: the path only. */
 const imageMeta = (over?: Record<string, unknown>) => ({ path: 'shots/card.png', ...over })
 

+ 2 - 2
packages/fs/tool-fs/tests/read-image.spec.ts

@@ -243,8 +243,8 @@ describe('read_image happy path', () => {
     expect(result.content).toHaveLength(2)
     const image = result.content[1] as { type: string; attachment: ImageAttachmentRef }
     expect(image.type).toBe('image')
-    // GIFs do not pass through unchanged: normalization re-encodes this
-    // transparent 1x1 GIF as WebP while keeping the source file name.
+    // Normalization re-encodes this transparent 1x1 GIF as WebP: the bytes do
+    // not pass through unchanged, only the source file name survives.
     expect(image.attachment.mediaType).toBe('image/webp')
     expect(image.attachment.width).toBe(1)
     expect(image.attachment.height).toBe(1)