ctxtop 4.0.0 → 4.1.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/.antigravity-plugin/plugin.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHECKSUMS.sha256 +59 -42
- package/README.md +351 -330
- package/bin/ah-statusline.mjs +30 -0
- package/bin/ctxtop.mjs +330 -5
- package/config/default_flightcheck.json +19 -0
- package/config/modelCatalog.json +165 -0
- package/hooks/handlers/compact-lifecycle.mjs +323 -8
- package/hooks/handlers/config-change.mjs +402 -0
- package/hooks/handlers/hookIo.mjs +56 -0
- package/hooks/handlers/post-model-switch.mjs +111 -0
- package/hooks/handlers/post-tool-use.mjs +117 -16
- package/hooks/handlers/pre-model-switch.mjs +823 -24
- package/hooks/handlers/pre-tool-use.mjs +271 -4
- package/hooks/handlers/stop-gate.mjs +297 -11
- package/hooks/handlers/user-prompt-submit.mjs +224 -0
- package/hooks/hooks.json +50 -0
- package/hooks/post_tool_use.mjs +8 -0
- package/hooks/register.js +48 -9
- package/hooks/session_start.mjs +11 -1
- package/hooks/stop.mjs +11 -1
- package/package.json +11 -4
- package/packages/antigravity/package.json +1 -1
- package/packages/claude-code/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/packages/engine-node/package.json +1 -1
- package/packages/mcp/package.json +1 -1
- package/packages/mcp/src/server.mjs +1 -1
- package/packages/pro/package.json +1 -1
- package/plugin.json +1 -1
- package/sidecars/horizon-daemon/server.mjs +38 -2
- package/skills/handoff/SKILL.md +8 -0
- package/src/adapters/antigravity/index.mjs +31 -1
- package/src/adapters/claude-code/index.mjs +40 -1
- package/src/cli/horizon_hud.mjs +254 -52
- package/src/config/modelCatalog.json +84 -0
- package/src/core/bucket_b_runtime.mjs +1200 -0
- package/src/core/constants.mjs +191 -4
- package/src/core/detectors_det01_to_16.mjs +54 -5
- package/src/core/doc_indexer.mjs +338 -0
- package/src/core/layer5_hygiene.mjs +118 -0
- package/src/core/parser.mjs +2 -1
- package/src/core/paths.mjs +3 -2
- package/src/core/rsl_clash_auditor.mjs +423 -0
- package/src/core/rsl_distiller.mjs +372 -0
- package/src/core/rsl_ledger.mjs +969 -0
- package/src/core/rsl_triage.mjs +909 -0
- package/src/core/session_auditor.mjs +658 -0
- package/src/core/shield_manager.mjs +1417 -0
- package/src/core/task_quota_router.mjs +1 -1
- package/src/core-isomorphic/coach/cacheGravityRouter.mjs +874 -47
- package/src/core-isomorphic/coach/resumeToolsetAuditor.mjs +321 -0
- package/src/core-isomorphic/coach/smartCompactAdvisor.mjs +305 -0
- package/src/core-isomorphic/coach/ttlWatchdog.mjs +13 -6
- package/src/core-isomorphic/config/anthropicModelCatalog.json +404 -1
- package/src/core-isomorphic/config/catalogLoader.mjs +546 -46
- package/src/core-isomorphic/config/horizonConfig.mjs +47 -1
- package/src/core-isomorphic/diagnostics/prompt_hygiene_governor.mjs +266 -0
- package/src/core-isomorphic/economics/cacheGravity.mjs +18 -0
- package/src/core-isomorphic/economics/cliffBreaker.mjs +98 -12
- package/src/core-isomorphic/economics/driftLatency.mjs +114 -0
- package/src/core-isomorphic/guards/bucketBAlphaBeta.mjs +860 -0
- package/src/core-isomorphic/guards/bucketBGamma.mjs +442 -0
- package/src/core-isomorphic/guards/bucketBHeuristics.mjs +37 -0
- package/src/core-isomorphic/guards/circuitBreakers.mjs +191 -191
- package/src/core-isomorphic/guards/det01_03_shell_secret.mjs +154 -5
- package/src/core-isomorphic/guards/det04_12_thrash_rot.mjs +103 -11
- package/src/core-isomorphic/guards/det13_20_mcp_scope.mjs +311 -1
- package/src/core-isomorphic/guards/docIndexCore.mjs +446 -0
- package/src/core-isomorphic/guards/losslessPostSanitizer.mjs +16 -0
- package/src/core-isomorphic/guards/slopsquatGate.mjs +551 -0
- package/src/core-isomorphic/index.js +1 -0
- package/src/core-isomorphic/telemetry/telemetryBridge.mjs +36 -12
- package/src/core-isomorphic/ui/horizonPanelHtml.mjs +293 -237
- package/src/core-isomorphic/ui/modViews.mjs +35 -9
- package/src/diagnostics/claudeHookCapabilities.mjs +396 -0
- package/src/diagnostics/doctorEngine.mjs +95 -3
- package/src/engine-node/db/probe.mjs +234 -2
- package/src/engine-node/index.mjs +3 -0
- package/src/engine-node/sensors/blindspots.mjs +13 -6
- package/src/hooks/antigravity_rsl_hook.mjs +250 -0
- package/src/hooks/claude_rsl_hook.mjs +288 -0
- package/src/hooks/post_invocation.mjs +196 -4
- package/src/hooks/pre_invocation.mjs +732 -22
- package/src/hooks/session_start.mjs +39 -1
- package/src/utils/modelSwitchTelemetry.mjs +308 -0
- package/src/utils/sessionCalibration.mjs +657 -0
- package/src/webview/horizon_panel.html +1325 -317
|
@@ -3938,9 +3938,9 @@
|
|
|
3938
3938
|
clip: auto !important;
|
|
3939
3939
|
overflow: visible !important;
|
|
3940
3940
|
display: inline-block !important;
|
|
3941
|
-
font-size:
|
|
3941
|
+
font-size: 15px !important;
|
|
3942
3942
|
font-weight: 600 !important;
|
|
3943
|
-
letter-spacing: -0.
|
|
3943
|
+
letter-spacing: -0.015em !important;
|
|
3944
3944
|
color: var(--hz-fg) !important;
|
|
3945
3945
|
margin: 0 !important;
|
|
3946
3946
|
}
|
|
@@ -3954,6 +3954,10 @@
|
|
|
3954
3954
|
padding: 2px 7px;
|
|
3955
3955
|
font-variant-numeric: tabular-nums;
|
|
3956
3956
|
white-space: nowrap;
|
|
3957
|
+
min-width: 0;
|
|
3958
|
+
flex: 0 1 auto;
|
|
3959
|
+
overflow: hidden;
|
|
3960
|
+
text-overflow: ellipsis;
|
|
3957
3961
|
}
|
|
3958
3962
|
.header-controls {
|
|
3959
3963
|
display: flex !important;
|
|
@@ -3975,16 +3979,127 @@
|
|
|
3975
3979
|
}
|
|
3976
3980
|
.header-controls .header-right {
|
|
3977
3981
|
width: 100% !important;
|
|
3982
|
+
min-width: 0 !important;
|
|
3978
3983
|
display: flex !important;
|
|
3984
|
+
flex-wrap: nowrap !important;
|
|
3979
3985
|
align-items: center !important;
|
|
3980
3986
|
justify-content: space-between !important;
|
|
3981
3987
|
gap: 8px !important;
|
|
3982
3988
|
}
|
|
3989
|
+
.header-controls .shadcn-tabs-list {
|
|
3990
|
+
flex: 0 0 auto !important;
|
|
3991
|
+
border-radius: 999px !important;
|
|
3992
|
+
padding: 2px !important;
|
|
3993
|
+
background: rgba(255, 255, 255, 0.05) !important;
|
|
3994
|
+
border: 1px solid var(--hz-border) !important;
|
|
3995
|
+
}
|
|
3996
|
+
.header-controls .shadcn-tab-trigger {
|
|
3997
|
+
flex: 1 1 0;
|
|
3998
|
+
text-align: center;
|
|
3999
|
+
border-radius: 999px !important;
|
|
4000
|
+
padding: 2px 9px !important;
|
|
4001
|
+
font-size: 10.5px !important;
|
|
4002
|
+
font-weight: 500 !important;
|
|
4003
|
+
}
|
|
4004
|
+
.header-controls .icon-btn {
|
|
4005
|
+
display: inline-flex !important;
|
|
4006
|
+
align-items: center;
|
|
4007
|
+
justify-content: center;
|
|
4008
|
+
flex-shrink: 0;
|
|
4009
|
+
width: 24px !important;
|
|
4010
|
+
height: 24px !important;
|
|
4011
|
+
padding: 0 !important;
|
|
4012
|
+
border-radius: 999px !important;
|
|
4013
|
+
}
|
|
4014
|
+
|
|
4015
|
+
html, body { max-width: 100%; overflow-x: hidden; }
|
|
4016
|
+
.wrap { width: 100%; min-width: 0; }
|
|
4017
|
+
|
|
4018
|
+
:root {
|
|
4019
|
+
/* DESIGN.md Locked Surface & Semantic Exception Tokens */
|
|
4020
|
+
--bg-canvas: #0B0C0E;
|
|
4021
|
+
--bg-surface: #121417;
|
|
4022
|
+
--bg-elevated: #1B1E23;
|
|
4023
|
+
--hairline: rgba(255, 255, 255, 0.07);
|
|
4024
|
+
--text-primary: #F1F3F4;
|
|
4025
|
+
--text-secondary: #9AA0A6;
|
|
4026
|
+
--text-muted: #80868B;
|
|
4027
|
+
--status-critical: #D93025;
|
|
4028
|
+
--status-warning: #F29900;
|
|
4029
|
+
--status-nominal: #1E8E3E;
|
|
4030
|
+
--accent-focus: #1A73E8;
|
|
4031
|
+
--font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Google Sans", sans-serif;
|
|
4032
|
+
--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
4033
|
+
--space-1: 8px;
|
|
4034
|
+
--space-2: 16px;
|
|
4035
|
+
--space-3: 24px;
|
|
4036
|
+
--control-height: 28px;
|
|
4037
|
+
--control-radius: 6px;
|
|
4038
|
+
--ease-snappy: 140ms cubic-bezier(0.2, 0, 0, 1);
|
|
4039
|
+
|
|
4040
|
+
/* Calm Monochrome Signal + Exception Clutter (<10% non-neutral pixels) */
|
|
4041
|
+
--ts-sig: #E8EAED;
|
|
4042
|
+
--ts-sig-ink: #0B0C0E;
|
|
4043
|
+
--ts-sig-text: #E8EAED;
|
|
4044
|
+
--ts-clu: #F29900;
|
|
4045
|
+
--ts-clu-ink: #0B0C0E;
|
|
4046
|
+
--ts-clu-text: #F29900;
|
|
4047
|
+
--ts-clu-cached: #64748B;
|
|
4048
|
+
--ts-clu-cached-text: #9AA0A6;
|
|
4049
|
+
}
|
|
4050
|
+
:root[data-theme="light"],
|
|
4051
|
+
[data-theme="light"] body,
|
|
4052
|
+
body[data-theme="light"] {
|
|
4053
|
+
--bg-canvas: #F8F9FA;
|
|
4054
|
+
--bg-surface: #FFFFFF;
|
|
4055
|
+
--bg-elevated: #F1F3F4;
|
|
4056
|
+
--hairline: rgba(0, 0, 0, 0.08);
|
|
4057
|
+
--text-primary: #111315;
|
|
4058
|
+
--text-secondary: #3C4043;
|
|
4059
|
+
--text-muted: #5F6368;
|
|
4060
|
+
--status-critical: #D93025;
|
|
4061
|
+
--status-warning: #B06000;
|
|
4062
|
+
--status-nominal: #137333;
|
|
4063
|
+
--accent-focus: #1A73E8;
|
|
4064
|
+
|
|
4065
|
+
--ts-sig: #202124;
|
|
4066
|
+
--ts-sig-ink: #FFFFFF;
|
|
4067
|
+
--ts-sig-text: #202124;
|
|
4068
|
+
--ts-clu: #D97706;
|
|
4069
|
+
--ts-clu-ink: #FFFFFF;
|
|
4070
|
+
--ts-clu-text: #B45309;
|
|
4071
|
+
--ts-clu-cached: #64748B;
|
|
4072
|
+
--ts-clu-cached-text: #5F6368;
|
|
4073
|
+
}
|
|
4074
|
+
|
|
4075
|
+
body[data-view-mode="simple"] {
|
|
4076
|
+
background: var(--bg-canvas);
|
|
4077
|
+
color: var(--text-primary);
|
|
4078
|
+
font-family: var(--font-sans);
|
|
4079
|
+
}
|
|
4080
|
+
body[data-view-mode="simple"] .wrap > header {
|
|
4081
|
+
padding-bottom: 1px;
|
|
4082
|
+
}
|
|
4083
|
+
body[data-view-mode="simple"] .wrap > header .brand-wordmark {
|
|
4084
|
+
height: 20px;
|
|
4085
|
+
width: auto;
|
|
4086
|
+
}
|
|
4087
|
+
body[data-view-mode="simple"] .wrap > header .brand-logo {
|
|
4088
|
+
width: 22px;
|
|
4089
|
+
height: 22px;
|
|
4090
|
+
}
|
|
4091
|
+
body[data-view-mode="simple"] .header-controls {
|
|
4092
|
+
padding: 0 0 6px 0 !important;
|
|
4093
|
+
margin: 0 !important;
|
|
4094
|
+
border-bottom: 1px solid var(--hairline) !important;
|
|
4095
|
+
}
|
|
3983
4096
|
|
|
3984
4097
|
#argonSimpleSurface {
|
|
3985
4098
|
display: none;
|
|
3986
4099
|
flex-direction: column;
|
|
3987
4100
|
width: 100%;
|
|
4101
|
+
font-family: var(--font-sans);
|
|
4102
|
+
color: var(--text-primary);
|
|
3988
4103
|
font-variant-numeric: tabular-nums;
|
|
3989
4104
|
}
|
|
3990
4105
|
body[data-view-mode="simple"] #argonSimpleSurface {
|
|
@@ -4000,200 +4115,505 @@
|
|
|
4000
4115
|
display: flex;
|
|
4001
4116
|
}
|
|
4002
4117
|
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
flex-direction: column;
|
|
4008
|
-
gap: 6px;
|
|
4009
|
-
}
|
|
4010
|
-
.ts-zone-last {
|
|
4011
|
-
padding: 11px 0 2px;
|
|
4118
|
+
/* Pass 2 Atomic Primitives: MetricHeader (Pinned at scrollTop: 0) */
|
|
4119
|
+
.ts-metric-header {
|
|
4120
|
+
padding: 8px 0;
|
|
4121
|
+
border-bottom: 1px solid var(--hairline);
|
|
4012
4122
|
display: flex;
|
|
4013
4123
|
flex-direction: column;
|
|
4014
4124
|
gap: 6px;
|
|
4015
4125
|
}
|
|
4016
|
-
.ts-
|
|
4126
|
+
.ts-status-row {
|
|
4017
4127
|
display: flex;
|
|
4018
4128
|
align-items: center;
|
|
4019
4129
|
justify-content: space-between;
|
|
4020
4130
|
gap: 8px;
|
|
4131
|
+
min-width: 0;
|
|
4021
4132
|
}
|
|
4022
|
-
.ts-
|
|
4023
|
-
|
|
4133
|
+
.ts-status-badge {
|
|
4134
|
+
display: inline-flex;
|
|
4135
|
+
align-items: center;
|
|
4136
|
+
gap: 6px;
|
|
4137
|
+
font-size: 12.5px;
|
|
4024
4138
|
font-weight: 600;
|
|
4025
|
-
text-
|
|
4026
|
-
|
|
4027
|
-
color: var(--hz-muted);
|
|
4028
|
-
margin: 0;
|
|
4139
|
+
color: var(--text-primary);
|
|
4140
|
+
min-width: 0;
|
|
4029
4141
|
}
|
|
4030
|
-
.ts-
|
|
4031
|
-
|
|
4142
|
+
.ts-dot {
|
|
4143
|
+
width: 7px;
|
|
4144
|
+
height: 7px;
|
|
4145
|
+
border-radius: 999px;
|
|
4146
|
+
background: var(--status-nominal);
|
|
4147
|
+
flex-shrink: 0;
|
|
4148
|
+
}
|
|
4149
|
+
.ts-dot[data-tone="nominal"] { background: var(--text-secondary); }
|
|
4150
|
+
.ts-dot[data-tone="signal"] { background: var(--status-nominal); }
|
|
4151
|
+
.ts-dot[data-tone="warn"] { background: var(--status-warning); }
|
|
4152
|
+
.ts-dot[data-tone="danger"] { background: var(--status-critical); }
|
|
4153
|
+
.ts-dot[data-tone="active"] { background: var(--accent-focus); }
|
|
4154
|
+
|
|
4155
|
+
.ts-runway-meta {
|
|
4156
|
+
font-family: var(--font-mono);
|
|
4032
4157
|
font-size: 11px;
|
|
4033
|
-
|
|
4158
|
+
font-variant-numeric: tabular-nums;
|
|
4159
|
+
color: var(--text-secondary);
|
|
4160
|
+
white-space: nowrap;
|
|
4161
|
+
flex-shrink: 0;
|
|
4034
4162
|
}
|
|
4035
|
-
.ts-meta[data-tone="
|
|
4036
|
-
.ts-meta[data-tone="
|
|
4037
|
-
|
|
4163
|
+
.ts-runway-meta[data-tone="warn"] { color: var(--status-warning); }
|
|
4164
|
+
.ts-runway-meta[data-tone="danger"] { color: var(--status-critical); font-weight: 600; }
|
|
4165
|
+
|
|
4166
|
+
.ts-quant-row {
|
|
4038
4167
|
display: flex;
|
|
4039
4168
|
align-items: baseline;
|
|
4040
4169
|
justify-content: space-between;
|
|
4041
4170
|
gap: 8px;
|
|
4042
|
-
|
|
4171
|
+
font-size: 11px;
|
|
4172
|
+
color: var(--text-secondary);
|
|
4173
|
+
font-variant-numeric: tabular-nums;
|
|
4043
4174
|
}
|
|
4044
|
-
.ts-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4175
|
+
.ts-quant-primary {
|
|
4176
|
+
font-family: var(--font-mono);
|
|
4177
|
+
font-variant-numeric: tabular-nums;
|
|
4178
|
+
color: var(--text-secondary);
|
|
4179
|
+
}
|
|
4180
|
+
.ts-quant-primary strong {
|
|
4181
|
+
color: var(--text-primary);
|
|
4049
4182
|
font-weight: 600;
|
|
4050
|
-
color: var(--hz-fg);
|
|
4051
4183
|
}
|
|
4052
|
-
.ts-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
background: #10B981;
|
|
4057
|
-
flex-shrink: 0;
|
|
4184
|
+
.ts-anchor-health {
|
|
4185
|
+
font-size: 10.5px;
|
|
4186
|
+
color: var(--text-muted);
|
|
4187
|
+
white-space: nowrap;
|
|
4058
4188
|
}
|
|
4059
|
-
.ts-
|
|
4060
|
-
|
|
4061
|
-
|
|
4189
|
+
.ts-anchor-health[data-risk="true"] {
|
|
4190
|
+
color: var(--status-critical);
|
|
4191
|
+
font-weight: 600;
|
|
4192
|
+
}
|
|
4193
|
+
|
|
4194
|
+
/* 1D 8px Horizon BulletBar (Zero Chartjunk) */
|
|
4062
4195
|
.ts-bar-wrap {
|
|
4063
4196
|
position: relative;
|
|
4064
|
-
padding:
|
|
4197
|
+
padding: 1px 0 11px;
|
|
4065
4198
|
}
|
|
4066
4199
|
.ts-bar-track {
|
|
4067
4200
|
width: 100%;
|
|
4068
4201
|
height: 8px;
|
|
4069
|
-
background:
|
|
4070
|
-
border: 1px solid var(--
|
|
4071
|
-
border-radius:
|
|
4202
|
+
background: var(--bg-elevated);
|
|
4203
|
+
border: 1px solid var(--hairline);
|
|
4204
|
+
border-radius: 2px;
|
|
4072
4205
|
overflow: hidden;
|
|
4073
4206
|
display: flex;
|
|
4074
4207
|
}
|
|
4075
4208
|
.ts-seg-signal {
|
|
4076
4209
|
height: 100%;
|
|
4077
|
-
background:
|
|
4078
|
-
transition: width
|
|
4210
|
+
background: var(--ts-sig);
|
|
4211
|
+
transition: width var(--ease-snappy);
|
|
4212
|
+
position: relative;
|
|
4213
|
+
overflow: hidden;
|
|
4079
4214
|
}
|
|
4080
4215
|
.ts-seg-clutter {
|
|
4081
4216
|
height: 100%;
|
|
4082
|
-
background:
|
|
4083
|
-
transition: width
|
|
4217
|
+
background: var(--ts-clu);
|
|
4218
|
+
transition: width var(--ease-snappy);
|
|
4219
|
+
position: relative;
|
|
4220
|
+
overflow: hidden;
|
|
4084
4221
|
}
|
|
4085
4222
|
.ts-seg-clutter[data-clutter-tone="cached"] {
|
|
4086
|
-
background:
|
|
4223
|
+
background: var(--ts-clu-cached);
|
|
4224
|
+
}
|
|
4225
|
+
.ts-seg-label,
|
|
4226
|
+
.ts-bar-outer-label {
|
|
4227
|
+
position: absolute;
|
|
4228
|
+
width: 1px;
|
|
4229
|
+
height: 1px;
|
|
4230
|
+
overflow: hidden;
|
|
4231
|
+
clip: rect(0, 0, 0, 0);
|
|
4232
|
+
white-space: nowrap;
|
|
4233
|
+
pointer-events: none;
|
|
4087
4234
|
}
|
|
4088
4235
|
.ts-safe-tick {
|
|
4089
4236
|
position: absolute;
|
|
4090
|
-
top:
|
|
4091
|
-
bottom:
|
|
4237
|
+
top: -1px;
|
|
4238
|
+
bottom: 9px;
|
|
4092
4239
|
width: 2px;
|
|
4093
|
-
background:
|
|
4240
|
+
background: var(--text-secondary);
|
|
4094
4241
|
pointer-events: none;
|
|
4095
4242
|
}
|
|
4243
|
+
.ts-safe-tick[data-breach="true"] {
|
|
4244
|
+
background: var(--status-critical);
|
|
4245
|
+
}
|
|
4246
|
+
.ts-safe-label {
|
|
4247
|
+
position: absolute;
|
|
4248
|
+
bottom: 0;
|
|
4249
|
+
transform: translateX(-100%);
|
|
4250
|
+
padding-right: 3px;
|
|
4251
|
+
white-space: nowrap;
|
|
4252
|
+
font-family: var(--font-mono);
|
|
4253
|
+
font-size: 9.5px;
|
|
4254
|
+
line-height: 10px;
|
|
4255
|
+
color: var(--text-muted);
|
|
4256
|
+
font-variant-numeric: tabular-nums;
|
|
4257
|
+
}
|
|
4258
|
+
.ts-safe-label[data-breach="true"] {
|
|
4259
|
+
color: var(--status-critical);
|
|
4260
|
+
font-weight: 600;
|
|
4261
|
+
}
|
|
4096
4262
|
.ts-legend {
|
|
4097
4263
|
display: flex;
|
|
4098
4264
|
align-items: center;
|
|
4099
|
-
|
|
4100
|
-
gap: 8px;
|
|
4265
|
+
gap: 10px;
|
|
4101
4266
|
flex-wrap: wrap;
|
|
4102
|
-
font-size:
|
|
4103
|
-
color: var(--
|
|
4104
|
-
|
|
4105
|
-
.ts-guidance-list {
|
|
4106
|
-
display: flex;
|
|
4107
|
-
flex-direction: column;
|
|
4108
|
-
gap: 6px;
|
|
4109
|
-
}
|
|
4110
|
-
.ts-guidance-row {
|
|
4111
|
-
display: grid;
|
|
4112
|
-
grid-template-columns: 44px minmax(0, 1fr);
|
|
4113
|
-
gap: 8px;
|
|
4114
|
-
align-items: start;
|
|
4115
|
-
padding: 6px 8px;
|
|
4116
|
-
border-radius: 4px;
|
|
4117
|
-
background: rgba(255, 255, 255, 0.025);
|
|
4118
|
-
border: 1px solid var(--hz-border);
|
|
4119
|
-
border-left-width: 2px;
|
|
4120
|
-
font-size: 11.5px;
|
|
4121
|
-
line-height: 1.4;
|
|
4122
|
-
overflow-wrap: anywhere;
|
|
4267
|
+
font-size: 10.5px;
|
|
4268
|
+
color: var(--text-secondary);
|
|
4269
|
+
font-variant-numeric: tabular-nums;
|
|
4123
4270
|
}
|
|
4124
|
-
.ts-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
.ts-tag {
|
|
4128
|
-
font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
|
|
4129
|
-
font-size: 10px;
|
|
4271
|
+
.ts-legend strong {
|
|
4272
|
+
font-family: var(--font-mono);
|
|
4273
|
+
color: var(--text-primary);
|
|
4130
4274
|
font-weight: 600;
|
|
4131
|
-
text-transform: uppercase;
|
|
4132
|
-
letter-spacing: 0.05em;
|
|
4133
|
-
padding-top: 1px;
|
|
4134
4275
|
}
|
|
4135
|
-
.ts-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
margin:
|
|
4141
|
-
|
|
4276
|
+
.ts-swatch-dot {
|
|
4277
|
+
display: inline-block;
|
|
4278
|
+
width: 6px;
|
|
4279
|
+
height: 6px;
|
|
4280
|
+
border-radius: 999px;
|
|
4281
|
+
margin-right: 4px;
|
|
4282
|
+
vertical-align: middle;
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4285
|
+
/* Immediate Remediation Strip + 28px ActionPill */
|
|
4286
|
+
.ts-remediation {
|
|
4142
4287
|
display: flex;
|
|
4143
4288
|
flex-direction: column;
|
|
4289
|
+
gap: 5px;
|
|
4290
|
+
padding-top: 2px;
|
|
4144
4291
|
}
|
|
4145
|
-
.ts-
|
|
4146
|
-
display:
|
|
4147
|
-
grid-template-columns: 36px minmax(0, 1fr) auto;
|
|
4148
|
-
gap: 8px;
|
|
4292
|
+
.ts-guidance-row {
|
|
4293
|
+
display: flex;
|
|
4149
4294
|
align-items: baseline;
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4295
|
+
gap: 6px;
|
|
4296
|
+
padding: 0;
|
|
4297
|
+
border: 0;
|
|
4298
|
+
background: transparent;
|
|
4299
|
+
font-size: 11px;
|
|
4300
|
+
line-height: 1.35;
|
|
4301
|
+
color: var(--text-secondary);
|
|
4153
4302
|
overflow-wrap: anywhere;
|
|
4154
4303
|
}
|
|
4155
|
-
.ts-
|
|
4156
|
-
|
|
4157
|
-
|
|
4304
|
+
.ts-guidance-row[data-tone="avoid"] {
|
|
4305
|
+
padding-left: 6px;
|
|
4306
|
+
border-left: 2px solid var(--status-warning);
|
|
4307
|
+
color: var(--text-primary);
|
|
4308
|
+
}
|
|
4309
|
+
.ts-guidance-row[data-tone="danger"] {
|
|
4310
|
+
padding-left: 6px;
|
|
4311
|
+
border-left: 2px solid var(--status-critical);
|
|
4312
|
+
color: var(--text-primary);
|
|
4313
|
+
}
|
|
4314
|
+
.ts-tag {
|
|
4315
|
+
font-family: var(--font-mono);
|
|
4316
|
+
font-size: 9.5px;
|
|
4158
4317
|
font-weight: 600;
|
|
4159
|
-
|
|
4160
|
-
|
|
4318
|
+
text-transform: uppercase;
|
|
4319
|
+
letter-spacing: 0.04em;
|
|
4320
|
+
color: var(--text-muted);
|
|
4321
|
+
flex-shrink: 0;
|
|
4161
4322
|
}
|
|
4323
|
+
.ts-guidance-row[data-tone="avoid"] .ts-tag { color: var(--status-warning); }
|
|
4324
|
+
.ts-guidance-row[data-tone="danger"] .ts-tag { color: var(--status-critical); }
|
|
4325
|
+
|
|
4162
4326
|
.ts-cta-btn {
|
|
4163
4327
|
width: 100%;
|
|
4164
|
-
min-height:
|
|
4165
|
-
padding:
|
|
4166
|
-
border-radius:
|
|
4328
|
+
min-height: var(--control-height);
|
|
4329
|
+
padding: 4px 10px;
|
|
4330
|
+
border-radius: var(--control-radius);
|
|
4167
4331
|
border: 1px solid var(--hz-fg);
|
|
4168
4332
|
background: var(--hz-fg);
|
|
4169
|
-
color:
|
|
4170
|
-
font-family:
|
|
4171
|
-
font-size:
|
|
4333
|
+
color: var(--hz-bg);
|
|
4334
|
+
font-family: var(--font-sans);
|
|
4335
|
+
font-size: 11.5px;
|
|
4172
4336
|
font-weight: 600;
|
|
4337
|
+
white-space: normal;
|
|
4338
|
+
text-align: center;
|
|
4339
|
+
line-height: 1.2;
|
|
4173
4340
|
cursor: pointer;
|
|
4174
4341
|
display: inline-flex;
|
|
4175
4342
|
align-items: center;
|
|
4176
4343
|
justify-content: center;
|
|
4177
4344
|
gap: 6px;
|
|
4345
|
+
transition: opacity var(--ease-snappy), transform var(--ease-snappy);
|
|
4346
|
+
}
|
|
4347
|
+
.ts-cta-btn:hover:not(:disabled) { opacity: 0.9; }
|
|
4348
|
+
.ts-cta-btn:active:not(:disabled) { transform: scale(0.988); }
|
|
4349
|
+
.ts-cta-btn[data-cta-state="ready"] {
|
|
4350
|
+
background: var(--accent-focus);
|
|
4351
|
+
color: #FFFFFF;
|
|
4352
|
+
border-color: var(--accent-focus);
|
|
4178
4353
|
}
|
|
4179
4354
|
.ts-cta-btn[data-cta-state="guarded"] {
|
|
4180
|
-
background:
|
|
4181
|
-
color: var(--
|
|
4182
|
-
border-color: var(--
|
|
4355
|
+
background: var(--bg-elevated);
|
|
4356
|
+
color: var(--text-primary);
|
|
4357
|
+
border-color: var(--hairline);
|
|
4183
4358
|
}
|
|
4184
4359
|
.ts-cta-btn[data-cta-state="crisis"] {
|
|
4185
|
-
background:
|
|
4360
|
+
background: var(--status-critical);
|
|
4186
4361
|
color: #FFFFFF;
|
|
4187
|
-
border-color:
|
|
4362
|
+
border-color: var(--status-critical);
|
|
4188
4363
|
}
|
|
4189
4364
|
.ts-cta-btn:disabled,
|
|
4190
4365
|
.ts-cta-btn[data-cta-state="disabled"] {
|
|
4191
4366
|
background: transparent;
|
|
4192
|
-
color: var(--
|
|
4193
|
-
border-color: var(--
|
|
4367
|
+
color: var(--text-muted);
|
|
4368
|
+
border-color: var(--hairline);
|
|
4194
4369
|
opacity: 0.55;
|
|
4195
4370
|
cursor: not-allowed;
|
|
4196
4371
|
}
|
|
4372
|
+
.ts-compact-caption {
|
|
4373
|
+
display: flex;
|
|
4374
|
+
flex-wrap: wrap;
|
|
4375
|
+
align-items: baseline;
|
|
4376
|
+
justify-content: space-between;
|
|
4377
|
+
gap: 2px 8px;
|
|
4378
|
+
font-size: 10px;
|
|
4379
|
+
line-height: 1.3;
|
|
4380
|
+
color: var(--text-muted);
|
|
4381
|
+
}
|
|
4382
|
+
.ts-compact-caption code {
|
|
4383
|
+
font-family: var(--font-mono);
|
|
4384
|
+
color: var(--text-secondary);
|
|
4385
|
+
}
|
|
4386
|
+
|
|
4387
|
+
/* Core Health Signals: Full-Bleed 1px Hairline MetricRows (Zero Nested Cards) */
|
|
4388
|
+
.ts-metric-list {
|
|
4389
|
+
display: flex;
|
|
4390
|
+
flex-direction: column;
|
|
4391
|
+
}
|
|
4392
|
+
.ts-metric-row {
|
|
4393
|
+
display: grid;
|
|
4394
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
4395
|
+
align-items: center;
|
|
4396
|
+
gap: 8px;
|
|
4397
|
+
padding: 6.5px 0;
|
|
4398
|
+
border-bottom: 1px solid var(--hairline);
|
|
4399
|
+
min-width: 0;
|
|
4400
|
+
}
|
|
4401
|
+
.ts-metric-main {
|
|
4402
|
+
display: flex;
|
|
4403
|
+
flex-wrap: wrap;
|
|
4404
|
+
align-items: baseline;
|
|
4405
|
+
gap: 2px 7px;
|
|
4406
|
+
min-width: 0;
|
|
4407
|
+
}
|
|
4408
|
+
.ts-metric-label {
|
|
4409
|
+
font-size: 11px;
|
|
4410
|
+
font-weight: 500;
|
|
4411
|
+
color: var(--text-secondary);
|
|
4412
|
+
white-space: nowrap;
|
|
4413
|
+
}
|
|
4414
|
+
.ts-meta {
|
|
4415
|
+
font-family: var(--font-mono);
|
|
4416
|
+
font-size: 11px;
|
|
4417
|
+
font-variant-numeric: tabular-nums;
|
|
4418
|
+
color: var(--text-primary);
|
|
4419
|
+
min-width: 0;
|
|
4420
|
+
overflow-wrap: anywhere;
|
|
4421
|
+
}
|
|
4422
|
+
.ts-meta[data-tone="muted"] { color: var(--text-secondary); }
|
|
4423
|
+
.ts-meta[data-tone="signal"] { color: var(--text-primary); }
|
|
4424
|
+
.ts-meta[data-tone="warn"] { color: var(--status-warning); font-weight: 600; }
|
|
4425
|
+
.ts-meta[data-tone="danger"] { color: var(--status-critical); font-weight: 600; }
|
|
4426
|
+
|
|
4427
|
+
/* High-Resolution Micro-Visuals: 6px BulletBar + 72x18 Sparkline */
|
|
4428
|
+
.ts-micro-bullet {
|
|
4429
|
+
position: relative;
|
|
4430
|
+
width: 60px;
|
|
4431
|
+
height: 6px;
|
|
4432
|
+
background: var(--bg-elevated);
|
|
4433
|
+
border: 1px solid var(--hairline);
|
|
4434
|
+
border-radius: 2px;
|
|
4435
|
+
overflow: hidden;
|
|
4436
|
+
flex-shrink: 0;
|
|
4437
|
+
}
|
|
4438
|
+
.ts-micro-bullet-fill {
|
|
4439
|
+
height: 100%;
|
|
4440
|
+
background: var(--text-primary);
|
|
4441
|
+
transition: width var(--ease-snappy);
|
|
4442
|
+
}
|
|
4443
|
+
.ts-micro-bullet-fill[data-tone="nominal"] { background: var(--status-nominal); }
|
|
4444
|
+
.ts-micro-bullet-fill[data-tone="warn"] { background: var(--status-warning); }
|
|
4445
|
+
.ts-micro-bullet-tick {
|
|
4446
|
+
position: absolute;
|
|
4447
|
+
top: 0;
|
|
4448
|
+
bottom: 0;
|
|
4449
|
+
left: 80%;
|
|
4450
|
+
width: 1.5px;
|
|
4451
|
+
background: var(--text-muted);
|
|
4452
|
+
pointer-events: none;
|
|
4453
|
+
}
|
|
4454
|
+
.ts-sparkline {
|
|
4455
|
+
width: 72px;
|
|
4456
|
+
height: 18px;
|
|
4457
|
+
display: block;
|
|
4458
|
+
flex-shrink: 0;
|
|
4459
|
+
overflow: visible;
|
|
4460
|
+
}
|
|
4461
|
+
.ts-kpi-inline {
|
|
4462
|
+
font-family: var(--font-mono);
|
|
4463
|
+
font-size: 11px;
|
|
4464
|
+
font-variant-numeric: tabular-nums;
|
|
4465
|
+
color: var(--text-primary);
|
|
4466
|
+
font-weight: 600;
|
|
4467
|
+
}
|
|
4468
|
+
.ts-kpi-sub {
|
|
4469
|
+
font-family: var(--font-mono);
|
|
4470
|
+
font-size: 10.5px;
|
|
4471
|
+
font-variant-numeric: tabular-nums;
|
|
4472
|
+
color: var(--text-muted);
|
|
4473
|
+
}
|
|
4474
|
+
|
|
4475
|
+
/* Progressive Disclosure Drawers (CollapsibleSection, Zero Layout Shift) */
|
|
4476
|
+
.ts-why,
|
|
4477
|
+
.ts-drawer {
|
|
4478
|
+
border-bottom: 1px solid var(--hairline);
|
|
4479
|
+
padding: 6px 0;
|
|
4480
|
+
}
|
|
4481
|
+
.ts-why > summary,
|
|
4482
|
+
.ts-drawer > summary {
|
|
4483
|
+
list-style: none;
|
|
4484
|
+
cursor: pointer;
|
|
4485
|
+
display: flex;
|
|
4486
|
+
align-items: center;
|
|
4487
|
+
justify-content: space-between;
|
|
4488
|
+
gap: 8px;
|
|
4489
|
+
font-size: 11px;
|
|
4490
|
+
font-weight: 500;
|
|
4491
|
+
color: var(--text-secondary);
|
|
4492
|
+
user-select: none;
|
|
4493
|
+
}
|
|
4494
|
+
.ts-why > summary::-webkit-details-marker,
|
|
4495
|
+
.ts-drawer > summary::-webkit-details-marker { display: none; }
|
|
4496
|
+
.ts-why > summary:hover,
|
|
4497
|
+
.ts-drawer > summary:hover { color: var(--text-primary); }
|
|
4498
|
+
.ts-why > summary:focus-visible,
|
|
4499
|
+
.ts-drawer > summary:focus-visible { outline: 1.5px solid var(--accent-focus); outline-offset: 2px; border-radius: 2px; }
|
|
4500
|
+
.ts-why-caret {
|
|
4501
|
+
display: inline-block;
|
|
4502
|
+
width: 10px;
|
|
4503
|
+
color: var(--text-muted);
|
|
4504
|
+
transition: transform var(--ease-snappy);
|
|
4505
|
+
}
|
|
4506
|
+
.ts-why[open] .ts-why-caret,
|
|
4507
|
+
.ts-drawer[open] .ts-why-caret { transform: rotate(90deg); }
|
|
4508
|
+
.ts-drawer-body {
|
|
4509
|
+
margin-top: 6px;
|
|
4510
|
+
padding-left: 10px;
|
|
4511
|
+
display: flex;
|
|
4512
|
+
flex-direction: column;
|
|
4513
|
+
gap: 6px;
|
|
4514
|
+
}
|
|
4515
|
+
.ts-why-total, .ts-why-tok {
|
|
4516
|
+
font-family: var(--font-mono);
|
|
4517
|
+
font-variant-numeric: tabular-nums;
|
|
4518
|
+
color: var(--text-primary);
|
|
4519
|
+
font-weight: 600;
|
|
4520
|
+
}
|
|
4521
|
+
.ts-why-list { list-style: none; margin: 5px 0 0; padding: 0; }
|
|
4522
|
+
.ts-why-row {
|
|
4523
|
+
display: flex;
|
|
4524
|
+
justify-content: space-between;
|
|
4525
|
+
gap: 8px;
|
|
4526
|
+
padding: 3.5px 0 3.5px 10px;
|
|
4527
|
+
border-top: 1px solid var(--hairline);
|
|
4528
|
+
font-size: 11px;
|
|
4529
|
+
color: var(--text-primary);
|
|
4530
|
+
}
|
|
4531
|
+
.ts-why-row:first-child { border-top: none; }
|
|
4532
|
+
.ts-why-sub { color: var(--text-muted); }
|
|
4533
|
+
.ts-why-keep { padding: 3px 0 0 10px; font-size: 10.5px; color: var(--text-muted); }
|
|
4534
|
+
|
|
4535
|
+
/* Flattened Switch & Hygiene Rows inside Progressive Disclosure */
|
|
4536
|
+
.ts-switch-grid {
|
|
4537
|
+
display: grid;
|
|
4538
|
+
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
4539
|
+
gap: 6px;
|
|
4540
|
+
}
|
|
4541
|
+
.ts-guidance-row.ts-switch-card {
|
|
4542
|
+
display: flex;
|
|
4543
|
+
flex-direction: column;
|
|
4544
|
+
align-items: stretch;
|
|
4545
|
+
gap: 2px;
|
|
4546
|
+
min-width: 0;
|
|
4547
|
+
padding: 5px 0 0;
|
|
4548
|
+
border: 0;
|
|
4549
|
+
border-top: 1px solid var(--hairline);
|
|
4550
|
+
background: transparent;
|
|
4551
|
+
}
|
|
4552
|
+
.ts-switch-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
|
|
4553
|
+
.ts-switch-verdict {
|
|
4554
|
+
font-family: var(--font-mono);
|
|
4555
|
+
font-size: 10px;
|
|
4556
|
+
font-weight: 600;
|
|
4557
|
+
font-variant-numeric: tabular-nums;
|
|
4558
|
+
letter-spacing: 0.02em;
|
|
4559
|
+
color: var(--text-secondary);
|
|
4560
|
+
}
|
|
4561
|
+
.ts-switch-card[data-tone="do"] .ts-switch-verdict { color: var(--text-secondary); }
|
|
4562
|
+
.ts-switch-card[data-tone="avoid"] .ts-switch-verdict { color: var(--status-warning); }
|
|
4563
|
+
.ts-switch-card[data-tone="danger"] .ts-switch-verdict { color: var(--status-critical); }
|
|
4564
|
+
.ts-switch-name { font-size: 11px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
|
|
4565
|
+
.ts-switch-lines {
|
|
4566
|
+
margin: 0;
|
|
4567
|
+
padding: 0;
|
|
4568
|
+
list-style: none;
|
|
4569
|
+
font-size: 10.5px;
|
|
4570
|
+
color: var(--text-secondary);
|
|
4571
|
+
font-variant-numeric: tabular-nums;
|
|
4572
|
+
}
|
|
4573
|
+
.ts-switch-lines li + li { margin-top: 2px; }
|
|
4574
|
+
.ts-switch-card .ts-sub { font-size: 10.5px; color: var(--text-muted); }
|
|
4575
|
+
|
|
4576
|
+
.ts-ledger {
|
|
4577
|
+
list-style: none;
|
|
4578
|
+
margin: 5px 0 0;
|
|
4579
|
+
padding: 0;
|
|
4580
|
+
display: flex;
|
|
4581
|
+
flex-direction: column;
|
|
4582
|
+
}
|
|
4583
|
+
.ts-ledger-row {
|
|
4584
|
+
display: grid;
|
|
4585
|
+
grid-template-columns: 36px minmax(0, 1fr) auto;
|
|
4586
|
+
gap: 8px;
|
|
4587
|
+
align-items: baseline;
|
|
4588
|
+
padding: 3.5px 0 3.5px 10px;
|
|
4589
|
+
border-top: 1px solid var(--hairline);
|
|
4590
|
+
font-size: 11px;
|
|
4591
|
+
color: var(--text-primary);
|
|
4592
|
+
overflow-wrap: anywhere;
|
|
4593
|
+
}
|
|
4594
|
+
.ts-ledger-row:first-child { border-top: none; }
|
|
4595
|
+
.ts-ledger-age { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
|
|
4596
|
+
.ts-ledger-saved { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-secondary); font-weight: 600; }
|
|
4597
|
+
.ts-guard-head { margin: 8px 0 0 10px; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
|
|
4598
|
+
.ts-guard-list { max-height: 180px; overflow-y: auto; }
|
|
4599
|
+
.ts-guard-list[hidden], .ts-guard-head[hidden] { display: none; }
|
|
4600
|
+
.ts-guard-list .ts-ledger-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
|
|
4601
|
+
.ts-guard-list .ts-ledger-row[data-tripped="true"] .ts-ledger-saved { color: var(--warn, #f59e0b); }
|
|
4602
|
+
.ts-guard-list .ts-ledger-row[data-mode="advisory"] .ts-ledger-saved { font-weight: 400; color: var(--text-muted); }
|
|
4603
|
+
|
|
4604
|
+
[data-theme="light"] .ta-cell:not([data-cat]) { background: var(--hz-free); }
|
|
4605
|
+
[data-theme="light"] .ta-inspector,
|
|
4606
|
+
[data-theme="light"] .ta-ucurve,
|
|
4607
|
+
[data-theme="light"] .ta-source-grid,
|
|
4608
|
+
[data-theme="light"] .tufte-top-host-badge { background: var(--hz-card); }
|
|
4609
|
+
[data-theme="light"] .header-controls .shadcn-tabs-list,
|
|
4610
|
+
[data-theme="light"] .ta-mini-btn { background: var(--hz-card-alt) !important; }
|
|
4611
|
+
[data-theme="light"] .header-controls .shadcn-tab-trigger[aria-selected="true"] { background: var(--hz-card); }
|
|
4612
|
+
[data-theme="light"] .ta-table td { border-bottom-color: var(--hz-border-subtle); }
|
|
4613
|
+
|
|
4614
|
+
@media (prefers-reduced-motion: reduce) {
|
|
4615
|
+
.ts-why-caret, .ts-seg-signal, .ts-seg-clutter, .ts-micro-bullet-fill, .ts-cta-btn { transition: none; }
|
|
4616
|
+
}
|
|
4197
4617
|
|
|
4198
4618
|
/* Advanced Forensic Surface inside horizon_panel.html */
|
|
4199
4619
|
.ta-subhud {
|
|
@@ -4232,15 +4652,17 @@
|
|
|
4232
4652
|
.ta-cell[data-cat="clutter"] { background: #F59E0B; }
|
|
4233
4653
|
.ta-cell[data-cat="error"] { background: #EF4444; }
|
|
4234
4654
|
.ta-cell[aria-selected="true"] {
|
|
4235
|
-
outline: 1.5px solid
|
|
4655
|
+
outline: 1.5px solid var(--hz-fg);
|
|
4236
4656
|
outline-offset: -1.5px;
|
|
4237
4657
|
z-index: 2;
|
|
4238
4658
|
}
|
|
4239
4659
|
.ta-inspector {
|
|
4240
4660
|
display: flex;
|
|
4661
|
+
flex-wrap: wrap;
|
|
4241
4662
|
align-items: center;
|
|
4242
4663
|
justify-content: space-between;
|
|
4243
|
-
gap: 8px;
|
|
4664
|
+
gap: 4px 8px;
|
|
4665
|
+
min-width: 0;
|
|
4244
4666
|
padding: 4px 7px;
|
|
4245
4667
|
background: rgba(255, 255, 255, 0.03);
|
|
4246
4668
|
border: 1px solid var(--hz-border);
|
|
@@ -4250,7 +4672,7 @@
|
|
|
4250
4672
|
}
|
|
4251
4673
|
.ta-ucurve {
|
|
4252
4674
|
display: grid;
|
|
4253
|
-
grid-template-columns: repeat(3, 1fr);
|
|
4675
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
4254
4676
|
gap: 6px;
|
|
4255
4677
|
padding: 5px 7px;
|
|
4256
4678
|
background: rgba(255, 255, 255, 0.025);
|
|
@@ -4296,7 +4718,7 @@
|
|
|
4296
4718
|
}
|
|
4297
4719
|
.ta-source-grid {
|
|
4298
4720
|
display: grid;
|
|
4299
|
-
grid-template-columns: repeat(4, 1fr);
|
|
4721
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
4300
4722
|
gap: 4px;
|
|
4301
4723
|
padding: 5px 7px;
|
|
4302
4724
|
background: rgba(255, 255, 255, 0.025);
|
|
@@ -4305,6 +4727,16 @@
|
|
|
4305
4727
|
font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
|
|
4306
4728
|
font-size: 10px;
|
|
4307
4729
|
}
|
|
4730
|
+
@media (max-width: 400px) {
|
|
4731
|
+
body { padding: 10px 12px !important; }
|
|
4732
|
+
.header-controls .shadcn-tab-trigger { padding: 2px 7px !important; font-size: 10px !important; }
|
|
4733
|
+
.tufte-top-host-badge { font-size: 10px; padding: 2px 5px; }
|
|
4734
|
+
.ts-switch-grid { grid-template-columns: 1fr; }
|
|
4735
|
+
.ta-ucurve { gap: 4px; padding: 5px; font-size: 10px; }
|
|
4736
|
+
.ta-source-grid { gap: 3px; padding: 5px; font-size: 9.5px; }
|
|
4737
|
+
.ta-table th, .ta-table td { padding: 3px 2px; font-size: 9.5px; }
|
|
4738
|
+
.ta-mini-btn { padding: 2px 5px; font-size: 9.5px; }
|
|
4739
|
+
}
|
|
4308
4740
|
</style>
|
|
4309
4741
|
</head>
|
|
4310
4742
|
<body data-view-mode="simple">
|
|
@@ -4337,94 +4769,139 @@
|
|
|
4337
4769
|
LIVE EDWARD TUFTE "SIMPLE VIEW" SURFACE (Active when data-view-mode=simple)
|
|
4338
4770
|
========================================================================= -->
|
|
4339
4771
|
<div id="argonSimpleSurface" aria-label="Highbeam Simple View">
|
|
4340
|
-
<!--
|
|
4341
|
-
<section class="ts-
|
|
4342
|
-
<div class="ts-head">
|
|
4343
|
-
<h2 class="ts-overline">Zone A · System State & Context</h2>
|
|
4344
|
-
<span id="tsCacheMeta" class="ts-meta" data-tone="muted">0% hit · Cold</span>
|
|
4345
|
-
</div>
|
|
4772
|
+
<!-- Pass 2 MetricHeader: Pinned at scrollTop: 0 (Status + HorizonBulletBar + Primary ActionPill) -->
|
|
4773
|
+
<section id="tsMetricHeader" class="ts-metric-header">
|
|
4346
4774
|
<div class="ts-status-row">
|
|
4347
4775
|
<div class="ts-status-badge" role="status" aria-live="polite">
|
|
4348
|
-
<span id="tsStatusDot" class="ts-dot" data-tone="
|
|
4349
|
-
<span id="tsStatusLabel">
|
|
4350
|
-
</div>
|
|
4351
|
-
<div style="font-size:11.5px;">
|
|
4352
|
-
<strong id="tsUsedLabel">0.0k</strong>
|
|
4353
|
-
<span style="color:var(--hz-muted);">/ <span id="tsSafeLabel">179.0k</span> safe (<span id="tsUsedPct">0%</span>)</span>
|
|
4776
|
+
<span id="tsStatusDot" class="ts-dot" data-tone="nominal"></span>
|
|
4777
|
+
<span id="tsStatusLabel">Nominal Memory</span>
|
|
4354
4778
|
</div>
|
|
4779
|
+
<span id="tsRunwayMeta" class="ts-runway-meta" data-tone="nominal">179.0k headroom</span>
|
|
4780
|
+
</div>
|
|
4781
|
+
|
|
4782
|
+
<div class="ts-quant-row">
|
|
4783
|
+
<span class="ts-quant-primary">
|
|
4784
|
+
<strong id="tsUsedLabel">0.0k</strong> / <span id="tsSafeLabel">179.0k</span> safe (<span id="tsUsedPct">0%</span>)
|
|
4785
|
+
</span>
|
|
4786
|
+
<span id="tsAnchorHealth" class="ts-anchor-health" data-risk="false">Pinned rules safe</span>
|
|
4355
4787
|
</div>
|
|
4356
|
-
|
|
4788
|
+
|
|
4789
|
+
<div class="ts-bar-wrap" role="img" aria-label="Context usage vs safe limit">
|
|
4357
4790
|
<div class="ts-bar-track">
|
|
4358
|
-
<div id="tsBarSignal" class="ts-seg-signal" style="width:0%"></div>
|
|
4359
|
-
<div id="tsBarClutter" class="ts-seg-clutter" data-clutter-tone="stale" style="width:0%"></div>
|
|
4791
|
+
<div id="tsBarSignal" class="ts-seg-signal" style="width:0%"><span id="tsBarSignalLabel" class="ts-seg-label"></span></div>
|
|
4792
|
+
<div id="tsBarClutter" class="ts-seg-clutter" data-clutter-tone="stale" style="width:0%"><span id="tsBarClutterLabel" class="ts-seg-label"></span></div>
|
|
4360
4793
|
</div>
|
|
4361
4794
|
<div id="tsSafeTick" class="ts-safe-tick" style="left:70%" title="Safe Attention Horizon"></div>
|
|
4795
|
+
<div id="tsSafeTickLabel" class="ts-safe-label" style="left:70%">safe limit</div>
|
|
4796
|
+
<div id="tsBarOuterLabel" class="ts-bar-outer-label" hidden></div>
|
|
4362
4797
|
</div>
|
|
4798
|
+
|
|
4363
4799
|
<div class="ts-legend">
|
|
4364
|
-
<span><span style="
|
|
4365
|
-
<span><span id="tsClutterDot" style="
|
|
4366
|
-
<span id="tsAnchorHealth" style="color:var(--hz-muted);">Pinned rules safe</span>
|
|
4800
|
+
<span><span class="ts-swatch-dot" style="background:var(--ts-sig);" aria-hidden="true"></span>Signal <strong id="tsValSignal">0.0k</strong></span>
|
|
4801
|
+
<span><span id="tsClutterDot" class="ts-swatch-dot" style="background:var(--ts-clu);" aria-hidden="true"></span><span id="tsClutterKind">Reclaimable</span> <strong id="tsValClutter">0.0k</strong></span>
|
|
4367
4802
|
</div>
|
|
4368
|
-
</section>
|
|
4369
4803
|
|
|
4370
|
-
|
|
4371
|
-
<section class="ts-zone">
|
|
4372
|
-
<div class="ts-head">
|
|
4373
|
-
<h2 class="ts-overline">Zone B · Direct Guidance</h2>
|
|
4374
|
-
<span id="tsGuidanceBadge" class="ts-meta" data-tone="signal">Model: OK · Effort: OK</span>
|
|
4375
|
-
</div>
|
|
4376
|
-
<div class="ts-guidance-list">
|
|
4804
|
+
<div class="ts-remediation">
|
|
4377
4805
|
<div id="tsDoRow" class="ts-guidance-row" data-tone="do">
|
|
4378
|
-
<span class="ts-tag">
|
|
4806
|
+
<span class="ts-tag">Next</span>
|
|
4379
4807
|
<span id="tsDoText">Safe to run multi-file edits or implementation tasks; working memory has ample headroom.</span>
|
|
4380
4808
|
</div>
|
|
4809
|
+
<button type="button" id="tsBtnCleanPrimary" class="ts-cta-btn" data-cta-state="guarded">
|
|
4810
|
+
<span id="tsBtnCleanLabel">Copy /compact Command (Memory Clean)</span>
|
|
4811
|
+
</button>
|
|
4812
|
+
<div class="ts-compact-caption">
|
|
4813
|
+
<span id="tsCompactReclaim">0.0k reclaimable clutter · Active working set protected</span>
|
|
4814
|
+
<span id="tsCompactInstruction">Type <code>/compact</code> in chat & press Enter</span>
|
|
4815
|
+
</div>
|
|
4816
|
+
</div>
|
|
4817
|
+
</section>
|
|
4818
|
+
|
|
4819
|
+
<!-- Core Health Signals: 3 Full-Bleed 1px Hairline Rows (Zero Nested Cards) -->
|
|
4820
|
+
<div class="ts-metric-list" role="region" aria-label="Core session telemetry">
|
|
4821
|
+
<!-- Signal 1: Prompt Cache Hit Rate & TTL -> 1D BulletBar -->
|
|
4822
|
+
<div class="ts-metric-row">
|
|
4823
|
+
<div class="ts-metric-main">
|
|
4824
|
+
<span class="ts-metric-label">Prompt cache</span>
|
|
4825
|
+
<span id="tsCacheMeta" class="ts-meta" data-tone="muted">0% hit · Cold</span>
|
|
4826
|
+
</div>
|
|
4827
|
+
<div class="ts-micro-bullet" role="img" aria-label="Prompt cache hit rate against 80% target">
|
|
4828
|
+
<div id="tsCacheBulletFill" class="ts-micro-bullet-fill" style="width:0%"></div>
|
|
4829
|
+
<div class="ts-micro-bullet-tick" title="80% cache hit target"></div>
|
|
4830
|
+
</div>
|
|
4831
|
+
</div>
|
|
4832
|
+
|
|
4833
|
+
<!-- Signal 2: Model & Effort Switch Gate -->
|
|
4834
|
+
<div class="ts-metric-row">
|
|
4835
|
+
<div class="ts-metric-main">
|
|
4836
|
+
<span class="ts-metric-label">Switch gate</span>
|
|
4837
|
+
<span id="tsSwitchActiveSummary" class="ts-kpi-sub">Auto · Auto</span>
|
|
4838
|
+
</div>
|
|
4839
|
+
<span id="tsGuidanceBadge" class="ts-meta" data-tone="muted">Model: OK · Effort: OK</span>
|
|
4840
|
+
</div>
|
|
4841
|
+
|
|
4842
|
+
<!-- Signal 3: Verified Savings & Velocity -> 72x18 Word-Sized SVG Sparkline -->
|
|
4843
|
+
<div class="ts-metric-row">
|
|
4844
|
+
<div class="ts-metric-main">
|
|
4845
|
+
<span class="ts-metric-label">Saved</span>
|
|
4846
|
+
<span id="tsKpiSaved" class="ts-kpi-inline">+0.0k</span>
|
|
4847
|
+
<span id="tsKpiUsd" class="ts-kpi-sub">~$0.00</span>
|
|
4848
|
+
<span class="ts-kpi-sub" aria-hidden="true">·</span>
|
|
4849
|
+
<span id="tsKpi30d" class="ts-kpi-sub">30d: +0.0k (~$0.00)</span>
|
|
4850
|
+
<span id="tsSprintMeta" class="ts-kpi-sub" hidden></span>
|
|
4851
|
+
</div>
|
|
4852
|
+
<svg id="tsTurnSparkline" class="ts-sparkline" width="72" height="18" viewBox="0 0 72 18" role="img" aria-label="Per-turn context velocity sparkline">
|
|
4853
|
+
<polyline id="tsSparklinePath" fill="none" stroke="var(--text-secondary)" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round" points="1,15 71,15"/>
|
|
4854
|
+
<circle id="tsSparklineDot" cx="71" cy="15" r="2" fill="var(--text-primary)"/>
|
|
4855
|
+
</svg>
|
|
4856
|
+
</div>
|
|
4857
|
+
</div>
|
|
4858
|
+
|
|
4859
|
+
<!-- Progressive Disclosure: Zero-Layout-Shift Expandable Diagnostics -->
|
|
4860
|
+
<details id="tsWhyClears" class="ts-why" hidden>
|
|
4861
|
+
<summary><span><span class="ts-why-caret" aria-hidden="true">▸</span>What <code>/compact</code> clears</span><span id="tsWhyTotal" class="ts-why-total">0.0k</span></summary>
|
|
4862
|
+
<ul id="tsWhyList" class="ts-why-list" role="list"></ul>
|
|
4863
|
+
<div id="tsWhyKeepNote" class="ts-why-keep">Keeps rules, <code>task.md</code>, plan & active code.</div>
|
|
4864
|
+
</details>
|
|
4865
|
+
|
|
4866
|
+
<details id="tsSwitchDetailsDrawer" class="ts-drawer">
|
|
4867
|
+
<summary><span><span class="ts-why-caret" aria-hidden="true">▸</span>Switch cost & hygiene rules</span><span id="tsSwitchDrawerHint" class="ts-kpi-sub">Details</span></summary>
|
|
4868
|
+
<div class="ts-drawer-body">
|
|
4381
4869
|
<div id="tsAvoidRow" class="ts-guidance-row" data-tone="avoid">
|
|
4382
4870
|
<span class="ts-tag">AVOID</span>
|
|
4383
4871
|
<span id="tsAvoidText">Avoid reading large files without line bounds (`StartLine`/`EndLine`) to keep context lean.</span>
|
|
4384
4872
|
</div>
|
|
4385
|
-
<div
|
|
4386
|
-
<
|
|
4387
|
-
|
|
4873
|
+
<div class="ts-switch-grid">
|
|
4874
|
+
<div id="tsModelCard" class="ts-guidance-row ts-switch-card" data-tone="do">
|
|
4875
|
+
<div class="ts-switch-head"><span class="ts-tag">MODEL</span><span id="tsModelVerdict" class="ts-switch-verdict">OK</span></div>
|
|
4876
|
+
<div id="tsModelName" class="ts-switch-name">Auto</div>
|
|
4877
|
+
<ul class="ts-switch-lines">
|
|
4878
|
+
<li id="tsModelSameFam">Cache is cold — no rewrite penalty.</li>
|
|
4879
|
+
<li id="tsModelCrossFam"></li>
|
|
4880
|
+
</ul>
|
|
4881
|
+
<div id="tsModelLast" class="ts-sub" hidden></div>
|
|
4882
|
+
</div>
|
|
4883
|
+
<div id="tsEffortCard" class="ts-guidance-row ts-switch-card" data-tone="do">
|
|
4884
|
+
<div class="ts-switch-head"><span class="ts-tag">EFFORT</span><span id="tsEffortVerdict" class="ts-switch-verdict">OK</span></div>
|
|
4885
|
+
<div id="tsEffortName" class="ts-switch-name">Auto</div>
|
|
4886
|
+
<div id="tsEffortText" class="ts-sub">Match tier to task: Low/Med for edits, High for specs.</div>
|
|
4887
|
+
<div id="tsEffortHist" class="ts-sub" hidden></div>
|
|
4888
|
+
</div>
|
|
4388
4889
|
</div>
|
|
4389
4890
|
</div>
|
|
4390
|
-
</
|
|
4891
|
+
</details>
|
|
4391
4892
|
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
<div class="ts-head">
|
|
4395
|
-
<h2 class="ts-overline">Zone C · Automated Activity</h2>
|
|
4396
|
-
<span id="tsGuardsSummary" class="ts-meta">32 guards armed</span>
|
|
4397
|
-
</div>
|
|
4893
|
+
<details id="tsActivityDrawer" class="ts-drawer">
|
|
4894
|
+
<summary><span><span class="ts-why-caret" aria-hidden="true">▸</span>Auto-guard activity</span><span id="tsGuardsSummary" class="ts-kpi-sub">Guards armed</span></summary>
|
|
4398
4895
|
<ul id="tsLedgerList" class="ts-ledger" role="list">
|
|
4399
4896
|
<li class="ts-ledger-row">
|
|
4400
|
-
<span
|
|
4897
|
+
<span class="ts-ledger-age">now</span>
|
|
4401
4898
|
<span>Auto-guards armed (FTS5 CLI compressor & PrefixCacheShield)</span>
|
|
4402
|
-
<span
|
|
4899
|
+
<span class="ts-ledger-saved">ready</span>
|
|
4403
4900
|
</li>
|
|
4404
4901
|
</ul>
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
<section class="ts-zone-last">
|
|
4409
|
-
<div class="ts-head">
|
|
4410
|
-
<h2 class="ts-overline">Zone D · Session Impact & Memory Clean</h2>
|
|
4411
|
-
<span id="tsKpi30d" class="ts-meta">30d: 0.0k ($0.00)</span>
|
|
4412
|
-
</div>
|
|
4413
|
-
<div style="display:flex;align-items:baseline;justify-content:space-between;gap:8px;">
|
|
4414
|
-
<div>
|
|
4415
|
-
<span id="tsKpiSaved" class="ts-kpi-num">0.0k</span>
|
|
4416
|
-
<span style="font-size:11.5px;color:var(--hz-muted);margin-left:4px;">tokens saved</span>
|
|
4417
|
-
</div>
|
|
4418
|
-
<span id="tsKpiUsd" style="font-size:12px;color:#10B981;font-weight:600;">$0.00</span>
|
|
4419
|
-
</div>
|
|
4420
|
-
<button type="button" id="tsBtnCleanPrimary" class="ts-cta-btn" data-cta-state="disabled" disabled>
|
|
4421
|
-
<span id="tsBtnCleanLabel">Memory Clean · 0.0k Reclaimable</span>
|
|
4422
|
-
</button>
|
|
4423
|
-
<div style="font-size:11px;color:var(--hz-fg-secondary);line-height:1.35;">
|
|
4424
|
-
<div id="tsCompactReclaim">0.0k reclaimable clutter · Active working set protected</div>
|
|
4425
|
-
<div id="tsCompactInstruction" style="color:var(--hz-muted);">Type <code>/compact</code> in the chat box and press Enter when resetting conversation history.</div>
|
|
4426
|
-
</div>
|
|
4427
|
-
</section>
|
|
4902
|
+
<div id="tsGuardListHead" class="ts-guard-head" hidden>Live guards</div>
|
|
4903
|
+
<ul id="tsGuardList" class="ts-ledger ts-guard-list" role="list" hidden></ul>
|
|
4904
|
+
</details>
|
|
4428
4905
|
</div>
|
|
4429
4906
|
|
|
4430
4907
|
<!-- =========================================================================
|
|
@@ -4453,7 +4930,7 @@
|
|
|
4453
4930
|
</div>
|
|
4454
4931
|
<div style="font-size:11px;">
|
|
4455
4932
|
<strong id="taUsedTok">0.0k</strong>
|
|
4456
|
-
<span style="color:var(--hz-muted);">(<span id="taSigTok" style="color
|
|
4933
|
+
<span style="color:var(--hz-muted);">(<span id="taSigTok" style="color:var(--hz-useful);">0.0k</span> sig + <span id="taClutterTok" style="color:var(--hz-clutter);">0.0k</span> recl) / <span id="taSafeTok">179.0k</span></span>
|
|
4457
4934
|
</div>
|
|
4458
4935
|
</div>
|
|
4459
4936
|
<div id="taHorizonGrid" class="ta-cell-grid" role="listbox" aria-label="40-cell chronological context window"></div>
|
|
@@ -4462,9 +4939,9 @@
|
|
|
4462
4939
|
<span id="taCellRight">6.4k / cell · 1.00 recall</span>
|
|
4463
4940
|
</div>
|
|
4464
4941
|
<div class="ta-ucurve">
|
|
4465
|
-
<div><span style="color:var(--hz-muted);">Primacy (0–30%)</span><br><strong id="taUPrimacy" style="color
|
|
4942
|
+
<div><span style="color:var(--hz-muted);">Primacy (0–30%)</span><br><strong id="taUPrimacy" style="color:var(--hz-useful);">96% recall</strong></div>
|
|
4466
4943
|
<div><span style="color:var(--hz-muted);">Mid Trough (30–70%)</span><br><strong id="taUTrough" style="color:var(--hz-fg);">62% (0 specs)</strong></div>
|
|
4467
|
-
<div><span style="color:var(--hz-muted);">Recency (70–100%)</span><br><strong id="taURecency" style="color
|
|
4944
|
+
<div><span style="color:var(--hz-muted);">Recency (70–100%)</span><br><strong id="taURecency" style="color:var(--hz-useful);">94% recall</strong></div>
|
|
4468
4945
|
</div>
|
|
4469
4946
|
<table class="ta-table" aria-label="Top context token consumers">
|
|
4470
4947
|
<thead>
|
|
@@ -4487,7 +4964,7 @@
|
|
|
4487
4964
|
<h2 class="ts-overline">Zone B · Action Queue & Router Governance</h2>
|
|
4488
4965
|
<div id="taRouterSwitch" style="display:inline-flex;gap:3px;">
|
|
4489
4966
|
<button type="button" class="ta-mini-btn" data-ta-mode="off">Off</button>
|
|
4490
|
-
<button type="button" class="ta-mini-btn" data-ta-mode="coach" style="border-color
|
|
4967
|
+
<button type="button" class="ta-mini-btn" data-ta-mode="coach" style="border-color:var(--hz-useful);color:var(--hz-useful);">Coach</button>
|
|
4491
4968
|
<button type="button" class="ta-mini-btn" data-ta-mode="autopilot">Auto-Pilot</button>
|
|
4492
4969
|
</div>
|
|
4493
4970
|
</div>
|
|
@@ -4540,7 +5017,7 @@
|
|
|
4540
5017
|
<div>
|
|
4541
5018
|
<span id="taKpiTokens" class="ts-kpi-num">0.0k</span>
|
|
4542
5019
|
<span style="font-size:11px;color:var(--hz-muted);margin-left:4px;">saved</span>
|
|
4543
|
-
<span id="taKpiUsd" style="font-size:11.5px;color
|
|
5020
|
+
<span id="taKpiUsd" style="font-size:11.5px;color:var(--hz-useful);margin-left:5px;font-weight:600;">$0.00</span>
|
|
4544
5021
|
</div>
|
|
4545
5022
|
<span id="taKpi30d" class="ts-meta">30d: 0.0k ($0.00)</span>
|
|
4546
5023
|
</div>
|
|
@@ -4554,7 +5031,7 @@
|
|
|
4554
5031
|
<button type="button" id="taBtnSurgeryPrimary" class="ts-cta-btn" data-cta-state="disabled" disabled>
|
|
4555
5032
|
<span id="taBtnSurgeryLabel">Memory Clean · 0.0k Reclaimable</span>
|
|
4556
5033
|
</button>
|
|
4557
|
-
<button type="button" id="taBtnForceAst" class="ta-mini-btn" style="padding:0 10px;border-color
|
|
5034
|
+
<button type="button" id="taBtnForceAst" class="ta-mini-btn" style="padding:0 10px;border-color:var(--hz-clutter);color:var(--hz-clutter);" disabled>Fold AST</button>
|
|
4558
5035
|
</div>
|
|
4559
5036
|
</section>
|
|
4560
5037
|
</div>
|
|
@@ -4608,7 +5085,7 @@
|
|
|
4608
5085
|
<h2 class="section-box-title">Context Memory Capacity</h2>
|
|
4609
5086
|
</div>
|
|
4610
5087
|
<div class="section-box-meta-group">
|
|
4611
|
-
<span class="prefix-lock-badge mono" id="prefixLockBadge" hidden title="Active warm cache (>50k tokens).
|
|
5088
|
+
<span class="prefix-lock-badge mono" id="prefixLockBadge" hidden title="Active warm cache (>50k tokens). Switching models (within or across families) triggers a full uncached cache rebuild; on Claude, changing reasoning effort also re-bills cached chat history (Gemini thinking-level changes keep the cache).">🔒 Warm</span>
|
|
4612
5089
|
<span class="summary-status-pill mono" id="sessionModelPill" style="font-size:10px;">Auto</span>
|
|
4613
5090
|
<span class="summary-status-pill mono" id="storageHorizonBadge">Safe Limit: 140k</span>
|
|
4614
5091
|
</div>
|
|
@@ -5116,6 +5593,10 @@
|
|
|
5116
5593
|
<span id="rsiShieldLabel">Rule Shield: 0 queued</span>
|
|
5117
5594
|
</div>
|
|
5118
5595
|
</div>
|
|
5596
|
+
<div class="rsi-health-row rsl-summary-strip mono" id="rslSummaryStrip">
|
|
5597
|
+
<span class="rsi-icon" aria-hidden="true">🔁</span>
|
|
5598
|
+
<div class="rsi-health-summary" id="rslSummaryText">RSL Dual-Sync: <strong>0</strong> rules · <strong>0</strong> skills · <strong>0</strong> hooks · Budget: <strong>0/20k</strong> tok</div>
|
|
5599
|
+
</div>
|
|
5119
5600
|
<div class="action-rows-stack rsi-actions-stack" id="rsiActionList" hidden></div>
|
|
5120
5601
|
</section>
|
|
5121
5602
|
</div>
|
|
@@ -5544,7 +6025,14 @@
|
|
|
5544
6025
|
}
|
|
5545
6026
|
function isIgnorablePath(p) {
|
|
5546
6027
|
if (!p) return false;
|
|
5547
|
-
const
|
|
6028
|
+
const raw = String(p).replace(/\\/g, '/');
|
|
6029
|
+
const s = raw
|
|
6030
|
+
.replace(/^[a-z]:\/users\/[^/]+\/appdata\/local\/temp\/[^/]+\//i, '')
|
|
6031
|
+
.replace(/^\/(?:private\/)?var\/folders\/[^/]+\/[^/]+\/[^/]+\/[^/]+\//i, '')
|
|
6032
|
+
.replace(/^\/(?:private\/)?tmp\/(?:[^/]+\/)?/i, '');
|
|
6033
|
+
if (/(?:^|\/)(?:src|lib|packages|app|bin|test|tests|scripts)\/.*\.(?:[mc]?[jt]sx?|py|rs|go|java|c|cpp|h|hpp|rb|php|swift|kt|vue|svelte|html|css)$/i.test(s)) {
|
|
6034
|
+
return false;
|
|
6035
|
+
}
|
|
5548
6036
|
if (/(^|\/)(package-lock\.json|yarn\.lock|pnpm-lock\.yaml|poetry\.lock|Cargo\.lock|Gemfile\.lock|composer\.lock|\.lock)$/i.test(s)) return true;
|
|
5549
6037
|
if (/\.log$/i.test(s) || /(^|\/)logs?(\/|$)/i.test(s) || /\.jsonl$/i.test(s)) return true;
|
|
5550
6038
|
if (/(^|\/)(dist|build|out|target|\.next|\.nuxt|coverage|node_modules)(\/|$)/i.test(s)) return true;
|
|
@@ -5727,7 +6215,7 @@
|
|
|
5727
6215
|
}
|
|
5728
6216
|
|
|
5729
6217
|
const PREFIX_LOCK_WARNING_TEXT =
|
|
5730
|
-
'Active warm cache (>50k tokens).
|
|
6218
|
+
'Active warm cache (>50k tokens). Switching models (within or across families) triggers a full uncached cache rebuild; on Claude, changing reasoning effort also re-bills cached chat history (Gemini thinking-level changes keep the cache).';
|
|
5731
6219
|
|
|
5732
6220
|
function resolveSurfaceTag(surfaceOrPath) {
|
|
5733
6221
|
const s = String(surfaceOrPath || '').toLowerCase().trim();
|
|
@@ -6471,7 +6959,10 @@
|
|
|
6471
6959
|
}
|
|
6472
6960
|
}
|
|
6473
6961
|
if (!fromCatalog) {
|
|
6474
|
-
|
|
6962
|
+
// Keep the cached auto state fresh: the daemon pins the active conversation, so a pinned
|
|
6963
|
+
// stream state for the same session (or any state while following 'auto') must replace it.
|
|
6964
|
+
// Otherwise cached re-renders (workspace change / Follow active) resurrect pre-/compact totals.
|
|
6965
|
+
if (!latestAutoState || selectedSessionMode === 'auto' || raw.sessionId === latestAutoState.sessionId) {
|
|
6475
6966
|
latestAutoState = raw;
|
|
6476
6967
|
if (!initialHostSurface && raw.storeSource) initialHostSurface = raw.storeSource;
|
|
6477
6968
|
}
|
|
@@ -10195,6 +10686,19 @@
|
|
|
10195
10686
|
if (rsiPrimacyEl) rsiPrimacyEl.innerHTML = `Primacy Band: <strong>${uCurveData?.healthScore || 94}%</strong>`;
|
|
10196
10687
|
if (rsiMiddleEl) rsiMiddleEl.textContent = `${middleRisk} Trough Risk${middleRisk === 1 ? '' : 's'}`;
|
|
10197
10688
|
if (rsiShieldEl) rsiShieldEl.textContent = `Rule Shield: ${stagedCnt} queued`;
|
|
10689
|
+
const rslSummaryEl = document.getElementById('rslSummaryText');
|
|
10690
|
+
const rslData = raw.rsl || raw.coachState?.rsl;
|
|
10691
|
+
if (rslSummaryEl && rslData) {
|
|
10692
|
+
const rTok = Number(rslData.ruleBudgetTokens || 0);
|
|
10693
|
+
const rTokLabel = rTok >= 1000 ? `${(rTok / 1000).toFixed(1).replace(/\.0$/, '')}k` : String(rTok);
|
|
10694
|
+
const clashes = Number(rslData.clashCount || 0);
|
|
10695
|
+
const clashSuffix = clashes > 0 ? ` · <strong style="color:var(--warn)">${clashes} clash</strong>` : '';
|
|
10696
|
+
rslSummaryEl.innerHTML =
|
|
10697
|
+
`RSL Dual-Sync: <strong>${Number(rslData.activeRules || 0)}</strong> rules · ` +
|
|
10698
|
+
`<strong>${Number(rslData.activeSkills || 0)}</strong> skills · ` +
|
|
10699
|
+
`<strong>${Number(rslData.promotedHooks || 0)}</strong> hooks · ` +
|
|
10700
|
+
`Budget: <strong>${rTokLabel}/20k</strong> tok${clashSuffix}`;
|
|
10701
|
+
}
|
|
10198
10702
|
if (rsiPillEl) {
|
|
10199
10703
|
rsiPillEl.textContent = rsiRows.length > 0 ? `${rsiRows.length} Ready` : `Primacy: ${uCurveData?.healthScore || 94}%`;
|
|
10200
10704
|
}
|
|
@@ -10755,8 +11259,9 @@
|
|
|
10755
11259
|
clutter: 'Reclaimable Tool Logs',
|
|
10756
11260
|
error: 'Stale Error Trace'
|
|
10757
11261
|
};
|
|
10758
|
-
const recall = num <= 12 ? '0.96' : (num >= 28 ? '0.94' : '0.68');
|
|
10759
|
-
|
|
11262
|
+
const recall = cell.recall || (num <= 12 ? '0.96' : (num >= 28 ? '0.94' : '0.68'));
|
|
11263
|
+
const label = cell.source || catLabels[cell.cat] || cell.cat;
|
|
11264
|
+
if (leftEl) leftEl.textContent = `Cell #${num} \u00B7 ${label}`;
|
|
10760
11265
|
if (rightEl) rightEl.textContent = `${formatTokens(cell.tokens || 0)} / cell \u00B7 ${recall} recall`;
|
|
10761
11266
|
}
|
|
10762
11267
|
|
|
@@ -10765,30 +11270,42 @@
|
|
|
10765
11270
|
const win = raw.window || {};
|
|
10766
11271
|
const bd = win.breakdown || raw.categories || {};
|
|
10767
11272
|
const bs = raw.brainSignals || {};
|
|
10768
|
-
|
|
10769
|
-
|
|
11273
|
+
// Live daemon schema: top-level `breakdown` (ANCHOR / ACTIVE_WORKING_SET / STALE_DUPLICATE ...)
|
|
11274
|
+
// and `metrics.displayParity` (same totals the legacy panel displays).
|
|
11275
|
+
const bdLive = (raw.breakdown && typeof raw.breakdown === 'object') ? raw.breakdown : {};
|
|
11276
|
+
const dp = raw.metrics?.displayParity || null;
|
|
11277
|
+
const dpTotalT = dp ? Math.round(Number(dp.displayTotalTenths ?? (Number(dp.totalK) * 10)) * 100) || 0 : 0;
|
|
11278
|
+
const dpReclaimT = dp ? Math.round(Number(dp.displayReclaimableTenths ?? (Number(dp.reclaimableK) * 10)) * 100) || 0 : 0;
|
|
11279
|
+
const bdLiveUsedT = (Number(bdLive.ANCHOR) || 0) + (Number(bdLive.MEMORY_KI) || 0) + (Number(bdLive.FOREIGN_BLEED) || 0)
|
|
11280
|
+
+ (Number(bdLive.STALE_DUPLICATE) || 0) + (Number(bdLive.DEAD_ERROR) || 0) + (Number(bdLive.ACTIVE_WORKING_SET) || 0);
|
|
11281
|
+
const bdLiveReclaimT = (Number(bdLive.STALE_DUPLICATE) || 0) + (Number(bdLive.DEAD_ERROR) || 0) + (Number(bdLive.FOREIGN_BLEED) || 0);
|
|
11282
|
+
|
|
11283
|
+
const total = Math.max(0, Number(win.totalTokens ?? raw.totalTokens) || dpTotalT || bdLiveUsedT || Number(win.totalActiveTokens) || 0);
|
|
10770
11284
|
const maxCap = Math.max(1000, Number(win.maxTokens ?? raw.maxTokens) || 1000000);
|
|
10771
11285
|
const safeCap = Math.max(1000, Number(win.safeLimit ?? raw.safeHorizonTokens) || Math.round(maxCap * 0.6));
|
|
10772
11286
|
const rotThresh = Number(raw.contextRotThreshold) || Math.round(maxCap * 0.8);
|
|
10773
11287
|
|
|
10774
|
-
const rulesT = Number(bd.systemAndTools ?? bd.systemRules ?? bs.activeSignal?.baselineTokens) || 0;
|
|
11288
|
+
const rulesT = Number(bd.systemAndTools ?? bd.systemRules ?? bs.activeSignal?.baselineTokens ?? bdLive.ANCHOR) || 0;
|
|
10775
11289
|
const toolsT = Number(bd.toolDefinitions) || 0;
|
|
10776
|
-
const activeT = Number(bd.activeCodeAndRules ?? bd.activeSource ?? bs.activeSignal?.tokens) || 0;
|
|
11290
|
+
const activeT = Number(bd.activeCodeAndRules ?? bd.activeSource ?? bs.activeSignal?.tokens ?? bdLive.ACTIVE_WORKING_SET) || 0;
|
|
10777
11291
|
const filesT = Number(bd.toolOutputs) || 0;
|
|
10778
11292
|
const depsT = Number(bd.dependencyBloat) || 0;
|
|
10779
11293
|
|
|
10780
11294
|
const dupWaste = Array.isArray(bs.duplicateReads)
|
|
10781
11295
|
? bs.duplicateReads.reduce((acc, d) => acc + Math.max(0, Number(d?.wastedTokens || 0)), 0)
|
|
10782
|
-
: 0;
|
|
11296
|
+
: Math.max(0, Number(bs.duplicateReads?.reclaimableTokens || 0));
|
|
10783
11297
|
const errWaste = Math.max(0, Number(bs.deadErrors?.reclaimableTokens || 0));
|
|
10784
11298
|
const histWaste = Math.max(0, Number(bs.oldHistory?.reclaimableTokens || 0));
|
|
11299
|
+
const bleedWaste = Math.max(0, Number(bs.foreignBleed?.reclaimableTokens ?? bdLive.FOREIGN_BLEED) || 0);
|
|
10785
11300
|
const staleT = Math.min(
|
|
10786
11301
|
total,
|
|
10787
11302
|
Math.max(
|
|
10788
11303
|
Number(raw.reclaimableTokens) || 0,
|
|
11304
|
+
dpReclaimT,
|
|
11305
|
+
bdLiveReclaimT,
|
|
10789
11306
|
(Number(bd.reclaimableClutter) || 0) + (Number(bd.cachedHistory) || 0),
|
|
10790
11307
|
(Number(bd.staleLogs) || 0) + depsT,
|
|
10791
|
-
dupWaste + errWaste + histWaste
|
|
11308
|
+
dupWaste + errWaste + histWaste + bleedWaste
|
|
10792
11309
|
)
|
|
10793
11310
|
);
|
|
10794
11311
|
const usefulT = Math.max(0, total - staleT);
|
|
@@ -10800,8 +11317,19 @@
|
|
|
10800
11317
|
|
|
10801
11318
|
const setTxt = (id, v) => { const el = document.getElementById(id); if (el) el.textContent = v; };
|
|
10802
11319
|
|
|
10803
|
-
|
|
10804
|
-
const
|
|
11320
|
+
// Authoritative active model (raw.model) — quota pool name is only a legacy fallback.
|
|
11321
|
+
const mdl = raw.model || {};
|
|
11322
|
+
const activeModel = mdl.displayName || win.activeModelLabel || raw.modelName || raw.quota?.sprint5h?.modelPoolName || 'Auto';
|
|
11323
|
+
const modelId = String(mdl.id || raw.quota?.cache?.turnBoundarySwitchState?.active_model_id || win.unifiedPool?.modelId || activeModel).toLowerCase();
|
|
11324
|
+
const modelHay = `${modelId} ${String(mdl.rawLabel || activeModel).toLowerCase()}`;
|
|
11325
|
+
// Provider from id/label, including registry sub-families (constants.mjs `family`).
|
|
11326
|
+
const modelProvider = /claude|opus|sonnet|haiku|fable/.test(modelHay) ? 'Claude'
|
|
11327
|
+
: /gemini|carbon|argon|hydrogen|flash/.test(modelHay) ? 'Gemini'
|
|
11328
|
+
: /gpt/.test(modelHay) ? 'GPT-OSS' : 'Other';
|
|
11329
|
+
// Selected effort comes from the host label "Model (Medium)" only when the parenthetical is an effort word.
|
|
11330
|
+
const labelParen = (String(mdl.rawLabel || '').match(/\(([^)]+)\)\s*$/) || [])[1] || '';
|
|
11331
|
+
const effortFromLabel = /^(low|medium|med|high|max|minimal|auto|fast|thinking)\b/i.test(labelParen.trim()) ? labelParen.trim() : '';
|
|
11332
|
+
const activeEffort = effortFromLabel || raw.activeEffortProfile?.label || raw.effortProfile?.label || raw.thinkingEffort || 'Auto';
|
|
10805
11333
|
|
|
10806
11334
|
const hostBadge = document.getElementById('tufteTopHostBadge');
|
|
10807
11335
|
if (hostBadge) {
|
|
@@ -10816,25 +11344,46 @@
|
|
|
10816
11344
|
const ttlMm = String(Math.floor(ttlRem / 60)).padStart(2, '0');
|
|
10817
11345
|
const ttlSs = String(ttlRem % 60).padStart(2, '0');
|
|
10818
11346
|
const rawHit = Number(cache.hitRatePct ?? (Number(cache.hitRatio) ? Number(cache.hitRatio) * 100 : 0));
|
|
10819
|
-
|
|
10820
|
-
const
|
|
10821
|
-
const
|
|
11347
|
+
// Warm only when real cache reads are measured and no prefix bust occurred (no fabricated hit rates).
|
|
11348
|
+
const isWarm = isCacheTrulyWarmInline(cache) || (cacheState === 'HOT' && ttlRem > 0 && Number(rawHit) > 0);
|
|
11349
|
+
const isRebuilding = !isWarm && ttlRem > 0 && !cache.isCacheCold && isNextTurnLikelyWarmInline(cache);
|
|
11350
|
+
const isCold = !isWarm && !isRebuilding;
|
|
11351
|
+
const hitPct = Math.max(0, Math.round(rawHit || 0));
|
|
10822
11352
|
|
|
10823
11353
|
// --- Health state ---
|
|
10824
11354
|
const isCrisis = Boolean(raw.amputationCrisis || raw.amputation?.amputationCrisis || raw.telemetry?.amputationRisk) || total >= safeCap;
|
|
10825
11355
|
const isWarn = !isCrisis && (total >= safeCap * 0.82 || staleT >= 35000);
|
|
10826
11356
|
const errLoopCount = Number(bs.deadErrors?.errorCount || 0);
|
|
10827
11357
|
const isStuckErrorLoop = Boolean(bs.deadErrors?.isErrorLoop || errLoopCount >= 3);
|
|
11358
|
+
const topBlowup = Array.isArray(bs.blowupSteps) && bs.blowupSteps.length > 0 ? bs.blowupSteps[0] : null;
|
|
11359
|
+
const idleEagerMcps = Array.isArray(bs.mcpAudit?.unusedEagerServers) ? bs.mcpAudit.unusedEagerServers : [];
|
|
11360
|
+
const idleEagerTokens = Math.max(0, Number(bs.mcpAudit?.reclaimableEagerSchemaTokens) || 0);
|
|
11361
|
+
const baselineEst = Math.max(0, Number(raw.baseline?.totalEst ?? (rulesT + toolsT)) || 0);
|
|
11362
|
+
const baselineOverBudget = Boolean(raw.baseline?.eagerInjectionWarning) || baselineEst > 20000;
|
|
11363
|
+
const isHighEffort = /high|max|deep|thinking/i.test(String(activeEffort));
|
|
10828
11364
|
|
|
10829
11365
|
// =======================================================================
|
|
10830
|
-
// 1. SIMPLE VIEW UPDATES (#argonSimpleSurface)
|
|
11366
|
+
// 1. SIMPLE VIEW UPDATES (#argonSimpleSurface — Antigravity & Claude Code)
|
|
10831
11367
|
// =======================================================================
|
|
11368
|
+
const isClaudeSurface = (raw.storeSource || 'antigravity').toLowerCase().includes('claude');
|
|
10832
11369
|
const tsCacheMeta = document.getElementById('tsCacheMeta');
|
|
11370
|
+
const cacheUnmeasured = !isWarm && cache.prefixRetention?.unmeasuredReason === 'no_cache_telemetry';
|
|
10833
11371
|
if (tsCacheMeta) {
|
|
10834
|
-
tsCacheMeta.dataset.tone = isWarm ? 'signal' : (!
|
|
11372
|
+
tsCacheMeta.dataset.tone = isWarm ? 'signal' : (isRebuilding && !cacheUnmeasured ? 'warn' : 'muted');
|
|
10835
11373
|
tsCacheMeta.textContent = isWarm
|
|
10836
11374
|
? `${hitPct}% hit \u00B7 Warm (${ttlMm}:${ttlSs})`
|
|
10837
|
-
: (
|
|
11375
|
+
: (cacheUnmeasured && ttlRem > 0
|
|
11376
|
+
? `Cache not reported \u00B7 TTL ${ttlMm}:${ttlSs}`
|
|
11377
|
+
: (isRebuilding ? `${hitPct}% hit \u00B7 Rebuilding (${ttlMm}:${ttlSs})` : `${hitPct}% hit \u00B7 Cold`));
|
|
11378
|
+
tsCacheMeta.title = cacheUnmeasured
|
|
11379
|
+
? 'The host reports no cache-read tokens for this model, so the hit rate is unknown.'
|
|
11380
|
+
: (cache.prefixBustLabel || '');
|
|
11381
|
+
}
|
|
11382
|
+
const tsCacheBulletFill = document.getElementById('tsCacheBulletFill');
|
|
11383
|
+
if (tsCacheBulletFill) {
|
|
11384
|
+
const bulletW = cacheUnmeasured ? 0 : Math.max(0, Math.min(100, hitPct));
|
|
11385
|
+
tsCacheBulletFill.style.width = `${bulletW}%`;
|
|
11386
|
+
tsCacheBulletFill.dataset.tone = isWarm && hitPct >= 75 ? 'nominal' : (isRebuilding ? 'warn' : 'muted');
|
|
10838
11387
|
}
|
|
10839
11388
|
|
|
10840
11389
|
const tsStatusDot = document.getElementById('tsStatusDot');
|
|
@@ -10843,15 +11392,39 @@
|
|
|
10843
11392
|
if (isCrisis) {
|
|
10844
11393
|
tsStatusDot.dataset.tone = 'danger';
|
|
10845
11394
|
tsStatusLabel.textContent = 'Memory Pruning Active';
|
|
11395
|
+
} else if (isStuckErrorLoop) {
|
|
11396
|
+
tsStatusDot.dataset.tone = 'warn';
|
|
11397
|
+
tsStatusLabel.textContent = 'Error Loop Detected';
|
|
10846
11398
|
} else if (isWarn) {
|
|
10847
11399
|
tsStatusDot.dataset.tone = 'warn';
|
|
10848
|
-
tsStatusLabel.textContent = 'Context Saturation Risk';
|
|
11400
|
+
tsStatusLabel.textContent = total >= safeCap * 0.82 ? 'Context Saturation Risk' : 'Reclaimable Clutter High';
|
|
11401
|
+
} else if (topBlowup && Number(topBlowup.tokens) >= 15000) {
|
|
11402
|
+
tsStatusDot.dataset.tone = 'warn';
|
|
11403
|
+
tsStatusLabel.textContent = 'Single-Turn Output Spike';
|
|
11404
|
+
} else if ((idleEagerMcps.length > 0 && idleEagerTokens >= 10000) || baselineOverBudget) {
|
|
11405
|
+
tsStatusDot.dataset.tone = 'warn';
|
|
11406
|
+
tsStatusLabel.textContent = 'Turn-0 Prefix Bloat';
|
|
10849
11407
|
} else {
|
|
10850
|
-
tsStatusDot.dataset.tone = 'signal';
|
|
11408
|
+
tsStatusDot.dataset.tone = isWarm ? 'signal' : 'nominal';
|
|
10851
11409
|
tsStatusLabel.textContent = isWarm ? 'Optimal Cache' : 'Nominal Memory';
|
|
10852
11410
|
}
|
|
10853
11411
|
}
|
|
10854
11412
|
|
|
11413
|
+
const tsRunwayMeta = document.getElementById('tsRunwayMeta');
|
|
11414
|
+
if (tsRunwayMeta) {
|
|
11415
|
+
if (isCrisis) {
|
|
11416
|
+
const overTok = Math.max(0, total - safeCap);
|
|
11417
|
+
tsRunwayMeta.dataset.tone = 'danger';
|
|
11418
|
+
tsRunwayMeta.textContent = overTok > 0 ? `+${formatTokens(overTok)} over safe` : 'At safe limit';
|
|
11419
|
+
} else if (burnRate > 0 && turnsLeft < 99) {
|
|
11420
|
+
tsRunwayMeta.dataset.tone = turnsLeft <= 4 ? 'danger' : (turnsLeft <= 8 ? 'warn' : 'nominal');
|
|
11421
|
+
tsRunwayMeta.textContent = `~${turnsLeft} turn${turnsLeft === 1 ? '' : 's'} \u00B7 +${formatTokens(burnRate)}/t`;
|
|
11422
|
+
} else {
|
|
11423
|
+
tsRunwayMeta.dataset.tone = isWarn ? 'warn' : 'nominal';
|
|
11424
|
+
tsRunwayMeta.textContent = `${formatTokens(remainingSafe)} headroom`;
|
|
11425
|
+
}
|
|
11426
|
+
}
|
|
11427
|
+
|
|
10855
11428
|
setTxt('tsUsedLabel', formatTokens(total));
|
|
10856
11429
|
setTxt('tsSafeLabel', formatTokens(safeCap));
|
|
10857
11430
|
setTxt('tsUsedPct', `${usedPct}%`);
|
|
@@ -10862,81 +11435,272 @@
|
|
|
10862
11435
|
const tsBarSignal = document.getElementById('tsBarSignal');
|
|
10863
11436
|
const tsBarClutter = document.getElementById('tsBarClutter');
|
|
10864
11437
|
const tsSafeTick = document.getElementById('tsSafeTick');
|
|
11438
|
+
const tsClutterDot = document.getElementById('tsClutterDot');
|
|
11439
|
+
const isNearOrPastSafe = isCrisis || total >= safeCap * 0.85;
|
|
10865
11440
|
if (tsBarSignal) tsBarSignal.style.width = `${usefulPct.toFixed(1)}%`;
|
|
10866
11441
|
if (tsBarClutter) {
|
|
10867
11442
|
tsBarClutter.style.width = `${wastePct.toFixed(1)}%`;
|
|
10868
11443
|
tsBarClutter.dataset.clutterTone = isWarm ? 'cached' : 'stale';
|
|
10869
11444
|
}
|
|
10870
|
-
if (
|
|
11445
|
+
if (tsClutterDot) {
|
|
11446
|
+
tsClutterDot.style.background = isWarm ? 'var(--ts-clu-cached)' : 'var(--ts-clu)';
|
|
11447
|
+
}
|
|
11448
|
+
if (tsSafeTick) {
|
|
11449
|
+
tsSafeTick.style.left = `${safeMarkPct.toFixed(1)}%`;
|
|
11450
|
+
tsSafeTick.dataset.breach = isNearOrPastSafe ? 'true' : 'false';
|
|
11451
|
+
}
|
|
11452
|
+
|
|
11453
|
+
// Screen-reader / fallback segment labels preserved for DOM parity
|
|
11454
|
+
const usedSumT = Math.max(1, usefulT + staleT);
|
|
11455
|
+
const sigShare = Math.round((usefulT / usedSumT) * 100);
|
|
11456
|
+
const cluShare = staleT > 0 ? 100 - sigShare : 0;
|
|
11457
|
+
const trackW = tsBarSignal?.parentElement?.clientWidth || 300;
|
|
11458
|
+
const fitLabel = (pct, txt) => ((pct / 100) * trackW >= txt.length * 6.7 + 12 ? txt : '');
|
|
11459
|
+
const sigTxtFull = `${formatTokens(usefulT)} (${sigShare}%)`;
|
|
11460
|
+
const cluTxtFull = `${formatTokens(staleT)} (${cluShare}%)`;
|
|
11461
|
+
const sigInside = usefulT > 0 ? fitLabel(usefulPct, sigTxtFull) : '';
|
|
11462
|
+
const cluInside = staleT > 0 ? fitLabel(wastePct, cluTxtFull) : '';
|
|
11463
|
+
setTxt('tsBarSignalLabel', sigInside);
|
|
11464
|
+
setTxt('tsBarClutterLabel', cluInside);
|
|
11465
|
+
const tsBarOuterLabel = document.getElementById('tsBarOuterLabel');
|
|
11466
|
+
if (tsBarOuterLabel) {
|
|
11467
|
+
const outerParts = [];
|
|
11468
|
+
if (usefulT > 0 && !sigInside) outerParts.push(`<span class="ts-ol-signal">${escAttr(sigTxtFull)}</span>`);
|
|
11469
|
+
if (staleT > 0 && !cluInside) outerParts.push(`<span class="ts-ol-clutter" data-clutter-tone="${isWarm ? 'cached' : 'stale'}">${escAttr(cluTxtFull)}</span>`);
|
|
11470
|
+
const fillPct = usefulPct + wastePct;
|
|
11471
|
+
if (outerParts.length && fillPct < 75) {
|
|
11472
|
+
tsBarOuterLabel.innerHTML = outerParts.join('');
|
|
11473
|
+
tsBarOuterLabel.style.left = `${fillPct.toFixed(1)}%`;
|
|
11474
|
+
tsBarOuterLabel.hidden = false;
|
|
11475
|
+
} else {
|
|
11476
|
+
tsBarOuterLabel.hidden = true;
|
|
11477
|
+
tsBarOuterLabel.innerHTML = '';
|
|
11478
|
+
}
|
|
11479
|
+
}
|
|
11480
|
+
const tsSafeTickLabel = document.getElementById('tsSafeTickLabel');
|
|
11481
|
+
if (tsSafeTickLabel) {
|
|
11482
|
+
tsSafeTickLabel.style.left = `${safeMarkPct.toFixed(1)}%`;
|
|
11483
|
+
tsSafeTickLabel.dataset.breach = isNearOrPastSafe ? 'true' : 'false';
|
|
11484
|
+
tsSafeTickLabel.textContent = `${formatTokens(safeCap)} safe limit`;
|
|
11485
|
+
}
|
|
11486
|
+
|
|
11487
|
+
// Progressive Disclosure Drawer 1: "What /compact clears" (auto-hidden at <100 tok)
|
|
11488
|
+
const tsWhyClears = document.getElementById('tsWhyClears');
|
|
11489
|
+
const tsWhyList = document.getElementById('tsWhyList');
|
|
11490
|
+
const tsWhyKeepNote = document.getElementById('tsWhyKeepNote');
|
|
11491
|
+
if (tsWhyKeepNote) {
|
|
11492
|
+
tsWhyKeepNote.innerHTML = isClaudeSurface
|
|
11493
|
+
? 'Keeps <code>CLAUDE.md</code>, <code>HANDOFF_LATEST.md</code> & active code.'
|
|
11494
|
+
: 'Keeps rules, <code>task.md</code>, plan & active code.';
|
|
11495
|
+
}
|
|
11496
|
+
if (tsWhyClears && tsWhyList) {
|
|
11497
|
+
const dupFilesN = Number(bs.duplicateReads?.fileCount ?? (Array.isArray(bs.duplicateReads) ? bs.duplicateReads.length : 0)) || 0;
|
|
11498
|
+
const histTurnsN = Number(bs.oldHistory?.turnCount || 0);
|
|
11499
|
+
const errN = Number(bs.deadErrors?.errorCount || 0);
|
|
11500
|
+
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
11501
|
+
const knownWaste = dupWaste + histWaste + errWaste + bleedWaste;
|
|
11502
|
+
const otherWaste = staleT > knownWaste + 99 ? (staleT - knownWaste) : 0;
|
|
11503
|
+
const whyRows = [
|
|
11504
|
+
{ label: 'Repeated file reads', sub: dupFilesN ? plural(dupFilesN, 'file', 'files') : '', tok: dupWaste },
|
|
11505
|
+
{ label: 'Earlier chat history', sub: histTurnsN ? plural(histTurnsN, 'old turn', 'old turns') : '', tok: histWaste },
|
|
11506
|
+
{ label: isStuckErrorLoop ? 'Error logs & loop traces' : 'Fixed error logs', sub: errN ? plural(errN, isStuckErrorLoop ? 'error' : 'old error', isStuckErrorLoop ? 'errors' : 'old errors') : '', tok: errWaste },
|
|
11507
|
+
{ label: 'Cross-project memory bleed', sub: 'foreign KIs', tok: bleedWaste },
|
|
11508
|
+
{ label: 'Other stale tool outputs', sub: '', tok: otherWaste }
|
|
11509
|
+
].filter(r => r.tok >= 100).sort((a, b) => b.tok - a.tok);
|
|
11510
|
+
if (whyRows.length === 0) {
|
|
11511
|
+
tsWhyClears.hidden = true;
|
|
11512
|
+
tsWhyClears.open = false;
|
|
11513
|
+
} else {
|
|
11514
|
+
tsWhyClears.hidden = false;
|
|
11515
|
+
tsWhyList.innerHTML = whyRows.map(r =>
|
|
11516
|
+
`<li class="ts-why-row"><span>${escAttr(r.label)}${r.sub ? ` <span class="ts-why-sub">(${escAttr(r.sub)})</span>` : ''}</span>` +
|
|
11517
|
+
`<span class="ts-why-tok">${escAttr(formatTokens(r.tok))}</span></li>`
|
|
11518
|
+
).join('');
|
|
11519
|
+
setTxt('tsWhyTotal', formatTokens(staleT));
|
|
11520
|
+
}
|
|
11521
|
+
}
|
|
10871
11522
|
|
|
10872
11523
|
setTxt('tsValSignal', formatTokens(usefulT));
|
|
10873
11524
|
setTxt('tsValClutter', formatTokens(staleT));
|
|
10874
11525
|
setTxt('tsClutterKind', isWarm && staleT > 0 ? 'Warm Reclaimable' : 'Reclaimable');
|
|
10875
|
-
|
|
11526
|
+
const tsAnchorHealthEl = document.getElementById('tsAnchorHealth');
|
|
11527
|
+
if (tsAnchorHealthEl) {
|
|
11528
|
+
tsAnchorHealthEl.dataset.risk = isCrisis ? 'true' : 'false';
|
|
11529
|
+
tsAnchorHealthEl.textContent = isCrisis ? 'Oldest rules at risk' : 'Pinned rules safe';
|
|
11530
|
+
}
|
|
10876
11531
|
|
|
10877
11532
|
// Zone B: Direct Guidance (DO / AVOID / MODEL & EFFORT)
|
|
10878
11533
|
const tsGuidanceBadge = document.getElementById('tsGuidanceBadge');
|
|
10879
11534
|
const tsDoRow = document.getElementById('tsDoRow');
|
|
10880
|
-
const
|
|
10881
|
-
|
|
10882
|
-
const
|
|
11535
|
+
const breakerSrc = raw.coachState?.detectors?.tripped || raw.circuitBreakerTripped ||
|
|
11536
|
+
(Array.isArray(raw.coachState?.circuitBreakerAlerts) ? raw.coachState.circuitBreakerAlerts[0] : null);
|
|
11537
|
+
const simpleBreaker = (breakerSrc && typeof breakerSrc === 'object')
|
|
11538
|
+
? { id: String(breakerSrc.detectorId || breakerSrc.id || 'DET'), msg: String(breakerSrc.reason || breakerSrc.message || breakerSrc.title || 'intervention active').slice(0, 90) }
|
|
11539
|
+
: null;
|
|
11540
|
+
const shardedSpecCount = Number(raw.shardedSpecCount || 0);
|
|
11541
|
+
const rslClashCount = Number(raw.rsl?.clashCount || 0);
|
|
10883
11542
|
|
|
10884
11543
|
if (isCrisis) {
|
|
10885
11544
|
if (tsDoRow) tsDoRow.dataset.tone = 'danger';
|
|
10886
11545
|
setTxt('tsDoText', `Run /compact now or checkpoint to task.md \u2014 context is ${formatTokens(Math.max(0, total - safeCap))} past safe limit.`);
|
|
10887
11546
|
setTxt('tsAvoidText', `Avoid full-file reads or verbose test loops until ${formatTokens(staleT)} clutter is purged.`);
|
|
11547
|
+
} else if (isStuckErrorLoop) {
|
|
11548
|
+
if (tsDoRow) tsDoRow.dataset.tone = 'avoid';
|
|
11549
|
+
setTxt('tsDoText', `Pause blind retries (${errLoopCount}\u00D7 error loop) \u2014 inspect root cause${staleT >= 5000 ? ` or /compact ${formatTokens(staleT)} of error noise` : ''}.`);
|
|
11550
|
+
setTxt('tsAvoidText', 'Avoid repeating the same failing command; upshift model/effort or isolate a minimal repro.');
|
|
11551
|
+
} else if (simpleBreaker) {
|
|
11552
|
+
if (tsDoRow) tsDoRow.dataset.tone = 'danger';
|
|
11553
|
+
setTxt('tsDoText', `Guard tripped (${simpleBreaker.id}): ${simpleBreaker.msg} \u2014 review the agent's last changes before continuing.`);
|
|
11554
|
+
setTxt('tsAvoidText', 'Avoid approving further edits until the flagged change is reviewed or reverted.');
|
|
10888
11555
|
} else if (isWarm && staleT > 10000) {
|
|
10889
11556
|
if (tsDoRow) tsDoRow.dataset.tone = 'do';
|
|
10890
11557
|
setTxt('tsDoText', `Keep prompting while ${hitPct}% cache discount is warm (${formatTokens(remainingSafe)} safe headroom left).`);
|
|
10891
11558
|
setTxt('tsAvoidText', `Avoid /compact for ${ttlMm}:${ttlSs} so you do not invalidate the warm prefix cache.`);
|
|
11559
|
+
} else if (total >= safeCap * 0.82) {
|
|
11560
|
+
if (tsDoRow) tsDoRow.dataset.tone = 'avoid';
|
|
11561
|
+
setTxt('tsDoText', `Checkpoint to task.md or run /compact soon \u2014 only ${formatTokens(remainingSafe)} left below ${formatTokens(safeCap)} safe limit.`);
|
|
11562
|
+
setTxt('tsAvoidText', 'Avoid multi-file reads or verbose test loops until context is compacted.');
|
|
11563
|
+
} else if (shardedSpecCount >= 4) {
|
|
11564
|
+
if (tsDoRow) tsDoRow.dataset.tone = 'avoid';
|
|
11565
|
+
setTxt('tsDoText', `Consolidate ${shardedSpecCount} scattered requirement changes \u2014 run ctxtop handoff --consolidate and restart from one spec.`);
|
|
11566
|
+
setTxt('tsAvoidText', 'Avoid drip-feeding new constraints mid-task; state them together in one prompt or spec file.');
|
|
11567
|
+
} else if (isHighEffort && staleT >= 30000) {
|
|
11568
|
+
if (tsDoRow) tsDoRow.dataset.tone = 'avoid';
|
|
11569
|
+
setTxt('tsDoText', `Run /compact to clear ${formatTokens(staleT)} clutter \u2014 ${activeEffort} effort re-processes stale noise every turn.`);
|
|
11570
|
+
setTxt('tsAvoidText', 'Avoid stacking full-file reads or verbose logs while High effort is active.');
|
|
11571
|
+
} else if (staleT >= 35000) {
|
|
11572
|
+
if (tsDoRow) tsDoRow.dataset.tone = 'avoid';
|
|
11573
|
+
const dominantCause = dupWaste >= histWaste && dupWaste >= bleedWaste && dupWaste >= errWaste && dupWaste > 0
|
|
11574
|
+
? 'repeated file reads'
|
|
11575
|
+
: histWaste >= bleedWaste && histWaste >= errWaste && histWaste > 0
|
|
11576
|
+
? 'older chat history'
|
|
11577
|
+
: bleedWaste >= errWaste && bleedWaste > 0
|
|
11578
|
+
? 'cross-project bleed'
|
|
11579
|
+
: errWaste > 0 ? 'error logs' : 'stale outputs';
|
|
11580
|
+
setTxt('tsDoText', `Run /compact when ready to reclaim ${formatTokens(staleT)} clutter (${dominantCause}).`);
|
|
11581
|
+
setTxt('tsAvoidText', dominantCause === 'repeated file reads'
|
|
11582
|
+
? 'Avoid re-reading full files; use StartLine/EndLine bounds or delegate exploration to a subagent.'
|
|
11583
|
+
: dominantCause === 'cross-project bleed'
|
|
11584
|
+
? 'Avoid relying on unverified cross-project Knowledge Items; pin only current-workspace facts.'
|
|
11585
|
+
: 'Avoid letting stale turns accumulate past ~35k without compacting.');
|
|
11586
|
+
} else if (topBlowup && Number(topBlowup.tokens) >= 12000) {
|
|
11587
|
+
if (tsDoRow) tsDoRow.dataset.tone = 'avoid';
|
|
11588
|
+
const rawBlowupDetail = String(topBlowup.payload?.detail || topBlowup.target || 'tool output');
|
|
11589
|
+
const blowupShort = topBlowup.payload?.kind === 'file'
|
|
11590
|
+
? rawBlowupDetail.replace(/\\/g, '/').split('/').pop()
|
|
11591
|
+
: (rawBlowupDetail.length > 36 ? rawBlowupDetail.slice(0, 33) + '...' : rawBlowupDetail);
|
|
11592
|
+
setTxt('tsDoText', `Single-turn spike: ${formatTokens(topBlowup.tokens)} from ${blowupShort} (Turn #${topBlowup.userTurnNumber || topBlowup.stepIndex}) \u2014 filter future output.`);
|
|
11593
|
+
setTxt('tsAvoidText', 'Avoid unfiltered verbose test/build dumps; pipe output or delegate to a scout subagent.');
|
|
11594
|
+
} else if ((idleEagerMcps.length > 0 && idleEagerTokens >= 5000) || baselineOverBudget) {
|
|
11595
|
+
if (tsDoRow) tsDoRow.dataset.tone = 'avoid';
|
|
11596
|
+
setTxt('tsDoText', idleEagerMcps.length > 0
|
|
11597
|
+
? `Switch ${idleEagerMcps.length} idle eager MCP${idleEagerMcps.length === 1 ? '' : 's'} to lazy loading to save ~${formatTokens(idleEagerTokens)} at Turn 0.`
|
|
11598
|
+
: `Trim Turn-0 customizations (${formatTokens(baselineEst)} vs 20.0k budget) to free permanent headroom.`);
|
|
11599
|
+
setTxt('tsAvoidText', 'Avoid eager-loading unused MCP schemas or >200-line global rule files.');
|
|
11600
|
+
} else if (rslClashCount > 0) {
|
|
11601
|
+
if (tsDoRow) tsDoRow.dataset.tone = 'avoid';
|
|
11602
|
+
setTxt('tsDoText', `${rslClashCount} conflicting rule${rslClashCount === 1 ? '' : 's'} detected \u2014 run ctxtop rsl status and keep one directive per conflict.`);
|
|
11603
|
+
setTxt('tsAvoidText', 'Avoid adding rules that contradict existing AGENTS.md or .agents/rules directives.');
|
|
10892
11604
|
} else {
|
|
10893
11605
|
if (tsDoRow) tsDoRow.dataset.tone = 'do';
|
|
10894
11606
|
setTxt('tsDoText', `Safe to run multi-file edits or implementation tasks (${formatTokens(remainingSafe)} left below ${formatTokens(safeCap)} safe limit).`);
|
|
10895
11607
|
setTxt('tsAvoidText', 'Avoid reading large files without line bounds (StartLine/EndLine) to keep context lean.');
|
|
10896
11608
|
}
|
|
10897
11609
|
|
|
10898
|
-
//
|
|
10899
|
-
|
|
11610
|
+
// Zone B: separate MODEL and EFFORT containers (model-family aware)
|
|
11611
|
+
{
|
|
11612
|
+
const ttlTxt = `${ttlMm}:${ttlSs}`;
|
|
11613
|
+
const otherFamily = modelProvider === 'Claude' ? 'Gemini' : (modelProvider === 'Gemini' ? 'Claude' : 'another family');
|
|
11614
|
+
const familyHint = modelProvider === 'Claude' ? 'Opus/Sonnet/Haiku' : (modelProvider === 'Gemini' ? 'Carbon/Argon/Flash' : 'same provider');
|
|
11615
|
+
const cg = cache.costGate || {};
|
|
11616
|
+
const rewriteUsd = Number(cg.coldRewriteCostUsd) || 0;
|
|
11617
|
+
const quotaUnits = Number(cg.quotaPenaltyUnits) || 0;
|
|
11618
|
+
const usdTxt = rewriteUsd >= 0.01 ? `$${rewriteUsd.toFixed(2)}` : '<$0.01';
|
|
11619
|
+
const costTxt = rewriteUsd > 0 ? ` \u2248 ${usdTxt}${quotaUnits > 0 ? ` \u00B7 ${formatTokens(quotaUnits)} quota units` : ''}` : '';
|
|
11620
|
+
const windowTxt = `now ${formatTokens(maxCap)} window / ${formatTokens(safeCap)} safe`;
|
|
11621
|
+
const crossFamTxt = `To ${otherFamily}: cache rebuilds, tokens are re-counted, window & safe limit change (${windowTxt}).`;
|
|
11622
|
+
// Claude (and unknown providers, conservatively): effort/thinking changes invalidate cached chat history.
|
|
11623
|
+
// Gemini: thinking level is not part of the cached prompt prefix.
|
|
11624
|
+
const effortBustsCache = modelProvider !== 'Gemini';
|
|
11625
|
+
|
|
11626
|
+
let m = { tone: 'do', verdict: 'OK', badge: 'OK', same: '', cross: crossFamTxt };
|
|
11627
|
+
let e = { tone: 'do', verdict: 'OK', badge: 'OK', text: '' };
|
|
11628
|
+
|
|
10900
11629
|
if (isCrisis) {
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
if (tsGuidanceBadge) {
|
|
10906
|
-
tsGuidanceBadge.dataset.tone = 'warn';
|
|
10907
|
-
tsGuidanceBadge.textContent = 'Model: Hold \u00B7 Effort: Lower';
|
|
10908
|
-
}
|
|
11630
|
+
m = { tone: 'danger', verdict: 'LOCK', badge: 'Hold',
|
|
11631
|
+
same: `Run /compact first \u2014 any switch re-sends ${formatTokens(total)} uncached.`,
|
|
11632
|
+
cross: `To ${otherFamily}: same rebuild, plus tokens re-counted against a new window.` };
|
|
11633
|
+
e = { tone: 'danger', verdict: 'LOWER', badge: 'Lower', text: 'Drop to Low/Med to stop thinking-token overflow.' };
|
|
10909
11634
|
} else if (isStuckErrorLoop) {
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
}
|
|
11635
|
+
m = { tone: 'avoid', verdict: 'UPSHIFT OK', badge: 'Upshift OK',
|
|
11636
|
+
same: `${errLoopCount}\u00D7 error loop \u2014 a stronger ${modelProvider} model can break it${costTxt}.`,
|
|
11637
|
+
cross: `To ${otherFamily}: fresh perspective; cache rebuilds and tokens are re-counted.` };
|
|
11638
|
+
e = { tone: 'avoid', verdict: 'RAISE OK', badge: 'High OK', text: 'Raise to High to break the error loop.' };
|
|
11639
|
+
} else if (isWarm) {
|
|
11640
|
+
m = { tone: 'avoid', verdict: `HOLD ${ttlTxt}`, badge: `Hold ${ttlTxt}`,
|
|
11641
|
+
same: `Within ${modelProvider} (${familyHint}): full cache rebuild${costTxt}.`, cross: crossFamTxt };
|
|
11642
|
+
e = effortBustsCache
|
|
11643
|
+
? { tone: 'avoid', verdict: `HOLD ${ttlTxt}`, badge: `Hold ${ttlTxt}`, text: 'Changing re-bills cached chat history; tools & system prompt stay cached.' }
|
|
11644
|
+
: { tone: 'do', verdict: 'OK', badge: 'OK', text: 'Thinking level is not part of the cached prompt \u2014 cache is kept.' };
|
|
11645
|
+
} else if (isRebuilding) {
|
|
11646
|
+
m = { tone: 'avoid', verdict: 'STAY', badge: 'Stay',
|
|
11647
|
+
same: `Cache is likely rebuilding on ${activeModel} \u2014 staying reuses it next turn.`, cross: crossFamTxt };
|
|
11648
|
+
e = effortBustsCache
|
|
11649
|
+
? { tone: 'avoid', verdict: 'STAY', badge: 'Stay', text: 'Changing now discards the history cache being rebuilt.' }
|
|
11650
|
+
: { tone: 'do', verdict: 'OK', badge: 'OK', text: 'Thinking level is not part of the cached prompt \u2014 cache is kept.' };
|
|
10927
11651
|
} else {
|
|
10928
|
-
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
:
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
11652
|
+
m = { tone: 'do', verdict: 'OK', badge: 'OK',
|
|
11653
|
+
same: `Cache is cold \u2014 no rewrite penalty within ${modelProvider} (${familyHint}).`,
|
|
11654
|
+
cross: `To ${otherFamily}: tokens are re-counted, window & safe limit change (${windowTxt}).` };
|
|
11655
|
+
e = { tone: 'do', verdict: 'OK', badge: 'OK',
|
|
11656
|
+
text: isHighEffort && usedPct >= 45 ? 'Consider Low/Med for routine edits.' : 'Match tier to task: Low/Med for edits, High for specs.' };
|
|
11657
|
+
}
|
|
11658
|
+
|
|
11659
|
+
const tsModelCard = document.getElementById('tsModelCard');
|
|
11660
|
+
const tsEffortCard = document.getElementById('tsEffortCard');
|
|
11661
|
+
if (tsModelCard) { tsModelCard.dataset.tone = m.tone; tsModelCard.title = `${activeModel} \u00B7 ${modelProvider} family`; }
|
|
11662
|
+
if (tsEffortCard) { tsEffortCard.dataset.tone = e.tone; tsEffortCard.title = `${activeEffort} effort on ${activeModel}`; }
|
|
11663
|
+
setTxt('tsModelVerdict', m.verdict);
|
|
11664
|
+
setTxt('tsModelName', activeModel);
|
|
11665
|
+
setTxt('tsModelSameFam', m.same);
|
|
11666
|
+
setTxt('tsModelCrossFam', m.cross);
|
|
11667
|
+
setTxt('tsEffortVerdict', e.verdict);
|
|
11668
|
+
setTxt('tsEffortName', activeEffort);
|
|
11669
|
+
setTxt('tsEffortText', e.text);
|
|
11670
|
+
|
|
11671
|
+
const bc = cache.prefixBustCause;
|
|
11672
|
+
const hasModelSwitchBust = Boolean(bc && bc.cause === 'model_switch' && bc.from && bc.to);
|
|
11673
|
+
const tsModelLast = document.getElementById('tsModelLast');
|
|
11674
|
+
if (tsModelLast) {
|
|
11675
|
+
if (hasModelSwitchBust) {
|
|
11676
|
+
const stripEff = (s) => String(s).replace(/\s*\([^)]*\)\s*$/, '');
|
|
11677
|
+
const prov = (s) => (/claude|opus|sonnet|haiku|fable/i.test(s) ? 'Claude' : /gemini|carbon|argon|hydrogen|flash/i.test(s) ? 'Gemini' : /gpt/i.test(s) ? 'GPT-OSS' : 'Other');
|
|
11678
|
+
const crossTag = prov(bc.from) !== prov(bc.to) ? ' \u00B7 cross-family' : '';
|
|
11679
|
+
tsModelLast.textContent = `Last switch: ${stripEff(bc.from)} \u2192 ${stripEff(bc.to)} (cache miss${crossTag})`;
|
|
11680
|
+
tsModelLast.hidden = false;
|
|
11681
|
+
} else {
|
|
11682
|
+
tsModelLast.hidden = true;
|
|
11683
|
+
tsModelLast.textContent = '';
|
|
10938
11684
|
}
|
|
10939
11685
|
}
|
|
11686
|
+
const tsEffortHist = document.getElementById('tsEffortHist');
|
|
11687
|
+
if (tsEffortHist) {
|
|
11688
|
+
const effSwitches = (raw.effortTransitions || raw.effortHistory || []).length;
|
|
11689
|
+
tsEffortHist.hidden = effSwitches < 2;
|
|
11690
|
+
tsEffortHist.textContent = effSwitches >= 2 ? `${effSwitches} effort switches this chat` : '';
|
|
11691
|
+
}
|
|
11692
|
+
setTxt('tsSwitchActiveSummary', `${activeModel} \u00B7 ${activeEffort}`);
|
|
11693
|
+
setTxt('tsSwitchDrawerHint', isCrisis ? 'Switch locked' : (hasModelSwitchBust ? 'Cache miss' : (isWarm ? `Hold ${ttlTxt}` : 'Details')));
|
|
11694
|
+
const tsSwitchDetailsDrawer = document.getElementById('tsSwitchDetailsDrawer');
|
|
11695
|
+
if (tsSwitchDetailsDrawer && hasModelSwitchBust) {
|
|
11696
|
+
tsSwitchDetailsDrawer.open = true;
|
|
11697
|
+
}
|
|
11698
|
+
if (tsGuidanceBadge) {
|
|
11699
|
+
tsGuidanceBadge.dataset.tone = (m.tone === 'danger' || e.tone === 'danger')
|
|
11700
|
+
? 'danger'
|
|
11701
|
+
: ((m.tone === 'do' && e.tone === 'do') ? 'muted' : 'warn');
|
|
11702
|
+
tsGuidanceBadge.textContent = `Model: ${m.badge} \u00B7 Effort: ${e.badge}`;
|
|
11703
|
+
}
|
|
10940
11704
|
}
|
|
10941
11705
|
|
|
10942
11706
|
// Zone C: Automated Activity Ledger (reads raw.autoFixLog.items + raw.savings.session.bySource + prefixShield)
|
|
@@ -10953,7 +11717,14 @@
|
|
|
10953
11717
|
const savSubagent = Number(srvBySource.subagentIsolated ?? srvBySource.subagentIsolation ?? raw.savingsLedger?.subagentTokens ?? 0);
|
|
10954
11718
|
const savCache = Number(srvBySource.cachePreserved ?? srvBySource.cachePreservation ?? raw.savingsLedger?.prefixCacheTokens ?? 0);
|
|
10955
11719
|
const savCli = Number(srvBySource.cliCompressed ?? srvBySource.cliCompression ?? raw.savingsLedger?.cliTokens ?? 0);
|
|
10956
|
-
const savGuards = Number(
|
|
11720
|
+
const savGuards = Number(
|
|
11721
|
+
srvBySource.avoidedBloat ??
|
|
11722
|
+
((srvBySource.guardsPrevented != null || srvBySource.compactionReclaimed != null)
|
|
11723
|
+
? ((Number(srvBySource.guardsPrevented) || 0) + (Number(srvBySource.compactionReclaimed) || 0))
|
|
11724
|
+
: raw.savingsLedger?.dedupTokens) ??
|
|
11725
|
+
0
|
|
11726
|
+
);
|
|
11727
|
+
const queuedShield = Number(raw.prefixShield?.queuedCount ?? raw.coachState?.prefixCacheShield?.queuedCount ?? raw.coachState?.prefixShield?.queuedCount ?? 0);
|
|
10957
11728
|
|
|
10958
11729
|
if (tsLedgerList) {
|
|
10959
11730
|
const rows = [];
|
|
@@ -10997,7 +11768,6 @@
|
|
|
10997
11768
|
});
|
|
10998
11769
|
}
|
|
10999
11770
|
}
|
|
11000
|
-
const queuedShield = Number(raw.prefixShield?.queuedCount ?? raw.coachState?.prefixShield?.queuedCount ?? 0);
|
|
11001
11771
|
if (rows.length < 4 && queuedShield > 0) {
|
|
11002
11772
|
rows.push({
|
|
11003
11773
|
age: 'live',
|
|
@@ -11007,12 +11777,16 @@
|
|
|
11007
11777
|
}
|
|
11008
11778
|
|
|
11009
11779
|
const activeInterventionCount = rows.length;
|
|
11780
|
+
const liveGuardTotal = Number(raw.coachState?.detectors?.totalCount || 0);
|
|
11781
|
+
const guardLabel = liveGuardTotal > 0 ? `${liveGuardTotal} guards` : 'guards';
|
|
11010
11782
|
if (rows.length === 0) {
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11783
|
+
if (rulesT > 0) {
|
|
11784
|
+
rows.push({
|
|
11785
|
+
age: 'active',
|
|
11786
|
+
action: `Pinned ${formatTokens(rulesT)} system rules & workspace invariants`,
|
|
11787
|
+
saved: 'pinned'
|
|
11788
|
+
});
|
|
11789
|
+
}
|
|
11016
11790
|
rows.push({
|
|
11017
11791
|
age: 'now',
|
|
11018
11792
|
action: 'Auto-guards armed (FTS5 CLI compressor & PrefixCacheShield)',
|
|
@@ -11020,19 +11794,47 @@
|
|
|
11020
11794
|
});
|
|
11021
11795
|
}
|
|
11022
11796
|
setTxt('tsGuardsSummary', activeInterventionCount > 0
|
|
11023
|
-
? `${activeInterventionCount} auto-intervention${activeInterventionCount === 1 ? '' : 's'} \u00B7
|
|
11024
|
-
: '
|
|
11797
|
+
? `${activeInterventionCount} auto-intervention${activeInterventionCount === 1 ? '' : 's'} \u00B7 ${guardLabel}`
|
|
11798
|
+
: `${liveGuardTotal > 0 ? guardLabel : 'Guards'} armed`);
|
|
11025
11799
|
|
|
11026
11800
|
tsLedgerList.innerHTML = rows.slice(0, 4).map(r => `
|
|
11027
11801
|
<li class="ts-ledger-row">
|
|
11028
|
-
<span
|
|
11802
|
+
<span class="ts-ledger-age">${escAttr(r.age)}</span>
|
|
11029
11803
|
<span>${escAttr(r.action)}</span>
|
|
11030
|
-
<span
|
|
11804
|
+
<span class="ts-ledger-saved">${escAttr(r.saved)}</span>
|
|
11031
11805
|
</li>
|
|
11032
11806
|
`).join('');
|
|
11033
11807
|
}
|
|
11034
11808
|
|
|
11035
|
-
//
|
|
11809
|
+
// Live guard roster (dropdown body of Auto-guard activity)
|
|
11810
|
+
{
|
|
11811
|
+
const guardListEl = document.getElementById('tsGuardList');
|
|
11812
|
+
const guardHeadEl = document.getElementById('tsGuardListHead');
|
|
11813
|
+
const liveGuards = Array.isArray(raw.coachState?.detectors?.list) ? raw.coachState.detectors.list : [];
|
|
11814
|
+
if (guardListEl && guardHeadEl) {
|
|
11815
|
+
if (liveGuards.length === 0) {
|
|
11816
|
+
guardListEl.hidden = true;
|
|
11817
|
+
guardHeadEl.hidden = true;
|
|
11818
|
+
guardListEl.innerHTML = '';
|
|
11819
|
+
} else {
|
|
11820
|
+
const rank = (g) => (g.tripped ? 0 : (g.mode === 'guard' ? 1 : 2));
|
|
11821
|
+
const sorted = liveGuards.slice().sort((a, b) => rank(a) - rank(b) || String(a.id).localeCompare(String(b.id)));
|
|
11822
|
+
const trippedN = sorted.filter((g) => g.tripped).length;
|
|
11823
|
+
guardHeadEl.textContent = `Live guards (${sorted.length}${trippedN ? ` \u00B7 ${trippedN} tripped` : ''})`;
|
|
11824
|
+
guardListEl.innerHTML = sorted.map((g) => {
|
|
11825
|
+
const state = g.tripped ? 'tripped' : (g.mode === 'guard' ? 'blocks' : 'advises');
|
|
11826
|
+
return `<li class="ts-ledger-row" data-mode="${escAttr(g.mode)}" data-tripped="${g.tripped ? 'true' : 'false'}">` +
|
|
11827
|
+
`<span class="ts-ledger-age">${escAttr(g.id)}</span>` +
|
|
11828
|
+
`<span>${escAttr(g.name)}</span>` +
|
|
11829
|
+
`<span class="ts-ledger-saved">${state}</span></li>`;
|
|
11830
|
+
}).join('');
|
|
11831
|
+
guardHeadEl.hidden = false;
|
|
11832
|
+
guardListEl.hidden = false;
|
|
11833
|
+
}
|
|
11834
|
+
}
|
|
11835
|
+
}
|
|
11836
|
+
|
|
11837
|
+
// Core Impact KPI, 5h Sprint Pacing, 72x18 SVG Sparkline & Primary ActionPill
|
|
11036
11838
|
const sessionSaved = Math.max(
|
|
11037
11839
|
0,
|
|
11038
11840
|
Number(
|
|
@@ -11072,6 +11874,56 @@
|
|
|
11072
11874
|
setTxt('tsKpiSaved', `+${formatTokens(sessionSaved)}`);
|
|
11073
11875
|
setTxt('tsKpiUsd', `~$${usdSaved.toFixed(2)}`);
|
|
11074
11876
|
setTxt('tsKpi30d', `30d: +${formatTokens(lifetimeSaved)} (~$${usd30d.toFixed(2)})`);
|
|
11877
|
+
{
|
|
11878
|
+
const usdEl = document.getElementById('tsKpiUsd');
|
|
11879
|
+
const d30El = document.getElementById('tsKpi30d');
|
|
11880
|
+
const sepEl = d30El ? d30El.previousElementSibling : null;
|
|
11881
|
+
const hideUsd = usdSaved < 0.005;
|
|
11882
|
+
const hide30d = lifetimeSaved <= 0;
|
|
11883
|
+
if (usdEl) usdEl.hidden = hideUsd;
|
|
11884
|
+
if (d30El) d30El.hidden = hide30d;
|
|
11885
|
+
if (sepEl && sepEl.getAttribute('aria-hidden') === 'true') sepEl.hidden = hide30d;
|
|
11886
|
+
}
|
|
11887
|
+
|
|
11888
|
+
const tsSprintMeta = document.getElementById('tsSprintMeta');
|
|
11889
|
+
if (tsSprintMeta) {
|
|
11890
|
+
const sprintPctRaw = raw.quota?.sprint5h?.usedPct ?? raw.quota?.fiveHourPct;
|
|
11891
|
+
if (sprintPctRaw != null && Number.isFinite(Number(sprintPctRaw))) {
|
|
11892
|
+
const estPrefix = raw.quota?.sprint5h?.source === 'estimate' ? '~' : '';
|
|
11893
|
+
tsSprintMeta.textContent = `\u00B7 5h: ${estPrefix}${Math.min(100, Math.round(Number(sprintPctRaw)))}%`;
|
|
11894
|
+
tsSprintMeta.hidden = false;
|
|
11895
|
+
} else {
|
|
11896
|
+
tsSprintMeta.hidden = true;
|
|
11897
|
+
tsSprintMeta.textContent = '';
|
|
11898
|
+
}
|
|
11899
|
+
}
|
|
11900
|
+
|
|
11901
|
+
const tsSparklinePath = document.getElementById('tsSparklinePath');
|
|
11902
|
+
const tsSparklineDot = document.getElementById('tsSparklineDot');
|
|
11903
|
+
if (tsSparklinePath && tsSparklineDot) {
|
|
11904
|
+
const tlTurns = Array.isArray(raw.sessionTimeline?.turns) ? raw.sessionTimeline.turns : [];
|
|
11905
|
+
let series = tlTurns.slice(-16).map(t => Math.max(0, Number(t.tokensAdded ?? t.cumulativeTokens ?? t.tokens) || 0));
|
|
11906
|
+
if (series.length < 2 && Array.isArray(raw.cells)) {
|
|
11907
|
+
const cellVals = raw.cells.filter(c => c && c.cat !== 'empty' && Number(c.tokens) > 0).slice(-16).map(c => Number(c.tokens) || 0);
|
|
11908
|
+
if (cellVals.length >= 2) series = cellVals;
|
|
11909
|
+
}
|
|
11910
|
+
if (series.length < 2) {
|
|
11911
|
+
series = total > 0 ? [Math.round(usefulT * 0.5), usefulT, total] : [0, 0];
|
|
11912
|
+
}
|
|
11913
|
+
const peak = Math.max(1, ...series);
|
|
11914
|
+
const pts = series.map((v, idx) => {
|
|
11915
|
+
const x = 2 + (idx / Math.max(1, series.length - 1)) * 68;
|
|
11916
|
+
const y = 15 - (Math.min(peak, v) / peak) * 12;
|
|
11917
|
+
return [Number(x.toFixed(1)), Number(y.toFixed(1))];
|
|
11918
|
+
});
|
|
11919
|
+
tsSparklinePath.setAttribute('points', pts.map(p => `${p[0]},${p[1]}`).join(' '));
|
|
11920
|
+
const lastPt = pts[pts.length - 1] || [70, 15];
|
|
11921
|
+
tsSparklineDot.setAttribute('cx', String(lastPt[0]));
|
|
11922
|
+
tsSparklineDot.setAttribute('cy', String(lastPt[1]));
|
|
11923
|
+
const sparkStroke = isCrisis ? 'var(--status-critical)' : (isWarn ? 'var(--status-warning)' : 'var(--text-secondary)');
|
|
11924
|
+
tsSparklinePath.setAttribute('stroke', sparkStroke);
|
|
11925
|
+
tsSparklineDot.setAttribute('fill', isCrisis ? 'var(--status-critical)' : (isWarn ? 'var(--status-warning)' : 'var(--text-primary)'));
|
|
11926
|
+
}
|
|
11075
11927
|
|
|
11076
11928
|
const tsBtnCleanPrimary = document.getElementById('tsBtnCleanPrimary');
|
|
11077
11929
|
if (tsBtnCleanPrimary) {
|
|
@@ -11084,7 +11936,7 @@
|
|
|
11084
11936
|
tsBtnCleanPrimary.dataset.ctaState = isWarm ? 'guarded' : 'ready';
|
|
11085
11937
|
setTxt('tsBtnCleanLabel', isWarm
|
|
11086
11938
|
? `Hold Cache (${ttlMm}:${ttlSs}) or Copy /compact (${formatTokens(staleT)})`
|
|
11087
|
-
: `
|
|
11939
|
+
: `Reclaim ${formatTokens(staleT)} Clutter (Copy /compact)`);
|
|
11088
11940
|
} else {
|
|
11089
11941
|
tsBtnCleanPrimary.disabled = false;
|
|
11090
11942
|
tsBtnCleanPrimary.dataset.ctaState = 'guarded';
|
|
@@ -11097,9 +11949,13 @@
|
|
|
11097
11949
|
// 2. ADVANCED VIEW UPDATES (#argonAdvancedSurface)
|
|
11098
11950
|
// =======================================================================
|
|
11099
11951
|
setTxt('taSessionLabel', raw.sessionTitle || raw.workspaceName || 'Active Session');
|
|
11100
|
-
|
|
11101
|
-
|
|
11102
|
-
|
|
11952
|
+
const q5h = raw.quota?.sprint5h?.usedPct ?? raw.quota?.fiveHourPct ?? ((total / safeCap) * 18);
|
|
11953
|
+
const q7d = raw.quota?.weekly7d?.usedPct ?? raw.quota?.sevenDayPct ?? 12;
|
|
11954
|
+
const est5hPrefix = raw.quota?.sprint5h?.source === 'estimate' ? '~' : '';
|
|
11955
|
+
const est7dPrefix = raw.quota?.weekly7d?.source === 'estimate' ? '~' : '';
|
|
11956
|
+
setTxt('taSprint5h', `${est5hPrefix}${Math.min(100, Math.round(Number(q5h) || 0))}%`);
|
|
11957
|
+
setTxt('taWeekly7d', `${est7dPrefix}${Math.min(100, Math.round(Number(q7d) || 0))}%`);
|
|
11958
|
+
setTxt('taHostRam', `${Number(raw.hostHealth?.rssGb ?? raw.hostRamGb ?? 0).toFixed(1)}GB`);
|
|
11103
11959
|
|
|
11104
11960
|
const taDualTtl = document.getElementById('taDualTtl');
|
|
11105
11961
|
if (taDualTtl) {
|
|
@@ -11107,8 +11963,8 @@
|
|
|
11107
11963
|
taDualTtl.textContent = `${hitPct}% hit \u00B7 5m KV ${ttlMm}:${ttlSs}`;
|
|
11108
11964
|
}
|
|
11109
11965
|
const taStatusDot = document.getElementById('taStatusDot');
|
|
11110
|
-
if (taStatusDot) taStatusDot.dataset.tone = isCrisis ? 'danger' : (isWarn ? 'warn' : 'signal');
|
|
11111
|
-
setTxt('taStatusLabel', isCrisis ? 'Pruning Required' : (isWarn ? 'Saturation Risk' : 'Optimal Cache'));
|
|
11966
|
+
if (taStatusDot) taStatusDot.dataset.tone = isCrisis ? 'danger' : ((isStuckErrorLoop || isWarn) ? 'warn' : 'signal');
|
|
11967
|
+
setTxt('taStatusLabel', isCrisis ? 'Pruning Required' : (isStuckErrorLoop ? 'Error Loop' : (isWarn ? 'Saturation Risk' : (isWarm ? 'Optimal Cache' : 'Nominal Memory'))));
|
|
11112
11968
|
setTxt('taUsedTok', formatTokens(total));
|
|
11113
11969
|
setTxt('taSigTok', formatTokens(usefulT));
|
|
11114
11970
|
setTxt('taClutterTok', formatTokens(staleT));
|
|
@@ -11117,29 +11973,68 @@
|
|
|
11117
11973
|
// Build 40 cells using data-cat="anchor|signal|cached|clutter|error"
|
|
11118
11974
|
const totalCells = 40;
|
|
11119
11975
|
const tokPerCell = Math.max(1, Math.round(safeCap / totalCells));
|
|
11120
|
-
const
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11976
|
+
const catLabelsAdv = {
|
|
11977
|
+
anchor: 'System Anchor & Rules',
|
|
11978
|
+
signal: 'Active Dialogue & Edits',
|
|
11979
|
+
cached: 'Warm Prefix History',
|
|
11980
|
+
clutter: 'Reclaimable Tool Logs',
|
|
11981
|
+
error: 'Stale Error Trace'
|
|
11982
|
+
};
|
|
11983
|
+
let cells = [];
|
|
11984
|
+
if (Array.isArray(raw.cells) && raw.cells.length === 40 && raw.cells[0]?.dominantCategory) {
|
|
11985
|
+
cells = raw.cells.map((c, i) => {
|
|
11986
|
+
const dc = String(c.dominantCategory || '').toUpperCase();
|
|
11987
|
+
const st = String(c.state || '').toLowerCase();
|
|
11988
|
+
let cat = 'empty';
|
|
11989
|
+
if (dc === 'FREE_HEADROOM' || c.fillPct === 0 || st === 'free') {
|
|
11990
|
+
cat = 'empty';
|
|
11991
|
+
} else if (c.isCrisisCell || dc === 'DEAD_ERROR' || st === 'error') {
|
|
11992
|
+
cat = 'error';
|
|
11993
|
+
} else if (dc === 'ANCHOR') {
|
|
11994
|
+
cat = 'anchor';
|
|
11995
|
+
} else if (dc === 'STALE_DUPLICATE' || dc === 'DUPLICATE_READ' || dc === 'STALE_TURN' || dc === 'FOREIGN_BLEED' || st === 'stale') {
|
|
11996
|
+
cat = 'clutter';
|
|
11997
|
+
} else if (dc === 'ACTIVE_WORKING_SET' || dc === 'MEMORY_KI' || st === 'useful') {
|
|
11998
|
+
cat = isWarm && i < 24 ? 'cached' : 'signal';
|
|
11999
|
+
}
|
|
12000
|
+
const tbc = c.tokensByCategory && typeof c.tokensByCategory === 'object' ? c.tokensByCategory : null;
|
|
12001
|
+
const tok = tbc
|
|
12002
|
+
? Object.entries(tbc).reduce((acc, [k, v]) => (k === 'FREE_HEADROOM' ? acc : acc + Math.max(0, Number(v) || 0)), 0)
|
|
12003
|
+
: (cat === 'empty' ? 0 : Math.round(((c.fillPct ?? 100) / 100) * tokPerCell));
|
|
12004
|
+
return {
|
|
12005
|
+
cat,
|
|
12006
|
+
tokens: tok,
|
|
12007
|
+
source: cat === 'empty' ? 'Available capacity' : (c.topTarget || catLabelsAdv[cat] || cat),
|
|
12008
|
+
recall: typeof c.attentionWeight === 'number' ? c.attentionWeight.toFixed(2) : undefined
|
|
12009
|
+
};
|
|
12010
|
+
});
|
|
12011
|
+
} else {
|
|
12012
|
+
const anchorCells = Math.max(1, Math.min(8, Math.round((rulesT + toolsT) / tokPerCell)));
|
|
12013
|
+
const signalCells = Math.max(0, Math.min(32 - anchorCells, Math.round((activeT + filesT) / tokPerCell)));
|
|
12014
|
+
const clutterCells = Math.max(0, Math.min(40 - anchorCells - signalCells, Math.round(staleT / tokPerCell)));
|
|
12015
|
+
for (let i = 0; i < totalCells; i++) {
|
|
12016
|
+
let cat = 'empty';
|
|
12017
|
+
let tok = 0;
|
|
12018
|
+
let src = 'Available capacity';
|
|
12019
|
+
if (i < anchorCells) {
|
|
12020
|
+
cat = 'anchor'; tok = Math.round((rulesT + toolsT) / anchorCells); src = 'System Anchor & Rules';
|
|
12021
|
+
} else if (i < anchorCells + signalCells) {
|
|
12022
|
+
cat = isWarm && i < anchorCells + Math.ceil(signalCells * 0.6) ? 'cached' : 'signal';
|
|
12023
|
+
tok = Math.round((activeT + filesT) / Math.max(1, signalCells));
|
|
12024
|
+
src = cat === 'cached' ? 'Warm Prefix History' : 'Active Dialogue & Edits';
|
|
12025
|
+
} else if (i < anchorCells + signalCells + clutterCells) {
|
|
12026
|
+
cat = isCrisis ? 'error' : 'clutter';
|
|
12027
|
+
tok = Math.round(staleT / Math.max(1, clutterCells));
|
|
12028
|
+
src = 'Reclaimable Tool Logs';
|
|
12029
|
+
}
|
|
12030
|
+
cells.push({ cat, tokens: tok, source: src });
|
|
12031
|
+
}
|
|
11140
12032
|
}
|
|
11141
12033
|
__taLastCells = cells;
|
|
11142
12034
|
|
|
12035
|
+
const strandedN = Number(raw.attentionHeatmap?.strandedSignalCount) || 0;
|
|
12036
|
+
setTxt('taUTrough', `62% (${strandedN} spec${strandedN === 1 ? '' : 's'})`);
|
|
12037
|
+
|
|
11143
12038
|
const gridEl = document.getElementById('taHorizonGrid');
|
|
11144
12039
|
if (gridEl) {
|
|
11145
12040
|
const domCells = gridEl.querySelectorAll('.ta-cell');
|
|
@@ -11154,9 +12049,57 @@
|
|
|
11154
12049
|
|
|
11155
12050
|
// Top Context Consumers Table (respecting Active Source File Protection invariant)
|
|
11156
12051
|
const taConsumersBody = document.getElementById('taConsumersBody');
|
|
11157
|
-
|
|
11158
|
-
|
|
11159
|
-
|
|
12052
|
+
let hogs = [];
|
|
12053
|
+
if (Array.isArray(raw.topConsumers) && raw.topConsumers.length > 0) {
|
|
12054
|
+
hogs = raw.topConsumers;
|
|
12055
|
+
} else {
|
|
12056
|
+
const seenTargets = new Set();
|
|
12057
|
+
const topFiles = Array.isArray(bs.duplicateReads?.topFiles)
|
|
12058
|
+
? bs.duplicateReads.topFiles
|
|
12059
|
+
: (Array.isArray(raw.duplicateReads) ? raw.duplicateReads : []);
|
|
12060
|
+
topFiles.forEach(f => {
|
|
12061
|
+
const p = f?.path || f?.file;
|
|
12062
|
+
const tok = Number(f?.wastedTokens ?? f?.tokens ?? f?.reclaimableTokens ?? 0);
|
|
12063
|
+
if (!p || tok <= 0) return;
|
|
12064
|
+
seenTargets.add(String(p).toLowerCase());
|
|
12065
|
+
hogs.push({ kind: 'file', path: p, pattern: `${Number(f.occurrences || f.reads || f.count || 1)}x read`, tokens: tok });
|
|
12066
|
+
});
|
|
12067
|
+
(Array.isArray(raw.offenders) ? raw.offenders : []).forEach(o => {
|
|
12068
|
+
const tgt = String(o?.target || '');
|
|
12069
|
+
const tok = Number(o?.wastedTokens || 0);
|
|
12070
|
+
if (!tgt || tok <= 0) return;
|
|
12071
|
+
if (o.category === 'DEAD_ERROR') {
|
|
12072
|
+
if (!seenTargets.has(tgt.toLowerCase())) {
|
|
12073
|
+
seenTargets.add(tgt.toLowerCase());
|
|
12074
|
+
hogs.push({ kind: 'error', label: tgt, pattern: `${Number(o.occurrences || 1)}x error`, tokens: tok });
|
|
12075
|
+
}
|
|
12076
|
+
} else if (tgt === 'Older chat history (>25 turns ago)') {
|
|
12077
|
+
hogs.push({ kind: 'history', label: 'Older chat history (>25 turns)', pattern: `${Number(o.occurrences || 1)} turns`, tokens: tok });
|
|
12078
|
+
} else if (tgt !== 'Foreign Bleed Knowledge' && !seenTargets.has(tgt.toLowerCase())) {
|
|
12079
|
+
seenTargets.add(tgt.toLowerCase());
|
|
12080
|
+
hogs.push({ kind: 'file', path: tgt, pattern: `${Number(o.occurrences || 1)}x read`, tokens: tok });
|
|
12081
|
+
}
|
|
12082
|
+
});
|
|
12083
|
+
if (bleedWaste > 0) {
|
|
12084
|
+
hogs.push({ kind: 'bleed', label: 'Cross-project memory bleed', pattern: 'foreign KI', tokens: bleedWaste });
|
|
12085
|
+
}
|
|
12086
|
+
(Array.isArray(bs.blowupSteps) ? bs.blowupSteps : []).forEach(b => {
|
|
12087
|
+
const tok = Number(b?.tokens || 0);
|
|
12088
|
+
if (tok <= 0) return;
|
|
12089
|
+
const isFile = b.payload?.kind === 'file' && Boolean(b.payload?.path);
|
|
12090
|
+
const key = String(isFile ? b.payload.path : (b.payload?.detail || b.target || '')).toLowerCase();
|
|
12091
|
+
if (isFile && seenTargets.has(key)) return;
|
|
12092
|
+
seenTargets.add(key);
|
|
12093
|
+
hogs.push({
|
|
12094
|
+
kind: isFile ? 'file' : 'spike',
|
|
12095
|
+
path: isFile ? b.payload.path : undefined,
|
|
12096
|
+
label: b.payload?.detail || b.target || 'Output spike',
|
|
12097
|
+
pattern: `T${b.userTurnNumber || b.stepIndex} spike`,
|
|
12098
|
+
tokens: tok
|
|
12099
|
+
});
|
|
12100
|
+
});
|
|
12101
|
+
hogs.sort((a, b) => (b.tokens || 0) - (a.tokens || 0));
|
|
12102
|
+
}
|
|
11160
12103
|
if (taConsumersBody) {
|
|
11161
12104
|
const list = hogs.slice(0, 4);
|
|
11162
12105
|
if (list.length === 0) {
|
|
@@ -11165,30 +12108,43 @@
|
|
|
11165
12108
|
<td>AGENTS.md + rules</td>
|
|
11166
12109
|
<td>pinned</td>
|
|
11167
12110
|
<td class="num">${formatTokens(rulesT || 12400)}</td>
|
|
11168
|
-
<td class="num"><span style="color
|
|
12111
|
+
<td class="num"><span style="color:var(--hz-useful);">Protected</span></td>
|
|
11169
12112
|
</tr>
|
|
11170
12113
|
<tr>
|
|
11171
12114
|
<td>Active working files</td>
|
|
11172
12115
|
<td>1x read</td>
|
|
11173
12116
|
<td class="num">${formatTokens(Math.max(4200, usefulT - rulesT))}</td>
|
|
11174
|
-
<td class="num"><span style="color
|
|
12117
|
+
<td class="num"><span style="color:var(--hz-anchor);">Active Source</span></td>
|
|
11175
12118
|
</tr>
|
|
11176
12119
|
`;
|
|
11177
12120
|
} else {
|
|
11178
12121
|
taConsumersBody.innerHTML = list.map(item => {
|
|
12122
|
+
const kind = item.kind || (item.path || item.file ? 'file' : 'spike');
|
|
11179
12123
|
const p = String(item.path || item.file || item.label || 'context-item');
|
|
11180
|
-
const
|
|
12124
|
+
const patternTxt = item.pattern || `${Number(item.reads || item.count || 1)}x read`;
|
|
11181
12125
|
const tok = Number(item.tokens || item.reclaimableTokens || 2400);
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
12126
|
+
let actionHtml = '';
|
|
12127
|
+
if (kind === 'file') {
|
|
12128
|
+
const ignorable = typeof isIgnorablePath === 'function'
|
|
12129
|
+
? isIgnorablePath(p)
|
|
12130
|
+
: /\.(log|lock|tmp|bak|min\.js|map)$|package-lock\.json|pnpm-lock\.yaml|yarn\.lock|node_modules|\.antigravity/i.test(p);
|
|
12131
|
+
actionHtml = ignorable
|
|
12132
|
+
? `<button type="button" class="ta-mini-btn" data-ignore-path="${escAttr(p)}">+Ignore</button>`
|
|
12133
|
+
: `<span style="color:var(--hz-anchor);">Active Source</span>`;
|
|
12134
|
+
} else if (kind === 'history') {
|
|
12135
|
+
actionHtml = `<span style="color:var(--hz-muted);">Cleared by /compact</span>`;
|
|
12136
|
+
} else if (kind === 'error') {
|
|
12137
|
+
actionHtml = `<span style="color:var(--hz-danger);">Error trace</span>`;
|
|
12138
|
+
} else if (kind === 'bleed') {
|
|
12139
|
+
actionHtml = `<span style="color:var(--hz-clutter);">Foreign KI</span>`;
|
|
12140
|
+
} else {
|
|
12141
|
+
actionHtml = `<span style="color:var(--hz-clutter);">Output spike</span>`;
|
|
12142
|
+
}
|
|
12143
|
+
const displayTarget = kind === 'file' && typeof formatShortPath === 'function' ? formatShortPath(p) : p;
|
|
11188
12144
|
return `
|
|
11189
12145
|
<tr>
|
|
11190
|
-
<td title="${escAttr(p)}">${escAttr(
|
|
11191
|
-
<td>${
|
|
12146
|
+
<td title="${escAttr(p)}">${escAttr(displayTarget)}</td>
|
|
12147
|
+
<td>${escAttr(patternTxt)}</td>
|
|
11192
12148
|
<td class="num">${formatTokens(tok)}</td>
|
|
11193
12149
|
<td class="num">${actionHtml}</td>
|
|
11194
12150
|
</tr>
|
|
@@ -11201,15 +12157,65 @@
|
|
|
11201
12157
|
const routerMode = String(raw.routerMode || 'coach').toLowerCase();
|
|
11202
12158
|
document.querySelectorAll('#taRouterSwitch button').forEach(btn => {
|
|
11203
12159
|
const active = (btn.dataset.taMode || btn.dataset.mode) === routerMode;
|
|
11204
|
-
btn.style.borderColor = active ? '
|
|
11205
|
-
btn.style.color = active ? '
|
|
12160
|
+
btn.style.borderColor = active ? 'var(--hz-useful)' : '';
|
|
12161
|
+
btn.style.color = active ? 'var(--hz-useful)' : '';
|
|
11206
12162
|
});
|
|
12163
|
+
const taActionQueue = document.getElementById('taActionQueue');
|
|
12164
|
+
if (taActionQueue) {
|
|
12165
|
+
const qRows = [];
|
|
12166
|
+
if (isCrisis) {
|
|
12167
|
+
qRows.push({ tone: 'danger', tag: 'CRISIS', text: `Run /compact or checkpoint task.md \u2014 ${formatTokens(Math.max(0, total - safeCap))} past safe limit` });
|
|
12168
|
+
} else if (isStuckErrorLoop) {
|
|
12169
|
+
qRows.push({ tone: 'avoid', tag: 'LOOP', text: `${errLoopCount}\u00D7 error loop \u2014 inspect root cause or upshift model/effort` });
|
|
12170
|
+
} else if (staleT >= 35000) {
|
|
12171
|
+
qRows.push({ tone: 'avoid', tag: 'COMPACT', text: `${formatTokens(staleT)} reclaimable clutter queued for /compact` });
|
|
12172
|
+
} else if (topBlowup && Number(topBlowup.tokens) >= 12000) {
|
|
12173
|
+
qRows.push({ tone: 'avoid', tag: 'SPIKE', text: `Turn #${topBlowup.userTurnNumber || topBlowup.stepIndex} spike (${formatTokens(topBlowup.tokens)}) \u2014 filter verbose output` });
|
|
12174
|
+
}
|
|
12175
|
+
if (idleEagerMcps.length > 0) {
|
|
12176
|
+
qRows.push({ tone: 'avoid', tag: 'MCP', text: `${idleEagerMcps.length} idle eager MCP${idleEagerMcps.length === 1 ? '' : 's'} \u00B7 ~${formatTokens(idleEagerTokens)} schema bloat` });
|
|
12177
|
+
}
|
|
12178
|
+
if (Number(raw.hostHealth?.orphanCount) > 0) {
|
|
12179
|
+
const oc = Number(raw.hostHealth.orphanCount);
|
|
12180
|
+
qRows.push({ tone: 'avoid', tag: 'PID', text: `${oc} orphan language_server PID${oc === 1 ? '' : 's'} detected` });
|
|
12181
|
+
}
|
|
12182
|
+
if (strandedN > 0) {
|
|
12183
|
+
qRows.push({ tone: 'avoid', tag: 'TROUGH', text: `${strandedN} stranded mid-trough spec${strandedN === 1 ? '' : 's'} (low recall)` });
|
|
12184
|
+
}
|
|
12185
|
+
if (raw.coachState?.det17ShadowBloat?.triggered) {
|
|
12186
|
+
const sb = raw.coachState.det17ShadowBloat;
|
|
12187
|
+
qRows.push({ tone: 'avoid', tag: 'SHADOW', text: `${sb.shadowedFileCount || 1} shadowed file(s) \u00B7 ~${formatTokens(sb.totalShadowWastedTokens || 0)} wasted` });
|
|
12188
|
+
}
|
|
12189
|
+
if (qRows.length === 0) {
|
|
12190
|
+
qRows.push({ tone: 'do', tag: 'QUEUE', text: 'Nominal queue \u00B7 0 orphan PIDs, 0 idle eager MCPs, 0 trough specs' });
|
|
12191
|
+
}
|
|
12192
|
+
taActionQueue.innerHTML = qRows.slice(0, 3).map(r =>
|
|
12193
|
+
`<div class="ts-guidance-row" data-tone="${escAttr(r.tone)}"><span class="ts-tag">${escAttr(r.tag)}</span><span>${escAttr(r.text)}</span></div>`
|
|
12194
|
+
).join('');
|
|
12195
|
+
}
|
|
12196
|
+
const taRouterNote = document.getElementById('taRouterNote');
|
|
12197
|
+
if (taRouterNote) {
|
|
12198
|
+
taRouterNote.textContent = raw.coachState?.taskQuotaRouter?.coachPillText || 'KV Gravity Router ready \u00B7 Turn-boundary switch buffer armed';
|
|
12199
|
+
}
|
|
11207
12200
|
|
|
11208
12201
|
// Zone C: Turn-0 Baseline & Guard Log
|
|
11209
|
-
const baselineTok = rulesT + toolsT;
|
|
11210
12202
|
const taBaselineText = document.getElementById('taBaselineText');
|
|
11211
12203
|
if (taBaselineText) {
|
|
11212
|
-
taBaselineText.innerHTML = `Turn-0 Baseline: <strong>${formatTokens(
|
|
12204
|
+
taBaselineText.innerHTML = `Turn-0 Baseline: <strong${baselineOverBudget ? ' style="color:var(--hz-clutter);"' : ''}>${formatTokens(baselineEst)}</strong> / 20.0k budget`;
|
|
12205
|
+
}
|
|
12206
|
+
setTxt('taBtnShield', `Shield: ${queuedShield} queued`);
|
|
12207
|
+
const taDetBadge = document.getElementById('taDetBadge');
|
|
12208
|
+
const trippedDet = raw.coachState?.detectors?.tripped;
|
|
12209
|
+
if (taDetBadge) {
|
|
12210
|
+
if (trippedDet && trippedDet.detectorId) {
|
|
12211
|
+
taDetBadge.dataset.tone = 'warn';
|
|
12212
|
+
taDetBadge.textContent = `${trippedDet.detectorId} tripped`;
|
|
12213
|
+
taDetBadge.title = trippedDet.reason || '';
|
|
12214
|
+
} else {
|
|
12215
|
+
taDetBadge.dataset.tone = '';
|
|
12216
|
+
taDetBadge.textContent = '32/32 guards armed';
|
|
12217
|
+
taDetBadge.title = '';
|
|
12218
|
+
}
|
|
11213
12219
|
}
|
|
11214
12220
|
const taGuardBody = document.getElementById('taGuardBody');
|
|
11215
12221
|
if (taGuardBody && rawAutoFixItems.length > 0) {
|
|
@@ -11218,7 +12224,7 @@
|
|
|
11218
12224
|
<td>${escAttr(ev.turn ? 'T' + ev.turn : (ev.ageLabel || 'auto'))}</td>
|
|
11219
12225
|
<td>${escAttr(ev.guardId || `DET-0${idx + 1}`)}</td>
|
|
11220
12226
|
<td>${escAttr(ev.label || ev.title || ev.summary || 'Guard intervention')}</td>
|
|
11221
|
-
<td class="num" style="color
|
|
12227
|
+
<td class="num" style="color:var(--hz-useful);">${ev.tokensSaved ? `+${formatTokens(ev.tokensSaved)}` : 'fixed'}</td>
|
|
11222
12228
|
</tr>
|
|
11223
12229
|
`).join('');
|
|
11224
12230
|
}
|
|
@@ -11228,10 +12234,11 @@
|
|
|
11228
12234
|
setTxt('taKpiUsd', `~$${usdSaved.toFixed(2)}`);
|
|
11229
12235
|
setTxt('taKpi30d', `30d: +${formatTokens(lifetimeSaved)} (~$${usd30d.toFixed(2)})`);
|
|
11230
12236
|
|
|
11231
|
-
const
|
|
11232
|
-
const
|
|
11233
|
-
const
|
|
11234
|
-
const
|
|
12237
|
+
const hasDetailedSavings = (savCache + savSubagent + savCli + savGuards) > 0 || !raw.savingsLedger;
|
|
12238
|
+
const savedCache = hasDetailedSavings ? savCache : (Number(raw.savingsLedger?.prefixCacheTokens) || Math.round(sessionSaved * 0.75));
|
|
12239
|
+
const savedSub = hasDetailedSavings ? savSubagent : (Number(raw.savingsLedger?.subagentTokens) || Math.round(sessionSaved * 0.10));
|
|
12240
|
+
const savedCli = hasDetailedSavings ? savCli : (Number(raw.savingsLedger?.cliTokens) || Math.round(sessionSaved * 0.08));
|
|
12241
|
+
const savedGuards = hasDetailedSavings ? savGuards : Math.max(0, sessionSaved - savedCache - savedSub - savedCli);
|
|
11235
12242
|
setTxt('taSrcCache', `+${formatTokens(savedCache)}`);
|
|
11236
12243
|
setTxt('taSrcSub', `+${formatTokens(savedSub)}`);
|
|
11237
12244
|
setTxt('taSrcCli', `+${formatTokens(savedCli)}`);
|
|
@@ -11255,16 +12262,17 @@
|
|
|
11255
12262
|
const tsBtnCleanPrimary = document.getElementById('tsBtnCleanPrimary');
|
|
11256
12263
|
if (tsBtnCleanPrimary) {
|
|
11257
12264
|
tsBtnCleanPrimary.addEventListener('click', async () => {
|
|
12265
|
+
const cmd = currentRenderedState?.compaction?.parameterizedCommand || '/compact';
|
|
11258
12266
|
try {
|
|
11259
12267
|
if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
|
|
11260
|
-
await navigator.clipboard.writeText(
|
|
12268
|
+
await navigator.clipboard.writeText(cmd);
|
|
11261
12269
|
}
|
|
11262
12270
|
} catch {}
|
|
11263
12271
|
try {
|
|
11264
12272
|
await fetch('/api/pre-compact', {
|
|
11265
12273
|
method: 'POST',
|
|
11266
12274
|
headers: buildHorizonPostHeaders(),
|
|
11267
|
-
body: JSON.stringify({ conversationId: currentRenderedState?.sessionId || 'auto', action: 'clean_purge_cache' })
|
|
12275
|
+
body: JSON.stringify({ conversationId: currentRenderedState?.sessionId || 'auto', action: 'clean_purge_cache', command: cmd })
|
|
11268
12276
|
});
|
|
11269
12277
|
} catch {}
|
|
11270
12278
|
const lbl = document.getElementById('tsBtnCleanLabel');
|
|
@@ -11278,7 +12286,7 @@
|
|
|
11278
12286
|
const taBtnSurgeryPrimary = document.getElementById('taBtnSurgeryPrimary');
|
|
11279
12287
|
if (taBtnSurgeryPrimary) {
|
|
11280
12288
|
taBtnSurgeryPrimary.addEventListener('click', async () => {
|
|
11281
|
-
const cmd = document.getElementById('taCompactCmdText')?.textContent?.trim() || '/compact';
|
|
12289
|
+
const cmd = document.getElementById('taCompactCmdText')?.textContent?.trim() || currentRenderedState?.compaction?.parameterizedCommand || '/compact';
|
|
11282
12290
|
try {
|
|
11283
12291
|
if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
|
|
11284
12292
|
await navigator.clipboard.writeText(cmd);
|
|
@@ -11298,7 +12306,7 @@
|
|
|
11298
12306
|
const taBtnCopyCompact = document.getElementById('taBtnCopyCompact');
|
|
11299
12307
|
if (taBtnCopyCompact) {
|
|
11300
12308
|
taBtnCopyCompact.addEventListener('click', async () => {
|
|
11301
|
-
const cmd = document.getElementById('taCompactCmdText')?.textContent?.trim() || '/compact';
|
|
12309
|
+
const cmd = document.getElementById('taCompactCmdText')?.textContent?.trim() || currentRenderedState?.compaction?.parameterizedCommand || '/compact';
|
|
11302
12310
|
try {
|
|
11303
12311
|
if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
|
|
11304
12312
|
await navigator.clipboard.writeText(cmd);
|