Repository navigation
Expand file tree
/
Copy pathcodexViewComponents.ts
More file actions
354 lines (349 loc) · 12.8 KB
/
Copy pathcodexViewComponents.ts
File metadata and controls
354 lines (349 loc) · 12.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
import {
CodexInsightEvidenceKey,
CodexInsightKind,
} from './providers/codex/codexInsights';
import type { BackgroundWorkReason } from './backgroundWorkState';
/** Copy contract retained for provider-aware renderers in webview.ts. */
export const CODEX_QUALITY_FLAGS = [
'invalid-turn-context',
'invalid-session-meta',
'missing-pseudonymizer',
'missing-token-info',
'invalid-token-count',
'counter-regression',
'component-delta-clamped',
'missing-parent',
'index-backfill-incomplete',
'ambiguous-session-identity',
'invalid-json',
'invalid-event-payload',
'unknown-event',
'invalid-event-timestamp',
'oversized-jsonl-line',
'truncated-jsonl',
'replaced-jsonl',
'stale-file',
'stale-reset-required',
] as const;
export type CodexQualityFlag = (typeof CODEX_QUALITY_FLAGS)[number];
export interface CodexViewCopy {
title: string;
refresh: string;
overview: string;
explore: string;
recommendations: string;
usageTrend: string;
daily: string;
date: string;
role: string;
scope: string;
threadLabel: string;
unnamedSession: string;
unidentifiedProject: string;
parentThread: string;
searchThreads: string;
all: string;
localDirectory: string;
lastActive: string;
expand: string;
viewAllSessions: string;
sortBy: string;
rootRole: string;
childRole: string;
approvalReviewerRole: string;
unknownRole: string;
noDailyData: string;
noMonthlyData: string;
noThreadData: string;
lastTask: string;
last7Days: string;
last30Days: string;
allTime: string;
behavior: string;
settings: string;
monthly: string;
tokenComposition: string;
freshInput: string;
reasoningSubset: string;
threadRoleComposition: string;
childThreadsPerRootTask: string;
childFreshShare: string;
approvalFreshShare: string;
highEffortFreshShare: string;
processedToFreshRatio: string;
reasoningOutputShare: string;
postPatchToolCallsPerPatchCall: string;
patchCalls: string;
compactions: string;
projects: string;
projectLabel: string;
processed: string;
apiEquivalentCost: string;
apiEquivalentCostHelp: string;
fresh: string;
input: string;
cachedInput: string;
output: string;
reasoning: string;
model: string;
models: string;
efforts: string;
threads: string;
rootTasks: string;
childThreads: string;
approvalReviewers: string;
duration: string;
cacheShare: string;
coverage: string;
quality: string;
qualityFlagLabels: Record<CodexQualityFlag, string>;
qualityFlagUnknown: string;
complete: string;
partial: string;
lastObserved: string;
usageLimits: string;
resets: string;
credits: string;
unlimited: string;
unavailable: string;
optimization: string;
structuralProxy: string;
pasteConstraint: string;
constraintNoAgents: string;
constraintLowerEffort: string;
constraintPostPatch: string;
constraintCacheContext: string;
constraintApprovalReviewer: string;
constraintTests?: string;
constraintStop?: string;
recommendationComposition: string;
recommendationProxyKpi: string;
recommendationEmpty: string;
recommendationPartial: string;
insightObservation: string;
insightEvidence: string;
insightConditionalAction: string;
insightObservations: Record<CodexInsightKind, string>;
insightTips: Record<CodexInsightKind, string>;
insightEvidenceLabels: Record<CodexInsightEvidenceKey, string>;
compareTitle: string;
noRecentTask: string;
sessions: string;
modelsEffort: string;
clearFilters: string;
activeFilters: string;
parentTask: string;
fiveHourWindow: string;
weeklyWindow: string;
used: string;
remaining: string;
localLogNotLive: string;
accountSnapshotLastObserved: string;
limitExpired: string;
limitMissing: string;
observedSessionDuration: string;
indexedLogEntries: string;
indexedStorage: string;
indexedAllTime: string;
indexedSubtotal: string;
indexingInProgress: string;
indexingReasons: Record<BackgroundWorkReason, string>;
updatedAt: string;
claudeTokenAccounting: string;
codexTokenAccounting: string;
insightTitles: Record<CodexInsightKind, string>;
}
export const CODEX_COPY_EN: CodexViewCopy = {
title: 'Codex usage',
refresh: 'Refresh',
overview: 'Overview',
explore: 'Explore',
recommendations: 'Recommendations',
usageTrend: 'Usage trend',
daily: 'Daily',
date: 'Date',
role: 'Role',
scope: 'Scope',
threadLabel: 'Thread',
unnamedSession: 'Unnamed session',
unidentifiedProject: 'Unidentified project',
parentThread: 'Parent',
searchThreads: 'Search sessions',
all: 'All',
localDirectory: 'Local folder',
lastActive: 'Last active',
expand: 'Expand',
viewAllSessions: 'View all sessions',
sortBy: 'Sort by',
rootRole: 'Root',
childRole: 'Subagent',
approvalReviewerRole: 'Approval reviewer',
unknownRole: 'Unknown',
noDailyData: 'No daily Codex usage is indexed yet.',
noMonthlyData: 'No monthly Codex usage is indexed yet.',
noThreadData: 'No Codex threads are indexed yet.',
lastTask: 'Recent task',
last7Days: 'Last 7 days',
last30Days: 'Last 30 days',
allTime: 'All time',
behavior: 'Behavior',
settings: 'Settings',
monthly: 'Monthly',
tokenComposition: 'Token composition',
freshInput: 'Uncached input',
reasoningSubset: 'Included in Output',
threadRoleComposition: 'Thread-role composition',
childThreadsPerRootTask: 'Child threads / root task',
childFreshShare: 'Child uncached share',
approvalFreshShare: 'Approval uncached share',
highEffortFreshShare: 'High-effort uncached share',
processedToFreshRatio: 'Processed / uncached',
reasoningOutputShare: 'Reasoning share of output',
postPatchToolCallsPerPatchCall: 'Post-patch tool-call proxy / patch call',
patchCalls: 'Patch calls',
compactions: 'Compactions',
projects: 'Projects',
projectLabel: 'Project',
processed: 'Processed',
apiEquivalentCost: 'API-equivalent cost',
apiEquivalentCostHelp: 'Estimated from currently indexed tokens at current official API rates; not a bill or subscription charge. Priced model coverage: {coverage}.',
fresh: 'Uncached usage',
input: 'Input',
cachedInput: 'Cached input',
output: 'Output',
reasoning: 'Reasoning',
model: 'Model',
models: 'Models',
efforts: 'Effort',
threads: 'Threads',
rootTasks: 'Root tasks',
childThreads: 'Child threads',
approvalReviewers: 'Approval reviewers',
duration: 'Session span',
cacheShare: 'Input cache share',
coverage: 'Coverage',
quality: 'Quality',
qualityFlagLabels: {
'invalid-turn-context': 'Invalid turn context',
'invalid-session-meta': 'Invalid session metadata',
'missing-pseudonymizer': 'Identity protection unavailable',
'missing-token-info': 'Missing token information',
'invalid-token-count': 'Invalid token count',
'counter-regression': 'Usage counter moved backwards',
'component-delta-clamped': 'Cached or reasoning token delta exceeded its parent total and was capped',
'missing-parent': 'Parent session log missing; conservative usage retained',
'index-backfill-incomplete': 'Usage index is still being built; current totals are incomplete and indexing will continue automatically',
'ambiguous-session-identity': 'Duplicate session identity is ambiguous; both local copies are retained',
'invalid-json': 'Unreadable JSON log entry',
'invalid-event-payload': 'Invalid event payload',
'unknown-event': 'Unrecognized log event',
'invalid-event-timestamp': 'Invalid event timestamp',
'oversized-jsonl-line': 'Oversized log entry',
'truncated-jsonl': 'Log file was truncated',
'replaced-jsonl': 'Log file was replaced',
'stale-file': 'Using last verified file data',
'stale-reset-required': 'Full file rescan required',
},
qualityFlagUnknown: 'Other data-quality issue',
complete: 'Complete',
partial: 'Partial',
lastObserved: 'Last observed',
usageLimits: 'Usage limits',
resets: 'Resets',
credits: 'Credits',
unlimited: 'Unlimited',
unavailable: 'Unavailable',
optimization: 'Local optimization signals',
structuralProxy: 'Structural proxy; tool-call details are not read.',
pasteConstraint: 'Paste-ready constraint',
constraintNoAgents: 'For comparable tasks, decide whether subagents are needed before spawning them.',
constraintLowerEffort: 'On a representative task, A/B the observed high effort against one lower effort level.',
constraintPostPatch: 'After the next patch, use the structural proxy to consider a shorter tool sequence.',
constraintCacheContext: 'Keep the cache and context proxy in view when choosing the next task boundary.',
constraintApprovalReviewer: 'Before adding approval reviewers, check whether that role is needed for this task.',
recommendationComposition: 'Observed role, model, and effort composition',
recommendationProxyKpi: 'Structural proxy KPI',
recommendationEmpty: 'No evidence-based recommendations for this scope.',
recommendationPartial: 'Some date ranges are unavailable while the daily index catches up.',
insightObservation: 'Observation',
insightEvidence: 'Evidence',
insightConditionalAction: 'Conditional action',
compareTitle: 'Provider comparison',
noRecentTask: 'No recent Codex task is indexed yet.',
sessions: 'Sessions',
modelsEffort: 'Models & effort',
clearFilters: 'Clear filters',
activeFilters: 'Active filters',
parentTask: 'Parent task',
fiveHourWindow: '5-hour window',
weeklyWindow: 'Weekly window',
used: 'used',
remaining: 'remaining',
localLogNotLive: 'Local log · not live',
accountSnapshotLastObserved:
'Usage combines sign-ins in this Codex home · limits are last observed, not combined',
limitExpired: 'Expired / stale last-observed limit',
limitMissing: 'No locally observed usage limit',
observedSessionDuration: 'Elapsed span between the first and last observed events; a proxy, not actual active time.',
indexedSubtotal: 'Indexed subtotal',
indexingInProgress: 'Indexing is still in progress; unverified legacy totals are excluded.',
indexingReasons: {
'first-index': 'First local history setup',
'parser-migration': 'Updating the local parser index',
'period-migration': 'Updating date history',
'hourly-history': 'Building recent hourly history',
'history-backfill': 'Completing local history',
'rule-migration': 'Updating measurement rules',
resume: 'Resuming local history',
},
indexedLogEntries: 'Indexed log entries',
indexedStorage: 'Indexed storage',
indexedAllTime: 'Indexed all time',
updatedAt: 'Updated at',
claudeTokenAccounting: 'Claude tokens',
codexTokenAccounting: 'Codex tokens',
insightTitles: {
'multi-agent-share': 'Subagent uncached-share proxy',
'effort-comparison': 'Compare one lower effort level',
'post-patch-tool-intensity': 'Post-patch tool intensity proxy',
'cache-context': 'Cache and long-context context',
'approval-reviewer-share': 'Approval-reviewer uncached-share proxy',
},
insightObservations: {
'multi-agent-share': 'A substantial share of observed uncached usage is associated with subagent roles.',
'effort-comparison': 'High effort appears in this structural proxy scope.',
'post-patch-tool-intensity': 'Observed tool activity after patches is elevated in this structural proxy scope.',
'cache-context': 'Processed activity is high relative to uncached usage; cache/context can affect this proxy.',
'approval-reviewer-share': 'A material share of observed uncached usage is associated with approval-reviewer roles.',
},
insightTips: {
'multi-agent-share': 'For comparable tasks, decide whether subagents are needed before spawning them.',
'effort-comparison': 'On a representative task, A/B the observed high effort against one lower effort level.',
'post-patch-tool-intensity': 'After the next patch, use this proxy to consider a shorter tool sequence.',
'cache-context': 'Keep cache/context observations in view when choosing the next task boundary.',
'approval-reviewer-share': 'Before adding approval reviewers, check whether that role is needed for this task.',
},
insightEvidenceLabels: {
taskCount: 'Root tasks',
rootSessionFresh: 'Root / unknown-role uncached usage',
subagentFresh: 'Subagent uncached usage',
approvalReviewerFresh: 'Approval-reviewer uncached usage',
observedEffort: 'Observed effort',
highEffortFresh: 'High-effort uncached usage',
lowMediumEffortFresh: 'Lower-effort uncached usage',
patchCalls: 'Patch calls (proxy)',
toolCalls: 'Tool calls (proxy)',
postPatchToolCalls: 'Post-patch tool calls (proxy)',
compactCount: 'Context compactions (proxy)',
taskCompleteCount: 'Task-complete events (proxy)',
processedToFreshRatio: 'Processed / uncached proxy',
cachedInputShare: 'Cached-input share',
reasoningOutputShare: 'Reasoning share of output',
},
};
export function defaultDashboardProvider(
hasClaude: boolean,
hasCodex: boolean,
): 'claude' | 'codex' {
return hasClaude || !hasCodex ? 'claude' : 'codex';
}