sidekick-shared 0.28.3 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/README.md +149 -19
- package/dist/authStatus.d.ts +54 -0
- package/dist/authStatus.js +91 -0
- package/dist/browser.d.ts +12 -6
- package/dist/browser.js +17 -1
- package/dist/codex.d.ts +23 -0
- package/dist/codex.js +44 -0
- package/dist/codexProfiles.d.ts +1 -0
- package/dist/codexProfiles.js +8 -11
- package/dist/esm/authStatus.js +87 -0
- package/dist/esm/browser.js +4 -2
- package/dist/esm/codex.js +18 -0
- package/dist/esm/codexProfiles.js +8 -11
- package/dist/esm/formatting.js +10 -1
- package/dist/esm/index.js +9 -6
- package/dist/esm/modelCatalog.js +2 -1
- package/dist/esm/modelInfo.js +422 -45
- package/dist/esm/node.js +9 -3
- package/dist/esm/parsers/codexParser.js +175 -54
- package/dist/esm/parsers/codexRolloutOrigin.js +107 -0
- package/dist/esm/parsers/openCodeParser.js +83 -21
- package/dist/esm/pricing.js +18 -0
- package/dist/esm/pricingCatalog.js +14 -7
- package/dist/esm/promptHistory.js +66 -4
- package/dist/esm/providerFailure.js +124 -3
- package/dist/esm/providers/codex.js +2 -24
- package/dist/esm/providers/codexDatabase.js +3 -19
- package/dist/esm/providers/codexRollouts.js +24 -1
- package/dist/esm/providers/openCode.js +9 -17
- package/dist/esm/report/htmlReportGenerator.js +42 -5
- package/dist/esm/report/transcriptParser.js +13 -11
- package/dist/esm/schemas/providerFailure.js +3 -1
- package/dist/esm/schemas/transcript.js +4 -0
- package/dist/esm/sessionPromptHistory.js +2 -2
- package/dist/esm/statusline/payload.js +9 -0
- package/dist/esm/testing/credentialGuard.js +87 -5
- package/dist/esm/toolCallOrigins.js +310 -0
- package/dist/esm/transcript.js +42 -3
- package/dist/esm/usage/usageEvents.js +146 -17
- package/dist/esm/usage/usageReports.js +39 -6
- package/dist/esm/watchers/jsonlTail.js +378 -59
- package/dist/formatting.d.ts +26 -1
- package/dist/formatting.js +11 -1
- package/dist/index.d.ts +16 -10
- package/dist/index.js +35 -12
- package/dist/modelCatalog.js +2 -1
- package/dist/modelInfo.d.ts +185 -16
- package/dist/modelInfo.js +431 -47
- package/dist/node.d.ts +16 -5
- package/dist/node.js +31 -2
- package/dist/parsers/codexParser.d.ts +55 -0
- package/dist/parsers/codexParser.js +175 -54
- package/dist/parsers/codexRolloutOrigin.d.ts +49 -0
- package/dist/parsers/codexRolloutOrigin.js +111 -0
- package/dist/parsers/openCodeParser.d.ts +38 -0
- package/dist/parsers/openCodeParser.js +86 -21
- package/dist/pricing.d.ts +22 -0
- package/dist/pricing.js +50 -0
- package/dist/pricingCatalog.d.ts +10 -0
- package/dist/pricingCatalog.js +13 -6
- package/dist/promptHistory.d.ts +65 -4
- package/dist/promptHistory.js +68 -5
- package/dist/providerFailure.d.ts +44 -0
- package/dist/providerFailure.js +126 -4
- package/dist/providers/codex.d.ts +3 -22
- package/dist/providers/codex.js +3 -26
- package/dist/providers/codexDatabase.d.ts +3 -2
- package/dist/providers/codexDatabase.js +4 -22
- package/dist/providers/codexRollouts.d.ts +22 -0
- package/dist/providers/codexRollouts.js +24 -0
- package/dist/providers/openCode.js +8 -16
- package/dist/report/htmlReportGenerator.js +42 -5
- package/dist/report/transcriptParser.d.ts +10 -1
- package/dist/report/transcriptParser.js +13 -11
- package/dist/schemas/providerFailure.d.ts +39 -0
- package/dist/schemas/providerFailure.js +2 -0
- package/dist/schemas/transcript.d.ts +2 -0
- package/dist/schemas/transcript.js +4 -0
- package/dist/sessionPromptHistory.d.ts +7 -1
- package/dist/sessionPromptHistory.js +1 -1
- package/dist/statusline/payload.d.ts +10 -0
- package/dist/statusline/payload.js +14 -0
- package/dist/testing/credentialGuard.d.ts +14 -0
- package/dist/testing/credentialGuard.js +87 -5
- package/dist/toolCallOrigins.d.ts +70 -0
- package/dist/toolCallOrigins.js +346 -0
- package/dist/transcript.d.ts +12 -0
- package/dist/transcript.js +42 -3
- package/dist/types/opencode.d.ts +2 -0
- package/dist/usage/usageEvents.d.ts +54 -6
- package/dist/usage/usageEvents.js +146 -17
- package/dist/usage/usageReports.d.ts +35 -4
- package/dist/usage/usageReports.js +39 -6
- package/dist/watchers/jsonlTail.d.ts +101 -4
- package/dist/watchers/jsonlTail.js +380 -60
- package/package.json +41 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,9 @@ export type { ExactTokenCounterContext, ExactTokenCounter, TokenEstimationMethod
|
|
|
10
10
|
export { projectSessionTranscript } from './transcript';
|
|
11
11
|
export type { TranscriptFidelity, TranscriptSourceProvenance, CanonicalTranscriptBlock, CanonicalTranscriptMessage, CanonicalToolCall, CanonicalTranscriptUsageTotals, CanonicalSessionTranscript, ProjectSessionTranscriptOptions, } from './transcript';
|
|
12
12
|
export { listRecentSessions, readSessionTranscript } from './sessionTranscripts';
|
|
13
|
-
export { collectPromptHistory, isPromptHistorySessionSettled, parsePromptHistoryCursor, } from './promptHistory';
|
|
13
|
+
export { collectPromptHistory, isPromptHistorySessionSettled, parsePromptHistoryCursor, PROMPT_HISTORY_ORDINAL_MAX_RECORD_BYTES, } from './promptHistory';
|
|
14
|
+
export { findToolCallOrigins } from './toolCallOrigins';
|
|
15
|
+
export type { FindToolCallOriginsOptions, ToolCallOrigin } from './toolCallOrigins';
|
|
14
16
|
export type { CollectPromptHistoryOptions, PromptHistoryAnswerState, PromptHistoryBound, PromptHistoryBounds, PromptHistoryCursor, PromptHistoryCursorSession, PromptHistoryEntry, PromptHistoryExclusion, PromptHistoryMetadataStatus, PromptHistoryPendingPrompt, PromptHistoryProvider, PromptHistoryResult, PromptHistoryResumeState, PromptHistoryStats, PromptHistoryUsage, } from './promptHistory';
|
|
15
17
|
export { collectSessionPromptHistory } from './sessionPromptHistory';
|
|
16
18
|
export type { CollectSessionPromptHistoryOptions, PromptHistorySession, PromptHistorySessionPrompt, PromptHistorySessionRef, SessionPromptHistoryBound, SessionPromptHistoryBounds, SessionPromptHistoryInclude, SessionPromptHistoryResult, SessionPromptHistoryStats, } from './sessionPromptHistory';
|
|
@@ -89,7 +91,9 @@ export { JsonlParser, TRUNCATION_PATTERNS } from './parsers/jsonl';
|
|
|
89
91
|
export type { RawSessionEvent, JsonlParserCallbacks, JsonlParserOptions } from './parsers/jsonl';
|
|
90
92
|
export { normalizeToolName, normalizeToolInput, detectPlanModeFromText, convertOpenCodeMessage, parseDbMessageData, parseDbPartData, } from './parsers/openCodeParser';
|
|
91
93
|
export { CodexRolloutParser, DEFAULT_MAX_TRACKED_TOOL_CALLS, extractPatchFilePaths, normalizeCodexToolName, normalizeCodexToolInput, resolveCodexCallUsage, } from './parsers/codexParser';
|
|
92
|
-
export type { CodexRolloutParserOptions } from './parsers/codexParser';
|
|
94
|
+
export type { CodexPendingStats, CodexRolloutParserOptions } from './parsers/codexParser';
|
|
95
|
+
export { codexRolloutOrigin, codexSpawnParentFromSource } from './parsers/codexRolloutOrigin';
|
|
96
|
+
export type { CodexRolloutOrigin } from './parsers/codexRolloutOrigin';
|
|
93
97
|
export { scanSubagentDir, extractTaskInfo, readAgentMeta } from './parsers/subagentScanner';
|
|
94
98
|
export { ClaudeUsageDeduper, SYNTHETIC_MODEL, dedupedRawClaudeUsage, normalizeClaudeUsage, } from './usage/claudeUsageDedupe';
|
|
95
99
|
export { addUsageToSubagent } from './usage/subagentUsage';
|
|
@@ -128,8 +132,8 @@ export type { FollowEvent, FollowEventType, SessionWatcher, SessionWatcherCallba
|
|
|
128
132
|
export { createWatcher, resolveSessionPath } from './watchers/factory';
|
|
129
133
|
export type { CreateWatcherOptions } from './watchers/factory';
|
|
130
134
|
export { toFollowEvents } from './watchers/eventBridge';
|
|
131
|
-
export { createJsonlTail, DEFAULT_JSONL_TAIL_MAX_LINE_BYTES, DEFAULT_JSONL_TAIL_READ_BYTES, } from './watchers/jsonlTail';
|
|
132
|
-
export type { JsonlTail, JsonlTailBatch, JsonlTailLine, JsonlTailOptions, JsonlTailReset, JsonlTailResetReason, } from './watchers/jsonlTail';
|
|
135
|
+
export { createJsonlTail, DEFAULT_JSONL_TAIL_MAX_LINE_BYTES, DEFAULT_JSONL_TAIL_READ_BYTES, JSONL_TAIL_CHECKPOINT_VERSION, JsonlTailSymlinkError, } from './watchers/jsonlTail';
|
|
136
|
+
export type { JsonlTail, JsonlTailCheckpoint, JsonlTailReadResult, JsonlTailEntry, JsonlTailRewritePolicy, JsonlTailBatch, JsonlTailLine, JsonlTailOptions, JsonlTailReset, JsonlTailResetReason, } from './watchers/jsonlTail';
|
|
133
137
|
export { addLocalDays, formatDurationMs, formatLocalDateKey, formatTokenCount, parseLocalDateKey, } from './formatting';
|
|
134
138
|
export type { FormatDurationMsOptions, FormatTokenCountOptions } from './formatting';
|
|
135
139
|
export { formatToolSummary } from './formatters/toolSummary';
|
|
@@ -178,7 +182,7 @@ export { readClaudeMaxCredentials, readClaudeMaxCredentialsRaw, readClaudeMaxAcc
|
|
|
178
182
|
export type { ClaudeMaxCredentials } from './credentials';
|
|
179
183
|
export { parseClaudeCredentialBlob, claudeCredentialFreshness, isNewerClaudeCredential, resolveClaudeRefreshExpiry, claudeRefreshFingerprint, claudeLoginOnly, mergeClaudeLoginIntoLive, CLAUDE_ACCESS_TOKEN_LIFETIME_MS, CLAUDE_REFRESH_TOKEN_LIFETIME_ESTIMATE_MS, } from './claudeCredentials';
|
|
180
184
|
export type { ClaudeOauthCredentials } from './claudeCredentials';
|
|
181
|
-
export { parseAuthJson as parseCodexAuthJson, readAuthIdentityFromRaw as readCodexAuthIdentity, readLastRefresh as readCodexLastRefresh, readAccessTokenExpiry as readCodexAccessTokenExpiry, identitiesMatch as codexIdentitiesMatch, } from './codexAuth';
|
|
185
|
+
export { parseAuthJson as parseCodexAuthJson, readAuthIdentityFromRaw as readCodexAuthIdentity, readLastRefresh as readCodexLastRefresh, readAccessTokenExpiry as readCodexAccessTokenExpiry, identitiesMatch as codexIdentitiesMatch, codexRefreshFingerprint, compareCodexAuthFreshness, } from './codexAuth';
|
|
182
186
|
export type { CodexAuthIdentity, CodexAuthJsonFile } from './codexAuth';
|
|
183
187
|
export { ensureDefaultAccounts } from './ensureDefaultAccounts';
|
|
184
188
|
export type { EnsureDefaultAccountStatus, EnsureDefaultAccountsOptions, EnsureDefaultAccountsResult, } from './ensureDefaultAccounts';
|
|
@@ -248,8 +252,8 @@ export { formatStatusline, selectStatuslineAccount } from './statusline/formatte
|
|
|
248
252
|
export type { StatuslineInput, StatuslineSelection } from './statusline/formatter';
|
|
249
253
|
export { getModelContextWindowSize, resolveModelContextWindow, DEFAULT_CONTEXT_WINDOW, } from './modelContext';
|
|
250
254
|
export type { ModelCatalogMatch, ModelContextWindowProvenance, ModelContextWindowSource, ResolvedModelContextWindow, } from './modelContext';
|
|
251
|
-
export { parseModelId, getModelPricing, resolveModelPricing, getModelInfo, calculateCost, calculateCostWithPricing, calculateCostWithProvenance, mergeCostSources, shortModelName, getModelDisplayInfo, compareModelIds, sortModelIds, formatCost, MODEL_PROVIDER_IDS, } from './modelInfo';
|
|
252
|
-
export type { ModelPricing, CostTokenUsage, CostSource, CostProvenanceInput, CostWithProvenance, ModelInfo, ModelProvider, ParsedModelId, ModelDisplayInfo, ModelPricingMatch, ModelPricingProvenance, ModelPricingSource, ResolvedModelPricing, } from './modelInfo';
|
|
255
|
+
export { parseModelId, getModelPricing, resolveModelPricing, getModelInfo, calculateCost, calculateCostWithPricing, calculateCostWithProvenance, mergeCostSources, shortModelName, getModelDisplayInfo, compareModelIds, sortModelIds, formatCost, MODEL_PROVIDER_IDS, canonicalModelId, isMovingModelAlias, registerModelPricing, clearRegisteredModelPricing, getPricingCatalogInfo, costSourceFromPricingProvenance, mergeCostComponents, } from './modelInfo';
|
|
256
|
+
export type { ModelPricing, ResolveModelPricingOptions, RegisterModelPricingOptions, PricingCatalogInfo, PricingCatalogSource, CostComponent, FormatCostOptions, CostTokenUsage, CostSource, CostProvenanceInput, CostWithProvenance, ModelInfo, ModelProvider, ParsedModelId, ModelDisplayInfo, ModelPricingMatch, ModelPricingProvenance, ModelPricingSource, ResolvedModelPricing, } from './modelInfo';
|
|
253
257
|
export { exportResolvedModelCatalog, importResolvedModelCatalog, registerModelAlias, resolveModelAlias, RESOLVED_MODEL_CATALOG_SCHEMA_VERSION, } from './modelCatalog';
|
|
254
258
|
export type { ImportResolvedModelCatalogResult, ResolvedModelCatalogEntry, ResolvedModelCatalogSnapshot, } from './modelCatalog';
|
|
255
259
|
export { hydratePricingCatalog, normalizeLiteLlmCatalog, normalizeLiteLlmContextWindows, LITELLM_CATALOG_URL, } from './pricingCatalog';
|
|
@@ -281,14 +285,16 @@ export { _resetPeakHoursCache, createPeakHoursNotApplicableState, DEFAULT_PEAK_H
|
|
|
281
285
|
export type { FetchPeakHoursOptions, PeakHoursState } from './peakHours';
|
|
282
286
|
export { FAILING_TOOL_TREND_ARROWS, failingToolTrend, mergeFailingToolWindows, } from './failingTools';
|
|
283
287
|
export type { FailingToolTrend, FailingToolTrendRow, FailingToolWindow } from './failingTools';
|
|
284
|
-
export { diagnoseProviderFailure, PROVIDER_AUTHENTICATION_SOURCES, PROVIDER_AUTHENTICATION_STATES, PROVIDER_CREDENTIAL_KINDS, PROVIDER_FAILURE_CODES, PROVIDER_FAILURE_EVIDENCE_SOURCES, PROVIDER_RECOVERY_ACTIONS, } from './providerFailure';
|
|
285
|
-
export
|
|
288
|
+
export { diagnoseProviderFailure, PROVIDER_AUTHENTICATION_SOURCES, PROVIDER_AUTHENTICATION_STATES, PROVIDER_CREDENTIAL_KINDS, PROVIDER_FAILURE_CODES, PROVIDER_FAILURE_EVIDENCE_SOURCES, PROVIDER_RECOVERY_ACTIONS, CODEX_ERROR_INFO_KINDS, decodeCodexErrorInfo, } from './providerFailure';
|
|
289
|
+
export { parseClaudeAuthStatus, parseCodexLoginStatus } from './authStatus';
|
|
290
|
+
export type { ParsedClaudeAuthStatus, ParsedCodexLoginStatus } from './authStatus';
|
|
291
|
+
export type { CodexErrorInfoKind, CodexErrorInfoSummary, ProviderCredentialKind, ProviderAuthenticationEvidence, ProviderFailureInput, ProviderFailureCode, ProviderRecoveryAction, ProviderRetryAfter, ProviderFailureEvidence, ProviderFailureDiagnosis, } from './providerFailure';
|
|
286
292
|
export type { ProviderServiceSeverity, ProviderServiceComponent, ProviderServiceIncident, ProviderServiceStatusFailureReason, ObservedProviderServiceStatus, UnavailableProviderServiceStatus, ProviderServiceStatus, FetchProviderServiceStatusOptions, } from './providerServiceStatusTypes';
|
|
287
293
|
export { fetchProviderServiceStatus } from './providerServiceStatus';
|
|
288
294
|
export { inspectCodexCredentialStores, repairCodexCredentialStores } from './codexCredentialDoctor';
|
|
289
295
|
export type { CodexCredentialFinding, CodexCredentialInspection, CodexCredentialRepairResult, } from './codexCredentialDoctor';
|
|
290
296
|
export { readStoredCodexAccount, syncCodexLiveStateAsync } from './codexProfiles';
|
|
291
|
-
export { getCodexSessionsDirs, CODEX_SESSIONS_SUBDIR, CODEX_ARCHIVED_SESSIONS_SUBDIR, } from './codexPaths';
|
|
297
|
+
export { getCodexSessionsDirs, forceFileCredentialStore, CODEX_SESSIONS_SUBDIR, CODEX_ARCHIVED_SESSIONS_SUBDIR, } from './codexPaths';
|
|
292
298
|
export type { CodexSessionsDirsOptions } from './codexPaths';
|
|
293
299
|
export { classifyTool, TOOL_CATEGORIES } from './toolCategory';
|
|
294
300
|
export type { ClassifyToolOptions, ToolCategory } from './toolCategory';
|
package/dist/index.js
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* Public API for sidekick-shared.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.resolveWorkspaceRoots = exports.TOOL_CATEGORIES = exports.classifyTool = exports.CODEX_ARCHIVED_SESSIONS_SUBDIR = exports.CODEX_SESSIONS_SUBDIR = exports.getCodexSessionsDirs = exports.syncCodexLiveStateAsync = exports.readStoredCodexAccount = exports.repairCodexCredentialStores = exports.inspectCodexCredentialStores = exports.fetchProviderServiceStatus = exports.PROVIDER_RECOVERY_ACTIONS = exports.PROVIDER_FAILURE_EVIDENCE_SOURCES = exports.PROVIDER_FAILURE_CODES = exports.PROVIDER_CREDENTIAL_KINDS = exports.PROVIDER_AUTHENTICATION_STATES = exports.PROVIDER_AUTHENTICATION_SOURCES = exports.diagnoseProviderFailure = exports.mergeFailingToolWindows = exports.failingToolTrend = void 0;
|
|
6
|
+
exports.applySessionSummary = exports.pruneUsageCache = exports.getUsageCacheDir = exports.collectUsageEvents = exports.USAGE_CACHE_VERSION = exports.MAX_USAGE_CACHE_FILES = exports.findActiveBillingBlock = exports.computeBillingBlocks = exports.BILLING_BLOCK_DURATION_MS = exports.writeStateFile = exports.readStateFile = exports.quotaToStateFile = exports.getStateFilePath = exports.billingBlockToStateFile = exports.STATE_FILE_SCHEMA_VERSION = exports.STATE_FILE_NAME = exports.sessionFingerprintParts = exports.fingerprintString = exports.readSessionReportInputs = exports.readSessionFileStats = exports.providerContextSizeFn = exports.firstUserPrompt = exports.computeSessionFileStats = exports.isHumanPrompt = exports.humanPromptText = exports.HUMAN_CODEX_SOURCES = exports.HUMAN_CLAUDE_ENTRYPOINTS = exports.collectSessionPromptHistory = exports.findToolCallOrigins = exports.PROMPT_HISTORY_ORDINAL_MAX_RECORD_BYTES = exports.parsePromptHistoryCursor = exports.isPromptHistorySessionSettled = exports.collectPromptHistory = exports.readSessionTranscript = exports.listRecentSessions = exports.projectSessionTranscript = exports.estimateSerializedTokens = exports.estimateTextTokens = exports.ASCII_CHARS_PER_TOKEN = exports.TOKEN_TOTAL_LABEL = exports.TOKEN_SUBAGENTS_LABEL = exports.TOKEN_SESSION_TOTAL_LABEL = exports.TOKEN_MAIN_THREAD_LABEL = exports.TOKEN_CONTEXT_LABEL = exports.sumTokenTotals = exports.summarizeTokens = exports.formatTokenBreakdown = exports.calculateNormalizedUsageCost = exports.extractNormalizedUsage = exports.normalizeProviderUsage = void 0;
|
|
7
|
+
exports.getPlanAnalytics = exports.writePlans = exports.getLatestPlan = exports.readPlans = exports.readLatestHandoff = exports.readHistory = exports.readNotes = exports.readDecisions = exports.readTasks = exports.migrateLegacyProjectStores = exports.resolveProjectIdentity = exports.getProjectSlugRaw = exports.getProjectSlug = exports.encodeWorkspacePath = exports.getGlobalDataPath = exports.getProjectDataPath = exports.setConfigDir = exports.getDefaultConfigDir = exports.getConfigDirOverride = exports.getConfigDir = exports.CONFIG_DIR_ENV_VAR = exports.MAX_PLANS_PER_PROJECT = exports.PLAN_SCHEMA_VERSION = exports.createEmptyDataStore = exports.createEmptyTokenTotals = exports.HISTORICAL_SESSION_RETENTION_LIMIT = 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 = exports.isAggregateCodexLimit = exports.splitWatchedPath = exports.DirectoryListingCache = exports.fileFingerprintParts = exports.fileFingerprint = exports.observedSessionSourceFromProvider = exports.ObservedSessionCollector = exports.weekKey = exports.usageBucketKey = exports.summarizeUsageRows = exports.bucketUsage = exports.importSessionHistory = exports.ACTIVE_SESSION_MTIME_THRESHOLD_MS = exports.sessionSummaryFromStats = exports.removeSessionSummary = exports.markFileImported = exports.isFileImported = void 0;
|
|
8
|
+
exports.dedupedRawClaudeUsage = exports.SYNTHETIC_MODEL = exports.ClaudeUsageDeduper = exports.readAgentMeta = exports.extractTaskInfo = exports.scanSubagentDir = exports.codexSpawnParentFromSource = exports.codexRolloutOrigin = exports.resolveCodexCallUsage = exports.normalizeCodexToolInput = exports.normalizeCodexToolName = exports.extractPatchFilePaths = exports.DEFAULT_MAX_TRACKED_TOOL_CALLS = exports.CodexRolloutParser = exports.parseDbPartData = exports.parseDbMessageData = exports.convertOpenCodeMessage = exports.detectPlanModeFromText = exports.normalizeToolInput = exports.normalizeToolName = exports.TRUNCATION_PATTERNS = exports.JsonlParser = exports.walkRolloutFilesAsync = exports.walkRolloutFiles = exports.findCodexRolloutFile = exports.CodexProvider = exports.getOpenCodeDataDir = exports.OpenCodeProvider = exports.ClaudeCodeProvider = exports.getAllDetectedProviders = exports.detectProvider = exports._resetProviderDetectionCache = exports.getObservedActivityReason = exports.derivePendingUserRequestV1 = exports.createProviderSessionAdapterV1 = exports.createSessionProviders = exports.SESSION_PROVIDER_IDS = exports.renderHandoffUrlTemplate = exports.addNote = exports.decisionFingerprint = exports.addDecision = exports.completeTask = exports.addTask = exports.withFileLockSync = exports.updateJsonStoreAtomicSync = exports.updateJsonStoreAtomic = exports.atomicWriteFileSync = exports.atomicWriteJsonSync = exports.atomicWriteJson = exports.readClaudeCodePlanFiles = void 0;
|
|
9
|
+
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.readSessionPreviewAsync = exports.readSessionPreview = exports.listSessionPreviewsAsync = exports.listSessionPreviews = exports.readCodexHistory = exports.parseMcpToolName = exports.scanSubagentTraces = exports.findAllSessionsWithWorktrees = exports.discoverWorktreeSiblings = exports.resolveWorktreeMainRepo = exports.getAllClaudeProjectFolders = exports.decodeEncodedPath = exports.getMostRecentlyActiveSessionDir = exports.findSubdirectorySessionDirs = exports.findSessionFilesWithStats = exports.findSessionsInDirectory = exports.findAllClaudeSessions = exports.findActiveClaudeSession = exports.discoverSessionDirectory = exports.getClaudeSessionDirectory = exports.encodeClaudeWorkspacePath = exports.SESSION_ACTIVITY_STALENESS_MS = exports.SESSION_ACTIVITY_GRACE_PERIOD_MS = exports.refreshSessionActivityState = exports.detectSessionActivity = exports.classifySessionActivity = exports.subagentTokenTotals = exports.scanSessionSubagents = exports.readMainThreadTokenTotals = exports.combineSessionTokenTotals = exports.collectSessionTokenTotals = exports.addUsageToSubagent = exports.normalizeClaudeUsage = void 0;
|
|
10
|
+
exports.readErrorHistory = exports.getTopFailingTools = exports.appendErrorHistory = exports.MAX_ERROR_HISTORY_SESSIONS = exports.ERROR_HISTORY_SCHEMA_VERSION = exports.getSnapshotPath = exports.MAX_SNAPSHOT_FILES = exports.pruneSnapshots = exports.isSnapshotValid = exports.deleteSnapshot = exports.loadSnapshot = exports.saveSnapshot = exports.SessionMonitor = exports.parseTodoDependencies = exports.EventAggregator = exports.getRandomPhrase = exports.PHRASE_CATEGORIES = exports.ALL_PHRASES = exports.HIGHLIGHT_CSS = exports.clearHighlightCache = 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.parseLocalDateKey = exports.formatTokenCount = exports.formatLocalDateKey = exports.formatDurationMs = exports.addLocalDays = exports.JsonlTailSymlinkError = exports.JSONL_TAIL_CHECKPOINT_VERSION = exports.DEFAULT_JSONL_TAIL_READ_BYTES = exports.DEFAULT_JSONL_TAIL_MAX_LINE_BYTES = exports.createJsonlTail = exports.toFollowEvents = exports.resolveSessionPath = exports.createWatcher = exports.parseChangelog = exports.extractProposedPlanShared = exports.parsePlanMarkdownShared = exports.PlanExtractor = exports.segmentAssistantTurn = void 0;
|
|
11
|
+
exports.addCurrentAccount = exports.readActiveClaudeAccount = exports.writeAccountRegistry = exports.readAccountRegistry = exports.ensureDefaultAccounts = exports.compareCodexAuthFreshness = exports.codexRefreshFingerprint = exports.codexIdentitiesMatch = exports.readCodexAccessTokenExpiry = exports.readCodexLastRefresh = exports.readCodexAuthIdentity = exports.parseCodexAuthJson = exports.CLAUDE_REFRESH_TOKEN_LIFETIME_ESTIMATE_MS = exports.CLAUDE_ACCESS_TOKEN_LIFETIME_MS = exports.mergeClaudeLoginIntoLive = exports.claudeLoginOnly = exports.claudeRefreshFingerprint = exports.resolveClaudeRefreshExpiry = exports.isNewerClaudeCredential = exports.claudeCredentialFreshness = exports.parseClaudeCredentialBlob = exports.readClaudeMaxAccessTokenSync = exports.readClaudeMaxCredentialsRaw = exports.readClaudeMaxCredentials = exports.parseKeychainDump = exports.repairClaudeCredentialStores = exports.inspectClaudeCredentialStores = exports.getClaudeCredentialLedgerPath = exports.readClaudeCredentialLedger = exports.decideLiveClaudeWrite = exports.SIDEKICK_KEYCHAIN_COMMENT_PREFIX = exports.ClaudeCredentialWriteError = exports.deleteStoredCredentials = exports.writeActiveCredentials = exports.readClaudeCredentialStore = exports.readActiveCredentials = exports.openInBrowser = exports.parseTranscriptFromEvents = exports.parseTranscript = exports.generateHtmlReport = exports.formatCompactionLedger = exports.calculateCompactionLedger = exports.describeCostProvenance = exports.classifyCostProvenance = exports.calculateCodeImpact = exports.scoreSessionQuality = exports.calculateQualityTrend = exports.PatternExtractor = exports.HeatmapTracker = exports.FrequencyTracker = void 0;
|
|
12
|
+
exports.setActiveSavedAccount = exports.upsertSavedAccountProfile = exports.getActiveSavedAccount = exports.listSavedAccountProfiles = exports.writeSavedAccountRegistry = exports.readSavedAccountRegistry = exports.getAccountsDir = exports.ACCOUNT_CONSUMER_REACHABILITY = exports.describeAccountConsumer = exports.detectRunningAccountConsumersSync = exports.detectRunningAccountConsumers = exports.findRunningProcessesSync = exports.findRunningProcesses = exports.keepAliveCommand = exports.refreshInactiveAccounts = exports.getAccountLaunchEnv = exports.getHealthSidecarPath = exports.readHealthSidecar = exports.listAccountsWithHealth = exports.getAccountHealth = exports.cleanupAbandonedLogins = exports.syncLiveAccountStateSync = exports.syncLiveAccountState = exports.getLastSwitchPath = exports.readLastSwitch = exports.discardAccountLogin = exports.resolveClaudeLoginCommand = exports.listAllAccounts = exports.getLastSwitch = exports.undoLastSwitch = exports.switchAccountAsync = exports.switchAccount = exports.spawnAccountLogin = exports.finalizeAccountLoginAsync = exports.finalizeAccountLogin = exports.getAccountLoginStatusAsync = exports.getAccountLoginStatus = exports.beginAccountLogin = exports.isMultiAccountEnabled = exports.resolveActiveClaudeAccount = exports.getActiveAccount = exports.listAccounts = exports.removeAccount = exports.reconcileClaudeAuthState = exports.applyActiveClaudeToLiveHome = exports.resolveActiveClaudeHome = exports.cleanupAbandonedClaudeLogins = exports.syncClaudeLiveState = exports.switchToAccountAsync = exports.switchToAccount = void 0;
|
|
13
|
+
exports.claudePlanLabel = exports.SEVEN_DAY_WINDOW_MS = exports.QUOTA_PROVIDER_IDS = exports.FIVE_HOUR_WINDOW_MS = exports.AutoSwitchController = exports.decideAutoSwitch = exports.DEFAULT_AUTO_SWITCH_CONFIG = exports.removeLauncher = exports.writeLauncher = exports.writeAccountLauncher = exports.CODEX_KEYRING_FIX_HINT = exports.getCodexCredentialStoreMode = exports.cleanupAbandonedCodexLogins = exports.syncCodexLiveState = exports.removeCodexAccount = exports.switchToCodexAccountAsync = exports.switchToCodexAccount = exports.finalizeCodexAccountAsync = exports.finalizeCodexAccount = exports.prepareCodexAccountAsync = exports.prepareCodexAccount = exports.getCodexExecutionEnv = exports.resolveSidekickCodexHome = exports.resolveActiveCodexAccount = exports.getActiveCodexAccount = exports.listCodexAccounts = exports.getSystemCodexHome = exports.getCodexMonitoringHomes = exports.getCodexProfileHome = exports.getCodexProfilesDir = exports.getClaudeProjectsDir = exports.isDefaultClaudeHome = exports.getDefaultClaudeHome = exports.getLiveClaudeHome = exports.readLiveClaudeIdentity = exports.readClaudeProfileIdentity = exports.isClaudeProfileAuthenticated = exports.CLAUDE_SECURESTORAGE_CONFIG_DIR_ENV = exports.buildClaudeChildEnv = exports.claudeKeychainAccountName = exports.claudeKeychainService = exports.claudeKeychainSuffix = exports.getClaudeConfigPath = exports.getClaudeProfileHome = exports.getClaudeProfilesDir = exports.onAccountsChanged = exports.getActiveAccountStatus = exports.ACCOUNT_PROVIDER_IDS = exports.removeSavedAccountProfile = exports.replaceSavedAccountProfiles = void 0;
|
|
14
|
+
exports.getModelContextWindowSize = exports.selectStatuslineAccount = exports.formatStatusline = exports.estimateTimeToQuota = exports.BurnRateCalculator = exports.RUNTIME_QUOTA_PROVIDER_IDS = exports.MultiProviderQuotaService = exports.resolveZaiQuota = exports.readZaiCredentials = exports.quotaStateFromZaiQuotaLimitPayload = exports.fetchZaiQuotaFromApi = exports.CodexQuotaWatcher = exports.resolveCodexQuotaFromLocalSources = exports.resolveCodexQuota = exports.readLatestCodexQuotaFromRollouts = exports.quotaFromCodexRateLimits = exports.fetchCodexQuotaFromApi = exports.fetchCodexResetCreditsFromApi = exports.quotaHistoryWindow = exports.getWorkspaceIdFromPath = exports.pruneQuotaHistory = exports.readQuotaHistoryDailyBuckets = exports.readQuotaHistoryRange = exports.appendQuotaHistorySample = exports.quotaFromStatuslinePayload = exports.parseClaudeStatuslinePayload = exports.evaluateQuotaThresholds = exports.describeQuotaThresholdAlert = exports.DEFAULT_QUOTA_THRESHOLDS = exports.QUOTA_FRESH_MAX_AGE_MS = exports.QUOTA_AGING_MAX_AGE_MS = exports.formatQuotaAge = exports.classifyQuotaFreshness = exports.resolveQuota = exports.writeQuotaSnapshot = exports.readQuotaSnapshot = exports.QuotaPoller = exports.describeQuotaFailure = exports.withQuotaProjections = exports.withClaudePlan = exports.quotaWindowShortLabel = exports.quotaWindowLabel = exports.quotaWindowHasData = exports.quotaWindowApplies = exports.quotaStateFromClaudeUsagePayload = exports.quotaSampleExpired = exports.projectQuotaWindow = exports.formatExtraUsage = exports.fetchQuota = exports.extraQuotaRows = void 0;
|
|
15
|
+
exports.messageUsageSchema = exports.ToolCallTracker = exports.extractToolCalls = exports.extractToolCall = exports.extractErrorMessage = exports.categorizeError = exports.gatherAssetsForCwd = exports.codexSessions = exports.readCodexAssets = exports.claudeSessions = exports.readClaudeAssets = exports.extractCommands = exports.extractFilePaths = exports.extractUrls = exports.extractTokenUsage = exports.getObservedContextWindowPath = exports.recordObservedContextWindow = exports.loadObservedContextWindows = exports.LITELLM_CATALOG_URL = exports.normalizeLiteLlmContextWindows = exports.normalizeLiteLlmCatalog = exports.hydratePricingCatalog = exports.RESOLVED_MODEL_CATALOG_SCHEMA_VERSION = exports.resolveModelAlias = exports.registerModelAlias = exports.importResolvedModelCatalog = exports.exportResolvedModelCatalog = exports.mergeCostComponents = exports.costSourceFromPricingProvenance = exports.getPricingCatalogInfo = exports.clearRegisteredModelPricing = exports.registerModelPricing = exports.isMovingModelAlias = exports.canonicalModelId = exports.MODEL_PROVIDER_IDS = exports.formatCost = exports.sortModelIds = exports.compareModelIds = exports.getModelDisplayInfo = exports.shortModelName = exports.mergeCostSources = exports.calculateCostWithProvenance = exports.calculateCostWithPricing = exports.calculateCost = exports.getModelInfo = exports.resolveModelPricing = exports.getModelPricing = exports.parseModelId = exports.DEFAULT_CONTEXT_WINDOW = exports.resolveModelContextWindow = void 0;
|
|
16
|
+
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.providerFailureDiagnosisSchema = exports.providerRetryAfterSchema = exports.providerFailureEvidenceSchema = exports.providerAuthenticationEvidenceSchema = exports.quotaHistoryDailyBucketSchema = exports.quotaHistorySampleSchema = exports.quotaHistoryRuntimeProviderSchema = exports.providerQuotaMapSchema = exports.zaiProviderQuotaStateSchema = exports.codexProviderQuotaStateSchema = exports.claudeProviderQuotaStateSchema = exports.providerQuotaStateSchema = exports.runtimeQuotaProviderSchema = exports.quotaFailureDescriptorSchema = exports.peakHoursStateSchema = exports.codexResetCreditsSnapshotSchema = exports.codexResetCreditSchema = exports.quotaSourceSchema = exports.quotaProviderIdSchema = exports.quotaFailureKindSchema = exports.quotaExtraUsageSchema = exports.quotaLimitRowSchema = exports.quotaStateSchema = exports.quotaWindowSchema = exports.extractSessionEvents = exports.permissionModeSchema = exports.sessionEventSchema = exports.sessionMessageSchema = void 0;
|
|
17
|
+
exports.resolveWorkspaceRoots = exports.TOOL_CATEGORIES = exports.classifyTool = exports.CODEX_ARCHIVED_SESSIONS_SUBDIR = exports.CODEX_SESSIONS_SUBDIR = exports.forceFileCredentialStore = exports.getCodexSessionsDirs = exports.syncCodexLiveStateAsync = exports.readStoredCodexAccount = exports.repairCodexCredentialStores = exports.inspectCodexCredentialStores = exports.fetchProviderServiceStatus = exports.parseCodexLoginStatus = exports.parseClaudeAuthStatus = exports.decodeCodexErrorInfo = exports.CODEX_ERROR_INFO_KINDS = exports.PROVIDER_RECOVERY_ACTIONS = exports.PROVIDER_FAILURE_EVIDENCE_SOURCES = exports.PROVIDER_FAILURE_CODES = exports.PROVIDER_CREDENTIAL_KINDS = exports.PROVIDER_AUTHENTICATION_STATES = exports.PROVIDER_AUTHENTICATION_SOURCES = exports.diagnoseProviderFailure = exports.mergeFailingToolWindows = exports.failingToolTrend = exports.FAILING_TOOL_TREND_ARROWS = exports.scopePeakHoursToSessionProvider = exports.PEAK_HOURS_DESCRIPTION = exports.PEAK_HOURS_CACHE_MS = exports.isClaudeCodeSessionProvider = exports.getScheduledPeakHoursState = exports.fetchPeakHoursStatus = exports.DEFAULT_PEAK_HOURS_TIMEOUT_MS = exports.createPeakHoursNotApplicableState = exports._resetPeakHoursCache = exports.runDoctor = exports.getSessionDiagnostics = exports.formatHealthReport = exports.toLegacyProviderStatus = exports.fetchOpenAIStatus = void 0;
|
|
18
18
|
var usageNormalization_1 = require("./usageNormalization");
|
|
19
19
|
Object.defineProperty(exports, "normalizeProviderUsage", { enumerable: true, get: function () { return usageNormalization_1.normalizeProviderUsage; } });
|
|
20
20
|
Object.defineProperty(exports, "extractNormalizedUsage", { enumerable: true, get: function () { return usageNormalization_1.extractNormalizedUsage; } });
|
|
@@ -41,6 +41,9 @@ var promptHistory_1 = require("./promptHistory");
|
|
|
41
41
|
Object.defineProperty(exports, "collectPromptHistory", { enumerable: true, get: function () { return promptHistory_1.collectPromptHistory; } });
|
|
42
42
|
Object.defineProperty(exports, "isPromptHistorySessionSettled", { enumerable: true, get: function () { return promptHistory_1.isPromptHistorySessionSettled; } });
|
|
43
43
|
Object.defineProperty(exports, "parsePromptHistoryCursor", { enumerable: true, get: function () { return promptHistory_1.parsePromptHistoryCursor; } });
|
|
44
|
+
Object.defineProperty(exports, "PROMPT_HISTORY_ORDINAL_MAX_RECORD_BYTES", { enumerable: true, get: function () { return promptHistory_1.PROMPT_HISTORY_ORDINAL_MAX_RECORD_BYTES; } });
|
|
45
|
+
var toolCallOrigins_1 = require("./toolCallOrigins");
|
|
46
|
+
Object.defineProperty(exports, "findToolCallOrigins", { enumerable: true, get: function () { return toolCallOrigins_1.findToolCallOrigins; } });
|
|
44
47
|
var sessionPromptHistory_1 = require("./sessionPromptHistory");
|
|
45
48
|
Object.defineProperty(exports, "collectSessionPromptHistory", { enumerable: true, get: function () { return sessionPromptHistory_1.collectSessionPromptHistory; } });
|
|
46
49
|
var humanPrompt_1 = require("./humanPrompt");
|
|
@@ -210,6 +213,9 @@ Object.defineProperty(exports, "extractPatchFilePaths", { enumerable: true, get:
|
|
|
210
213
|
Object.defineProperty(exports, "normalizeCodexToolName", { enumerable: true, get: function () { return codexParser_1.normalizeCodexToolName; } });
|
|
211
214
|
Object.defineProperty(exports, "normalizeCodexToolInput", { enumerable: true, get: function () { return codexParser_1.normalizeCodexToolInput; } });
|
|
212
215
|
Object.defineProperty(exports, "resolveCodexCallUsage", { enumerable: true, get: function () { return codexParser_1.resolveCodexCallUsage; } });
|
|
216
|
+
var codexRolloutOrigin_1 = require("./parsers/codexRolloutOrigin");
|
|
217
|
+
Object.defineProperty(exports, "codexRolloutOrigin", { enumerable: true, get: function () { return codexRolloutOrigin_1.codexRolloutOrigin; } });
|
|
218
|
+
Object.defineProperty(exports, "codexSpawnParentFromSource", { enumerable: true, get: function () { return codexRolloutOrigin_1.codexSpawnParentFromSource; } });
|
|
213
219
|
// Parsers — Subagent scanning
|
|
214
220
|
var subagentScanner_1 = require("./parsers/subagentScanner");
|
|
215
221
|
Object.defineProperty(exports, "scanSubagentDir", { enumerable: true, get: function () { return subagentScanner_1.scanSubagentDir; } });
|
|
@@ -315,6 +321,8 @@ var jsonlTail_1 = require("./watchers/jsonlTail");
|
|
|
315
321
|
Object.defineProperty(exports, "createJsonlTail", { enumerable: true, get: function () { return jsonlTail_1.createJsonlTail; } });
|
|
316
322
|
Object.defineProperty(exports, "DEFAULT_JSONL_TAIL_MAX_LINE_BYTES", { enumerable: true, get: function () { return jsonlTail_1.DEFAULT_JSONL_TAIL_MAX_LINE_BYTES; } });
|
|
317
323
|
Object.defineProperty(exports, "DEFAULT_JSONL_TAIL_READ_BYTES", { enumerable: true, get: function () { return jsonlTail_1.DEFAULT_JSONL_TAIL_READ_BYTES; } });
|
|
324
|
+
Object.defineProperty(exports, "JSONL_TAIL_CHECKPOINT_VERSION", { enumerable: true, get: function () { return jsonlTail_1.JSONL_TAIL_CHECKPOINT_VERSION; } });
|
|
325
|
+
Object.defineProperty(exports, "JsonlTailSymlinkError", { enumerable: true, get: function () { return jsonlTail_1.JsonlTailSymlinkError; } });
|
|
318
326
|
// Formatters
|
|
319
327
|
var formatting_1 = require("./formatting");
|
|
320
328
|
Object.defineProperty(exports, "addLocalDays", { enumerable: true, get: function () { return formatting_1.addLocalDays; } });
|
|
@@ -427,6 +435,8 @@ Object.defineProperty(exports, "readCodexAuthIdentity", { enumerable: true, get:
|
|
|
427
435
|
Object.defineProperty(exports, "readCodexLastRefresh", { enumerable: true, get: function () { return codexAuth_1.readLastRefresh; } });
|
|
428
436
|
Object.defineProperty(exports, "readCodexAccessTokenExpiry", { enumerable: true, get: function () { return codexAuth_1.readAccessTokenExpiry; } });
|
|
429
437
|
Object.defineProperty(exports, "codexIdentitiesMatch", { enumerable: true, get: function () { return codexAuth_1.identitiesMatch; } });
|
|
438
|
+
Object.defineProperty(exports, "codexRefreshFingerprint", { enumerable: true, get: function () { return codexAuth_1.codexRefreshFingerprint; } });
|
|
439
|
+
Object.defineProperty(exports, "compareCodexAuthFreshness", { enumerable: true, get: function () { return codexAuth_1.compareCodexAuthFreshness; } });
|
|
430
440
|
// Accounts
|
|
431
441
|
var ensureDefaultAccounts_1 = require("./ensureDefaultAccounts");
|
|
432
442
|
Object.defineProperty(exports, "ensureDefaultAccounts", { enumerable: true, get: function () { return ensureDefaultAccounts_1.ensureDefaultAccounts; } });
|
|
@@ -638,6 +648,13 @@ Object.defineProperty(exports, "compareModelIds", { enumerable: true, get: funct
|
|
|
638
648
|
Object.defineProperty(exports, "sortModelIds", { enumerable: true, get: function () { return modelInfo_1.sortModelIds; } });
|
|
639
649
|
Object.defineProperty(exports, "formatCost", { enumerable: true, get: function () { return modelInfo_1.formatCost; } });
|
|
640
650
|
Object.defineProperty(exports, "MODEL_PROVIDER_IDS", { enumerable: true, get: function () { return modelInfo_1.MODEL_PROVIDER_IDS; } });
|
|
651
|
+
Object.defineProperty(exports, "canonicalModelId", { enumerable: true, get: function () { return modelInfo_1.canonicalModelId; } });
|
|
652
|
+
Object.defineProperty(exports, "isMovingModelAlias", { enumerable: true, get: function () { return modelInfo_1.isMovingModelAlias; } });
|
|
653
|
+
Object.defineProperty(exports, "registerModelPricing", { enumerable: true, get: function () { return modelInfo_1.registerModelPricing; } });
|
|
654
|
+
Object.defineProperty(exports, "clearRegisteredModelPricing", { enumerable: true, get: function () { return modelInfo_1.clearRegisteredModelPricing; } });
|
|
655
|
+
Object.defineProperty(exports, "getPricingCatalogInfo", { enumerable: true, get: function () { return modelInfo_1.getPricingCatalogInfo; } });
|
|
656
|
+
Object.defineProperty(exports, "costSourceFromPricingProvenance", { enumerable: true, get: function () { return modelInfo_1.costSourceFromPricingProvenance; } });
|
|
657
|
+
Object.defineProperty(exports, "mergeCostComponents", { enumerable: true, get: function () { return modelInfo_1.mergeCostComponents; } });
|
|
641
658
|
var modelCatalog_1 = require("./modelCatalog");
|
|
642
659
|
Object.defineProperty(exports, "exportResolvedModelCatalog", { enumerable: true, get: function () { return modelCatalog_1.exportResolvedModelCatalog; } });
|
|
643
660
|
Object.defineProperty(exports, "importResolvedModelCatalog", { enumerable: true, get: function () { return modelCatalog_1.importResolvedModelCatalog; } });
|
|
@@ -775,6 +792,11 @@ Object.defineProperty(exports, "PROVIDER_CREDENTIAL_KINDS", { enumerable: true,
|
|
|
775
792
|
Object.defineProperty(exports, "PROVIDER_FAILURE_CODES", { enumerable: true, get: function () { return providerFailure_2.PROVIDER_FAILURE_CODES; } });
|
|
776
793
|
Object.defineProperty(exports, "PROVIDER_FAILURE_EVIDENCE_SOURCES", { enumerable: true, get: function () { return providerFailure_2.PROVIDER_FAILURE_EVIDENCE_SOURCES; } });
|
|
777
794
|
Object.defineProperty(exports, "PROVIDER_RECOVERY_ACTIONS", { enumerable: true, get: function () { return providerFailure_2.PROVIDER_RECOVERY_ACTIONS; } });
|
|
795
|
+
Object.defineProperty(exports, "CODEX_ERROR_INFO_KINDS", { enumerable: true, get: function () { return providerFailure_2.CODEX_ERROR_INFO_KINDS; } });
|
|
796
|
+
Object.defineProperty(exports, "decodeCodexErrorInfo", { enumerable: true, get: function () { return providerFailure_2.decodeCodexErrorInfo; } });
|
|
797
|
+
var authStatus_1 = require("./authStatus");
|
|
798
|
+
Object.defineProperty(exports, "parseClaudeAuthStatus", { enumerable: true, get: function () { return authStatus_1.parseClaudeAuthStatus; } });
|
|
799
|
+
Object.defineProperty(exports, "parseCodexLoginStatus", { enumerable: true, get: function () { return authStatus_1.parseCodexLoginStatus; } });
|
|
778
800
|
var providerServiceStatus_1 = require("./providerServiceStatus");
|
|
779
801
|
Object.defineProperty(exports, "fetchProviderServiceStatus", { enumerable: true, get: function () { return providerServiceStatus_1.fetchProviderServiceStatus; } });
|
|
780
802
|
var codexCredentialDoctor_1 = require("./codexCredentialDoctor");
|
|
@@ -786,6 +808,7 @@ Object.defineProperty(exports, "syncCodexLiveStateAsync", { enumerable: true, ge
|
|
|
786
808
|
// Codex rollout directories (live and archived)
|
|
787
809
|
var codexPaths_1 = require("./codexPaths");
|
|
788
810
|
Object.defineProperty(exports, "getCodexSessionsDirs", { enumerable: true, get: function () { return codexPaths_1.getCodexSessionsDirs; } });
|
|
811
|
+
Object.defineProperty(exports, "forceFileCredentialStore", { enumerable: true, get: function () { return codexPaths_1.forceFileCredentialStore; } });
|
|
789
812
|
Object.defineProperty(exports, "CODEX_SESSIONS_SUBDIR", { enumerable: true, get: function () { return codexPaths_1.CODEX_SESSIONS_SUBDIR; } });
|
|
790
813
|
Object.defineProperty(exports, "CODEX_ARCHIVED_SESSIONS_SUBDIR", { enumerable: true, get: function () { return codexPaths_1.CODEX_ARCHIVED_SESSIONS_SUBDIR; } });
|
|
791
814
|
// Tool categories across providers
|
package/dist/modelCatalog.js
CHANGED
|
@@ -35,7 +35,8 @@ function exportResolvedModelCatalog(ids) {
|
|
|
35
35
|
id,
|
|
36
36
|
canonicalId,
|
|
37
37
|
contextWindow: (0, modelContext_1.resolveModelContextWindow)(id),
|
|
38
|
-
|
|
38
|
+
// Registered prices are this realm's local configuration, never exported.
|
|
39
|
+
pricing: (0, modelInfo_1.resolveModelPricing)(id, { includeRegistered: false }),
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
const selectedCanonicalIds = new Set(Object.values(models).flatMap(({ id, canonicalId }) => [id, canonicalId]));
|
package/dist/modelInfo.d.ts
CHANGED
|
@@ -14,11 +14,18 @@
|
|
|
14
14
|
* baseline without requiring a redeploy when vendor prices change.
|
|
15
15
|
* - Longest-prefix matching handles variants like `claude-opus-4.5-20250514`
|
|
16
16
|
* against a key like `claude-opus-4.5`. Same pattern used in modelContext.ts.
|
|
17
|
+
* - A consumer layer (`registerModelPricing`) sits beside the catalog and
|
|
18
|
+
* imported layers and survives their resets.
|
|
19
|
+
* - Every table-derived value is computed lazily, so a tree-shaken bundle that
|
|
20
|
+
* only uses the parsing/display helpers does not retain the pricing table.
|
|
17
21
|
*
|
|
18
22
|
* @module modelInfo
|
|
19
23
|
*/
|
|
20
24
|
import type { ModelProviderId } from './providerIds';
|
|
25
|
+
import type { PricingProvenance } from './usageNormalization';
|
|
21
26
|
export { MODEL_PROVIDER_IDS } from './providerIds';
|
|
27
|
+
export { formatCost } from './formatting';
|
|
28
|
+
export type { FormatCostOptions } from './formatting';
|
|
22
29
|
/** Pricing information for a model. All costs are per million tokens in USD. */
|
|
23
30
|
export interface ModelPricing {
|
|
24
31
|
inputCostPerMillion: number;
|
|
@@ -26,7 +33,18 @@ export interface ModelPricing {
|
|
|
26
33
|
cacheWriteCostPerMillion: number;
|
|
27
34
|
cacheReadCostPerMillion: number;
|
|
28
35
|
}
|
|
29
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Which layer answered a pricing lookup.
|
|
38
|
+
*
|
|
39
|
+
* - `registered` — an entry supplied through `registerModelPricing` (consumer
|
|
40
|
+
* configuration such as negotiated prices). Always an exact match.
|
|
41
|
+
* - `imported` — an exact resolution imported from another realm via
|
|
42
|
+
* `importResolvedModelCatalog`.
|
|
43
|
+
* - `catalog` — the runtime LiteLLM catalog (`hydratePricingCatalog`).
|
|
44
|
+
* - `static` — the offline baseline shipped with this package.
|
|
45
|
+
* - `none` — unpriced.
|
|
46
|
+
*/
|
|
47
|
+
export type ModelPricingSource = 'registered' | 'imported' | 'catalog' | 'static' | 'none';
|
|
30
48
|
export type ModelPricingMatch = 'exact' | 'prefix' | 'none';
|
|
31
49
|
export interface ModelPricingProvenance {
|
|
32
50
|
source: ModelPricingSource;
|
|
@@ -37,10 +55,75 @@ export interface ModelPricingProvenance {
|
|
|
37
55
|
}
|
|
38
56
|
export interface ResolvedModelPricing {
|
|
39
57
|
modelId: string;
|
|
58
|
+
/**
|
|
59
|
+
* The looked-up id trimmed, lowercased, without `[1m]`, and resolved through
|
|
60
|
+
* registered aliases. Deployment prefixes and date suffixes are kept, so
|
|
61
|
+
* this is not the same value as `canonicalModelId(modelId)`.
|
|
62
|
+
*/
|
|
40
63
|
canonicalModelId: string;
|
|
41
64
|
pricing: ModelPricing | null;
|
|
42
65
|
provenance: ModelPricingProvenance;
|
|
43
66
|
}
|
|
67
|
+
export interface ResolveModelPricingOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Consult entries from `registerModelPricing`. Defaults to true; pass false
|
|
70
|
+
* to see what the package's own layers would answer.
|
|
71
|
+
*/
|
|
72
|
+
includeRegistered?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface RegisterModelPricingOptions {
|
|
75
|
+
/**
|
|
76
|
+
* `false` (default): the entry wins over every other layer — explicit
|
|
77
|
+
* configuration such as negotiated prices.
|
|
78
|
+
*
|
|
79
|
+
* `true`: the entry is a gap filler. It is used only when no other layer has
|
|
80
|
+
* an exact price for the looked-up id (its raw form or registered alias
|
|
81
|
+
* target), so it replaces a prefix-inherited or missing price but never an
|
|
82
|
+
* exact static, catalog, or imported one.
|
|
83
|
+
*/
|
|
84
|
+
onlyIfMissing?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** Where the active pricing tables came from. */
|
|
87
|
+
export type PricingCatalogSource = 'static' | 'litellm' | 'stale-cache' | 'imported';
|
|
88
|
+
/** Describes the pricing basis currently applied to cost estimates. */
|
|
89
|
+
export interface PricingCatalogInfo {
|
|
90
|
+
/**
|
|
91
|
+
* `litellm` — catalog loaded from a fresh fetch or a cache within its TTL;
|
|
92
|
+
* `stale-cache` — catalog loaded from a cache older than its TTL (the
|
|
93
|
+
* refresh failed or was skipped offline); `imported` — no catalog, but
|
|
94
|
+
* resolutions imported from another realm are active; `static` — only the
|
|
95
|
+
* built-in baseline. Registered entries never change the source.
|
|
96
|
+
*/
|
|
97
|
+
source: PricingCatalogSource;
|
|
98
|
+
/** When the active catalog was fetched, if known. Only set for catalog sources. */
|
|
99
|
+
fetchedAt?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Stable, non-cryptographic fingerprint (`fnv1a64:<16 hex>`) of the active
|
|
102
|
+
* static, catalog, imported, and registered pricing tables. Equal digests
|
|
103
|
+
* mean equal prices; it changes whenever any price in any layer changes.
|
|
104
|
+
* Registered aliases are not part of it.
|
|
105
|
+
*/
|
|
106
|
+
digest: string;
|
|
107
|
+
/** Entries in the runtime catalog layer. */
|
|
108
|
+
catalogEntries: number;
|
|
109
|
+
/** Entries in the `registerModelPricing` layer. */
|
|
110
|
+
registeredEntries: number;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Internal: how the catalog overrides were obtained, recorded by
|
|
114
|
+
* `pricingCatalog.ts` alongside `_setPricingOverrides`.
|
|
115
|
+
*/
|
|
116
|
+
export interface PricingOverridesBasis {
|
|
117
|
+
source: 'litellm' | 'stale-cache';
|
|
118
|
+
fetchedAt?: string;
|
|
119
|
+
}
|
|
120
|
+
/** One contribution to a cost rollup, for `mergeCostComponents`. */
|
|
121
|
+
export interface CostComponent {
|
|
122
|
+
/** Provenance of this component's cost; undefined means nothing seen yet. */
|
|
123
|
+
source?: CostSource;
|
|
124
|
+
/** Tokens this component contributed. */
|
|
125
|
+
tokens: number;
|
|
126
|
+
}
|
|
44
127
|
/**
|
|
45
128
|
* Token usage for the legacy cost calculation contract.
|
|
46
129
|
* @deprecated Use NormalizedUsage and calculateNormalizedUsageCost. This shape
|
|
@@ -65,6 +148,12 @@ export interface ParsedModelId {
|
|
|
65
148
|
provider: ModelProvider;
|
|
66
149
|
family: string;
|
|
67
150
|
version: string;
|
|
151
|
+
/**
|
|
152
|
+
* GPT tier name (`astra`, `sol`, `terra`, `luna`) when the id carries one,
|
|
153
|
+
* e.g. `gpt-6.1-sol` → `sol`. `version` still includes it (`6.1-sol`).
|
|
154
|
+
* Absent for every other id.
|
|
155
|
+
*/
|
|
156
|
+
variant?: string;
|
|
68
157
|
}
|
|
69
158
|
/** Comprehensive model metadata. */
|
|
70
159
|
export interface ModelInfo {
|
|
@@ -104,8 +193,12 @@ export interface ModelDisplayInfo {
|
|
|
104
193
|
* after a successful LiteLLM hydration. Not part of the stable public API,
|
|
105
194
|
* but exported so the Node-only catalog module can wire itself in without
|
|
106
195
|
* creating a circular import.
|
|
196
|
+
*
|
|
197
|
+
* `basis` records how the map was obtained for `getPricingCatalogInfo()`;
|
|
198
|
+
* omitted, a non-empty map reports as `litellm` with no `fetchedAt`. Every
|
|
199
|
+
* call replaces the previous basis.
|
|
107
200
|
*/
|
|
108
|
-
export declare function _setPricingOverrides(overrides: Record<string, ModelPricing
|
|
201
|
+
export declare function _setPricingOverrides(overrides: Record<string, ModelPricing>, basis?: PricingOverridesBasis): void;
|
|
109
202
|
/** Internal: snapshot current overrides (test + diagnostics). */
|
|
110
203
|
export declare function _getPricingOverrides(): Record<string, ModelPricing>;
|
|
111
204
|
/** Internal: clear overrides (used by tests and when disabling hydration). */
|
|
@@ -118,8 +211,67 @@ export declare function _clearPricingOverrides(): void;
|
|
|
118
211
|
export declare function _setImportedResolvedPricing(values: Record<string, ResolvedModelPricing>): void;
|
|
119
212
|
/** Internal test hook. */
|
|
120
213
|
export declare function _clearImportedResolvedPricing(): void;
|
|
214
|
+
/**
|
|
215
|
+
* Register consumer pricing for model ids, e.g. negotiated or private-deployment
|
|
216
|
+
* rates. This layer is separate from the runtime catalog and imported layers:
|
|
217
|
+
* `_setPricingOverrides`, `hydratePricingCatalog`, and
|
|
218
|
+
* `importResolvedModelCatalog` never reset it; only
|
|
219
|
+
* `clearRegisteredModelPricing` does.
|
|
220
|
+
*
|
|
221
|
+
* Keys are trimmed, lowercased, and stripped of `[1m]`, like the other tables.
|
|
222
|
+
* Matching is exact, never by prefix, against the looked-up id, its registered
|
|
223
|
+
* alias target, and its `canonicalModelId()` form — so a `claude-opus-5-5`
|
|
224
|
+
* entry also answers `claude-opus-5-5-20261001` and
|
|
225
|
+
* `us.anthropic.claude-opus-5-5-20261001-v1:0`.
|
|
226
|
+
*
|
|
227
|
+
* Successive calls merge; re-registering a key replaces its price and mode.
|
|
228
|
+
* Entries whose four rates are not all finite, nonnegative numbers are
|
|
229
|
+
* skipped. Results carry `provenance.source: 'registered'`.
|
|
230
|
+
*
|
|
231
|
+
* Registered entries are realm-local configuration and are kept out of
|
|
232
|
+
* cross-realm snapshots: they are not listed by the catalog id enumeration,
|
|
233
|
+
* and `resolveModelPricing(id, { includeRegistered: false })` is the
|
|
234
|
+
* resolution a snapshot should carry. An exported price would otherwise be
|
|
235
|
+
* pinned as an exact import in the other realm and outlive
|
|
236
|
+
* `clearRegisteredModelPricing` there. Register in each realm instead.
|
|
237
|
+
*/
|
|
238
|
+
export declare function registerModelPricing(entries: Record<string, ModelPricing>, options?: RegisterModelPricingOptions): void;
|
|
239
|
+
/** Remove every entry added by `registerModelPricing`. */
|
|
240
|
+
export declare function clearRegisteredModelPricing(): void;
|
|
241
|
+
/**
|
|
242
|
+
* Describe the pricing basis behind current cost estimates: which layer the
|
|
243
|
+
* prices come from, when the catalog was fetched, and a digest that changes
|
|
244
|
+
* whenever any active price changes. Pure and cheap after the first call (the
|
|
245
|
+
* digest is memoized until a table changes).
|
|
246
|
+
*/
|
|
247
|
+
export declare function getPricingCatalogInfo(): PricingCatalogInfo;
|
|
121
248
|
/** Internal: list every ID known to the pricing resolver. */
|
|
122
249
|
export declare function _getModelPricingIds(): string[];
|
|
250
|
+
/**
|
|
251
|
+
* Reduce a model id to the bare model name it denotes, for grouping and
|
|
252
|
+
* matching across hosts and snapshots.
|
|
253
|
+
*
|
|
254
|
+
* Trims and lowercases, then removes: `[1m]`; every leading `segment/`
|
|
255
|
+
* provider or region prefix (`azure/us/gpt-6.1-terra` → `gpt-6.1-terra`);
|
|
256
|
+
* Bedrock forms (`us.anthropic.claude-opus-5-5-20261001-v1:0` →
|
|
257
|
+
* `claude-opus-5-5`, also `eu.`/`apac.`/`global.` and bare `anthropic.`);
|
|
258
|
+
* Vertex `@YYYYMMDD`; trailing `-YYYYMMDD` and `-YYYY-MM-DD` dates; `-latest`.
|
|
259
|
+
* Meaningful suffixes (`-mini`, `-codex`, `-sol`, `-terra`, `-high`, …) stay.
|
|
260
|
+
*
|
|
261
|
+
* Pure and syntactic: registered aliases are not applied (see
|
|
262
|
+
* `resolveModelAlias`). Pricing lookups do not use this to reach other
|
|
263
|
+
* models' prices — dated snapshots and deployments can bill differently — only
|
|
264
|
+
* to match `registerModelPricing` entries.
|
|
265
|
+
*/
|
|
266
|
+
export declare function canonicalModelId(id: string): string;
|
|
267
|
+
/**
|
|
268
|
+
* True for model names an agent CLI resolves to a different concrete model
|
|
269
|
+
* over time (`default`, `auto`, `latest`, `sonnet`, `opus`, `haiku`, `fable`,
|
|
270
|
+
* and Claude Code's `opusplan`), so a recorded value names a moving target
|
|
271
|
+
* rather than a model. Case-insensitive, trimmed, and `[1m]`-tolerant
|
|
272
|
+
* (`sonnet[1m]`). Dated or versioned ids are never moving aliases.
|
|
273
|
+
*/
|
|
274
|
+
export declare function isMovingModelAlias(id: string): boolean;
|
|
123
275
|
/**
|
|
124
276
|
* Parses a model ID into {provider, family, version}.
|
|
125
277
|
*
|
|
@@ -130,14 +282,23 @@ export declare function _getModelPricingIds(): string[];
|
|
|
130
282
|
* Returns null for anything else — callers should treat that as "unknown model".
|
|
131
283
|
*/
|
|
132
284
|
export declare function parseModelId(modelId: string): ParsedModelId | null;
|
|
133
|
-
/**
|
|
134
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Resolve pricing and disclose which layer answered and whether the result was
|
|
287
|
+
* inherited by prefix.
|
|
288
|
+
*
|
|
289
|
+
* Order: registered entries (default mode); exact imported, catalog, and
|
|
290
|
+
* static matches; registered `onlyIfMissing` entries; catalog then static
|
|
291
|
+
* prefix matches; unpriced.
|
|
292
|
+
*/
|
|
293
|
+
export declare function resolveModelPricing(modelId: string, options?: ResolveModelPricingOptions): ResolvedModelPricing;
|
|
135
294
|
/**
|
|
136
295
|
* Gets pricing for a model ID.
|
|
137
296
|
*
|
|
138
|
-
* Lookup order:
|
|
139
|
-
* 1.
|
|
140
|
-
* 2.
|
|
297
|
+
* Lookup order (see `resolveModelPricing` for provenance):
|
|
298
|
+
* 1. Registered entries (`registerModelPricing`), exact matches only.
|
|
299
|
+
* 2. Imported resolutions, then the runtime override map (from LiteLLM
|
|
300
|
+
* catalog hydration), then the static PRICING_TABLE — exact before prefix,
|
|
301
|
+
* with gap-filling registered entries between the two.
|
|
141
302
|
* 3. `null` — unknown model. Callers MUST handle this.
|
|
142
303
|
*
|
|
143
304
|
* The ID is first looked up verbatim (minus the "[1m]" suffix) — override
|
|
@@ -188,6 +349,19 @@ export declare function calculateCostWithProvenance(input: CostProvenanceInput):
|
|
|
188
349
|
* containing any unpriced or estimated component does not look fully reported.
|
|
189
350
|
*/
|
|
190
351
|
export declare function mergeCostSources(a: CostSource, b: CostSource): CostSource;
|
|
352
|
+
/**
|
|
353
|
+
* Map the provenance `calculateNormalizedUsageCost` reports to the display
|
|
354
|
+
* cost source: provider-reported costs are `reported`, costs computed from
|
|
355
|
+
* explicit or catalog pricing are `estimated`, and unpriced stays `unpriced`.
|
|
356
|
+
*/
|
|
357
|
+
export declare function costSourceFromPricingProvenance(provenance: PricingProvenance): CostSource;
|
|
358
|
+
/**
|
|
359
|
+
* Merge the cost sources of a rollup's components, least certain winning (as
|
|
360
|
+
* `mergeCostSources`). Components without a `source` have not been seen yet
|
|
361
|
+
* and are ignored, and an `unpriced` component that contributed no tokens
|
|
362
|
+
* does not taint the total. Returns `undefined` when nothing counted.
|
|
363
|
+
*/
|
|
364
|
+
export declare function mergeCostComponents(components: Iterable<CostComponent>): CostSource | undefined;
|
|
191
365
|
/**
|
|
192
366
|
* Short display label for model IDs. Keeps historical Claude family labels
|
|
193
367
|
* compact while normalizing common OpenAI labels.
|
|
@@ -197,15 +371,10 @@ export declare function shortModelName(modelId: string): string;
|
|
|
197
371
|
* Returns stable display metadata and a rank suitable for provider model menus.
|
|
198
372
|
*/
|
|
199
373
|
export declare function getModelDisplayInfo(modelId: string): ModelDisplayInfo;
|
|
200
|
-
/**
|
|
374
|
+
/**
|
|
375
|
+
* Compare two model IDs using shared provider/family ranking rules. Within a
|
|
376
|
+
* family and numeric version, GPT tiers rank astra > sol > terra > luna.
|
|
377
|
+
*/
|
|
201
378
|
export declare function compareModelIds(a: string, b: string): number;
|
|
202
379
|
/** Return a sorted copy of model IDs using shared provider/family ranking rules. */
|
|
203
380
|
export declare function sortModelIds<T extends string>(modelIds: readonly T[]): T[];
|
|
204
|
-
/**
|
|
205
|
-
* Formats a USD cost as a currency string.
|
|
206
|
-
*
|
|
207
|
-
* - `null` / `undefined` → `"—"` (honest "pricing unavailable").
|
|
208
|
-
* - `< $0.01` → 4 decimals, so sub-cent costs are still visible.
|
|
209
|
-
* - otherwise → 2 decimals.
|
|
210
|
-
*/
|
|
211
|
-
export declare function formatCost(cost: number | null | undefined): string;
|