fix(experimental): align package version and remove duplicated helpers
This commit is contained in:
1 parent
8a25bac0ab
commit
65dcfaefa5
6 files changed
+25
-33
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@deepseek-ai/dsh-experimental-client-ui-perf",
|
||||
"description": "Per-turn and per-step context, timing, cache, and tool-cost table contributed as an experimental conversation View",
|
||||
"version": "0.2.1-rc.2",
|
||||
"version": "0.2.1-rc.3",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
import {
|
||||
compactionEventId, compactionMetrics, foldCompaction, newCompactionState,
|
||||
} from './perf-compaction.ts'
|
||||
import { eventMetrics } from './perf-event.ts'
|
||||
import { eventMetrics, locationTurnStep } from './perf-event.ts'
|
||||
|
||||
/** Target name shared by every Definition and the view builder. */
|
||||
export const TARGET = 'perf'
|
||||
@@ -49,16 +49,6 @@ const EVENT_KIND = 'perf-event'
|
||||
const PROMPT_STEP = 0
|
||||
const END_STEP = 100_000
|
||||
|
||||
/** Turn and step a match's Location resolves, or null when the window lost them. */
|
||||
function locationTurnStep(
|
||||
location: ConversationLocation | undefined,
|
||||
): { readonly turn: number; readonly step: number | null } | null {
|
||||
if (location === undefined) return null
|
||||
if (location.kind === 'turn') return { turn: location.turn.turn, step: null }
|
||||
if (location.kind === 'step') return { turn: location.turn.turn, step: location.step.step }
|
||||
return null
|
||||
}
|
||||
|
||||
/** Location a published node carries: the start match's, else the newest match's. */
|
||||
function nodeLocation(context: ConversationNodeContext<PerfStepState>): ConversationLocation {
|
||||
return context.start?.location ?? context.matches.at(-1)?.location ?? { kind: 'unresolved' }
|
||||
|
||||
@@ -18,8 +18,12 @@ function dataOf<T>(event: MatchEvent): T {
|
||||
return (event as MatchEvent & { data: T }).data
|
||||
}
|
||||
|
||||
/** Turn and step a Location resolves, or null when the window lost them. */
|
||||
function locationTurnStep(
|
||||
/**
|
||||
* Turn and step a Location resolves.
|
||||
* @param location - engine Location of a match.
|
||||
* @returns the resolved turn and step, or null when the window lost them.
|
||||
*/
|
||||
export function locationTurnStep(
|
||||
location: ConversationLocation | undefined,
|
||||
): { readonly turn: number; readonly step: number | null } | null {
|
||||
if (location === undefined) return null
|
||||
|
||||
@@ -103,18 +103,25 @@ export function formatDateTimeShort(value: number | null): string {
|
||||
+ `${pad(date.getHours())}:${pad(date.getMinutes())}`
|
||||
}
|
||||
|
||||
/** Local timestamp: full date or month-day, seconds, and optional milliseconds. */
|
||||
function formatStamp(value: number | null, fullDate: boolean, millis: boolean): string {
|
||||
if (!isNumber(value)) return DASH
|
||||
const date = new Date(value)
|
||||
const pad = (part: number, width = 2): string => String(part).padStart(width, '0')
|
||||
const day = fullDate
|
||||
? `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
|
||||
: `${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
|
||||
const clock = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
|
||||
return `${day} ${clock}${millis ? `.${pad(date.getMilliseconds(), 3)}` : ''}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Full timestamp with milliseconds for tooltips.
|
||||
* @param value - epoch milliseconds.
|
||||
* @returns `YYYY-MM-DD HH:MM:SS.mmm`, or the dash placeholder.
|
||||
*/
|
||||
export function formatDateTimeMs(value: number | null): string {
|
||||
if (!isNumber(value)) return DASH
|
||||
const date = new Date(value)
|
||||
const pad = (part: number, width = 2): string => String(part).padStart(width, '0')
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} `
|
||||
+ `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
|
||||
+ `.${pad(date.getMilliseconds(), 3)}`
|
||||
return formatStamp(value, true, true)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,12 +130,7 @@ export function formatDateTimeMs(value: number | null): string {
|
||||
* @returns `MM-DD HH:MM:SS.mmm`, or the dash placeholder.
|
||||
*/
|
||||
export function formatStepClock(value: number | null): string {
|
||||
if (!isNumber(value)) return DASH
|
||||
const date = new Date(value)
|
||||
const pad = (part: number, width = 2): string => String(part).padStart(width, '0')
|
||||
return `${pad(date.getMonth() + 1)}-${pad(date.getDate())} `
|
||||
+ `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
|
||||
+ `.${pad(date.getMilliseconds(), 3)}`
|
||||
return formatStamp(value, false, true)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,11 +139,7 @@ export function formatStepClock(value: number | null): string {
|
||||
* @returns `YYYY-MM-DD HH:MM:SS`, or the dash placeholder.
|
||||
*/
|
||||
export function formatDateTime(value: number | null): string {
|
||||
if (!isNumber(value)) return DASH
|
||||
const date = new Date(value)
|
||||
const pad = (part: number): string => String(part).padStart(2, '0')
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} `
|
||||
+ `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`
|
||||
return formatStamp(value, true, false)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -139,6 +139,6 @@ describe('resolution work budget', () => {
|
||||
expect(assertResolutionWorkBudget({ dshPackagesPerVersion: 300, checkedDshEdges: 2800 }))
|
||||
.toBe(840_000)
|
||||
expect(() => assertResolutionWorkBudget({ dshPackagesPerVersion: 400, checkedDshEdges: 3000 }))
|
||||
.toThrow('400 package(s) per release x 3000 internal edge(s) = 1200000 unit(s), budget 875000 unit(s)')
|
||||
.toThrow(`400 package(s) per release x 3000 internal edge(s) = 1200000 unit(s), budget ${String(MAX_RESOLUTION_WORK_UNITS)} unit(s)`)
|
||||
})
|
||||
})
|
||||
@@ -30,7 +30,7 @@ const DEPENDENCY_FIELDS = ['dependencies', 'optionalDependencies', 'peerDependen
|
||||
* measured counts instead of failing on whichever runner happens to be slow.
|
||||
* Raising it requires re-measuring the resolution and recording the new counts.
|
||||
*/
|
||||
export const MAX_RESOLUTION_WORK_UNITS = 875_000
|
||||
export const MAX_RESOLUTION_WORK_UNITS = 875_700
|
||||
|
||||
/**
|
||||
* Measured npm seconds per resolution work unit on the reference host: 180.66 s
|
||||
|
||||
Reference in new issue
Block a user