@linxin666/dsh-liangshen 0.4.2 → 0.4.4
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.i18n.yaml +2 -2
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/lib/client.js +144 -9
- package/lib/client.js.map +1 -1
- package/lib/index.js +125 -13
- package/lib/types/client/index.d.ts +38 -6
- package/lib/types/client/settings-entry-form.d.ts +49 -0
- package/lib/types/mount-once.d.ts +38 -7
- package/package.json +15 -15
- package/src/announce.test.ts +77 -3
- package/src/client/index.ts +58 -15
- package/src/client/settings-entry-form.ts +142 -0
- package/src/index.ts +41 -1
- package/src/mount-once.ts +107 -13
- package/tools/analyze-session.mjs +19 -0
- package/tools/benchmark-live-run.mjs +141 -25
- package/tools/benchmark-report.mjs +32 -9
- package/tools/prices/deepseek-flash.json +14 -0
- package/tools/tasks/liangshen-v41-flash.json +49 -1
|
@@ -27,7 +27,13 @@
|
|
|
27
27
|
*
|
|
28
28
|
* Usage:
|
|
29
29
|
* node tools/benchmark-live-run.mjs --variant B [--timeout 300000] [--keep]
|
|
30
|
-
* node tools/benchmark-live-run.mjs --tasks tools/tasks/liangshen-v41-flash.json --groups B,P,T,N,M --repeat 3 --max-sessions 60 --budget-
|
|
30
|
+
* node tools/benchmark-live-run.mjs --tasks tools/tasks/liangshen-v41-flash.json --groups B,P,T,N,M --repeat 3 --max-sessions 60 --budget-cny 10 --prices tools/prices/deepseek-flash.json --out .benchmark-results
|
|
31
|
+
*
|
|
32
|
+
* Cost is CNY: DeepSeek bills in CNY, and the published row the route prices at
|
|
33
|
+
* is quoted in CNY per million tokens (cache hit / cache miss / output) off-peak,
|
|
34
|
+
* doubled while peaking. A run reads an explicit price book, so the budget gate
|
|
35
|
+
* and the report's cost column share one source of truth instead of a conversion
|
|
36
|
+
* factor living in a reader's head.
|
|
31
37
|
*/
|
|
32
38
|
|
|
33
39
|
import { execFileSync, spawn } from 'node:child_process'
|
|
@@ -373,6 +379,24 @@ export function summarizeUsage(events) {
|
|
|
373
379
|
return { ...totals, uncachedInputTokens: totals.inputTokens }
|
|
374
380
|
}
|
|
375
381
|
|
|
382
|
+
/**
|
|
383
|
+
* The tool names that mutate a workspace. The first one in a session's call order
|
|
384
|
+
* marks the moment the model stopped inspecting and started writing; how many
|
|
385
|
+
* inspections precede it is the "did it verify before acting" guardrail.
|
|
386
|
+
*/
|
|
387
|
+
const WRITE_TOOL_NAMES = new Set(['write', 'edit', 'str_replace_editor', 'apply_patch'])
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* A provider transport failure recorded as a tool result: the workspace never
|
|
391
|
+
* reached the destination, so the call is evidence about the network rather than
|
|
392
|
+
* about the model's behaviour. Reading a fact the workspace cannot fetch must
|
|
393
|
+
* stay distinguishable from a model that guessed instead of looking.
|
|
394
|
+
*/
|
|
395
|
+
function isTransportFailure(event) {
|
|
396
|
+
const code = event?.data?.error?.code
|
|
397
|
+
return typeof code === 'string' && code.startsWith('WEB_')
|
|
398
|
+
}
|
|
399
|
+
|
|
376
400
|
/**
|
|
377
401
|
* Read one session log into the evidence the comparison actually needs.
|
|
378
402
|
*
|
|
@@ -422,6 +446,27 @@ export function summarizeSession(logPath) {
|
|
|
422
446
|
}
|
|
423
447
|
}
|
|
424
448
|
|
|
449
|
+
// Model-issued research calls, counted per call name so a run reports how much
|
|
450
|
+
// it verified rather than only what it produced, plus the plain "did it look
|
|
451
|
+
// before it wrote" guardrail we-need measured (30 -> 6 inspections).
|
|
452
|
+
const researchCallsByName = {}
|
|
453
|
+
for (const name of ['web_search', 'web_fetch']) {
|
|
454
|
+
researchCallsByName[name] = toolCallsByName[name] ?? 0
|
|
455
|
+
}
|
|
456
|
+
const callOrder = events.filter((event) => event.type === 'tool/call').map((event) => event.data?.name)
|
|
457
|
+
const firstWriteIndex = callOrder.findIndex((name) => WRITE_TOOL_NAMES.has(name))
|
|
458
|
+
const inspectionsBeforeFirstWrite = firstWriteIndex === -1 ? callOrder.length : firstWriteIndex
|
|
459
|
+
|
|
460
|
+
const toolFailureCodes = {}
|
|
461
|
+
for (const event of events) {
|
|
462
|
+
if (event.type !== 'tool/result' || event.data?.error === undefined) continue
|
|
463
|
+
const code = event.data.error.code ?? event.data.error.name ?? 'unknown'
|
|
464
|
+
toolFailureCodes[code] = (toolFailureCodes[code] ?? 0) + 1
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const toolResults = events.filter((event) => event.type === 'tool/result')
|
|
468
|
+
const transportFailures = toolResults.filter(isTransportFailure).length
|
|
469
|
+
|
|
425
470
|
return {
|
|
426
471
|
requests,
|
|
427
472
|
prompts,
|
|
@@ -429,7 +474,16 @@ export function summarizeSession(logPath) {
|
|
|
429
474
|
ptcDispatches: events.filter((event) => event.type === 'tool/ptc-dispatch').length,
|
|
430
475
|
toolCalls: events.filter((event) => event.type === 'tool/call').length,
|
|
431
476
|
toolCallsByName,
|
|
432
|
-
toolErrors:
|
|
477
|
+
toolErrors: toolResults.filter((event) => event.data?.error !== undefined).length,
|
|
478
|
+
// Transport failures are a subset of tool errors: subtract them to get the
|
|
479
|
+
// failures the model itself caused.
|
|
480
|
+
modelToolErrors: toolResults.filter((event) => event.data?.error !== undefined && !isTransportFailure(event)).length,
|
|
481
|
+
transportFailures,
|
|
482
|
+
toolFailureCodes,
|
|
483
|
+
researchCalls: researchCallsByName.web_search + researchCallsByName.web_fetch,
|
|
484
|
+
researchCallsByName,
|
|
485
|
+
firstWriteIndex,
|
|
486
|
+
inspectionsBeforeFirstWrite,
|
|
433
487
|
approvalsAsked: events.filter((event) => event.type === 'approval/asked').length,
|
|
434
488
|
humanInterventions: toolCallsByName.ask_user_question ?? 0,
|
|
435
489
|
}
|
|
@@ -452,6 +506,13 @@ const EMPTY_EVIDENCE = {
|
|
|
452
506
|
toolCalls: 0,
|
|
453
507
|
toolCallsByName: {},
|
|
454
508
|
toolErrors: 0,
|
|
509
|
+
modelToolErrors: 0,
|
|
510
|
+
transportFailures: 0,
|
|
511
|
+
toolFailureCodes: {},
|
|
512
|
+
researchCalls: 0,
|
|
513
|
+
researchCallsByName: { web_search: 0, web_fetch: 0 },
|
|
514
|
+
firstWriteIndex: -1,
|
|
515
|
+
inspectionsBeforeFirstWrite: 0,
|
|
455
516
|
approvalsAsked: 0,
|
|
456
517
|
humanInterventions: 0,
|
|
457
518
|
}
|
|
@@ -465,6 +526,41 @@ function gitValue(args) {
|
|
|
465
526
|
}
|
|
466
527
|
}
|
|
467
528
|
|
|
529
|
+
/**
|
|
530
|
+
* The version token in a command's output, or null. The `dsh` shim is a
|
|
531
|
+
* Windows command script, so spawning it wraps the arguments in a second quoting
|
|
532
|
+
* layer and cmd.exe answers with its own "is not recognized" text on stderr; a
|
|
533
|
+
* bare "first non-empty line" would record that error text as the baseline's
|
|
534
|
+
* harness version. Only a version triple is accepted, and only the triple is
|
|
535
|
+
* returned, so a program prefix cannot make two identical installs compare
|
|
536
|
+
* unequal in the report's baseline identity.
|
|
537
|
+
*/
|
|
538
|
+
export function versionLine(text) {
|
|
539
|
+
const match = String(text ?? '').match(/\bv?\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?/)
|
|
540
|
+
return match === null ? null : match[0]
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* The version of the CLI package the `dsh` command on PATH belongs to. It is
|
|
545
|
+
* the fallback that keeps a baseline honest on hosts where spawning the shim
|
|
546
|
+
* cannot answer, and the same resolution walk `officialMinimalPresetPatch`
|
|
547
|
+
* uses: realpath first, because createRequire derives module paths from the
|
|
548
|
+
* literal filename and the PATH shim sits outside the install tree.
|
|
549
|
+
*/
|
|
550
|
+
function shimPackageVersion() {
|
|
551
|
+
for (const shim of dshCommands()) {
|
|
552
|
+
try {
|
|
553
|
+
const fromShim = createRequire(realpathSync(shim))
|
|
554
|
+
const manifest = readFileSync(fromShim.resolve('@deepseek-ai/dsh/package.json'), 'utf8')
|
|
555
|
+
const version = JSON.parse(manifest).version
|
|
556
|
+
if (typeof version === 'string' && version !== '') return version
|
|
557
|
+
} catch {
|
|
558
|
+
// A stale PATH entry must not hide a resolvable install further down.
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
return null
|
|
562
|
+
}
|
|
563
|
+
|
|
468
564
|
/** The installed CLI version, read without touching the running DSH service. */
|
|
469
565
|
async function dshVersion() {
|
|
470
566
|
const spec = process.platform === 'win32'
|
|
@@ -472,11 +568,12 @@ async function dshVersion() {
|
|
|
472
568
|
: { command: 'dsh', args: ['--version'] }
|
|
473
569
|
try {
|
|
474
570
|
const result = await spawnCaptured(spec.command, spec.args, {}, 15000)
|
|
475
|
-
const line =
|
|
476
|
-
|
|
571
|
+
const line = versionLine(result.stdout) ?? versionLine(result.stderr)
|
|
572
|
+
if (line !== null) return line
|
|
477
573
|
} catch {
|
|
478
|
-
|
|
574
|
+
// Fall through to the package the shim resolves to.
|
|
479
575
|
}
|
|
576
|
+
return shimPackageVersion()
|
|
480
577
|
}
|
|
481
578
|
|
|
482
579
|
/**
|
|
@@ -555,10 +652,24 @@ function isRate(value) {
|
|
|
555
652
|
return typeof value === 'number' && Number.isFinite(value) && value >= 0
|
|
556
653
|
}
|
|
557
654
|
|
|
655
|
+
/** The key a price table is read by for one route. */
|
|
656
|
+
export function routePriceKey(route) {
|
|
657
|
+
return route.provider + '/' + route.model
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* The route-keyed rate table a price book carries: either the book's `prices`
|
|
662
|
+
* object, or the book itself when a caller passes a table directly.
|
|
663
|
+
*/
|
|
664
|
+
export function resolvePriceTable(book) {
|
|
665
|
+
if (book === null || book === undefined) return undefined
|
|
666
|
+
return typeof book === 'object' && typeof book.prices === 'object' && book.prices !== null ? book.prices : book
|
|
667
|
+
}
|
|
668
|
+
|
|
558
669
|
/** The price entry a route resolves to, keyed "provider/model" or by bare model. */
|
|
559
670
|
export function routePrices(prices, route) {
|
|
560
671
|
if (prices === null || prices === undefined) return undefined
|
|
561
|
-
return prices[route
|
|
672
|
+
return prices[routePriceKey(route)] ?? prices[route.model]
|
|
562
673
|
}
|
|
563
674
|
|
|
564
675
|
/**
|
|
@@ -578,11 +689,15 @@ export function assertPriceEntry(entry, routeKey) {
|
|
|
578
689
|
}
|
|
579
690
|
}
|
|
580
691
|
|
|
581
|
-
/**
|
|
692
|
+
/**
|
|
693
|
+
* Estimated cost, in the price book's own currency, for one run's usage under an
|
|
694
|
+
* optional per-million rate table. Cache writes bill at the cache-miss rate when
|
|
695
|
+
* the book names none, which is how the published DeepSeek rows read.
|
|
696
|
+
*/
|
|
582
697
|
export function priceRun(usage, prices, route) {
|
|
583
698
|
const entry = routePrices(prices, route)
|
|
584
699
|
if (entry === undefined) return null
|
|
585
|
-
assertPriceEntry(entry, route
|
|
700
|
+
assertPriceEntry(entry, routePriceKey(route))
|
|
586
701
|
const cost = (tokens, perMillion) => ((countOf(tokens) ?? 0) / 1_000_000) * perMillion
|
|
587
702
|
return cost(usage.uncachedInputTokens, entry.input)
|
|
588
703
|
+ cost(usage.outputTokens, entry.output)
|
|
@@ -780,20 +895,20 @@ export async function runLiveSuite(options) {
|
|
|
780
895
|
const corpus = options.tasks
|
|
781
896
|
const repeat = options.repeat ?? 3
|
|
782
897
|
const maxSessions = options.maxSessions ?? Number.POSITIVE_INFINITY
|
|
783
|
-
const
|
|
898
|
+
const budget = options.budgetCny ?? Number.POSITIVE_INFINITY
|
|
784
899
|
const timeoutMs = options.timeoutMs ?? 300000
|
|
785
|
-
const prices = options.prices ?? null
|
|
900
|
+
const prices = resolvePriceTable(options.prices) ?? null
|
|
786
901
|
|
|
787
|
-
const routeKey = FIXED_ROUTE
|
|
902
|
+
const routeKey = routePriceKey(FIXED_ROUTE)
|
|
788
903
|
const routePrice = routePrices(prices, FIXED_ROUTE)
|
|
789
904
|
// A budget gate that cannot price a run would silently never trigger, which is
|
|
790
905
|
// exactly the unbounded spend the plan forbids; validate instead of pretending.
|
|
791
906
|
if (routePrice !== undefined) assertPriceEntry(routePrice, routeKey)
|
|
792
|
-
if (Number.isFinite(
|
|
793
|
-
throw new Error('benchmark: --budget-
|
|
907
|
+
if (Number.isFinite(budget) && routePrice === undefined) {
|
|
908
|
+
throw new Error('benchmark: --budget-cny needs a price entry for ' + routeKey + '; pass --prices <file>')
|
|
794
909
|
}
|
|
795
|
-
if (!Number.isFinite(maxSessions) && !Number.isFinite(
|
|
796
|
-
process.stderr.write('benchmark: no --max-sessions or --budget-
|
|
910
|
+
if (!Number.isFinite(maxSessions) && !Number.isFinite(budget)) {
|
|
911
|
+
process.stderr.write('benchmark: no --max-sessions or --budget-cny bound was given; the matrix will run to the end of the corpus\n')
|
|
797
912
|
}
|
|
798
913
|
|
|
799
914
|
const baseline = await collectBaseline()
|
|
@@ -802,13 +917,13 @@ export async function runLiveSuite(options) {
|
|
|
802
917
|
groups,
|
|
803
918
|
repeat,
|
|
804
919
|
maxSessions: Number.isFinite(maxSessions) ? maxSessions : null,
|
|
805
|
-
|
|
920
|
+
budgetCny: Number.isFinite(budget) ? budget : null,
|
|
806
921
|
priced: routePrice !== undefined,
|
|
807
922
|
}
|
|
808
923
|
|
|
809
924
|
const runs = []
|
|
810
925
|
let sessions = 0
|
|
811
|
-
let
|
|
926
|
+
let estimatedCostCny = 0
|
|
812
927
|
let stopReason = 'completed'
|
|
813
928
|
|
|
814
929
|
for (const group of groups) {
|
|
@@ -820,7 +935,7 @@ export async function runLiveSuite(options) {
|
|
|
820
935
|
const task = step.task
|
|
821
936
|
const repetition = step.repetition
|
|
822
937
|
if (sessions >= maxSessions) { stopReason = 'session-limit'; break outer }
|
|
823
|
-
if (
|
|
938
|
+
if (estimatedCostCny >= budget) { stopReason = 'budget-limit'; break outer }
|
|
824
939
|
const run = await runLiveCase({
|
|
825
940
|
variant: group,
|
|
826
941
|
task,
|
|
@@ -830,20 +945,21 @@ export async function runLiveSuite(options) {
|
|
|
830
945
|
keep: options.keep === true,
|
|
831
946
|
})
|
|
832
947
|
sessions += 1
|
|
833
|
-
const
|
|
834
|
-
if (
|
|
835
|
-
const record = { baseline,
|
|
948
|
+
const costCny = priceRun(run.usage, prices, FIXED_ROUTE)
|
|
949
|
+
if (costCny !== null) estimatedCostCny += costCny
|
|
950
|
+
const record = { baseline, costCny, ...run }
|
|
836
951
|
const file = join(outDir, 'live-' + group + '-' + task.id + '-r' + repetition + '.json')
|
|
837
952
|
writeFileSync(file, JSON.stringify(record, null, 2))
|
|
838
|
-
runs.push({ file, group, taskId: task.id, repetition, passed: run.passed,
|
|
839
|
-
process.stdout.write(group + ' ' + task.id + ' r' + repetition + ': ' + (run.passed === true ? 'pass' : run.passed === false ? 'fail' : 'n/a') + ' in ' + run.durationMs + 'ms' + (
|
|
953
|
+
runs.push({ file, group, taskId: task.id, repetition, passed: run.passed, costCny })
|
|
954
|
+
process.stdout.write(group + ' ' + task.id + ' r' + repetition + ': ' + (run.passed === true ? 'pass' : run.passed === false ? 'fail' : 'n/a') + ' in ' + run.durationMs + 'ms' + (costCny === null ? '' : ' CNY ' + costCny.toFixed(4)) + '\n')
|
|
840
955
|
}
|
|
841
956
|
|
|
842
957
|
const suite = {
|
|
843
958
|
baseline,
|
|
844
959
|
stopReason,
|
|
845
960
|
sessions,
|
|
846
|
-
|
|
961
|
+
// Cost is recorded in the price book's currency; the book is CNY.
|
|
962
|
+
estimatedCostCny: prices === null ? null : estimatedCostCny,
|
|
847
963
|
runs,
|
|
848
964
|
}
|
|
849
965
|
writeFileSync(join(outDir, 'suite.json'), JSON.stringify(suite, null, 2))
|
|
@@ -870,7 +986,7 @@ if (isMain) {
|
|
|
870
986
|
groups: read('--groups', undefined)?.split(',').map((entry) => entry.trim()).filter(Boolean),
|
|
871
987
|
repeat: Number(read('--repeat', '3')),
|
|
872
988
|
maxSessions: Number(read('--max-sessions', '0')) > 0 ? Number(read('--max-sessions', '0')) : Number.POSITIVE_INFINITY,
|
|
873
|
-
|
|
989
|
+
budgetCny: Number(read('--budget-cny', '0')) > 0 ? Number(read('--budget-cny', '0')) : Number.POSITIVE_INFINITY,
|
|
874
990
|
timeoutMs,
|
|
875
991
|
prices: pricesPath === undefined ? null : JSON.parse(readFileSync(pricesPath, 'utf8')),
|
|
876
992
|
keep: args.includes('--keep'),
|
|
@@ -69,11 +69,21 @@ function sumOf(entries, pick) {
|
|
|
69
69
|
return entries.reduce((total, entry) => total + (pick(entry) ?? 0), 0)
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* A sum over the records that actually carry the field. A directory written by an
|
|
74
|
+
* older runner carries no such field at all, and reporting 0 for it would read as
|
|
75
|
+
* a measured zero (no research calls, no model mistakes) rather than as unmeasured.
|
|
76
|
+
*/
|
|
77
|
+
function sumIfPresent(entries, pick) {
|
|
78
|
+
const present = entries.map(pick).filter((value) => typeof value === 'number' && Number.isFinite(value))
|
|
79
|
+
return present.length === 0 ? null : present.reduce((total, value) => total + value, 0)
|
|
80
|
+
}
|
|
81
|
+
|
|
72
82
|
function costOf(entries) {
|
|
73
83
|
let total = 0
|
|
74
84
|
let priced = 0
|
|
75
85
|
for (const entry of entries) {
|
|
76
|
-
if (typeof entry.
|
|
86
|
+
if (typeof entry.costCny === 'number' && Number.isFinite(entry.costCny)) { total += entry.costCny; priced += 1 }
|
|
77
87
|
}
|
|
78
88
|
return priced === 0 ? null : total
|
|
79
89
|
}
|
|
@@ -106,9 +116,17 @@ export function aggregateGroups(runs) {
|
|
|
106
116
|
durationMs: sumOf(entries, (run) => run.durationMs),
|
|
107
117
|
toolCalls: sumOf(entries, (run) => run.toolCalls),
|
|
108
118
|
toolErrors: sumOf(entries, (run) => run.toolErrors),
|
|
119
|
+
// Transport failures are the subset of tool errors the workspace caused by
|
|
120
|
+
// being unable to reach a host; only the remainder is the model's own.
|
|
121
|
+
modelToolErrors: sumIfPresent(entries, (run) => run.modelToolErrors),
|
|
122
|
+
transportFailures: sumIfPresent(entries, (run) => run.transportFailures),
|
|
123
|
+
researchCalls: sumIfPresent(entries, (run) => run.researchCalls),
|
|
124
|
+
inspectionsBeforeFirstWrite: meanConfidenceInterval(
|
|
125
|
+
entries.map((run) => run.inspectionsBeforeFirstWrite).filter((value) => typeof value === 'number'),
|
|
126
|
+
),
|
|
109
127
|
humanInterventions: sumOf(entries, (run) => run.humanInterventions),
|
|
110
128
|
approvalAsks: sumOf(entries, (run) => run.approvalsAsked),
|
|
111
|
-
|
|
129
|
+
estimatedCostCny: costOf(entries),
|
|
112
130
|
}
|
|
113
131
|
}
|
|
114
132
|
return groups
|
|
@@ -273,8 +291,8 @@ export function renderMarkdown(report) {
|
|
|
273
291
|
}
|
|
274
292
|
lines.push('## Group results')
|
|
275
293
|
lines.push('')
|
|
276
|
-
lines.push('| Group | Sessions | Graded | Passed | Success rate (95% CI) | Infra failures | Timeouts | Input tokens | Output tokens | Cache read | Tool calls |
|
|
277
|
-
lines.push('| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |')
|
|
294
|
+
lines.push('| Group | Sessions | Graded | Passed | Success rate (95% CI) | Infra failures | Timeouts | Input tokens | Output tokens | Cache read | Tool calls | Model tool errors | Transport failures | Research calls | Inspections before first write (mean) | Interventions | Cost CNY |')
|
|
295
|
+
lines.push('| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |')
|
|
278
296
|
for (const group of GROUP_ORDER) {
|
|
279
297
|
const stats = report.groups[group]
|
|
280
298
|
if (stats === undefined) continue
|
|
@@ -290,9 +308,12 @@ export function renderMarkdown(report) {
|
|
|
290
308
|
stats.outputTokens,
|
|
291
309
|
stats.cacheReadTokens,
|
|
292
310
|
stats.toolCalls,
|
|
293
|
-
stats.
|
|
311
|
+
stats.modelToolErrors ?? 'n/a',
|
|
312
|
+
stats.transportFailures ?? 'n/a',
|
|
313
|
+
stats.researchCalls ?? 'n/a',
|
|
314
|
+
stats.inspectionsBeforeFirstWrite === null ? 'n/a' : stats.inspectionsBeforeFirstWrite.mean.toFixed(1),
|
|
294
315
|
stats.humanInterventions,
|
|
295
|
-
stats.
|
|
316
|
+
stats.estimatedCostCny === null ? 'n/a' : stats.estimatedCostCny.toFixed(4),
|
|
296
317
|
].join(' | ') + ' |')
|
|
297
318
|
}
|
|
298
319
|
lines.push('')
|
|
@@ -302,8 +323,8 @@ export function renderMarkdown(report) {
|
|
|
302
323
|
lines.push('| --- | --- | --- | --- |')
|
|
303
324
|
const purposes = {
|
|
304
325
|
'B-P': 'isolates the persona change',
|
|
305
|
-
'P-T': '
|
|
306
|
-
'T-N': 'compares PTC against native
|
|
326
|
+
'P-T': "compares the 'both' presentation against 'ptc'",
|
|
327
|
+
'T-N': 'compares the PTC transport against the native roster',
|
|
307
328
|
'B-M': 'external reference, not single-factor attribution',
|
|
308
329
|
}
|
|
309
330
|
for (const comparison of report.comparisons) {
|
|
@@ -324,7 +345,9 @@ export function renderMarkdown(report) {
|
|
|
324
345
|
lines.push('- The report reads only the run records listed in the suite index and rejects a directory whose runs disagree on commit, preset hash, route, or task revision.')
|
|
325
346
|
lines.push('- Group M is the bundle-provided Minimal preset as an external reference; it is not a single-factor arm.')
|
|
326
347
|
lines.push('- Group N is the full native roster, not Minimal and not a curated minimal toolset.')
|
|
327
|
-
lines.push('-
|
|
348
|
+
lines.push('- Model tool errors exclude transport failures: a run that cannot reach a host is evidence about the network, not about the model, so the two are reported side by side.')
|
|
349
|
+
lines.push('- Cost is the price book currency (CNY), not USD: the route bills in CNY and the published row is quoted per million CNY.')
|
|
350
|
+
lines.push('- Language-style counters (we and let me) stay with tools/analyze-session.mjs, which needs reasoning text the durable log does not always carry; those counters are not part of the outcome measures here.')
|
|
328
351
|
lines.push('- A small sample screens a direction; it does not claim a stable improvement. Widen the sample within the stated budget before concluding.')
|
|
329
352
|
lines.push('')
|
|
330
353
|
return lines.join('\n')
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"currency": "CNY",
|
|
3
|
+
"unit": "per-million-tokens",
|
|
4
|
+
"effectiveDate": "2026-09-10T12:00:00+08:00",
|
|
5
|
+
"note": "DeepSeek published row for the route every LiangShen comparison runs on. Off-peak values; the published peak is exactly double, so a peak-hour run understates its own cost by 2x. Cache writes bill at the cache-miss rate when no separate rate is published.",
|
|
6
|
+
"prices": {
|
|
7
|
+
"deepseek-official/deepseek-flash": {
|
|
8
|
+
"input": 1,
|
|
9
|
+
"output": 4,
|
|
10
|
+
"cacheRead": 0.02,
|
|
11
|
+
"cacheWrite": 1
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "liangshen-v41-flash-seed",
|
|
3
3
|
"version": 1,
|
|
4
|
-
"description": "Seed task corpus for the LiangShen V4.1 Flash comparison. Covers code repair, first-turn specialized tools, multi-turn edits, failure recovery, and workspace-
|
|
4
|
+
"description": "Seed task corpus for the LiangShen V4.1 Flash comparison. Covers code repair, first-turn specialized tools, multi-turn edits, failure recovery, workspace-instruction compliance, and external verification (facts published outside the workspace, so a run that guesses instead of looking is measurable, plus workspace-local authority facts that keep the guardrail independent of network reachability). Extend to 20-30 tasks before the main run.",
|
|
5
5
|
"tasks": [
|
|
6
6
|
{
|
|
7
7
|
"id": "repair-mean",
|
|
@@ -122,6 +122,54 @@
|
|
|
122
122
|
"Create the configuration module described by the workspace rules, exporting const port = 3000. Follow AGENTS.md. Then reply DONE and stop."
|
|
123
123
|
],
|
|
124
124
|
"check": "const fs = await import('node:fs'); if (fs.existsSync('config.js')) throw new Error('config.js must not exist'); if (!fs.existsSync('config.mjs')) throw new Error('config.mjs missing'); const m = await import('./config.mjs'); if (m.port !== 3000) throw new Error('port = ' + m.port)"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"id": "research-http-6585",
|
|
128
|
+
"category": "external-verification",
|
|
129
|
+
"turns": [
|
|
130
|
+
"Create status.json whose keys are exactly the four HTTP status codes defined by RFC 6585, each mapped to the reason phrase that RFC names. Look the RFC up; do not answer from memory. Then reply DONE and stop."
|
|
131
|
+
],
|
|
132
|
+
"check": "const fs = await import('node:fs'); const got = JSON.parse(fs.readFileSync('status.json','utf8')); const want = {\"428\":\"Precondition Required\",\"429\":\"Too Many Requests\",\"431\":\"Request Header Fields Too Large\",\"511\":\"Network Authentication Required\"}; const keys = Object.keys(got).sort(); const wkeys = Object.keys(want).sort(); if (JSON.stringify(keys) !== JSON.stringify(wkeys)) throw new Error('keys = ' + JSON.stringify(keys)); for (const k of wkeys) { if (String(got[k]).trim().toLowerCase() !== want[k].toLowerCase()) throw new Error(k + ' = ' + JSON.stringify(got[k])) }"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"id": "research-safe-methods",
|
|
136
|
+
"category": "external-verification",
|
|
137
|
+
"turns": [
|
|
138
|
+
"Create safe.txt listing, one per line and in the order RFC 9110 Section 9.2.1 presents them, every HTTP method that section defines as safe. Look the RFC up; do not answer from memory. Then reply DONE and stop."
|
|
139
|
+
],
|
|
140
|
+
"check": "const fs = await import('node:fs'); const got = fs.readFileSync('safe.txt','utf8').split(/\\r?\\n/).map((l) => l.trim().toLowerCase()).filter((l) => l !== ''); const want = ['get','head','options','trace']; if (JSON.stringify(got) !== JSON.stringify(want)) throw new Error('safe = ' + JSON.stringify(got))"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"id": "research-semver-precedence",
|
|
144
|
+
"category": "external-verification",
|
|
145
|
+
"turns": [
|
|
146
|
+
"Create order.json holding a JSON array of these version strings sorted in ascending SemVer 2.0.0 precedence order: 1.0.0-rc.1, 1.0.0-beta.11, 1.0.0, 1.0.0-alpha.beta, 1.0.0-alpha, 1.0.0-beta.2, 1.0.0-alpha.1, 1.0.0-beta. Follow the specification rather than intuition. Then reply DONE and stop."
|
|
147
|
+
],
|
|
148
|
+
"check": "const fs = await import('node:fs'); const got = JSON.parse(fs.readFileSync('order.json','utf8')); const want = [\"1.0.0-alpha\",\"1.0.0-alpha.1\",\"1.0.0-alpha.beta\",\"1.0.0-beta\",\"1.0.0-beta.2\",\"1.0.0-beta.11\",\"1.0.0-rc.1\",\"1.0.0\"]; if (JSON.stringify(got) !== JSON.stringify(want)) throw new Error('order = ' + JSON.stringify(got))"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"id": "research-local-authority",
|
|
152
|
+
"category": "external-verification",
|
|
153
|
+
"files": {
|
|
154
|
+
"SPEC.md": "# Widget protocol\n\nA widget frame carries three fields, in this order:\n\n1. `id` - a decimal integer, required.\n2. `flags` - a bitfield. Bit 2 (value 4) means `drained`.\n3. `payload` - UTF-8 bytes, optional.\n\nThe frame terminator is the two bytes `0x1E 0x1F`, not a newline.\n",
|
|
155
|
+
"encode.mjs": "export function encode(frame) {\n return JSON.stringify(frame) + '\\n'\n}\n"
|
|
156
|
+
},
|
|
157
|
+
"turns": [
|
|
158
|
+
"SPEC.md in this workspace defines the widget wire format. Fix encode.mjs so it matches that specification exactly. Read the specification rather than guessing. Then reply DONE and stop."
|
|
159
|
+
],
|
|
160
|
+
"check": "const fs = await import('node:fs'); const m = await import('./encode.mjs'); const out = m.encode({ id: 7, flags: 4, payload: 'x' }); if (typeof out !== 'string') throw new Error('not a string'); if (!out.startsWith('{\"id\":7')) throw new Error('field order or shape wrong: ' + out); if (!out.includes('\"flags\":4')) throw new Error('flags missing: ' + out); if (!out.endsWith('\\u001e\\u001f')) throw new Error('terminator is not 0x1E 0x1F: ' + JSON.stringify(out.slice(-4)))"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"id": "research-local-authority-negated",
|
|
164
|
+
"category": "external-verification",
|
|
165
|
+
"files": {
|
|
166
|
+
"AGENTS.md": "# Workspace rules\n\nThe wire terminator is NOT a newline. It is the two bytes 0x1E 0x1F.\n",
|
|
167
|
+
"encode.mjs": "export function encode(frame) {\n return JSON.stringify(frame)\n}\n"
|
|
168
|
+
},
|
|
169
|
+
"turns": [
|
|
170
|
+
"The workspace rules in AGENTS.md describe how frames end. Fix encode.mjs so it follows them. Then reply DONE and stop."
|
|
171
|
+
],
|
|
172
|
+
"check": "const m = await import('./encode.mjs'); const out = m.encode({ id: 1 }); if (!out.endsWith('\\u001e\\u001f')) throw new Error('terminator wrong: ' + JSON.stringify(out.slice(-4)))"
|
|
125
173
|
}
|
|
126
174
|
]
|
|
127
175
|
}
|