dsh-model-think-level 2.0.2 → 2.0.3

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.
@@ -84,6 +84,19 @@ export declare const UNSET_MARKER = "reasoningEffortsUnset";
84
84
  * `input` as a decision (the route default applies), not as a gap to fill.
85
85
  */
86
86
  export declare const INPUT_UNSET_MARKER = "inputUnset";
87
+ /**
88
+ * Model-level marker declaring the row an IMAGE-GENERATION model (生图).
89
+ *
90
+ * The chat wire's own `input` vocabulary (pi-ai's MODALITY_GATE) only knows
91
+ * text/image — the request modalities a model ACCEPTS — and an image generator
92
+ * is not a request-modality answer at all: it is a different kind of model that
93
+ * the composer's model switcher must hide (its entries cannot serve a chat
94
+ * turn), so it lives beside the declaration as its own marker. Schemastery
95
+ * passes unknown model keys through, so the marker survives official-page saves
96
+ * and restarts like the other three; absence means "not an image generator",
97
+ * and `false`/absent are the same state.
98
+ */
99
+ export declare const INPUT_IMAGE_GEN_MARKER = "inputImageGen";
87
100
  /**
88
101
  * Model-level provenance marker written beside every ladder the HOST autofill
89
102
  * fills from the knowledge base, carrying the settings revision the fill read.
@@ -32,6 +32,13 @@ export interface EndpointSignal {
32
32
  * layer owns the intersection with the core vocabulary.
33
33
  */
34
34
  input?: readonly string[];
35
+ /**
36
+ * The listing's output-modality disclosure, lowercased, when it named one
37
+ * (OpenRouter's `architecture.output_modalities` and its flattened copies).
38
+ * This is the disclosure that answers "is this an image generator": a model
39
+ * whose listing outputs images and not text cannot serve a chat turn.
40
+ */
41
+ output?: readonly string[];
35
42
  /** Context length the listing disclosed, when it carries one. */
36
43
  contextLength?: number;
37
44
  }
@@ -51,6 +51,13 @@ export interface ProbeOutcome {
51
51
  error?: string;
52
52
  /** Why the stream stopped, when one was reported. */
53
53
  finish?: string;
54
+ /**
55
+ * Milliseconds from dispatch start to the first visible text chunk. Absent
56
+ * when no text arrived (rejected, cancelled, empty answer).
57
+ */
58
+ firstTokenMs?: number;
59
+ /** Total wall time of the challenge, milliseconds. */
60
+ durationMs?: number;
54
61
  }
55
62
  /** Everything one model's fingerprint run learned, ready for the bank. */
