dsh-auto-model-routing 0.4.2 → 0.5.0

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +8 -8
  3. package/README.zh.md +8 -8
  4. package/docs/feedback-evaluation.md +4 -4
  5. package/docs/host-capability-report.md +2 -0
  6. package/docs/jev-policy-v2-validation.md +3 -1
  7. package/docs/magpie-live-acceptance.md +2 -0
  8. package/docs/policy-v2-development.md +5 -3
  9. package/docs/policy-v2-real-evaluation-plan.md +2 -0
  10. package/lib/client/control.d.ts +2 -2
  11. package/lib/client/control.js +10 -20
  12. package/lib/client/index.d.ts +0 -1
  13. package/lib/client/index.js +9 -6
  14. package/lib/client/label.d.ts +7 -10
  15. package/lib/client/label.js +17 -30
  16. package/lib/client/settings-section.d.ts +2 -2
  17. package/lib/client/settings-section.js +7 -69
  18. package/lib/client/strategy-details.js +3 -4
  19. package/lib/client.js +165 -481
  20. package/lib/context.d.ts +1 -3
  21. package/lib/context.js +3 -4
  22. package/lib/effort.d.ts +2 -10
  23. package/lib/effort.js +1 -31
  24. package/lib/endpoints.d.ts +11 -10
  25. package/lib/endpoints.js +29 -46
  26. package/lib/feedback.d.ts +60 -7
  27. package/lib/feedback.js +15 -5
  28. package/lib/index.d.ts +4 -0
  29. package/lib/index.js +17 -86
  30. package/lib/jev.d.ts +17 -29
  31. package/lib/jev.js +6 -34
  32. package/lib/policy-host.d.ts +6 -8
  33. package/lib/policy-host.js +39 -38
  34. package/lib/policy-store.d.ts +9 -20
  35. package/lib/policy-store.js +28 -16
  36. package/lib/routing.d.ts +20 -0
  37. package/lib/routing.js +51 -0
  38. package/lib/rubric.json +15 -6
  39. package/lib/settings-contract.d.ts +5 -21
  40. package/lib/settings-contract.js +3 -2
  41. package/lib/settings-host.d.ts +4 -8
  42. package/lib/settings-host.js +9 -10
  43. package/lib/settings-validation.d.ts +1 -7
  44. package/lib/settings-validation.js +0 -51
  45. package/lib/settings.d.ts +3 -8
  46. package/lib/settings.js +18 -177
  47. package/lib/state.d.ts +2 -4
  48. package/lib/state.js +2 -7
  49. package/lib/strategies/claude.d.ts +21 -0
  50. package/lib/strategies/claude.js +8 -0
  51. package/lib/strategies/codex.d.ts +21 -0
  52. package/lib/strategies/codex.js +9 -0
  53. package/lib/strategies/index.d.ts +22 -0
  54. package/lib/strategies/index.js +85 -0
  55. package/lib/strategies/types.d.ts +14 -0
  56. package/lib/strategies/types.js +1 -0
  57. package/lib/subagent-tool.d.ts +7 -7
  58. package/lib/subagent-tool.js +33 -76
  59. package/lib/support.d.ts +7 -8
  60. package/lib/support.js +9 -13
  61. package/lib/usage-report.d.ts +2 -2
  62. package/lib/usage-report.js +25 -17
  63. package/package.json +3 -4
  64. package/skills/auto-model-routing-report/SKILL.md +4 -3
  65. package/skills/subagent-model-routing/SKILL.md +14 -30
  66. package/lib/client/route-picker.d.ts +0 -21
  67. package/lib/client/route-picker.js +0 -75
  68. package/lib/judgements.d.ts +0 -41
  69. package/lib/judgements.js +0 -55
  70. package/lib/policy-v2-rubric.json +0 -21
  71. package/lib/policy-v2.d.ts +0 -21
  72. package/lib/policy-v2.js +0 -54
  73. package/lib/router.d.ts +0 -68
  74. package/lib/router.js +0 -153
  75. package/scripts/label-report.mjs +0 -50
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env node
2
- // Read-only report over judgements.jsonl (design D13): per rubric version, how the labels compare with Jev.
3
- // Zero dependencies; never reads message text, never touches the network, never writes.
4
- import { readFileSync } from 'node:fs'
5
- import { homedir } from 'node:os'
6
- import { resolve } from 'node:path'
7
- import { parseArgs } from 'node:util'
8
-
9
- const TIERS = ['simple', 'standard', 'complex', 'escalated']
10
- const { values } = parseArgs({ options: { file: { type: 'string' }, json: { type: 'boolean' } } })
11
- const home = process.env.DSH_HOME ?? resolve(homedir(), '.dsh')
12
- const file = values.file ?? resolve(home, 'state/auto-model-routing/judgements.jsonl')
13
-
14
- let text = ''
15
- try { text = readFileSync(file, 'utf8') } catch (error) { if (error.code !== 'ENOENT') throw error }
16
-
17
- // Fold by (sessionId, turn): the last judgement line and the last label line win; bad lines are skipped.
18
- const turns = new Map()
19
- for (const raw of text.split('\n')) {
20
- if (!raw.trim()) continue
21
- let line
22
- try { line = JSON.parse(raw) } catch { continue }
23
- if (typeof line?.sessionId !== 'string' || !Number.isInteger(line.turn)) continue
24
- const key = `${line.sessionId}\0${line.turn}`
25
- const entry = turns.get(key) ?? { sessionId: line.sessionId, turn: line.turn }
26
- if (TIERS.includes(line.tier) && typeof line.rubricVersion === 'string') Object.assign(entry, { tier: line.tier, rubricVersion: line.rubricVersion })
27
- if (TIERS.includes(line.label)) entry.label = line.label
28
- turns.set(key, entry)
29
- }
30
-
31
- const versions = {}
32
- const mismatches = []
33
- for (const entry of turns.values()) {
34
- if (!entry.tier || !entry.label) continue
35
- const row = versions[entry.rubricVersion] ??= { labeled: 0, agree: 0, over: 0, under: 0 }
36
- row.labeled++
37
- const diff = TIERS.indexOf(entry.tier) - TIERS.indexOf(entry.label)
38
- if (diff === 0) { row.agree++; continue }
39
- if (diff > 0) row.over++; else row.under++
40
- mismatches.push({ sessionId: entry.sessionId, turn: entry.turn, rubricVersion: entry.rubricVersion, tier: entry.tier, label: entry.label })
41
- }
42
-
43
- if (values.json) {
44
- console.log(JSON.stringify({ versions, mismatches }, null, 2))
45
- } else {
46
- console.log(`file: ${file}`)
47
- for (const [version, row] of Object.entries(versions)) console.log(`rubric ${version}: labeled ${row.labeled}, agree ${row.agree}, judged higher ${row.over}, judged lower ${row.under}`)
48
- if (!Object.keys(versions).length) console.log('no labeled turns yet')
49
- for (const m of mismatches) console.log(` ${m.sessionId} turn ${m.turn} [${m.rubricVersion}]: Jev ${m.tier}, label ${m.label}`)
50
- }