dsh-code 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -336,9 +336,13 @@ function imagesOf(content: readonly ContentBlock[]): readonly ImageBlock['attach
336
336
  export function imageLabels(images: readonly ImageBlock['attachment'][] | undefined): string {
337
337
  if (images === undefined || images.length === 0) return ''
338
338
  return images.map((image, index) => {
339
- const rawName = image.name?.trim() || `image ${index + 1}`
340
- const name = rawName.length <= 80 ? rawName : `${rawName.slice(0, 79)}…`
341
- return `[image: ${name} · ${image.width}×${image.height} · ${image.bytes} B]`
339
+ const rawName = image.name?.trim() || `image ${index + 1}`
340
+ const name = rawName.length <= 80 ? rawName : `${rawName.slice(0, 79)}…`
341
+ const original = image.originalDimensions
342
+ const dimensions = original === undefined
343
+ ? `${image.width}×${image.height}`
344
+ : `${image.width}×${image.height} · original ${original.width}×${original.height}`
345
+ return `[image: ${name} · ${dimensions} · ${image.bytes} B]`
342
346
  }).join('\n')
343
347
  }
344
348
 
@@ -55,12 +55,12 @@ function formatRate(n: number): string {
55
55
  /**
56
56
  * Cache-hit share of billed prompt-side input.
57
57
  * @param usage - cumulative token totals.
58
- * @returns rounded integer percent, or null when no input was billed.
58
+ * @returns percent rounded to one decimal place, or null when no input was billed.
59
59
  */
60
60
  export function cacheHitPercent(usage: TranscriptStats['usage']): number | null {
61
61
  return usage.inputTokens === 0
62
62
  ? null
63
- : Math.round(usage.cacheReadTokens / usage.inputTokens * 100)
63
+ : Math.round(usage.cacheReadTokens / usage.inputTokens * 1_000) / 10
64
64
  }
65
65
 
66
66
  /**
@@ -162,7 +162,7 @@ export function mergeSessionTitles(
162
162
  const titles = new Map<string, string>()
163
163
  for (const observation of observations) {
164
164
  if (observation.status !== 'fulfilled') continue
165
- const title = observation.value?.title?.title ?? observation.value?.title?.text
165
+ const title = observation.value?.title?.title
166
166
  if (title !== undefined && title.trim() !== '') titles.set(observation.sessionId, title)
167
167
  }
168
168
  return rows.map(row => titles.has(row.id) ? { ...row, title: titles.get(row.id) } : row)