56
63
  export interface ProbeRunResult {
@@ -84,8 +91,19 @@ export interface RunProbeOptions {
84
91
  /**
85
92
  * Called as each challenge settles, so a caller can stream progress. Fire
86
93
  * order is completion order, which for parallel runs is not `index` order.
94
+ * Challenges aborted by {@link shouldStop} do NOT fire this: they never
95
+ * answered, so they are not progress.
87
96
  */
88
97
  onOutcome?: (outcome: ProbeOutcome) => void;
98
+ /**
99
+ * Early-exit hook, called after each challenge settles with every outcome
100
+ * so far. Returning true aborts every challenge still in flight; their
101
+ * outcomes come back cancelled and stay out of `onOutcome` and of any
102
+ * caller-side progress accounting. This is what lets two confident answers
103
+ * close the run before the slowest challenge lands — aborting the tail is
104
+ * the whole point of firing all three at once.
105
+ */
106
+ shouldStop?: (outcomes: readonly ProbeOutcome[]) => boolean;
89
107
  }
90
108
  /** Default per-challenge timeout: two minutes is generous for 300 integers. */
91
109
  export declare const DEFAULT_PROBE_TIMEOUT_MS = 120000;
@@ -1,5 +1,5 @@
1
- import { type FingerprintRecord, type FingerprintStatus, type FingerprintTopEntry } from './verdict.js';
2
- export { type FingerprintRecord, type FingerprintStatus, type FingerprintTopEntry };
1
+ import { type FingerprintRecord, type FingerprintStatus, type FingerprintTiming, type FingerprintTopEntry } from './verdict.js';
2
+ export { type FingerprintRecord, type FingerprintStatus, type FingerprintTiming, type FingerprintTopEntry };
3
3
  export interface FingerprintDocument {
4
4
  version: 1;
5
5
  /** 银行的 built_at;换银行就整体失效。 */
@@ -1,6 +1,19 @@
1
1
  import type { AttributionResult, ResultRow } from './core.js';
2
2
  /** 落盘的三种状态。`running` 不落盘,只活在客户端 runner 里。 */
3
3
  export type FingerprintStatus = 'identified' | 'doubtful' | 'failed';
4
+ /**
5
+ * 检测的耗时画像(可选):给结果卡一句「慢在哪」。只收统计量 —— 首 token
6
+ * 等待、整次墙钟、按「总时长 − 首 token 等待」折出的吐字速度;原始文本
7
+ * 从不落盘(design §4.2)。
8
+ */
9
+ export interface FingerprintTiming {
10
+ /** 有效回答里最慢的首 token 等待,毫秒。 */
11
+ firstTokenMs?: number;
12
+ /** 有效回答里最慢的整题耗时(墙钟 ≈ 用户等的时间),毫秒。 */
13
+ durationMs?: number;
14
+ /** 有效回答合计的可见字符 ÷ 合计纯吐字时长,字符/秒。 */
15
+ charsPerSecond?: number;
16
+ }
4
17
  /** 结果卡「前三候选」里的一条。 */
5
18
  export interface FingerprintTopEntry {
6
19
  model: string;
@@ -31,6 +44,8 @@ export interface FingerprintRecord {
31
44
  queries: number;
32
45
  cvAccuracy: number;
33
46
  };
47
+ /** 本次检测的耗时画像,检测失败时没有意义,不落盘。 */
48
+ timing?: FingerprintTiming;
34
49
  /** 仅 failed 有值,面向用户的失败原因。 */
35
50
  error?: string;
36
51
  }
@@ -43,6 +58,16 @@ export interface FingerprintRecord {
43
58
  export declare const IDENTIFIED_THRESHOLD = 0.6;
44
59
  /** 出一个确定结论需要的完整题数。 */
45
60
  export declare const FULL_RUN_QUERIES = 3;
61
+ /**
62
+ * 两题早停判 `identified` 的概率下界。
63
+ *
64
+ * 银行自带 2 题校准:交叉验证准确率 99.7%(646/648),beta≈12 让概率分布
65
+ * 非常尖。0.9 在那套校准下仍是保守门槛 —— 池化概率到不了 0.9 就继续等第三
66
+ * 题,走三题的完整判据,所以早停只会提前、不会放宽。
67
+ */
68
+ export declare const EARLY_IDENTIFIED_PROBABILITY = 0.9;
69
+ /** 早停最少需要的有效题数(两题)。 */
70
+ export declare const EARLY_IDENTIFIED_QUERIES = 2;
46
71
  /**
47
72
  * 取概率最高的前几名候选,供结果卡画条形。
48
73
  * @param rows - 已按概率降序排好的候选。
@@ -53,9 +78,10 @@ export declare function topEntriesOf(rows: readonly ResultRow[], limit?: number)
53
78
  /**
54
79
  * 把一次归属结论定级。
55
80
  *
56
- * 两道闸:概率必须够高,而且三题必须都有效。1 题的交叉验证准确率只有
57
- * 96.3%,不够撑一个确定结论 —— 所以有效题数不足一律降级为 `doubtful`,
58
- * 哪怕那一题的概率是 0.99。
81
+ * 三道闸:概率必须够高,题数必须够多,多到哪一档就用哪一档的门槛。三题全有
82
+ * 效走 0.6;两题有效走 0.9(早停或第三题意外作废时,银行 2 题校准的交叉验证
83
+ * 准确率 99.7% 撑得起,但门槛相应收紧);1 题的交叉验证准确率只有 96.3%,
84
+ * 撑不起任何确定结论 —— 一律 `doubtful`,哪怕那一题的概率是 0.99。
59
85
  *
60
86
  * @param attribution - `analyzeGlobalOutputs` 的结果;失败时传 null。
61
87
  * @param usedOutputs - 有效题数。