dsh-thinking-levels 4.4.20 → 4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.5.0
4
+
5
+ - **新增「Effort 轨迹」标签页(conversation.view)**:会话时间线旁以 run-length 时间线展示本会话每次请求实际发出的档位——`↑ auto max ×1` / `= auto high ×12` / `↓ auto low ×3` 式标签,↑/↓/= 为相对上一 run 的升降(escalation 序,复用 effort slider 的显示序表),最新在前。issue #11 的延伸:chip 只回答「最后一发是什么」,标签页回答「一路是怎么变过来的」。
6
+ - 数据面:`tlAutoSchedule` 投影新增 `trace` 环(run-length 折叠 `{level, intent, count}`,`TRACE_MAX=64`),由与 `lastEffective` 相同的 `request/header` 事件折叠;intent 取折叠时刻的会话显式选择(auto / manual / 配置默认=中性)。`stateVersion` 2→3——投影是日志的纯折叠,冷读自动重建历史会话的轨迹,无迁移负担。
7
+ - 无档位 header(非推理模型 / 被剥离)不进轨迹、隐式结束当前 run;语义与 `lastEffective=null` 路径保持一致。
8
+ - 客户端面:`conversation.view` 槽位注册(perm-gate history 同款模式),读取与 chip 同一条投影 face 路径,无 HTTP feed;投影缺失 / trace 为空渲染空态,宿主未声明该槽位时 generator inject 永不触发(无标签页=诚实降级)。调度器零接触,chip 行为逐字不变。
9
+ - locale:10 语补 `trace.label` / `trace.empty` / `trace.intent.auto` / `trace.intent.manual`。
10
+ - 测试:投影折叠 + 轨迹组件两份 spec(20 例),全量 305/305。
11
+
3
12
  ## 4.4.20
4
13
 
