sidekick-shared 0.21.2 → 0.21.4
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/README.md +60 -45
- package/dist/accountManager.js +9 -7
- package/dist/accountRegistry.d.ts +17 -0
- package/dist/accountRegistry.js +18 -14
- package/dist/accountStatus.js +7 -7
- package/dist/accounts.d.ts +13 -0
- package/dist/accounts.js +110 -25
- package/dist/aggregation/EventAggregator.d.ts +14 -11
- package/dist/aggregation/EventAggregator.js +68 -31
- package/dist/aggregation/PatternExtractor.js +5 -4
- package/dist/autoSwitch.js +6 -12
- package/dist/claudeProfiles.js +3 -3
- package/dist/codexProfiles.d.ts +15 -1
- package/dist/codexProfiles.js +96 -22
- package/dist/codexQuota.js +44 -16
- package/dist/codexQuotaWatcher.js +19 -4
- package/dist/context/composer.js +8 -6
- package/dist/context/sessionContext.js +12 -9
- package/dist/credentialIO.js +10 -8
- package/dist/extractors/sessionAssets.js +9 -1
- package/dist/extractors/sources/claudeAssets.js +7 -1
- package/dist/extractors/sources/codexAssets.js +14 -3
- package/dist/extractors/toolCall.js +1 -4
- package/dist/formatters/eventHighlighter.js +148 -28
- package/dist/formatters/noiseClassifier.js +3 -11
- package/dist/formatters/sessionDump.js +22 -13
- package/dist/formatters/toolSummary.js +1 -3
- package/dist/index.d.ts +26 -26
- package/dist/index.js +10 -4
- package/dist/modelContext.js +10 -8
- package/dist/modelInfo.js +11 -6
- package/dist/multiProviderQuotaService.d.ts +2 -2
- package/dist/multiProviderQuotaService.js +14 -10
- package/dist/parsers/codexParser.js +170 -103
- package/dist/parsers/debugLogParser.js +5 -4
- package/dist/parsers/openCodeParser.js +66 -48
- package/dist/parsers/planExtractor.js +3 -3
- package/dist/parsers/sessionActivityDetector.js +10 -6
- package/dist/parsers/sessionPathResolver.js +29 -34
- package/dist/parsers/subagentScanner.js +21 -20
- package/dist/parsers/subagentTraceParser.js +7 -4
- package/dist/phrases.js +11 -11
- package/dist/providerStatus.js +3 -4
- package/dist/providers/claudeCode.js +3 -1
- package/dist/providers/codex.js +35 -14
- package/dist/providers/codexDatabase.js +14 -5
- package/dist/providers/detect.js +10 -6
- package/dist/providers/openCode.js +91 -63
- package/dist/providers/openCodeDatabase.js +44 -17
- package/dist/quota.d.ts +19 -0
- package/dist/quota.js +50 -8
- package/dist/quotaHistory.js +10 -3
- package/dist/quotaSnapshots.js +2 -2
- package/dist/readers/decisions.js +1 -1
- package/dist/readers/notes.js +5 -3
- package/dist/readers/plans.js +43 -23
- package/dist/readers/tasks.js +1 -1
- package/dist/report/htmlHelpers.js +135 -16
- package/dist/report/htmlReportGenerator.js +38 -12
- package/dist/report/transcriptParser.js +8 -2
- package/dist/schemas/index.d.ts +4 -4
- package/dist/schemas/quota.js +2 -10
- package/dist/schemas/sessionEvent.js +20 -10
- package/dist/search/advancedFilter.js +3 -3
- package/dist/search/sessionSearch.js +10 -4
- package/dist/terminalSync.js +4 -2
- package/dist/turns/assistantTurn.js +5 -1
- package/dist/watchers/eventBridge.js +56 -26
- package/dist/watchers/factory.js +5 -2
- package/dist/watchers/jsonlTail.js +3 -1
- package/dist/watchers/jsonlWatcher.js +128 -52
- package/dist/watchers/providerReaderWatcher.js +3 -1
- package/dist/watchers/sqliteWatcher.js +52 -22
- package/dist/zaiQuota.js +6 -10
- package/dist/zaiQuotaApi.js +13 -5
- package/dist/zaiQuotaWatcher.js +1 -1
- package/package.json +5 -2
|
@@ -46,43 +46,163 @@ const HTML_COLORS = {
|
|
|
46
46
|
};
|
|
47
47
|
function getColors(format) {
|
|
48
48
|
switch (format) {
|
|
49
|
-
case 'blessed':
|
|
50
|
-
|
|
51
|
-
case '
|
|
49
|
+
case 'blessed':
|
|
50
|
+
return BLESSED_COLORS;
|
|
51
|
+
case 'ansi':
|
|
52
|
+
return ANSI_COLORS;
|
|
53
|
+
case 'html':
|
|
54
|
+
return HTML_COLORS;
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
const ERROR_KEYWORDS = new Set([
|
|
55
|
-
'error',
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
59
|
-
'
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
58
|
+
'error',
|
|
59
|
+
'errors',
|
|
60
|
+
'err',
|
|
61
|
+
'fail',
|
|
62
|
+
'failed',
|
|
63
|
+
'failure',
|
|
64
|
+
'failures',
|
|
65
|
+
'fatal',
|
|
66
|
+
'panic',
|
|
67
|
+
'crash',
|
|
68
|
+
'crashed',
|
|
69
|
+
'exception',
|
|
70
|
+
'exceptions',
|
|
71
|
+
'critical',
|
|
72
|
+
'alert',
|
|
73
|
+
'abort',
|
|
74
|
+
'aborted',
|
|
75
|
+
'denied',
|
|
76
|
+
'forbidden',
|
|
77
|
+
'rejected',
|
|
78
|
+
'invalid',
|
|
79
|
+
'illegal',
|
|
80
|
+
'corrupt',
|
|
81
|
+
'corrupted',
|
|
82
|
+
'broken',
|
|
83
|
+
'bug',
|
|
84
|
+
'segfault',
|
|
85
|
+
'timeout',
|
|
86
|
+
'timedout',
|
|
87
|
+
'timed-out',
|
|
88
|
+
'deadlock',
|
|
89
|
+
'overflow',
|
|
90
|
+
'underflow',
|
|
91
|
+
'null',
|
|
92
|
+
'undefined',
|
|
93
|
+
'nan',
|
|
94
|
+
'unhandled',
|
|
95
|
+
'uncaught',
|
|
96
|
+
'unreachable',
|
|
97
|
+
'missing',
|
|
98
|
+
'notfound',
|
|
99
|
+
'not-found',
|
|
100
|
+
'unavailable',
|
|
101
|
+
'disconnected',
|
|
102
|
+
'dropped',
|
|
63
103
|
]);
|
|
64
104
|
const SUCCESS_KEYWORDS = new Set([
|
|
65
|
-
'success',
|
|
66
|
-
'
|
|
67
|
-
'
|
|
68
|
-
'
|
|
69
|
-
'
|
|
105
|
+
'success',
|
|
106
|
+
'successful',
|
|
107
|
+
'succeeded',
|
|
108
|
+
'ok',
|
|
109
|
+
'done',
|
|
110
|
+
'complete',
|
|
111
|
+
'completed',
|
|
112
|
+
'passed',
|
|
113
|
+
'pass',
|
|
114
|
+
'resolved',
|
|
115
|
+
'fixed',
|
|
116
|
+
'ready',
|
|
117
|
+
'active',
|
|
118
|
+
'running',
|
|
119
|
+
'started',
|
|
120
|
+
'created',
|
|
121
|
+
'connected',
|
|
122
|
+
'established',
|
|
123
|
+
'accepted',
|
|
124
|
+
'approved',
|
|
125
|
+
'merged',
|
|
126
|
+
'deployed',
|
|
127
|
+
'installed',
|
|
128
|
+
'loaded',
|
|
129
|
+
'enabled',
|
|
130
|
+
'healthy',
|
|
131
|
+
'valid',
|
|
132
|
+
'verified',
|
|
70
133
|
]);
|
|
71
134
|
const WARNING_KEYWORDS = new Set([
|
|
72
|
-
'warn',
|
|
73
|
-
'
|
|
74
|
-
'
|
|
75
|
-
'
|
|
76
|
-
'
|
|
135
|
+
'warn',
|
|
136
|
+
'warning',
|
|
137
|
+
'warnings',
|
|
138
|
+
'caution',
|
|
139
|
+
'deprecated',
|
|
140
|
+
'slow',
|
|
141
|
+
'retry',
|
|
142
|
+
'retrying',
|
|
143
|
+
'retries',
|
|
144
|
+
'pending',
|
|
145
|
+
'waiting',
|
|
146
|
+
'queued',
|
|
147
|
+
'stale',
|
|
148
|
+
'expired',
|
|
149
|
+
'expiring',
|
|
150
|
+
'limited',
|
|
151
|
+
'throttled',
|
|
152
|
+
'throttling',
|
|
153
|
+
'degraded',
|
|
154
|
+
'unstable',
|
|
155
|
+
'flaky',
|
|
156
|
+
'skipped',
|
|
157
|
+
'skip',
|
|
158
|
+
'ignored',
|
|
159
|
+
'unknown',
|
|
160
|
+
'unrecognized',
|
|
77
161
|
]);
|
|
78
162
|
const ACTION_KEYWORDS = new Set([
|
|
79
|
-
'read',
|
|
80
|
-
'
|
|
81
|
-
'
|
|
82
|
-
'
|
|
83
|
-
'
|
|
84
|
-
'
|
|
85
|
-
'
|
|
163
|
+
'read',
|
|
164
|
+
'write',
|
|
165
|
+
'edit',
|
|
166
|
+
'delete',
|
|
167
|
+
'create',
|
|
168
|
+
'update',
|
|
169
|
+
'insert',
|
|
170
|
+
'remove',
|
|
171
|
+
'add',
|
|
172
|
+
'modify',
|
|
173
|
+
'patch',
|
|
174
|
+
'merge',
|
|
175
|
+
'push',
|
|
176
|
+
'pull',
|
|
177
|
+
'fetch',
|
|
178
|
+
'send',
|
|
179
|
+
'receive',
|
|
180
|
+
'request',
|
|
181
|
+
'response',
|
|
182
|
+
'query',
|
|
183
|
+
'search',
|
|
184
|
+
'find',
|
|
185
|
+
'list',
|
|
186
|
+
'get',
|
|
187
|
+
'set',
|
|
188
|
+
'put',
|
|
189
|
+
'post',
|
|
190
|
+
'build',
|
|
191
|
+
'compile',
|
|
192
|
+
'test',
|
|
193
|
+
'deploy',
|
|
194
|
+
'install',
|
|
195
|
+
'run',
|
|
196
|
+
'execute',
|
|
197
|
+
'start',
|
|
198
|
+
'stop',
|
|
199
|
+
'restart',
|
|
200
|
+
'init',
|
|
201
|
+
'initialize',
|
|
202
|
+
'configure',
|
|
203
|
+
'spawn',
|
|
204
|
+
'call',
|
|
205
|
+
'invoke',
|
|
86
206
|
]);
|
|
87
207
|
const HTTP_METHODS = new Map([
|
|
88
208
|
['GET', 'green'],
|
|
@@ -18,11 +18,7 @@ exports.shouldMergeWithPrevious = shouldMergeWithPrevious;
|
|
|
18
18
|
exports.classifyNoise = classifyNoise;
|
|
19
19
|
// ── Hard Noise Detection ──
|
|
20
20
|
/** Hard noise types that should be dropped entirely from display. */
|
|
21
|
-
const HARD_NOISE_EVENT_TYPES = new Set([
|
|
22
|
-
'file-history-snapshot',
|
|
23
|
-
'queue-operation',
|
|
24
|
-
'progress',
|
|
25
|
-
]);
|
|
21
|
+
const HARD_NOISE_EVENT_TYPES = new Set(['file-history-snapshot', 'queue-operation', 'progress']);
|
|
26
22
|
const SYNTHETIC_MODEL_PREFIX = '<synthetic>';
|
|
27
23
|
/**
|
|
28
24
|
* Determines if an event is "hard noise" and should be dropped entirely.
|
|
@@ -70,11 +66,7 @@ const COMMAND_CAVEAT_PATTERNS = [
|
|
|
70
66
|
/IMPORTANT:.*?(?:never|always|must|should)/i,
|
|
71
67
|
/Note:.*?(?:do not|don't|avoid)/i,
|
|
72
68
|
];
|
|
73
|
-
const INTERRUPTION_MARKERS = [
|
|
74
|
-
'interrupted by user',
|
|
75
|
-
'operation cancelled',
|
|
76
|
-
'aborted',
|
|
77
|
-
];
|
|
69
|
+
const INTERRUPTION_MARKERS = ['interrupted by user', 'operation cancelled', 'aborted'];
|
|
78
70
|
/**
|
|
79
71
|
* Checks for soft noise that can be hidden but not dropped.
|
|
80
72
|
*
|
|
@@ -222,5 +214,5 @@ function extractContent(event) {
|
|
|
222
214
|
function hasToolUseBlocks(content) {
|
|
223
215
|
if (!Array.isArray(content))
|
|
224
216
|
return false;
|
|
225
|
-
return content.some(b => b.type === 'tool_use');
|
|
217
|
+
return content.some((b) => b.type === 'tool_use');
|
|
226
218
|
}
|
|
@@ -51,7 +51,7 @@ function formatSessionText(metrics, options = {}) {
|
|
|
51
51
|
// Tool stats
|
|
52
52
|
if (metrics.toolStats.length > 0) {
|
|
53
53
|
lines.push('Tools:');
|
|
54
|
-
const sorted = [...metrics.toolStats].sort((a, b) =>
|
|
54
|
+
const sorted = [...metrics.toolStats].sort((a, b) => b.successCount + b.failureCount - (a.successCount + a.failureCount));
|
|
55
55
|
for (const t of sorted) {
|
|
56
56
|
const total = t.successCount + t.failureCount;
|
|
57
57
|
const failStr = t.failureCount > 0 ? ` (${t.failureCount} failed)` : '';
|
|
@@ -77,7 +77,7 @@ function formatSessionText(metrics, options = {}) {
|
|
|
77
77
|
lines.push(hr);
|
|
78
78
|
const filteredEvents = expand
|
|
79
79
|
? metrics.timeline
|
|
80
|
-
: metrics.timeline.filter(e => e.noiseLevel !== 'noise');
|
|
80
|
+
: metrics.timeline.filter((e) => e.noiseLevel !== 'noise');
|
|
81
81
|
if (filteredEvents.length === 0) {
|
|
82
82
|
lines.push(' (no events)');
|
|
83
83
|
}
|
|
@@ -150,7 +150,7 @@ function formatSessionMarkdown(metrics, options = {}) {
|
|
|
150
150
|
lines.push('');
|
|
151
151
|
lines.push(`| Tool | Total | Failed | Avg Duration |`);
|
|
152
152
|
lines.push(`|------|-------|--------|--------------|`);
|
|
153
|
-
const sorted = [...metrics.toolStats].sort((a, b) =>
|
|
153
|
+
const sorted = [...metrics.toolStats].sort((a, b) => b.successCount + b.failureCount - (a.successCount + a.failureCount));
|
|
154
154
|
for (const t of sorted) {
|
|
155
155
|
const total = t.successCount + t.failureCount;
|
|
156
156
|
const avgMs = t.completedCount > 0 ? Math.round(t.totalDuration / t.completedCount) : 0;
|
|
@@ -190,7 +190,7 @@ function formatSessionMarkdown(metrics, options = {}) {
|
|
|
190
190
|
lines.push('');
|
|
191
191
|
const filteredEvents = expand
|
|
192
192
|
? metrics.timeline
|
|
193
|
-
: metrics.timeline.filter(e => e.noiseLevel !== 'noise');
|
|
193
|
+
: metrics.timeline.filter((e) => e.noiseLevel !== 'noise');
|
|
194
194
|
if (filteredEvents.length === 0) {
|
|
195
195
|
lines.push('_(no events)_');
|
|
196
196
|
}
|
|
@@ -279,15 +279,24 @@ function formatDuration(start, end) {
|
|
|
279
279
|
/** Map TimelineEvent.type to a display icon. */
|
|
280
280
|
function getTimelineEventIcon(type) {
|
|
281
281
|
switch (type) {
|
|
282
|
-
case 'user_prompt':
|
|
283
|
-
|
|
284
|
-
case '
|
|
285
|
-
|
|
286
|
-
case '
|
|
287
|
-
|
|
288
|
-
case '
|
|
289
|
-
|
|
290
|
-
|
|
282
|
+
case 'user_prompt':
|
|
283
|
+
return '\u25b6'; // right-pointing triangle
|
|
284
|
+
case 'assistant_response':
|
|
285
|
+
return '\u2726'; // four-pointed star
|
|
286
|
+
case 'tool_call':
|
|
287
|
+
return '\u2699'; // gear
|
|
288
|
+
case 'tool_result':
|
|
289
|
+
return '\u2190'; // left arrow
|
|
290
|
+
case 'compaction':
|
|
291
|
+
return '\u21bb'; // clockwise arrow
|
|
292
|
+
case 'error':
|
|
293
|
+
return '\u2718'; // heavy ballot X
|
|
294
|
+
case 'session_start':
|
|
295
|
+
return '\u25cf'; // black circle
|
|
296
|
+
case 'session_end':
|
|
297
|
+
return '\u25cb'; // white circle
|
|
298
|
+
default:
|
|
299
|
+
return ' ';
|
|
291
300
|
}
|
|
292
301
|
}
|
|
293
302
|
function truncateToWidth(text, maxLen) {
|
|
@@ -217,9 +217,7 @@ function genericFallback(input) {
|
|
|
217
217
|
*/
|
|
218
218
|
function formatToolSummary(toolName, input) {
|
|
219
219
|
// Strip MCP prefixes: "mcp__server__tool" → use "tool" for matching
|
|
220
|
-
const baseName = toolName.includes('__')
|
|
221
|
-
? toolName.split('__').pop() ?? toolName
|
|
222
|
-
: toolName;
|
|
220
|
+
const baseName = toolName.includes('__') ? (toolName.split('__').pop() ?? toolName) : toolName;
|
|
223
221
|
const formatter = TOOL_FORMATTERS[toolName] ?? TOOL_FORMATTERS[baseName];
|
|
224
222
|
if (formatter) {
|
|
225
223
|
const result = formatter(input);
|
package/dist/index.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ export type { PersistedTask, TaskPersistenceStore, TaskStatus } from './types/ta
|
|
|
8
8
|
export { TASK_PERSISTENCE_SCHEMA_VERSION, normalizeTaskStatus } from './types/taskPersistence';
|
|
9
9
|
export type { DecisionEntry, DecisionLogStore, DecisionSource } from './types/decisionLog';
|
|
10
10
|
export { DECISION_LOG_SCHEMA_VERSION } from './types/decisionLog';
|
|
11
|
-
export type { KnowledgeNote, KnowledgeNoteStore, KnowledgeNoteType, KnowledgeNoteSource, KnowledgeNoteStatus, KnowledgeNoteImportance } from './types/knowledgeNote';
|
|
12
|
-
export { KNOWLEDGE_NOTE_SCHEMA_VERSION, IMPORTANCE_DECAY_FACTORS, STALENESS_THRESHOLDS } from './types/knowledgeNote';
|
|
13
|
-
export type { HistoricalDataStore, DailyData, MonthlyData, AllTimeStats, TokenTotals, ModelUsageRecord, ToolUsageRecord, SessionSummary } from './types/historicalData';
|
|
11
|
+
export type { KnowledgeNote, KnowledgeNoteStore, KnowledgeNoteType, KnowledgeNoteSource, KnowledgeNoteStatus, KnowledgeNoteImportance, } from './types/knowledgeNote';
|
|
12
|
+
export { KNOWLEDGE_NOTE_SCHEMA_VERSION, IMPORTANCE_DECAY_FACTORS, STALENESS_THRESHOLDS, } from './types/knowledgeNote';
|
|
13
|
+
export type { HistoricalDataStore, DailyData, MonthlyData, AllTimeStats, TokenTotals, ModelUsageRecord, ToolUsageRecord, SessionSummary, } from './types/historicalData';
|
|
14
14
|
export { HISTORICAL_DATA_SCHEMA_VERSION, createEmptyTokenTotals } from './types/historicalData';
|
|
15
|
-
export type { PersistedPlan, PersistedPlanStep, PlanHistoryStore, PlanStepStatus, PlanStatus, PlanSource, PlanStepComplexity } from './types/plan';
|
|
15
|
+
export type { PersistedPlan, PersistedPlanStep, PlanHistoryStore, PlanStepStatus, PlanStatus, PlanSource, PlanStepComplexity, } from './types/plan';
|
|
16
16
|
export { PLAN_SCHEMA_VERSION, MAX_PLANS_PER_PROJECT } from './types/plan';
|
|
17
|
-
export { getConfigDir, getProjectDataPath, getGlobalDataPath, encodeWorkspacePath, getProjectSlug, getProjectSlugRaw } from './paths';
|
|
17
|
+
export { getConfigDir, getProjectDataPath, getGlobalDataPath, encodeWorkspacePath, getProjectSlug, getProjectSlugRaw, } from './paths';
|
|
18
18
|
export { readTasks } from './readers/tasks';
|
|
19
19
|
export type { ReadTasksOptions } from './readers/tasks';
|
|
20
20
|
export { readDecisions } from './readers/decisions';
|
|
@@ -23,9 +23,9 @@ export { readNotes } from './readers/notes';
|
|
|
23
23
|
export type { ReadNotesOptions } from './readers/notes';
|
|
24
24
|
export { readHistory } from './readers/history';
|
|
25
25
|
export { readLatestHandoff } from './readers/handoff';
|
|
26
|
-
export { readPlans, getLatestPlan, writePlans, getPlanAnalytics, readClaudeCodePlanFiles } from './readers/plans';
|
|
26
|
+
export { readPlans, getLatestPlan, writePlans, getPlanAnalytics, readClaudeCodePlanFiles, } from './readers/plans';
|
|
27
27
|
export type { ReadPlansOptions, PlanAnalytics } from './readers/plans';
|
|
28
|
-
export type { ProviderId, SessionProvider, SessionProviderBase, SessionFileStats, SessionFileInfo, SearchHit, ProjectFolderInfo, SessionReader, ProviderRuntimeStatus } from './providers/types';
|
|
28
|
+
export type { ProviderId, SessionProvider, SessionProviderBase, SessionFileStats, SessionFileInfo, SearchHit, ProjectFolderInfo, SessionReader, ProviderRuntimeStatus, } from './providers/types';
|
|
29
29
|
export { detectProvider, getAllDetectedProviders } from './providers/detect';
|
|
30
30
|
export { ClaudeCodeProvider } from './providers/claudeCode';
|
|
31
31
|
export { OpenCodeProvider, getOpenCodeDataDir } from './providers/openCode';
|
|
@@ -33,10 +33,10 @@ export { CodexProvider } from './providers/codex';
|
|
|
33
33
|
export { JsonlParser, TRUNCATION_PATTERNS } from './parsers/jsonl';
|
|
34
34
|
export type { RawSessionEvent, JsonlParserCallbacks, JsonlParserOptions } from './parsers/jsonl';
|
|
35
35
|
export { normalizeToolName, normalizeToolInput, detectPlanModeFromText, convertOpenCodeMessage, parseDbMessageData, parseDbPartData, } from './parsers/openCodeParser';
|
|
36
|
-
export { CodexRolloutParser, extractPatchFilePaths, normalizeCodexToolName, normalizeCodexToolInput } from './parsers/codexParser';
|
|
36
|
+
export { CodexRolloutParser, extractPatchFilePaths, normalizeCodexToolName, normalizeCodexToolInput, } from './parsers/codexParser';
|
|
37
37
|
export { scanSubagentDir, extractTaskInfo } from './parsers/subagentScanner';
|
|
38
38
|
export { detectSessionActivity } from './parsers/sessionActivityDetector';
|
|
39
|
-
export type { SessionActivityState, SessionActivityResult } from './parsers/sessionActivityDetector';
|
|
39
|
+
export type { SessionActivityState, SessionActivityResult, } from './parsers/sessionActivityDetector';
|
|
40
40
|
export { encodeWorkspacePath as encodeClaudeWorkspacePath, getSessionDirectory as getClaudeSessionDirectory, discoverSessionDirectory, findActiveSession as findActiveClaudeSession, findAllSessions as findAllClaudeSessions, findSessionsInDirectory, findSubdirectorySessionDirs, getMostRecentlyActiveSessionDir, decodeEncodedPath, getAllProjectFolders as getAllClaudeProjectFolders, resolveWorktreeMainRepo, discoverWorktreeSiblings, findAllSessionsWithWorktrees, } from './parsers/sessionPathResolver';
|
|
41
41
|
export { scanSubagentTraces } from './parsers/subagentTraceParser';
|
|
42
42
|
export type { SubagentTrace, SubagentTraceEvent } from './parsers/subagentTraceParser';
|
|
@@ -47,18 +47,18 @@ export { CodexDatabase } from './providers/codexDatabase';
|
|
|
47
47
|
export { searchSessions } from './search/sessionSearch';
|
|
48
48
|
export type { SearchResult } from './search/sessionSearch';
|
|
49
49
|
export { FilterEngine } from './search/advancedFilter';
|
|
50
|
-
export type { FilterMode, FilterState, HighlightFormat as FilterHighlightFormat } from './search/advancedFilter';
|
|
50
|
+
export type { FilterMode, FilterState, HighlightFormat as FilterHighlightFormat, } from './search/advancedFilter';
|
|
51
51
|
export { composeContext } from './context/composer';
|
|
52
52
|
export type { Fidelity, ContextResult } from './context/composer';
|
|
53
53
|
export { buildSessionContextSnapshot, calculateSessionContextPressure, createSessionContextProjector, readSessionContextSnapshot, } from './context/sessionContext';
|
|
54
54
|
export type { BuildSessionContextSnapshotOptions, ReadSessionContextSnapshotOptions, SessionContextCapabilities, SessionContextLayerBreakdown, SessionContextPressure, SessionContextProjector, SessionContextSnapshot, SessionContextSource, SessionContextSourceType, } from './context/sessionContext';
|
|
55
55
|
export { assistantTurnEventsFromSessionEvents, extractTurnSubagents, isAssistantTurnSubagentTool, reasoningSummary, segmentAssistantTurn, } from './turns/assistantTurn';
|
|
56
56
|
export type { AssistantTurnEvent, AssistantTurnEventType, AssistantTurnProcess, AssistantTurnProcessStep, AssistantTurnProjection, AssistantTurnSubagent, AssistantTurnSubagentStatus, AssistantTurnTimelineItem, AssistantTurnToolRef, ExtractTurnSubagentsOptions, ReasoningSummary, SegmentAssistantTurnOptions, } from './turns/assistantTurn';
|
|
57
|
-
export { PlanExtractor, parsePlanMarkdown as parsePlanMarkdownShared, extractProposedPlan as extractProposedPlanShared } from './parsers/planExtractor';
|
|
57
|
+
export { PlanExtractor, parsePlanMarkdown as parsePlanMarkdownShared, extractProposedPlan as extractProposedPlanShared, } from './parsers/planExtractor';
|
|
58
58
|
export type { ExtractedPlan, ExtractedPlanStep } from './parsers/planExtractor';
|
|
59
59
|
export { parseChangelog } from './parsers/changelogParser';
|
|
60
60
|
export type { ChangelogEntry } from './parsers/changelogParser';
|
|
61
|
-
export type { FollowEvent, FollowEventType, SessionWatcher, SessionWatcherCallbacks } from './watchers/types';
|
|
61
|
+
export type { FollowEvent, FollowEventType, SessionWatcher, SessionWatcherCallbacks, } from './watchers/types';
|
|
62
62
|
export { createWatcher } from './watchers/factory';
|
|
63
63
|
export type { CreateWatcherOptions } from './watchers/factory';
|
|
64
64
|
export { toFollowEvents } from './watchers/eventBridge';
|
|
@@ -69,15 +69,15 @@ export type { FormatDurationMsOptions, FormatTokenCountOptions } from './formatt
|
|
|
69
69
|
export { formatToolSummary } from './formatters/toolSummary';
|
|
70
70
|
export { isHardNoise, isHardNoiseFollowEvent, getSoftNoiseReason, classifyMessage, classifyFollowEvent, shouldMergeWithPrevious, classifyNoise, } from './formatters/noiseClassifier';
|
|
71
71
|
export type { MessageClassification, NoiseResult } from './formatters/noiseClassifier';
|
|
72
|
-
export { formatSessionText, formatSessionMarkdown, formatSessionJson } from './formatters/sessionDump';
|
|
72
|
+
export { formatSessionText, formatSessionMarkdown, formatSessionJson, } from './formatters/sessionDump';
|
|
73
73
|
export type { SessionDumpOptions } from './formatters/sessionDump';
|
|
74
|
-
export { highlight as highlightEvent, clearHighlightCache, HIGHLIGHT_CSS } from './formatters/eventHighlighter';
|
|
74
|
+
export { highlight as highlightEvent, clearHighlightCache, HIGHLIGHT_CSS, } from './formatters/eventHighlighter';
|
|
75
75
|
export type { HighlightFormat } from './formatters/eventHighlighter';
|
|
76
76
|
export { ALL_PHRASES, PHRASE_CATEGORIES, getRandomPhrase } from './phrases';
|
|
77
77
|
export type { PhraseCategory } from './phrases';
|
|
78
78
|
export { EventAggregator, parseTodoDependencies } from './aggregation/EventAggregator';
|
|
79
79
|
export type { SerializedAggregatorState } from './aggregation/EventAggregator';
|
|
80
|
-
export { saveSnapshot, loadSnapshot, deleteSnapshot, isSnapshotValid, getSnapshotPath } from './aggregation/snapshot';
|
|
80
|
+
export { saveSnapshot, loadSnapshot, deleteSnapshot, isSnapshotValid, getSnapshotPath, } from './aggregation/snapshot';
|
|
81
81
|
export type { SessionSnapshot } from './aggregation/snapshot';
|
|
82
82
|
export type { EventAggregatorOptions, AggregatedTokens, ModelUsageStats, BurnRateInfo, SubagentLifecycle, AggregatedMetrics, FrequencyMetric, PatternMetric, HeatmapBucketMetric, } from './aggregation/types';
|
|
83
83
|
export { FrequencyTracker } from './aggregation/FrequencyTracker';
|
|
@@ -86,30 +86,30 @@ export { HeatmapTracker } from './aggregation/HeatmapTracker';
|
|
|
86
86
|
export type { HeatmapBucket, SerializedHeatmapState } from './aggregation/HeatmapTracker';
|
|
87
87
|
export { PatternExtractor } from './aggregation/PatternExtractor';
|
|
88
88
|
export type { PatternCluster, SerializedPatternState } from './aggregation/PatternExtractor';
|
|
89
|
-
export { generateHtmlReport, parseTranscript, parseTranscriptFromEvents, openInBrowser } from './report';
|
|
89
|
+
export { generateHtmlReport, parseTranscript, parseTranscriptFromEvents, openInBrowser, } from './report';
|
|
90
90
|
export type { TranscriptContentBlock, TranscriptEntry, HtmlReportOptions } from './report';
|
|
91
91
|
export { readActiveCredentials, writeActiveCredentials } from './credentialIO';
|
|
92
92
|
export { readClaudeMaxCredentials, readClaudeMaxAccessTokenSync } from './credentials';
|
|
93
93
|
export type { ClaudeMaxCredentials } from './credentials';
|
|
94
|
-
export { ensureDefaultAccounts
|
|
94
|
+
export { ensureDefaultAccounts } from './ensureDefaultAccounts';
|
|
95
95
|
export type { EnsureDefaultAccountStatus, EnsureDefaultAccountsOptions, EnsureDefaultAccountsResult, } from './ensureDefaultAccounts';
|
|
96
|
-
export { readAccountRegistry, writeAccountRegistry, readActiveClaudeAccount, addCurrentAccount, switchToAccount, resolveActiveClaudeHome, applyActiveClaudeToLiveHome, reconcileClaudeAuthState, removeAccount, listAccounts, getActiveAccount, isMultiAccountEnabled, } from './accounts';
|
|
97
|
-
export type { AccountEntry, AccountRegistry, ActiveAccountInfo, AccountManagerResult } from './accounts';
|
|
96
|
+
export { readAccountRegistry, writeAccountRegistry, readActiveClaudeAccount, addCurrentAccount, switchToAccount, resolveActiveClaudeHome, applyActiveClaudeToLiveHome, reconcileClaudeAuthState, removeAccount, listAccounts, getActiveAccount, resolveActiveClaudeAccount, isMultiAccountEnabled, } from './accounts';
|
|
97
|
+
export type { AccountEntry, AccountRegistry, ActiveAccountInfo, AccountManagerResult, } from './accounts';
|
|
98
98
|
export { beginAccountLogin, getAccountLoginStatus, finalizeAccountLogin, spawnAccountLogin, switchAccount, listAllAccounts, resolveClaudeLoginCommand, } from './accountManager';
|
|
99
99
|
export type { AccountLoginCommand, AccountLoginState, AccountLoginStatus, BeginAccountLoginResult, FinalizeAccountLoginOptions, ListAllAccountsResult, SpawnAccountLoginOptions, } from './accountManager';
|
|
100
100
|
export { getAccountsDir, readSavedAccountRegistry, writeSavedAccountRegistry, listSavedAccountProfiles, getActiveSavedAccount, upsertSavedAccountProfile, setActiveSavedAccount, replaceSavedAccountProfiles, removeSavedAccountProfile, } from './accountRegistry';
|
|
101
|
-
export type { AccountProviderId, AccountIdentityMetadata, SavedAccountProfile, SavedAccountRegistry, } from './accountRegistry';
|
|
101
|
+
export type { AccountProviderId, AccountIdentityMetadata, ResolvedActiveAccount, SavedAccountProfile, SavedAccountRegistry, } from './accountRegistry';
|
|
102
102
|
export { getActiveAccountStatus } from './accountStatus';
|
|
103
103
|
export type { ActiveAccountStatus, ActiveProviderAccountStatus } from './accountStatus';
|
|
104
104
|
export { getClaudeProfilesDir, getClaudeProfileHome, claudeKeychainSuffix, claudeKeychainService, isClaudeProfileAuthenticated, readClaudeProfileIdentity, } from './claudeProfiles';
|
|
105
105
|
export type { ClaudeProfileIdentity } from './claudeProfiles';
|
|
106
|
-
export { getCodexProfilesDir, getCodexProfileHome, getCodexMonitoringHomes, getSystemCodexHome, listCodexAccounts, getActiveCodexAccount, resolveSidekickCodexHome, getCodexExecutionEnv, prepareCodexAccount, finalizeCodexAccount, switchToCodexAccount, removeCodexAccount, } from './codexProfiles';
|
|
106
|
+
export { getCodexProfilesDir, getCodexProfileHome, getCodexMonitoringHomes, getSystemCodexHome, listCodexAccounts, getActiveCodexAccount, resolveActiveCodexAccount, resolveSidekickCodexHome, getCodexExecutionEnv, prepareCodexAccount, finalizeCodexAccount, switchToCodexAccount, removeCodexAccount, } from './codexProfiles';
|
|
107
107
|
export type { CodexAccountManagerResult } from './codexProfiles';
|
|
108
108
|
export { setTerminalActiveProfile, installShellHook, uninstallShellHook, isShellHookInstalled, writeLauncher, removeLauncher, } from './terminalSync';
|
|
109
|
-
export { DEFAULT_AUTO_SWITCH_CONFIG, decideAutoSwitch, AutoSwitchController
|
|
109
|
+
export { DEFAULT_AUTO_SWITCH_CONFIG, decideAutoSwitch, AutoSwitchController } from './autoSwitch';
|
|
110
110
|
export type { AutoSwitchActiveAccount, AutoSwitchCandidate, AutoSwitchConfig, AutoSwitchControllerOptions, AutoSwitchDecision, AutoSwitchTransitionEvent, } from './autoSwitch';
|
|
111
|
-
export { fetchQuota } from './quota';
|
|
112
|
-
export type { QuotaWindow, QuotaState } from './quota';
|
|
111
|
+
export { FIVE_HOUR_WINDOW_MS, SEVEN_DAY_WINDOW_MS, fetchQuota, projectQuotaWindow, withQuotaProjections, } from './quota';
|
|
112
|
+
export type { QuotaProjectionInput, QuotaWindow, QuotaState } from './quota';
|
|
113
113
|
export { describeQuotaFailure } from './quotaPresentation';
|
|
114
114
|
export type { QuotaFailureDescriptor } from './quotaPresentation';
|
|
115
115
|
export { QuotaPoller } from './quotaPoller';
|
|
@@ -134,11 +134,11 @@ export type { QuotaSnapshotProviderId } from './quotaSnapshots';
|
|
|
134
134
|
export { getModelContextWindowSize, DEFAULT_CONTEXT_WINDOW } from './modelContext';
|
|
135
135
|
export { parseModelId, getModelPricing, getModelInfo, calculateCost, calculateCostWithPricing, calculateCostWithProvenance, mergeCostSources, shortModelName, getModelDisplayInfo, compareModelIds, sortModelIds, formatCost, } from './modelInfo';
|
|
136
136
|
export type { ModelPricing, CostTokenUsage, CostSource, CostProvenanceInput, CostWithProvenance, ModelInfo, ModelProvider, ParsedModelId, ModelDisplayInfo, } from './modelInfo';
|
|
137
|
-
export { hydratePricingCatalog, normalizeLiteLlmCatalog, LITELLM_CATALOG_URL } from './pricingCatalog';
|
|
137
|
+
export { hydratePricingCatalog, normalizeLiteLlmCatalog, LITELLM_CATALOG_URL, } from './pricingCatalog';
|
|
138
138
|
export type { HydrateOptions, HydrateResult } from './pricingCatalog';
|
|
139
139
|
export { extractTokenUsage } from './extractors/tokenUsage';
|
|
140
140
|
export { extractToolCall, extractToolCalls } from './extractors/toolCall';
|
|
141
|
-
export { extractUrls, extractFilePaths, extractCommands
|
|
141
|
+
export { extractUrls, extractFilePaths, extractCommands } from './extractors/sessionAssets';
|
|
142
142
|
export type { AssetAgent, ExtractedAsset, ExtractedAssetProvenance, ExtractedAssetType, ExtractedAssets, SourceAssets, } from './extractors/sessionAssets';
|
|
143
143
|
export { readClaudeAssets, claudeSessions } from './extractors/sources/claudeAssets';
|
|
144
144
|
export { readCodexAssets, codexSessions } from './extractors/sources/codexAssets';
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.discoverSessionDirectory = exports.getClaudeSessionDirectory = exports.encodeClaudeWorkspacePath = exports.detectSessionActivity = exports.extractTaskInfo = exports.scanSubagentDir = exports.normalizeCodexToolInput = exports.normalizeCodexToolName = exports.extractPatchFilePaths = exports.CodexRolloutParser = exports.parseDbPartData = exports.parseDbMessageData = exports.convertOpenCodeMessage = exports.detectPlanModeFromText = exports.normalizeToolInput = exports.normalizeToolName = exports.TRUNCATION_PATTERNS = exports.JsonlParser = exports.CodexProvider = exports.getOpenCodeDataDir = exports.OpenCodeProvider = exports.ClaudeCodeProvider = exports.getAllDetectedProviders = exports.detectProvider = exports.readClaudeCodePlanFiles = exports.getPlanAnalytics = exports.writePlans = exports.getLatestPlan = exports.readPlans = exports.readLatestHandoff = exports.readHistory = exports.readNotes = exports.readDecisions = exports.readTasks = exports.getProjectSlugRaw = exports.getProjectSlug = exports.encodeWorkspacePath = exports.getGlobalDataPath = exports.getProjectDataPath = exports.getConfigDir = exports.MAX_PLANS_PER_PROJECT = exports.PLAN_SCHEMA_VERSION = exports.createEmptyTokenTotals = exports.HISTORICAL_DATA_SCHEMA_VERSION = exports.STALENESS_THRESHOLDS = exports.IMPORTANCE_DECAY_FACTORS = exports.KNOWLEDGE_NOTE_SCHEMA_VERSION = exports.DECISION_LOG_SCHEMA_VERSION = exports.normalizeTaskStatus = exports.TASK_PERSISTENCE_SCHEMA_VERSION = void 0;
|
|
7
7
|
exports.highlightEvent = exports.formatSessionJson = exports.formatSessionMarkdown = exports.formatSessionText = exports.classifyNoise = exports.shouldMergeWithPrevious = exports.classifyFollowEvent = exports.classifyMessage = exports.getSoftNoiseReason = exports.isHardNoiseFollowEvent = exports.isHardNoise = exports.formatToolSummary = exports.formatTokenCount = exports.formatDurationMs = exports.createJsonlTail = exports.toFollowEvents = exports.createWatcher = exports.parseChangelog = exports.extractProposedPlanShared = exports.parsePlanMarkdownShared = exports.PlanExtractor = exports.segmentAssistantTurn = exports.reasoningSummary = exports.isAssistantTurnSubagentTool = exports.extractTurnSubagents = exports.assistantTurnEventsFromSessionEvents = exports.readSessionContextSnapshot = exports.createSessionContextProjector = exports.calculateSessionContextPressure = exports.buildSessionContextSnapshot = exports.composeContext = exports.FilterEngine = exports.searchSessions = exports.CodexDatabase = exports.OpenCodeDatabase = exports.discoverDebugLogs = exports.collapseDuplicates = exports.filterByLevel = exports.parseDebugLog = exports.scanSubagentTraces = exports.findAllSessionsWithWorktrees = exports.discoverWorktreeSiblings = exports.resolveWorktreeMainRepo = exports.getAllClaudeProjectFolders = exports.decodeEncodedPath = exports.getMostRecentlyActiveSessionDir = exports.findSubdirectorySessionDirs = exports.findSessionsInDirectory = exports.findAllClaudeSessions = exports.findActiveClaudeSession = void 0;
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.scopePeakHoursToSessionProvider = exports.isClaudeCodeSessionProvider = exports.fetchPeakHoursStatus = exports.createPeakHoursNotApplicableState = exports.fetchOpenAIStatus = exports.fetchProviderStatus = exports.assistantTurnToolRefSchema = exports.assistantTurnToolGroupStepSchema = exports.assistantTurnTimelineItemSchema = exports.assistantTurnSubagentStatusSchema = exports.assistantTurnSubagentSchema = exports.assistantTurnReasoningTimelineItemSchema = exports.assistantTurnProjectionSchema = exports.assistantTurnProcessStepSchema = exports.assistantTurnProcessSchema = exports.assistantTurnNarrationStepSchema = exports.assistantTurnEventTypeSchema = exports.assistantTurnEventSchema = exports.listAllAccountsResultSchema = exports.savedAccountProfileSchema = exports.accountEntrySchema = exports.accountLoginStatusSchema = exports.beginAccountLoginResultSchema = exports.accountManagerResultSchema = exports.accountProviderIdSchema = exports.activeAccountStatusSchema = exports.activeProviderAccountStatusSchema = exports.quotaHistoryDailyBucketSchema = exports.quotaHistorySampleSchema = exports.quotaHistoryRuntimeProviderSchema = exports.providerQuotaMapSchema = exports.zaiProviderQuotaStateSchema = exports.codexProviderQuotaStateSchema = exports.claudeProviderQuotaStateSchema = exports.providerQuotaStateSchema = exports.runtimeQuotaProviderSchema = exports.quotaFailureDescriptorSchema = exports.peakHoursStateSchema = exports.quotaSourceSchema = exports.quotaProviderIdSchema = void 0;
|
|
8
|
+
exports.upsertSavedAccountProfile = exports.getActiveSavedAccount = exports.listSavedAccountProfiles = exports.writeSavedAccountRegistry = exports.readSavedAccountRegistry = exports.getAccountsDir = exports.resolveClaudeLoginCommand = exports.listAllAccounts = exports.switchAccount = exports.spawnAccountLogin = exports.finalizeAccountLogin = exports.getAccountLoginStatus = exports.beginAccountLogin = exports.isMultiAccountEnabled = exports.resolveActiveClaudeAccount = exports.getActiveAccount = exports.listAccounts = exports.removeAccount = exports.reconcileClaudeAuthState = exports.applyActiveClaudeToLiveHome = exports.resolveActiveClaudeHome = exports.switchToAccount = exports.addCurrentAccount = exports.readActiveClaudeAccount = exports.writeAccountRegistry = exports.readAccountRegistry = exports.ensureDefaultAccounts = exports.readClaudeMaxAccessTokenSync = exports.readClaudeMaxCredentials = exports.writeActiveCredentials = exports.readActiveCredentials = exports.openInBrowser = exports.parseTranscriptFromEvents = exports.parseTranscript = exports.generateHtmlReport = exports.PatternExtractor = exports.HeatmapTracker = exports.FrequencyTracker = exports.getSnapshotPath = exports.isSnapshotValid = exports.deleteSnapshot = exports.loadSnapshot = exports.saveSnapshot = exports.parseTodoDependencies = exports.EventAggregator = exports.getRandomPhrase = exports.PHRASE_CATEGORIES = exports.ALL_PHRASES = exports.HIGHLIGHT_CSS = exports.clearHighlightCache = void 0;
|
|
9
|
+
exports.resolveCodexQuota = exports.readLatestCodexQuotaFromRollouts = exports.quotaFromCodexRateLimits = exports.fetchCodexQuotaFromApi = exports.getWorkspaceIdFromPath = exports.pruneQuotaHistory = exports.readQuotaHistoryDailyBuckets = exports.readQuotaHistoryRange = exports.appendQuotaHistorySample = exports.writeQuotaSnapshot = exports.readQuotaSnapshot = exports.QuotaPoller = exports.describeQuotaFailure = exports.withQuotaProjections = exports.projectQuotaWindow = exports.fetchQuota = exports.SEVEN_DAY_WINDOW_MS = exports.FIVE_HOUR_WINDOW_MS = exports.AutoSwitchController = exports.decideAutoSwitch = exports.DEFAULT_AUTO_SWITCH_CONFIG = exports.removeLauncher = exports.writeLauncher = exports.isShellHookInstalled = exports.uninstallShellHook = exports.installShellHook = exports.setTerminalActiveProfile = exports.removeCodexAccount = exports.switchToCodexAccount = exports.finalizeCodexAccount = exports.prepareCodexAccount = exports.getCodexExecutionEnv = exports.resolveSidekickCodexHome = exports.resolveActiveCodexAccount = exports.getActiveCodexAccount = exports.listCodexAccounts = exports.getSystemCodexHome = exports.getCodexMonitoringHomes = exports.getCodexProfileHome = exports.getCodexProfilesDir = exports.readClaudeProfileIdentity = exports.isClaudeProfileAuthenticated = exports.claudeKeychainService = exports.claudeKeychainSuffix = exports.getClaudeProfileHome = exports.getClaudeProfilesDir = exports.getActiveAccountStatus = exports.removeSavedAccountProfile = exports.replaceSavedAccountProfiles = exports.setActiveSavedAccount = void 0;
|
|
10
|
+
exports.sessionMessageSchema = exports.messageUsageSchema = exports.gatherAssetsForCwd = exports.codexSessions = exports.readCodexAssets = exports.claudeSessions = exports.readClaudeAssets = exports.extractCommands = exports.extractFilePaths = exports.extractUrls = exports.extractToolCalls = exports.extractToolCall = exports.extractTokenUsage = exports.LITELLM_CATALOG_URL = exports.normalizeLiteLlmCatalog = exports.hydratePricingCatalog = exports.formatCost = exports.sortModelIds = exports.compareModelIds = exports.getModelDisplayInfo = exports.shortModelName = exports.mergeCostSources = exports.calculateCostWithProvenance = exports.calculateCostWithPricing = exports.calculateCost = exports.getModelInfo = exports.getModelPricing = exports.parseModelId = exports.DEFAULT_CONTEXT_WINDOW = exports.getModelContextWindowSize = exports.MultiProviderQuotaService = exports.resolveZaiQuota = exports.readZaiCredentials = exports.quotaStateFromZaiQuotaLimitPayload = exports.fetchZaiQuotaFromApi = exports.ZaiQuotaWatcher = exports.ZAI_TIER_BUDGETS = exports.ZAI_PROVIDER_IDS = exports.ZAI_PROMPT_INVOCATIONS = exports.turnTokenWeight = exports.rowsToZaiTurnsAndErrors = exports.resolveZaiTier = exports.parseZaiQuotaError = exports.makeUnavailableZaiQuotaState = exports.isZaiProviderId = exports.inferZaiQuotaState = exports.extractNextFlushTime = exports.accumulateZaiUsage = exports.CodexQuotaWatcher = exports.resolveCodexQuotaFromLocalSources = void 0;
|
|
11
|
+
exports.scopePeakHoursToSessionProvider = exports.isClaudeCodeSessionProvider = exports.fetchPeakHoursStatus = exports.createPeakHoursNotApplicableState = exports.fetchOpenAIStatus = exports.fetchProviderStatus = exports.assistantTurnToolRefSchema = exports.assistantTurnToolGroupStepSchema = exports.assistantTurnTimelineItemSchema = exports.assistantTurnSubagentStatusSchema = exports.assistantTurnSubagentSchema = exports.assistantTurnReasoningTimelineItemSchema = exports.assistantTurnProjectionSchema = exports.assistantTurnProcessStepSchema = exports.assistantTurnProcessSchema = exports.assistantTurnNarrationStepSchema = exports.assistantTurnEventTypeSchema = exports.assistantTurnEventSchema = exports.listAllAccountsResultSchema = exports.savedAccountProfileSchema = exports.accountEntrySchema = exports.accountLoginStatusSchema = exports.beginAccountLoginResultSchema = exports.accountManagerResultSchema = exports.accountProviderIdSchema = exports.activeAccountStatusSchema = exports.activeProviderAccountStatusSchema = exports.quotaHistoryDailyBucketSchema = exports.quotaHistorySampleSchema = exports.quotaHistoryRuntimeProviderSchema = exports.providerQuotaMapSchema = exports.zaiProviderQuotaStateSchema = exports.codexProviderQuotaStateSchema = exports.claudeProviderQuotaStateSchema = exports.providerQuotaStateSchema = exports.runtimeQuotaProviderSchema = exports.quotaFailureDescriptorSchema = exports.peakHoursStateSchema = exports.quotaSourceSchema = exports.quotaProviderIdSchema = exports.quotaFailureKindSchema = exports.quotaStateSchema = exports.quotaWindowSchema = exports.extractSessionEvents = exports.permissionModeSchema = exports.sessionEventSchema = void 0;
|
|
12
12
|
var taskPersistence_1 = require("./types/taskPersistence");
|
|
13
13
|
Object.defineProperty(exports, "TASK_PERSISTENCE_SCHEMA_VERSION", { enumerable: true, get: function () { return taskPersistence_1.TASK_PERSISTENCE_SCHEMA_VERSION; } });
|
|
14
14
|
Object.defineProperty(exports, "normalizeTaskStatus", { enumerable: true, get: function () { return taskPersistence_1.normalizeTaskStatus; } });
|
|
@@ -220,6 +220,7 @@ Object.defineProperty(exports, "reconcileClaudeAuthState", { enumerable: true, g
|
|
|
220
220
|
Object.defineProperty(exports, "removeAccount", { enumerable: true, get: function () { return accounts_1.removeAccount; } });
|
|
221
221
|
Object.defineProperty(exports, "listAccounts", { enumerable: true, get: function () { return accounts_1.listAccounts; } });
|
|
222
222
|
Object.defineProperty(exports, "getActiveAccount", { enumerable: true, get: function () { return accounts_1.getActiveAccount; } });
|
|
223
|
+
Object.defineProperty(exports, "resolveActiveClaudeAccount", { enumerable: true, get: function () { return accounts_1.resolveActiveClaudeAccount; } });
|
|
223
224
|
Object.defineProperty(exports, "isMultiAccountEnabled", { enumerable: true, get: function () { return accounts_1.isMultiAccountEnabled; } });
|
|
224
225
|
var accountManager_1 = require("./accountManager");
|
|
225
226
|
Object.defineProperty(exports, "beginAccountLogin", { enumerable: true, get: function () { return accountManager_1.beginAccountLogin; } });
|
|
@@ -255,6 +256,7 @@ Object.defineProperty(exports, "getCodexMonitoringHomes", { enumerable: true, ge
|
|
|
255
256
|
Object.defineProperty(exports, "getSystemCodexHome", { enumerable: true, get: function () { return codexProfiles_1.getSystemCodexHome; } });
|
|
256
257
|
Object.defineProperty(exports, "listCodexAccounts", { enumerable: true, get: function () { return codexProfiles_1.listCodexAccounts; } });
|
|
257
258
|
Object.defineProperty(exports, "getActiveCodexAccount", { enumerable: true, get: function () { return codexProfiles_1.getActiveCodexAccount; } });
|
|
259
|
+
Object.defineProperty(exports, "resolveActiveCodexAccount", { enumerable: true, get: function () { return codexProfiles_1.resolveActiveCodexAccount; } });
|
|
258
260
|
Object.defineProperty(exports, "resolveSidekickCodexHome", { enumerable: true, get: function () { return codexProfiles_1.resolveSidekickCodexHome; } });
|
|
259
261
|
Object.defineProperty(exports, "getCodexExecutionEnv", { enumerable: true, get: function () { return codexProfiles_1.getCodexExecutionEnv; } });
|
|
260
262
|
Object.defineProperty(exports, "prepareCodexAccount", { enumerable: true, get: function () { return codexProfiles_1.prepareCodexAccount; } });
|
|
@@ -274,7 +276,11 @@ Object.defineProperty(exports, "decideAutoSwitch", { enumerable: true, get: func
|
|
|
274
276
|
Object.defineProperty(exports, "AutoSwitchController", { enumerable: true, get: function () { return autoSwitch_1.AutoSwitchController; } });
|
|
275
277
|
// Quota
|
|
276
278
|
var quota_1 = require("./quota");
|
|
279
|
+
Object.defineProperty(exports, "FIVE_HOUR_WINDOW_MS", { enumerable: true, get: function () { return quota_1.FIVE_HOUR_WINDOW_MS; } });
|
|
280
|
+
Object.defineProperty(exports, "SEVEN_DAY_WINDOW_MS", { enumerable: true, get: function () { return quota_1.SEVEN_DAY_WINDOW_MS; } });
|
|
277
281
|
Object.defineProperty(exports, "fetchQuota", { enumerable: true, get: function () { return quota_1.fetchQuota; } });
|
|
282
|
+
Object.defineProperty(exports, "projectQuotaWindow", { enumerable: true, get: function () { return quota_1.projectQuotaWindow; } });
|
|
283
|
+
Object.defineProperty(exports, "withQuotaProjections", { enumerable: true, get: function () { return quota_1.withQuotaProjections; } });
|
|
278
284
|
var quotaPresentation_1 = require("./quotaPresentation");
|
|
279
285
|
Object.defineProperty(exports, "describeQuotaFailure", { enumerable: true, get: function () { return quotaPresentation_1.describeQuotaFailure; } });
|
|
280
286
|
var quotaPoller_1 = require("./quotaPoller");
|
package/dist/modelContext.js
CHANGED
|
@@ -36,21 +36,20 @@ const MODEL_CONTEXT_SIZES = {
|
|
|
36
36
|
'gpt-5.3-codex': 400_000,
|
|
37
37
|
'gpt-5': 400_000,
|
|
38
38
|
// OpenAI reasoning
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
o1: 200_000,
|
|
40
|
+
o3: 200_000,
|
|
41
|
+
o4: 200_000,
|
|
42
42
|
// OpenAI GPT-4 series
|
|
43
43
|
'gpt-4o': 128_000,
|
|
44
44
|
'gpt-4-turbo': 128_000,
|
|
45
45
|
'gpt-4': 8_192,
|
|
46
46
|
// Gemini
|
|
47
|
-
|
|
47
|
+
gemini: 1_000_000,
|
|
48
48
|
// DeepSeek
|
|
49
|
-
|
|
49
|
+
deepseek: 128_000,
|
|
50
50
|
};
|
|
51
51
|
/** Prefix keys sorted longest-first for correct prefix matching. */
|
|
52
|
-
const SORTED_KEYS = Object.keys(MODEL_CONTEXT_SIZES)
|
|
53
|
-
.sort((a, b) => b.length - a.length);
|
|
52
|
+
const SORTED_KEYS = Object.keys(MODEL_CONTEXT_SIZES).sort((a, b) => b.length - a.length);
|
|
54
53
|
/** Default context window size when model is unknown. */
|
|
55
54
|
exports.DEFAULT_CONTEXT_WINDOW = 200_000;
|
|
56
55
|
/**
|
|
@@ -75,7 +74,10 @@ function getModelContextWindowSize(modelId) {
|
|
|
75
74
|
// Strip the suffix if present, so the normal lookup still succeeds when
|
|
76
75
|
// a caller passes e.g. "claude-opus-4-7[1m]" and we've already handled it.
|
|
77
76
|
// Trim/lowercase so padded or mixed-case IDs match the lowercase table keys.
|
|
78
|
-
const normalized = modelId
|
|
77
|
+
const normalized = modelId
|
|
78
|
+
.replace(/\[1m\]/gi, '')
|
|
79
|
+
.trim()
|
|
80
|
+
.toLowerCase();
|
|
79
81
|
// Exact match
|
|
80
82
|
if (MODEL_CONTEXT_SIZES[normalized] !== undefined) {
|
|
81
83
|
return MODEL_CONTEXT_SIZES[normalized];
|
package/dist/modelInfo.js
CHANGED
|
@@ -214,7 +214,7 @@ const PRICING_TABLE = {
|
|
|
214
214
|
cacheWriteCostPerMillion: 0,
|
|
215
215
|
cacheReadCostPerMillion: 0.55,
|
|
216
216
|
},
|
|
217
|
-
|
|
217
|
+
o3: {
|
|
218
218
|
inputCostPerMillion: 2.0,
|
|
219
219
|
outputCostPerMillion: 8.0,
|
|
220
220
|
cacheWriteCostPerMillion: 0,
|
|
@@ -226,7 +226,7 @@ const PRICING_TABLE = {
|
|
|
226
226
|
cacheWriteCostPerMillion: 0,
|
|
227
227
|
cacheReadCostPerMillion: 1.5,
|
|
228
228
|
},
|
|
229
|
-
|
|
229
|
+
o1: {
|
|
230
230
|
inputCostPerMillion: 15.0,
|
|
231
231
|
outputCostPerMillion: 60.0,
|
|
232
232
|
cacheWriteCostPerMillion: 0,
|
|
@@ -275,7 +275,10 @@ const GEMINI_RE = /^gemini-([0-9][0-9.A-Za-z-]*)/i;
|
|
|
275
275
|
function parseModelId(modelId) {
|
|
276
276
|
if (!modelId)
|
|
277
277
|
return null;
|
|
278
|
-
const normalized = modelId
|
|
278
|
+
const normalized = modelId
|
|
279
|
+
.replace(/\[1m\]/gi, '')
|
|
280
|
+
.trim()
|
|
281
|
+
.toLowerCase();
|
|
279
282
|
const claude = normalized.match(CLAUDE_RE);
|
|
280
283
|
if (claude) {
|
|
281
284
|
return { provider: 'anthropic', family: claude[1].toLowerCase(), version: claude[2] };
|
|
@@ -405,8 +408,7 @@ function calculateCost(usage, modelId) {
|
|
|
405
408
|
* locally estimated from pricing, or unavailable because the model is unpriced.
|
|
406
409
|
*/
|
|
407
410
|
function calculateCostWithProvenance(input) {
|
|
408
|
-
if (typeof input.reportedCostUsd === 'number' &&
|
|
409
|
-
Number.isFinite(input.reportedCostUsd)) {
|
|
411
|
+
if (typeof input.reportedCostUsd === 'number' && Number.isFinite(input.reportedCostUsd)) {
|
|
410
412
|
return { costUsd: input.reportedCostUsd, source: 'reported' };
|
|
411
413
|
}
|
|
412
414
|
const estimated = calculateCost(input.usage, input.modelId);
|
|
@@ -489,7 +491,10 @@ function getModelDisplayInfo(modelId) {
|
|
|
489
491
|
rank = 200;
|
|
490
492
|
}
|
|
491
493
|
else if (parsed?.provider === 'openai') {
|
|
492
|
-
rank =
|
|
494
|
+
rank =
|
|
495
|
+
parsed.family === 'gpt'
|
|
496
|
+
? 300 + versionRank(parsed.version)
|
|
497
|
+
: 400 + versionRank(parsed.version);
|
|
493
498
|
}
|
|
494
499
|
else if (parsed?.provider === 'google') {
|
|
495
500
|
rank = 500 + versionRank(parsed.version);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveActiveClaudeAccount } from './accounts';
|
|
2
2
|
import type { ClaudeMaxCredentials } from './credentials';
|
|
3
3
|
import type { PeakHoursState } from './peakHours';
|
|
4
4
|
import type { QuotaState } from './quota';
|
|
@@ -25,7 +25,7 @@ export interface MultiProviderQuotaServiceOptions {
|
|
|
25
25
|
codexWatcher?: CodexWatcherLike | null;
|
|
26
26
|
zaiWatcher?: ZaiWatcherLike | null;
|
|
27
27
|
readClaudeCredentials?: () => Promise<ClaudeMaxCredentials | null>;
|
|
28
|
-
readClaudeAccount?: typeof
|
|
28
|
+
readClaudeAccount?: typeof resolveActiveClaudeAccount;
|
|
29
29
|
fetchClaudeQuota?: (accessToken: string) => Promise<QuotaState>;
|
|
30
30
|
fetchPeakHours?: () => Promise<PeakHoursState>;
|
|
31
31
|
log?: Logger;
|