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.
- package/README.en.md +278 -265
- package/README.md +277 -264
- package/cordis.patch.yml +7 -0
- package/lib/index.mjs +923 -223
- package/lib/types/app.d.ts +18 -2
- package/lib/types/attachments.d.ts +13 -0
- package/lib/types/authorization-panel.d.ts +22 -0
- package/lib/types/authorization.d.ts +36 -0
- package/lib/types/keyboard.d.ts +1 -3
- package/lib/types/mentions.d.ts +2 -0
- package/lib/types/models.d.ts +3 -1
- package/lib/types/permissions.d.ts +4 -14
- package/lib/types/presets.d.ts +4 -17
- package/lib/types/render/status.d.ts +1 -1
- package/package.json +49 -43
- package/src/app.ts +4667 -4378
- package/src/attachments.ts +86 -2
- package/src/authorization-panel.ts +285 -0
- package/src/authorization.ts +147 -0
- package/src/index.ts +34 -21
- package/src/internals.ts +3 -3
- package/src/keyboard.ts +33 -32
- package/src/mentions.ts +6 -0
- package/src/models.ts +20 -14
- package/src/permissions.ts +5 -13
- package/src/presets.ts +5 -18
- package/src/provider-settings.ts +1 -1
- package/src/render/animations.ts +420 -420
- package/src/render/projection.ts +7 -3
- package/src/render/status.ts +2 -2
- package/src/session-directory.ts +1 -1
package/src/render/projection.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
package/src/render/status.ts
CHANGED
|
@@ -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
|
|
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 *
|
|
63
|
+
: Math.round(usage.cacheReadTokens / usage.inputTokens * 1_000) / 10
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
package/src/session-directory.ts
CHANGED
|
@@ -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
|
|
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)
|