5
14
  - **connect 类插件兼容矩阵(issue #10 后续收口,无 src/ 变更)。** 普查四家 connect/聚合插件当日版本的 adapter 形态——`@dmh2002/dsh-connect-qoder` 1.27.1 / `dsh-connect-trae` 4.18.5 / `dsh-connect-workbuddy` 5.30.0(dingminhua,ES class + 自有默认档广告)、`dsh-our-free-model`(Ebony-Vinyl,plain class + prepareCall 内部直调 this.resolveModel)——全部为普通对象形态、无 Proxy/freeze、不回读 `llm.adapters`,4.4.18 的 registry-entry facade 方案零返工成立。
package/README.md CHANGED
@@ -163,6 +163,20 @@ The scheduling policy is the same source as [dsh-tool-turbo](https://github.com/
163
163
 
164
164
  **Where the samples come from (4.4.7+).** The scheduler folds `tool/call` events into a Session projection (`tlAutoSchedule`), so it sees real tool history on every host from 0.1.2-rc.1 on; the pre-4.4.7 `session.events` read only ever produced samples on 0.1.0-rc.8. The session's explicit pick is folded from `model/selection` events, so a level the host echoes back can never be mistaken for a manual choice. Known limitation: host `0.1.0-rc.8` exposes no `stateOf` on its projection registry (legacy plane contract), so that one line keeps the old array read — scheduling works there, the echo correction does not.
165
165
 
166
+ ## Effort trace tab
167
+
168
+ The conversation view gains an **Effort 轨迹 / Effort trace** tab (next to the timeline): a run-length timeline of the levels this session's requests actually went out with —
169
+
170
+ ```
171
+ ↑ auto max ×1
172
+ = auto high ×12
173
+ ↓ auto low ×3
174
+ ```
175
+
176
+ `↑` / `↓` / `=` is the transition against the previous (older) run by escalation rank; the tag shows the intent (`auto` — the scheduler resolved it, `manual` — an explicit pick, neutral — the configured default) and how many consecutive requests the run covers. Newest first.
177
+
178
+ Data comes from the plugin's `tlAutoSchedule` session projection (stateVersion 3), folded from the same committed `request/header` events the selector chip's `Auto → level` hint reads — no HTTP feed, and a cold read rebuilds the trace of resumed/historical sessions from the log. The tab degrades silently on hosts without the conversation-view slot or the projection face (empty state, never an error).
179
+
166
180
  ## Third-party adapter compatibility (contract for connect-plugin authors)
167
181
 
168
182
  TL reads the `llm.adapters` registry to advertise `auto` in the model directory, and makes three promises to every plugin that registers adapters there (providers-hub, the connect-* family, our-free-model, vision-router, …):
package/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-thinking-levels",
3
- "version": "4.4.20",
3
+ "version": "4.5.0",
4
4
  "main": "./lib/index.js",
5
5
  "description": "thinking-level (reasoning_effort) control — auto-adjust per tool round, with optional manual lock and per-tool timing telemetry.",
6
6
  "engines": {
@@ -22,6 +22,10 @@
22
22
  * (`api/session-controller/src/agent.ts:340` ← `commands.ts:176`), so the
23
23
  * plugin's own injection can never pollute it — the echo disappears by
24
24
  * construction and needs no "remember what I injected" side table.
25
+ * - `apply` folds `request/header` events into `lastEffective` (issue #11) and
26
+ * the run-length `trace` (conversation-view effort tab): the header carries
27
+ * the level the request actually went out with, so the trace is the
28
+ * per-request history the single field can only summarize.
25
29
  *
26
30
  * Projections are the sanctioned read path ("reads the projection"), are
27
31
  * folded lazily over the in-memory log on first read (so resumed/forked
@@ -38,6 +42,21 @@ import { z } from 'zod';
38
42
  import { type EffortId, type ToolCallSample } from './thinking-level.ts';
39
43
  /** Projection key. `tl` matches the plugin's other unit (`tlCacheBilling`). */
40
44
  export declare const AUTO_SCHEDULE_KEY = "tlAutoSchedule";
45
+ /** One run-length segment of the effort trace (conversation-view tab). */
46
+ export interface EffortRun {
47
+ /** The wire level this run's requests went out with. */
48
+ level: string;
49
+ /**
50
+ * Why: `'auto'` (scheduler sentinel), `'manual'` (explicit session pick) or
51
+ * `null` (the configured default — a session that never picked cannot be
52
+ * told apart from one, so the tab renders it neutral).
53
+ */
54
+ intent: 'auto' | 'manual' | null;
55
+ /** How many consecutive committed requests the run covers. */
56
+ count: number;
57
+ }
58
+ /** Runs kept in the trace ring; run-length lets 64 runs cover very long sessions. */
59
+ export declare const TRACE_MAX = 64;
41
60
  /** Folded state: recent tool samples plus the session's explicit pick. */
42
61
  export interface AutoScheduleState {
43
62
  /** Recent `tool/call` samples, oldest first, at most {@link TOOL_SAMPLE_WINDOW}. */
@@ -58,7 +77,31 @@ export interface AutoScheduleState {
58
77
  * `null` until the session's first committed request.
59
78
  */
60
79
  lastEffective: string | null;
80
+ /**
81
+ * Run-length-folded effort trace, oldest run first — consecutive committed
82
+ * requests that went out with the same effective level AND the same intent
83
+ * collapse into one {@link EffortRun}. Folded from the same `request/header`
84
+ * events as `lastEffective`: the trace is the per-request history that field
85
+ * can only summarize (the conversation-view tab renders it). Headers without
86
+ * an effort (non-reasoning model, stripped) append nothing — they
87
+ * implicitly end the current run. At most {@link TRACE_MAX} runs.
88
+ */
89
+ trace: readonly EffortRun[];
61
90
  }
91
+ /**
92
+ * Append one committed request's effective level to the run-length trace.
93
+ *
94
+ * Pure and total: every call returns a NEW array (a header always grows some
95
+ * run — same level+intent extends the last run's count, anything else opens a
96
+ * new one), so the Object.is change gate treats every level-carrying header as
97
+ * a real state change and wakes the trace tab. Headers without a level never
98
+ * reach this function (see {@link applyAutoSchedule}).
99
+ * @param trace - trace before the header.
100
+ * @param level - the effective wire level the header committed.
101
+ * @param intent - why: the session pick at fold time, or null for default.
102
+ * @returns the advanced trace.
103
+ */
104
+ export declare function foldTrace(trace: readonly EffortRun[], level: string, intent: EffortRun['intent']): readonly EffortRun[];
62
105
  /**
63
106
  * Fold one committed Session event into the auto-schedule state.
64
107
  *
@@ -87,6 +130,11 @@ export declare function buildAutoScheduleDefinition(): {
87
130
  }, z.core.$strip>>;
88
131
  userEffort: z.ZodNullable<z.ZodString>;
89
132
  lastEffective: z.ZodNullable<z.ZodString>;
133
+ trace: z.ZodArray<z.ZodObject<{
134
+ level: z.ZodString;
135
+ intent: z.ZodNullable<z.ZodString>;
136
+ count: z.ZodNumber;
137
+ }, z.core.$strip>>;
90
138
  }, z.core.$strip>;
91
139
  init: () => AutoScheduleState;
92
140
  apply: typeof applyAutoSchedule;
@@ -22,6 +22,10 @@
22
22
  * (`api/session-controller/src/agent.ts:340` ← `commands.ts:176`), so the
23
23
  * plugin's own injection can never pollute it — the echo disappears by
24
24
  * construction and needs no "remember what I injected" side table.
25
+ * - `apply` folds `request/header` events into `lastEffective` (issue #11) and
26
+ * the run-length `trace` (conversation-view effort tab): the header carries
27
+ * the level the request actually went out with, so the trace is the
28
+ * per-request history the single field can only summarize.
25
29
  *
26
30
  * Projections are the sanctioned read path ("reads the projection"), are
27
31
  * folded lazily over the in-memory log on first read (so resumed/forked
@@ -39,13 +43,37 @@ import { TOOL_SAMPLE_WINDOW, toolSampleOf } from "./session-events.js";
39
43
  import { isEffortId } from "./thinking-level.js";
40
44
  /** Projection key. `tl` matches the plugin's other unit (`tlCacheBilling`). */
41
45
  export const AUTO_SCHEDULE_KEY = 'tlAutoSchedule';
46
+ /** Runs kept in the trace ring; run-length lets 64 runs cover very long sessions. */
47
+ export const TRACE_MAX = 64;
42
48
  const stateSchema = z.object({
43
49
  samples: z.array(z.object({ name: z.string(), argsSize: z.number() })),
44
50
  userEffort: z.string().nullable(),
45
51
  lastEffective: z.string().nullable(),
52
+ trace: z.array(z.object({ level: z.string(), intent: z.string().nullable(), count: z.number() })),
46
53
  });
47
54
  /** Initial folded state (also the shape every cold read starts from). */
48
- const initAutoSchedule = () => ({ samples: [], userEffort: null, lastEffective: null });
55
+ const initAutoSchedule = () => ({ samples: [], userEffort: null, lastEffective: null, trace: [] });
56
+ /**
57
+ * Append one committed request's effective level to the run-length trace.
58
+ *
59
+ * Pure and total: every call returns a NEW array (a header always grows some
60
+ * run — same level+intent extends the last run's count, anything else opens a
61
+ * new one), so the Object.is change gate treats every level-carrying header as
62
+ * a real state change and wakes the trace tab. Headers without a level never
63
+ * reach this function (see {@link applyAutoSchedule}).
64
+ * @param trace - trace before the header.
65
+ * @param level - the effective wire level the header committed.
66
+ * @param intent - why: the session pick at fold time, or null for default.
67
+ * @returns the advanced trace.
68
+ */
69
+ export function foldTrace(trace, level, intent) {
70
+ const last = trace[trace.length - 1];
71
+ if (last !== undefined && last.level === level && last.intent === intent) {
72
+ return [...trace.slice(0, -1), { level, intent, count: last.count + 1 }];
73
+ }
74
+ const pushed = [...trace, { level, intent, count: 1 }];
75
+ return pushed.length > TRACE_MAX ? pushed.slice(pushed.length - TRACE_MAX) : pushed;
76
+ }
49
77
  /**
50
78
  * Fold one committed Session event into the auto-schedule state.
51
79
  *
@@ -93,8 +121,19 @@ export function applyAutoSchedule(state, event) {
93
121
  const raw = typeof config === 'object' && config !== null
94
122
  ? config.reasoningEffort
95
123
  : undefined;
96
- const lastEffective = typeof raw === 'string' && raw.length > 0 ? raw : null;
97
- return lastEffective === state.lastEffective ? state : { ...state, lastEffective };
124
+ if (typeof raw !== 'string' || raw.length === 0) {
125
+ // A header without an effort (non-reasoning model, stripped) records
126
+ // nothing in the trace and keeps the old same-reference semantics when
127
+ // lastEffective is already null.
128
+ return state.lastEffective === null ? state : { ...state, lastEffective: null };
129
+ }
130
+ // The trace run's intent is the session pick AT FOLD TIME: model/selection
131
+ // events interleave chronologically in the log, so state.userEffort is
132
+ // exactly the pick in force when this header committed.
133
+ const intent = state.userEffort === 'auto'
134
+ ? 'auto'
135
+ : state.userEffort !== null ? 'manual' : null;
136
+ return { ...state, lastEffective: raw, trace: foldTrace(state.trace, raw, intent) };
98
137
  }
99
138
  return state;
100
139
  }
@@ -107,11 +146,13 @@ export function applyAutoSchedule(state, event) {
107
146
  export function buildAutoScheduleDefinition() {
108
147
  return {
109
148
  key: AUTO_SCHEDULE_KEY,
110
- // Bumped 1 → 2 when `lastEffective` joined the state (issue #11): the host
149
+ // Bumped 1 → 2 when `lastEffective` joined the state (issue #11), 2 → 3
150
+ // when the run-length `trace` joined (conversation-view tab): the host
111
151
  // validates against `stateSchema` per version, so a shape change must raise
112
152
  // it. Historical sessions are not lost — the state is a fold over the log,
113
- // so a cold read rebuilds samples/userEffort/lastEffective from the events.
114
- stateVersion: 2,
153
+ // so a cold read rebuilds samples/userEffort/lastEffective/trace from the
154
+ // events.
155
+ stateVersion: 3,
115
156
  stateSchema,
116
157
  init: initAutoSchedule,
117
158
  apply: applyAutoSchedule,
package/lib/client.js CHANGED
@@ -112,7 +112,11 @@ window.__ModuleLoader__.load({
112
112
  "card.dsContextTitle": "官方 DeepSeek 模型上下文上限",
113
113
  "input.effort.default": "提供方默认",
114
114
  "input.effort.reset": "恢复提供方默认",
115
- "card.capabilities.failed": "保存失败:配置被拒绝或冲突,请检查值。"
115
+ "card.capabilities.failed": "保存失败:配置被拒绝或冲突,请检查值。",
116
+ "trace.label": "Effort 轨迹",
117
+ "trace.empty": "本会话还没有已提交的请求档位。",
118
+ "trace.intent.auto": "auto",
119
+ "trace.intent.manual": "手动"
116
120
  };
117
121
  /** English dictionary (keys mirror zh). */
118
122
  const en = {
@@ -216,7 +220,11 @@ window.__ModuleLoader__.load({
216
220
  "card.dsContextTitle": "Official DeepSeek context windows",
217
221
  "input.effort.default": "Provider default",
218
222
  "input.effort.reset": "Restore provider default",
219
- "card.capabilities.failed": "Save failed: the value was rejected or conflicted. Check it."
223
+ "card.capabilities.failed": "Save failed: the value was rejected or conflicted. Check it.",
224
+ "trace.label": "Effort trace",
225
+ "trace.empty": "No committed request levels in this session yet.",
226
+ "trace.intent.auto": "auto",
227
+ "trace.intent.manual": "manual"
220
228
  };
221
229
  /** Japanese dictionary (keys mirror zh). */
222
230
  const ja = {
@@ -320,7 +328,11 @@ window.__ModuleLoader__.load({
320
328
  "card.dsContextTitle": "公式 DeepSeek モデルのコンテキスト上限",
321
329
  "input.effort.default": "プロバイダーの既定",
322
330
  "input.effort.reset": "プロバイダーの既定に戻す",
323
- "card.capabilities.failed": "保存に失敗しました:値が拒否されたか競合しています。確認してください。"
331
+ "card.capabilities.failed": "保存に失敗しました:値が拒否されたか競合しています。確認してください。",
332
+ "trace.label": "Effort 軌跡",
333
+ "trace.empty": "このセッションには確定済みリクエストのレベルがまだありません。",
334
+ "trace.intent.auto": "auto",
335
+ "trace.intent.manual": "手動"
324
336
  };
325
337
  /** Korean dictionary (keys mirror zh). */
326
338
  const ko = {
@@ -424,7 +436,11 @@ window.__ModuleLoader__.load({
424
436
  "card.dsContextTitle": "공식 DeepSeek 모델 컨텍스트 상한",
425
437
  "input.effort.default": "공급자 기본값",
426
438
  "input.effort.reset": "공급자 기본값으로 복원",
427
- "card.capabilities.failed": "저장 실패: 값이 거부되었거나 충돌합니다. 확인하세요."
439
+ "card.capabilities.failed": "저장 실패: 값이 거부되었거나 충돌합니다. 확인하세요.",
440
+ "trace.label": "Effort 궤적",
441
+ "trace.empty": "이 세션에는 아직 확정된 요청 레벨이 없습니다.",
442
+ "trace.intent.auto": "auto",
443
+ "trace.intent.manual": "수동"
428
444
  };
429
445
  /** French dictionary (keys mirror zh). */
430
446
  const fr = {
@@ -528,7 +544,11 @@ window.__ModuleLoader__.load({
528
544
  "card.dsContextTitle": "Fenêtres de contexte DeepSeek officielles",
529
545
  "input.effort.default": "Valeur par défaut du fournisseur",
530
546
  "input.effort.reset": "Restaurer la valeur par défaut du fournisseur",
531
- "card.capabilities.failed": "Échec de l'enregistrement : la valeur a été rejetée ou est en conflit. Vérifiez-la."
547
+ "card.capabilities.failed": "Échec de l'enregistrement : la valeur a été rejetée ou est en conflit. Vérifiez-la.",
548
+ "trace.label": "Trace des efforts",
549
+ "trace.empty": "Aucun niveau de requête validé dans cette session pour l'instant.",
550
+ "trace.intent.auto": "auto",
551
+ "trace.intent.manual": "manuel"
532
552
  };
533
553
  /** German dictionary (keys mirror zh). */
534
554
  const de = {
@@ -632,7 +652,11 @@ window.__ModuleLoader__.load({
632
652
  "card.dsContextTitle": "Kontextfenster der offiziellen DeepSeek-Modelle",
633
653
  "input.effort.default": "Anbieterstandard",
634
654
  "input.effort.reset": "Auf Anbieterstandard zurücksetzen",
635
- "card.capabilities.failed": "Speichern fehlgeschlagen: Der Wert wurde abgelehnt oder steht in Konflikt. Bitte überprüfen."
655
+ "card.capabilities.failed": "Speichern fehlgeschlagen: Der Wert wurde abgelehnt oder steht in Konflikt. Bitte überprüfen.",
656
+ "trace.label": "Effort-Verlauf",
657
+ "trace.empty": "In dieser Sitzung gibt es noch keine übermittelten Request-Stufen.",
658
+ "trace.intent.auto": "auto",
659
+ "trace.intent.manual": "manuell"
636
660
  };
637
661
  /** Italian dictionary (keys mirror zh). */
638
662
  const it = {
@@ -736,7 +760,11 @@ window.__ModuleLoader__.load({
736
760
  "card.dsContextTitle": "Finestra di contesto dei modelli DeepSeek ufficiali",
737
761
  "input.effort.default": "Predefinito del provider",
738
762
  "input.effort.reset": "Ripristina il predefinito del provider",
739
- "card.capabilities.failed": "Salvataggio non riuscito: il valore è stato rifiutato o è in conflitto. Verifica."
763
+ "card.capabilities.failed": "Salvataggio non riuscito: il valore è stato rifiutato o è in conflitto. Verifica.",
764
+ "trace.label": "Traccia degli effort",
765
+ "trace.empty": "Nessun livello di richiesta confermato in questa sessione.",
766
+ "trace.intent.auto": "auto",
767
+ "trace.intent.manual": "manuale"
740
768
  };
741
769
  /** Russian dictionary (keys mirror zh). */
742
770
  const ru = {
@@ -840,7 +868,11 @@ window.__ModuleLoader__.load({
840
868
  "card.dsContextTitle": "Лимиты контекста официальных моделей DeepSeek",
841
869
  "input.effort.default": "Значение провайдера по умолчанию",
842
870
  "input.effort.reset": "Вернуть значение провайдера по умолчанию",
843
- "card.capabilities.failed": "Ошибка сохранения: значение отклонено или конфликтует. Проверьте его."
871
+ "card.capabilities.failed": "Ошибка сохранения: значение отклонено или конфликтует. Проверьте его.",
872
+ "trace.label": "Трасса усилий",
873
+ "trace.empty": "В этой сессии ещё нет зафиксированных уровней запросов.",
874
+ "trace.intent.auto": "auto",
875
+ "trace.intent.manual": "вручную"
844
876
  };
845
877
  /** Spanish dictionary (keys mirror zh). */
846
878
  const es = {
@@ -944,7 +976,11 @@ window.__ModuleLoader__.load({
944
976
  "card.dsContextTitle": "Ventana de contexto de los modelos DeepSeek oficiales",
945
977
  "input.effort.default": "Predeterminado del proveedor",
946
978
  "input.effort.reset": "Restaurar el valor predeterminado del proveedor",
947
- "card.capabilities.failed": "Error al guardar: el valor fue rechazado o está en conflicto. Verifícalo."
979
+ "card.capabilities.failed": "Error al guardar: el valor fue rechazado o está en conflicto. Verifícalo.",
980
+ "trace.label": "Trazado de esfuerzo",
981
+ "trace.empty": "Aún no hay niveles de solicitud confirmados en esta sesión.",
982
+ "trace.intent.auto": "auto",
983
+ "trace.intent.manual": "manual"
948
984
  };
949
985
  /** Portuguese (pt-BR) dictionary (keys mirror zh). */
950
986
  const pt = {
@@ -1048,7 +1084,11 @@ window.__ModuleLoader__.load({
1048
1084
  "card.dsContextTitle": "Janela de contexto dos modelos DeepSeek oficiais",
1049
1085
  "input.effort.default": "Padrão do provedor",
1050
1086
  "input.effort.reset": "Restaurar o padrão do provedor",
1051
- "card.capabilities.failed": "Falha ao salvar: o valor foi rejeitado ou está em conflito. Verifique-o."
1087
+ "card.capabilities.failed": "Falha ao salvar: o valor foi rejeitado ou está em conflito. Verifique-o.",
1088
+ "trace.label": "Trilha de esforço",
1089
+ "trace.empty": "Ainda não há níveis de solicitação confirmados nesta sessão.",
1090
+ "trace.intent.auto": "auto",
1091
+ "trace.intent.manual": "manual"
1052
1092
  };
1053
1093
  //#endregion
1054
1094
  //#region src/client/context-ring.tsx
@@ -1189,7 +1229,7 @@ window.__ModuleLoader__.load({
1189
1229
  fontVariantNumeric: "tabular-nums",
1190
1230
  fontFamily: "var(--ds-font-family-code, monospace)"
1191
1231
  };
1192
- const rowStyle$1 = {
1232
+ const rowStyle$2 = {
1193
1233
  display: "flex",
1194
1234
  alignItems: "center",
1195
1235
  gap: "12px",
@@ -1253,7 +1293,7 @@ window.__ModuleLoader__.load({
1253
1293
  function BillSubRow({ label, tokens, amount, color }) {
1254
1294
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1255
1295
  style: {
1256
- ...rowStyle$1,
1296
+ ...rowStyle$2,
1257
1297
  paddingLeft: "16px"
1258
1298
  },
1259
1299
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dt", {
@@ -1358,7 +1398,7 @@ window.__ModuleLoader__.load({
1358
1398
  /** One breakdown row (cache-billing's swatch-row layout). */
1359
1399
  function BreakdownRow({ label, value, color }) {
1360
1400
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1361
- style: rowStyle$1,
1401
+ style: rowStyle$2,
1362
1402
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dt", {
1363
1403
  style: rowLabelStyle,
1364
1404
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: swatchStyle(color) }), label]
@@ -1398,7 +1438,7 @@ window.__ModuleLoader__.load({
1398
1438
  },
1399
1439
  children: [
1400
1440
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1401
- style: rowStyle$1,
1441
+ style: rowStyle$2,
1402
1442
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1403
1443
  style: {
1404
1444
  ...rowLabelStyle,
@@ -1436,7 +1476,7 @@ window.__ModuleLoader__.load({
1436
1476
  color: BILL_COLORS.output
1437
1477
  }),
1438
1478
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1439
- style: rowStyle$1,
1479
+ style: rowStyle$2,
1440
1480
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1441
1481
  style: {
1442
1482
  ...rowLabelStyle,
@@ -1474,7 +1514,7 @@ window.__ModuleLoader__.load({
1474
1514
  color: BILL_COLORS.output
1475
1515
  }),
1476
1516
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1477
- style: rowStyle$1,
1517
+ style: rowStyle$2,
1478
1518
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dt", {
1479
1519
  style: {
1480
1520
  ...rowLabelStyle,
@@ -1512,7 +1552,7 @@ window.__ModuleLoader__.load({
1512
1552
  color: BILL_COLORS.output
1513
1553
  }),
1514
1554
  (billing.sessionFullMissSteps ?? 0) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1515
- style: rowStyle$1,
1555
+ style: rowStyle$2,
1516
1556
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1517
1557
  style: {
1518
1558
  ...rowLabelStyle,
@@ -1616,7 +1656,7 @@ window.__ModuleLoader__.load({
1616
1656
  })]
1617
1657
  }),
1618
1658
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1619
- style: rowStyle$1,
1659
+ style: rowStyle$2,
1620
1660
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1621
1661
  style: rowLabelStyle,
1622
1662
  children: c.percent
@@ -1630,7 +1670,7 @@ window.__ModuleLoader__.load({
1630
1670
  })]
1631
1671
  }),
1632
1672
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1633
- style: rowStyle$1,
1673
+ style: rowStyle$2,
1634
1674
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1635
1675
  style: rowLabelStyle,
1636
1676
  children: c.remaining
@@ -3299,6 +3339,182 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
3299
3339
  });
3300
3340
  }
3301
3341
  //#endregion
3342
+ //#region src/client/effort-trace.tsx
3343
+ /**
3344
+ * Effort-trace tab — the `conversation.view` face of dsh-thinking-levels,
3345
+ * following the conversation-view pattern dsh-perm-gate's history tab
3346
+ * demonstrates (runtime slot declared by the conversation UI package; the
3347
+ * typed SlotMap merge lives in `types/contracts.d.ts`).
3348
+ *
3349
+ * A run-length timeline of the effort levels this session's requests ACTUALLY
3350
+ * went out with — the `tlAutoSchedule` projection's `trace` (stateVersion 3),
3351
+ * the same durable fold the composer chip's `lastEffective` reads. Consecutive
3352
+ * requests with the same level AND intent collapse into one run, so even a
3353
+ * 95-step session reads as a handful of rows:
3354
+ *
3355
+ * ↑ auto max ×1
3356
+ * = auto high ×12
3357
+ * ↓ auto low ×3
3358
+ *
3359
+ * The ↑/↓/= glyph is the transition against the escalation rank of the
3360
+ * previous (older) run; the run text shows the intent (`auto`/`manual`,
3361
+ * neutral when the session never picked and the configured default applied)
3362
+ * plus the repetition count.
3363
+ *
3364
+ * Data source: the session's projection face — NO HTTP feed. The projection is
3365
+ * a pure fold over the session log, so a cold read rebuilds historical
3366
+ * sessions for free. Everything is best-effort: a missing projection face, an
3367
+ * empty trace or a throwing face read renders the empty state — a thrown
3368
+ * render would abdicate the whole tab, which is never acceptable for a
3369
+ * cosmetic view.
3370
+ */
3371
+ /** Transition glyph per direction (mirrors perm-gate's glyph table pattern). */
3372
+ const GLYPH = {
3373
+ up: "↑",
3374
+ down: "↓",
3375
+ flat: "=",
3376
+ start: "•"
3377
+ };
3378
+ /** Unknown ids rank after the standard table (same tail semantics as the slider). */
3379
+ const rankOf = (level) => EFFORT_SLIDER_RANK[level] ?? 100;
3380
+ /**
3381
+ * Build the display rows: newest run first, each carrying the transition
3382
+ * against its chronological predecessor. Pure — the component is a straight
3383
+ * map over this.
3384
+ * @param trace - the folded run-length trace, oldest run first.
3385
+ * @returns rows newest first; empty for an absent or empty trace.
3386
+ */
3387
+ function traceRows(trace) {
3388
+ if (trace === void 0 || trace.length === 0) return [];
3389
+ const rows = [];
3390
+ for (let i = trace.length - 1; i >= 0; i -= 1) {
3391
+ const run = trace[i];
3392
+ const prev = i > 0 ? trace[i - 1] : void 0;
3393
+ if (prev === void 0) {
3394
+ rows.push({
3395
+ run,
3396
+ dir: "start"
3397
+ });
3398
+ continue;
3399
+ }
3400
+ const from = rankOf(prev.level);
3401
+ const to = rankOf(run.level);
3402
+ rows.push({
3403
+ run,
3404
+ dir: to > from ? "up" : to < from ? "down" : "flat"
3405
+ });
3406
+ }
3407
+ return rows;
3408
+ }
3409
+ /**
3410
+ * Read the folded trace off the session's projection face — the exact read
3411
+ * path the composer chip's `lastEffective` uses. Returns `undefined` — never
3412
+ * throws — when the session id, the face or the field is absent (older hosts,
3413
+ * cold sessions, odd shapes).
3414
+ * @param sessions - the sessions face.
3415
+ * @param sessionId - the owning session.
3416
+ * @returns the folded run-length trace, or undefined.
3417
+ */
3418
+ function traceOf(sessions, sessionId) {
3419
+ try {
3420
+ if (typeof sessionId !== "string" || sessionId.length === 0) return void 0;
3421
+ const face = sessions?.binding(sessionId)?.session?.projections?.faceOf?.("tlAutoSchedule");
3422
+ const snapshot = typeof face?.getSnapshot === "function" ? face.getSnapshot() : void 0;
3423
+ const value = typeof snapshot === "object" && snapshot !== null ? snapshot.value : void 0;
3424
+ const raw = typeof value === "object" && value !== null ? value.trace : void 0;
3425
+ return Array.isArray(raw) ? raw : void 0;
3426
+ } catch {
3427
+ return;
3428
+ }
3429
+ }
3430
+ /**
3431
+ * Subscribe to the trace over the projection face's store when it offers one;
3432
+ * a one-shot read otherwise (the conversation re-renders around every request
3433
+ * anyway, so the one-shot cadence still tracks). `useSyncExternalStore` needs
3434
+ * a cached snapshot — the projection registry gates republishes on
3435
+ * `Object.is`, so the face's `value.trace` reference is stable between
3436
+ * publishes and the read wrapper stays honest.
3437
+ */
3438
+ function useTrace(sessions, sessionId) {
3439
+ const id = typeof sessionId === "string" && sessionId.length > 0 ? sessionId : void 0;
3440
+ const face = (0, react.useMemo)(() => {
3441
+ try {
3442
+ return id === void 0 ? void 0 : sessions?.binding(id)?.session?.projections?.faceOf?.("tlAutoSchedule");
3443
+ } catch {
3444
+ return;
3445
+ }
3446
+ }, [sessions, id]);
3447
+ const getSnapshot = (0, react.useMemo)(() => () => traceOf(sessions, id), [sessions, id]);
3448
+ const subscribe = (0, react.useMemo)(() => (listener) => {
3449
+ try {
3450
+ return typeof face?.subscribe === "function" ? face.subscribe(listener) : () => {};
3451
+ } catch {
3452
+ return () => {};
3453
+ }
3454
+ }, [face]);
3455
+ return (0, react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
3456
+ }
3457
+ const listStyle = {
3458
+ display: "flex",
3459
+ flexDirection: "column",
3460
+ gap: 6,
3461
+ padding: 12,
3462
+ overflowY: "auto",
3463
+ font: "inherit"
3464
+ };
3465
+ const rowStyle$1 = {
3466
+ display: "flex",
3467
+ alignItems: "baseline",
3468
+ gap: 8
3469
+ };
3470
+ const glyphStyle = {
3471
+ width: 18,
3472
+ flexShrink: 0,
3473
+ textAlign: "center",
3474
+ fontFamily: "monospace",
3475
+ color: "var(--dsw-alias-text-secondary, rgba(127,127,127,0.9))"
3476
+ };
3477
+ const countStyle = {
3478
+ color: "var(--dsw-alias-text-secondary, rgba(127,127,127,0.9))",
3479
+ fontVariantNumeric: "tabular-nums"
3480
+ };
3481
+ const levelStyle = { fontFamily: "monospace" };
3482
+ /** The tab body: timeline rows newest first, or the empty state. */
3483
+ function EffortTrace(props) {
3484
+ const t = props.t ?? props.tFallback ?? ((key) => key);
3485
+ const trace = useTrace(props.sessions, props.sessionId);
3486
+ const rows = traceRows(trace);
3487
+ if (trace === void 0 || rows.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3488
+ style: listStyle,
3489
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3490
+ style: countStyle,
3491
+ children: t("trace.empty")
3492
+ })
3493
+ });
3494
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3495
+ style: listStyle,
3496
+ children: rows.map((row, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3497
+ style: rowStyle$1,
3498
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3499
+ style: glyphStyle,
3500
+ "aria-hidden": "true",
3501
+ children: GLYPH[row.dir]
3502
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
3503
+ row.run.intent === "auto" && `${t("trace.intent.auto")} `,
3504
+ row.run.intent === "manual" && `${t("trace.intent.manual")} `,
3505
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
3506
+ style: levelStyle,
3507
+ children: row.run.level
3508
+ }),
3509
+ row.run.count > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3510
+ style: countStyle,
3511
+ children: [" ×", row.run.count]
3512
+ })
3513
+ ] })]
3514
+ }, trace.length - i))
3515
+ });
3516
+ }
3517
+ //#endregion
3302
3518
  //#region src/client/card.tsx
3303
3519
  /**
3304
3520
  * Thinking-levels settings card — the family settings tab face of the
@@ -5583,6 +5799,23 @@ body:not([data-ds-dark-theme]) .${ZONE_CLASS}[data-top="1"] .${TRACK_CLASS} { an
5583
5799
  };
5584
5800
  });
5585
5801
  });
5802
+ ctx.inject(["sessions"], (scope) => {
5803
+ const sessions = scope.sessions;
5804
+ ctx.slots.inject("conversation.view", function* () {
5805
+ yield ctx.slots.register({
5806
+ name: "conversation.view",
5807
+ id: "dsh-thinking-levels.effort-trace",
5808
+ order: 25,
5809
+ label: () => t("trace.label"),
5810
+ locale: NS,
5811
+ inject: (sessionId) => ({
5812
+ sessionId,
5813
+ sessions,
5814
+ tFallback: t
5815
+ })
5816
+ }, EffortTrace);
5817
+ });
5818
+ });
5586
5819
  /** Registrant labels arrive as a string or a locale thunk; unwrap either.
5587
5820
  * A throwing thunk (e.g. a contributor whose label touches a service its own
5588
5821
  * inject never declared) must not kill the whole tab-ledger projection — fall