dsh-llm-verifier 0.1.10 → 0.1.11
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/lib/index.js +1 -1
- package/lib/types/index.js +4 -1
- package/package.json +9 -9
- package/src/index.ts +5 -2
- package/src/statistics.test.ts +12 -0
package/lib/index.js
CHANGED
|
@@ -2019,7 +2019,7 @@ function apply(ctx, config = {}) {
|
|
|
2019
2019
|
...sessionId ? { sessionId } : {}
|
|
2020
2020
|
};
|
|
2021
2021
|
try {
|
|
2022
|
-
const headers = (await services.sessionPersistence.list()).filter((header) => sessionId === void 0 || String(header.id) === sessionId);
|
|
2022
|
+
const headers = (await services.sessionPersistence.list()).map((item) => item && typeof item === "object" && "header" in item ? item.header : item).filter((header) => header !== void 0 && (sessionId === void 0 || String(header.id) === sessionId));
|
|
2023
2023
|
return rpcSuccess(mergeStatisticsOverviews(await Promise.all(headers.map((header) => topic(header).statistics.overview(query))), query));
|
|
2024
2024
|
} catch (error) {
|
|
2025
2025
|
return rpcFailure(error instanceof Error ? error.message : String(error));
|
package/lib/types/index.js
CHANGED
|
@@ -125,7 +125,10 @@ export function apply(ctx, config = {}) {
|
|
|
125
125
|
const sessionId = typeof row.sessionId === 'string' && row.sessionId.length > 0 ? row.sessionId : undefined;
|
|
126
126
|
const query = { fromMs: numberField(row.fromMs, Number.NaN), toMs: numberField(row.toMs, Number.NaN), timezoneOffsetMinutes: numberField(row.timezoneOffsetMinutes, 0), recentLimit: numberField(row.recentLimit, 40), ...(sessionId ? { sessionId } : {}) };
|
|
127
127
|
try {
|
|
128
|
-
const
|
|
128
|
+
const items = await services.sessionPersistence.list();
|
|
129
|
+
const headers = items
|
|
130
|
+
.map(item => item && typeof item === 'object' && 'header' in item ? item.header : item)
|
|
131
|
+
.filter(header => header !== undefined && (sessionId === undefined || String(header.id) === sessionId));
|
|
129
132
|
const overviews = await Promise.all(headers.map(header => topic(header).statistics.overview(query)));
|
|
130
133
|
const value = mergeStatisticsOverviews(overviews, query);
|
|
131
134
|
return rpcSuccess(value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-llm-verifier",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Configurable DSH-native LLM verifier with a Web settings page",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"@deepseek-ai/cordis": "^4.0.1 || ^4.0.2",
|
|
63
|
-
"@deepseek-ai/dsh-tools": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
64
|
-
"@deepseek-ai/dsh-agent": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
65
|
-
"@deepseek-ai/dsh-session": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
66
|
-
"@deepseek-ai/dsh-llm": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
67
|
-
"@deepseek-ai/dsh-attachment": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
68
|
-
"@deepseek-ai/dsh-settings": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
69
|
-
"@deepseek-ai/dsh-credentials": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2",
|
|
70
|
-
"@deepseek-ai/dsh-client-connection": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2"
|
|
63
|
+
"@deepseek-ai/dsh-tools": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4 || ^0.1.2-alpha.5",
|
|
64
|
+
"@deepseek-ai/dsh-agent": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4 || ^0.1.2-alpha.5",
|
|
65
|
+
"@deepseek-ai/dsh-session": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4 || ^0.1.2-alpha.5",
|
|
66
|
+
"@deepseek-ai/dsh-llm": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4 || ^0.1.2-alpha.5",
|
|
67
|
+
"@deepseek-ai/dsh-attachment": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4 || ^0.1.2-alpha.5",
|
|
68
|
+
"@deepseek-ai/dsh-settings": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4 || ^0.1.2-alpha.5",
|
|
69
|
+
"@deepseek-ai/dsh-credentials": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4 || ^0.1.2-alpha.5",
|
|
70
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.1-rc.2 || ^0.1.2-alpha.1 || ^0.1.2-alpha.2 || ^0.1.2-alpha.3 || ^0.1.2-alpha.4 || ^0.1.2-alpha.5"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"schemastery": "^3.18.0"
|
package/src/index.ts
CHANGED
|
@@ -44,7 +44,7 @@ interface SessionVerificationOptions { fromSeq?: number; toSeq?: number; include
|
|
|
44
44
|
interface SessionVerificationResult { sessionId: string; problem: string; score: number; baselineScore: number; winner: 'A' | 'B' | 'tie'; fromSeq: number; toSeq: number; omittedCharacters: number; calls: number; stats: RunStats }
|
|
45
45
|
|
|
46
46
|
export function apply(ctx: Context, config: Config = {}): void {
|
|
47
|
-
const services = ctx as Context & { attachments: AttachmentStore; connection: HostConnectionHandle; sessionPersistence: SessionArtifactLocator & { list(signal?: AbortSignal): Promise<
|
|
47
|
+
const services = ctx as Context & { attachments: AttachmentStore; connection: HostConnectionHandle; sessionPersistence: SessionArtifactLocator & { list(signal?: AbortSignal): Promise<readonly unknown[]> } }
|
|
48
48
|
const entry = resolveConfig(config)
|
|
49
49
|
let limiter = new RequestLimiter(entry.maxConcurrency)
|
|
50
50
|
const current = installVerifierSettings(ctx, entry, () => { limiter = new RequestLimiter(current().maxConcurrency) })
|
|
@@ -128,7 +128,10 @@ export function apply(ctx: Context, config: Config = {}): void {
|
|
|
128
128
|
const sessionId = typeof row.sessionId === 'string' && row.sessionId.length > 0 ? row.sessionId : undefined
|
|
129
129
|
const query: StatisticsQuery = { fromMs: numberField(row.fromMs, Number.NaN), toMs: numberField(row.toMs, Number.NaN), timezoneOffsetMinutes: numberField(row.timezoneOffsetMinutes, 0), recentLimit: numberField(row.recentLimit, 40), ...(sessionId ? { sessionId } : {}) }
|
|
130
130
|
try {
|
|
131
|
-
const
|
|
131
|
+
const items = await services.sessionPersistence.list()
|
|
132
|
+
const headers: SessionHeader[] = items
|
|
133
|
+
.map(item => item && typeof item === 'object' && 'header' in item ? (item as { header: SessionHeader }).header : item as SessionHeader)
|
|
134
|
+
.filter(header => header !== undefined && (sessionId === undefined || String(header.id) === sessionId))
|
|
132
135
|
const overviews = await Promise.all(headers.map(header => topic(header).statistics.overview(query)))
|
|
133
136
|
const value: StatisticsOverview = mergeStatisticsOverviews(overviews, query)
|
|
134
137
|
return rpcSuccess(value)
|
package/src/statistics.test.ts
CHANGED
|
@@ -65,4 +65,16 @@ describe('StatisticsStore', () => {
|
|
|
65
65
|
const result = await store.overview({ fromMs: 0, toMs: 10 })
|
|
66
66
|
expect(result.recent[0]?.errorMessage).toHaveLength(500)
|
|
67
67
|
})
|
|
68
|
+
|
|
69
|
+
it('normalizes legacy and modern sessionPersistence.list output formats', () => {
|
|
70
|
+
const legacyHeaders = [{ id: 'sess-1', cwd: 'C:\\test' }]
|
|
71
|
+
const modernSnapshots = [{ header: { id: 'sess-2', cwd: 'C:\\test' }, revision: 'rev-1' }]
|
|
72
|
+
const normalize = (items: readonly unknown[]) =>
|
|
73
|
+
items
|
|
74
|
+
.map(item => item && typeof item === 'object' && 'header' in item ? (item as { header: { id: string } }).header : item as { id: string })
|
|
75
|
+
.filter(header => header !== undefined)
|
|
76
|
+
|
|
77
|
+
expect(normalize(legacyHeaders).map(h => h.id)).toEqual(['sess-1'])
|
|
78
|
+
expect(normalize(modernSnapshots).map(h => h.id)).toEqual(['sess-2'])
|
|
79
|
+
})
|
|
68
80
|
})
|