sidekick-shared 0.24.4 → 0.25.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 +59 -0
- package/README.md +200 -52
- package/dist/accountChangeSignal.d.ts +3 -0
- package/dist/accountChangeSignal.js +19 -0
- package/dist/accountChanges.d.ts +21 -0
- package/dist/accountChanges.js +151 -0
- package/dist/accountManager.d.ts +13 -0
- package/dist/accountManager.js +60 -32
- package/dist/accountRegistry.d.ts +3 -1
- package/dist/accountRegistry.js +64 -41
- package/dist/accounts.js +40 -19
- package/dist/autoSwitch.d.ts +2 -1
- package/dist/autoSwitch.js +32 -7
- package/dist/browser.d.ts +10 -3
- package/dist/browser.js +17 -1
- package/dist/codexProfiles.d.ts +14 -0
- package/dist/codexProfiles.js +268 -116
- package/dist/codexQuotaWatcher.d.ts +6 -0
- package/dist/codexQuotaWatcher.js +101 -47
- package/dist/context/sessionContext.js +2 -4
- package/dist/ensureDefaultAccounts.js +4 -4
- package/dist/index.d.ts +32 -15
- package/dist/index.js +54 -9
- package/dist/modelAliases.d.ts +13 -0
- package/dist/modelAliases.js +58 -0
- package/dist/modelCatalog.d.ts +32 -0
- package/dist/modelCatalog.js +145 -0
- package/dist/modelContext.d.ts +36 -3
- package/dist/modelContext.js +109 -34
- package/dist/modelInfo.d.ts +30 -1
- package/dist/modelInfo.js +116 -26
- package/dist/multiProviderQuotaService.d.ts +8 -0
- package/dist/multiProviderQuotaService.js +64 -3
- package/dist/node.d.ts +8 -2
- package/dist/node.js +11 -1
- package/dist/observedContextWindows.d.ts +13 -0
- package/dist/observedContextWindows.js +13 -0
- package/dist/observedSessionCollector.d.ts +75 -4
- package/dist/observedSessionCollector.js +452 -42
- package/dist/parsers/codexHistory.d.ts +32 -0
- package/dist/parsers/codexHistory.js +125 -0
- package/dist/parsers/mcpToolName.d.ts +26 -0
- package/dist/parsers/mcpToolName.js +31 -0
- package/dist/parsers/sessionActivityDetector.d.ts +6 -0
- package/dist/parsers/sessionActivityDetector.js +17 -0
- package/dist/parsers/sessionPathResolver.d.ts +11 -4
- package/dist/parsers/sessionPathResolver.js +11 -4
- package/dist/paths.d.ts +7 -3
- package/dist/paths.js +7 -3
- package/dist/providerIds.d.ts +11 -0
- package/dist/providerIds.js +9 -0
- package/dist/providerQuota.d.ts +3 -1
- package/dist/providerQuota.js +3 -0
- package/dist/providers/claudeCode.d.ts +11 -1
- package/dist/providers/claudeCode.js +222 -39
- package/dist/providers/codex.d.ts +39 -1
- package/dist/providers/codex.js +326 -39
- package/dist/providers/codexDatabase.d.ts +9 -0
- package/dist/providers/codexDatabase.js +107 -2
- package/dist/providers/diagnostics.d.ts +13 -0
- package/dist/providers/diagnostics.js +88 -0
- package/dist/providers/factory.d.ts +14 -0
- package/dist/providers/factory.js +57 -0
- package/dist/providers/openCode.d.ts +20 -1
- package/dist/providers/openCode.js +361 -11
- package/dist/providers/openCodeDatabase.d.ts +10 -0
- package/dist/providers/openCodeDatabase.js +69 -0
- package/dist/providers/types.d.ts +57 -2
- package/dist/providers/types.js +4 -0
- package/dist/quota.d.ts +4 -1
- package/dist/quota.js +3 -7
- package/dist/quotaHistory.d.ts +3 -2
- package/dist/quotaHistory.js +2 -2
- package/dist/quotaPoller.d.ts +13 -1
- package/dist/quotaPoller.js +65 -3
- package/dist/quotaSnapshots.js +8 -77
- package/dist/schemas/accountManager.d.ts +2 -2
- package/dist/schemas/accountManager.js +2 -4
- package/dist/schemas/accountStatus.d.ts +3 -0
- package/dist/schemas/accountStatus.js +1 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +7 -2
- package/dist/schemas/observedSessionV1.d.ts +27 -26
- package/dist/schemas/observedSessionV1.js +6 -4
- package/dist/schemas/quota.d.ts +2 -2
- package/dist/schemas/quota.js +3 -6
- package/dist/schemas/quotaHistory.d.ts +2 -2
- package/dist/schemas/tokenEstimation.d.ts +1 -1
- package/dist/sessionMonitor.d.ts +15 -0
- package/dist/sessionMonitor.js +142 -0
- package/dist/sessionPreviews.d.ts +85 -0
- package/dist/sessionPreviews.js +549 -0
- package/dist/sessionTranscripts.js +10 -4
- package/dist/types/observedSessionV1.d.ts +6 -2
- package/dist/types/observedSessionV1.js +14 -8
- package/dist/writers/atomic.d.ts +20 -0
- package/dist/writers/atomic.js +190 -19
- package/package.json +22 -1
|
@@ -40,6 +40,7 @@ const codexQuota_1 = require("./codexQuota");
|
|
|
40
40
|
const quotaSnapshots_1 = require("./quotaSnapshots");
|
|
41
41
|
const quotaHistory_1 = require("./quotaHistory");
|
|
42
42
|
const codex_1 = require("./providers/codex");
|
|
43
|
+
const accountChanges_1 = require("./accountChanges");
|
|
43
44
|
const DEFAULT_DISCOVERY_POLL_INTERVAL_MS = 30_000;
|
|
44
45
|
const DEFAULT_LOCAL_SCAN_CACHE_MS = 5 * 60_000;
|
|
45
46
|
function accountEmail(account) {
|
|
@@ -86,6 +87,7 @@ class CodexQuotaWatcher {
|
|
|
86
87
|
now;
|
|
87
88
|
workspaceId;
|
|
88
89
|
appendHistorySample;
|
|
90
|
+
subscribeAccountsChanged;
|
|
89
91
|
listeners = [];
|
|
90
92
|
discoveryTimer;
|
|
91
93
|
provider = null;
|
|
@@ -96,6 +98,7 @@ class CodexQuotaWatcher {
|
|
|
96
98
|
lastLocalScanAt = Number.NEGATIVE_INFINITY;
|
|
97
99
|
lastLocalScanState = null;
|
|
98
100
|
running = false;
|
|
101
|
+
accountSubscription = null;
|
|
99
102
|
constructor(workspacePath, options = {}) {
|
|
100
103
|
this.workspacePath = workspacePath;
|
|
101
104
|
this.discoveryPollIntervalMs =
|
|
@@ -119,15 +122,14 @@ class CodexQuotaWatcher {
|
|
|
119
122
|
this.now = options.now ?? Date.now;
|
|
120
123
|
this.workspaceId = options.workspaceId;
|
|
121
124
|
this.appendHistorySample = options.appendHistorySample ?? quotaHistory_1.appendQuotaHistorySample;
|
|
125
|
+
this.subscribeAccountsChanged = options.subscribeAccountsChanged ?? accountChanges_1.onAccountsChanged;
|
|
122
126
|
}
|
|
123
127
|
start() {
|
|
124
128
|
if (this.running)
|
|
125
129
|
return;
|
|
126
130
|
this.running = true;
|
|
127
|
-
this.
|
|
128
|
-
this.
|
|
129
|
-
this.refreshActiveSession();
|
|
130
|
-
}, this.discoveryPollIntervalMs);
|
|
131
|
+
this.accountSubscription ??= this.subscribeAccountsChanged(() => this.handleAccountsChanged());
|
|
132
|
+
this.handleAccountsChanged();
|
|
131
133
|
}
|
|
132
134
|
stop() {
|
|
133
135
|
if (!this.running)
|
|
@@ -137,6 +139,8 @@ class CodexQuotaWatcher {
|
|
|
137
139
|
clearInterval(this.discoveryTimer);
|
|
138
140
|
this.discoveryTimer = undefined;
|
|
139
141
|
}
|
|
142
|
+
this.accountSubscription?.dispose();
|
|
143
|
+
this.accountSubscription = null;
|
|
140
144
|
this.teardownActiveSession();
|
|
141
145
|
}
|
|
142
146
|
dispose() {
|
|
@@ -157,21 +161,46 @@ class CodexQuotaWatcher {
|
|
|
157
161
|
return this.onUpdate(cb);
|
|
158
162
|
}
|
|
159
163
|
refresh() {
|
|
160
|
-
this.
|
|
164
|
+
this.handleAccountsChanged();
|
|
161
165
|
}
|
|
162
|
-
|
|
166
|
+
handleAccountsChanged() {
|
|
167
|
+
if (!this.running)
|
|
168
|
+
return;
|
|
169
|
+
const account = this.safeGetActiveAccount();
|
|
170
|
+
if (!account) {
|
|
171
|
+
if (this.discoveryTimer) {
|
|
172
|
+
clearInterval(this.discoveryTimer);
|
|
173
|
+
this.discoveryTimer = undefined;
|
|
174
|
+
}
|
|
175
|
+
this.teardownActiveSession();
|
|
176
|
+
this.emitState(makeUnavailableState(null, 'No Codex account configured'));
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (!this.discoveryTimer) {
|
|
180
|
+
this.discoveryTimer = setInterval(() => {
|
|
181
|
+
this.refreshActiveSession();
|
|
182
|
+
}, this.discoveryPollIntervalMs);
|
|
183
|
+
this.discoveryTimer.unref?.();
|
|
184
|
+
}
|
|
185
|
+
this.refreshActiveSession(account);
|
|
186
|
+
}
|
|
187
|
+
refreshActiveSession(account = this.safeGetActiveAccount()) {
|
|
188
|
+
if (!account) {
|
|
189
|
+
this.handleAccountsChanged();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
163
192
|
const provider = this.getProvider();
|
|
164
193
|
const nextSessionPath = provider.findActiveSession(this.workspacePath);
|
|
165
194
|
if (!nextSessionPath) {
|
|
166
195
|
this.teardownActiveSession();
|
|
167
|
-
this.emitCachedOrUnavailable();
|
|
196
|
+
this.emitCachedOrUnavailable(account);
|
|
168
197
|
return;
|
|
169
198
|
}
|
|
170
199
|
if (nextSessionPath !== this.sessionPath || this.reader == null) {
|
|
171
200
|
this.attachToSession(nextSessionPath);
|
|
172
201
|
return;
|
|
173
202
|
}
|
|
174
|
-
this.ingestSessionUpdate('readNew');
|
|
203
|
+
this.ingestSessionUpdate('readNew', account);
|
|
175
204
|
}
|
|
176
205
|
attachToSession(nextSessionPath) {
|
|
177
206
|
this.teardownActiveSession();
|
|
@@ -189,14 +218,30 @@ class CodexQuotaWatcher {
|
|
|
189
218
|
}
|
|
190
219
|
this.refreshActiveSession();
|
|
191
220
|
});
|
|
221
|
+
if (typeof this.fileWatcher.on === 'function') {
|
|
222
|
+
this.fileWatcher.on('error', () => {
|
|
223
|
+
try {
|
|
224
|
+
this.fileWatcher?.close();
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
// Discovery polling remains active.
|
|
228
|
+
}
|
|
229
|
+
this.fileWatcher = null;
|
|
230
|
+
});
|
|
231
|
+
}
|
|
192
232
|
}
|
|
193
233
|
catch {
|
|
194
234
|
this.emitCachedOrUnavailable();
|
|
195
235
|
}
|
|
196
236
|
}
|
|
197
|
-
ingestSessionUpdate(mode) {
|
|
237
|
+
ingestSessionUpdate(mode, knownAccount) {
|
|
238
|
+
const account = knownAccount ?? this.safeGetActiveAccount();
|
|
239
|
+
if (!account) {
|
|
240
|
+
this.handleAccountsChanged();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
198
243
|
if (!this.provider || !this.reader) {
|
|
199
|
-
this.emitCachedOrUnavailable();
|
|
244
|
+
this.emitCachedOrUnavailable(account);
|
|
200
245
|
return;
|
|
201
246
|
}
|
|
202
247
|
if (!this.reader.exists()) {
|
|
@@ -211,48 +256,45 @@ class CodexQuotaWatcher {
|
|
|
211
256
|
}
|
|
212
257
|
const liveQuota = (0, codexQuota_1.quotaFromCodexRateLimits)(this.provider.getLastRateLimits(), 'session');
|
|
213
258
|
if (!liveQuota) {
|
|
214
|
-
this.emitCachedOrUnavailable();
|
|
259
|
+
this.emitCachedOrUnavailable(account);
|
|
215
260
|
return;
|
|
216
261
|
}
|
|
217
|
-
const
|
|
218
|
-
const cached = account ? this.readSnapshot('codex', account.id) : null;
|
|
262
|
+
const cached = this.readSnapshot('codex', account.id);
|
|
219
263
|
const liveQuotaWithResetCredits = {
|
|
220
264
|
...liveQuota,
|
|
221
265
|
resetCredits: liveQuota.resetCredits ?? cached?.resetCredits,
|
|
222
266
|
};
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
catch {
|
|
253
|
-
// Synchronous errors swallowed for the same reason.
|
|
267
|
+
this.writeSnapshot('codex', account.id, liveQuotaWithResetCredits);
|
|
268
|
+
if (this.workspaceId) {
|
|
269
|
+
const sample = {
|
|
270
|
+
timestamp: liveQuotaWithResetCredits.capturedAt ?? new Date().toISOString(),
|
|
271
|
+
runtimeProvider: 'codex',
|
|
272
|
+
providerId: account.id,
|
|
273
|
+
workspaceId: this.workspaceId,
|
|
274
|
+
fiveHour: {
|
|
275
|
+
utilization: liveQuotaWithResetCredits.fiveHour.utilization,
|
|
276
|
+
resetsAt: liveQuotaWithResetCredits.fiveHour.resetsAt,
|
|
277
|
+
},
|
|
278
|
+
sevenDay: {
|
|
279
|
+
utilization: liveQuotaWithResetCredits.sevenDay.utilization,
|
|
280
|
+
resetsAt: liveQuotaWithResetCredits.sevenDay.resetsAt,
|
|
281
|
+
},
|
|
282
|
+
available: liveQuotaWithResetCredits.available,
|
|
283
|
+
error: liveQuotaWithResetCredits.error,
|
|
284
|
+
source: liveQuotaWithResetCredits.source,
|
|
285
|
+
stale: liveQuotaWithResetCredits.stale,
|
|
286
|
+
};
|
|
287
|
+
try {
|
|
288
|
+
const result = this.appendHistorySample(sample);
|
|
289
|
+
if (result && typeof result.catch === 'function') {
|
|
290
|
+
result.catch(() => {
|
|
291
|
+
// History append must never break the live emission path.
|
|
292
|
+
});
|
|
254
293
|
}
|
|
255
294
|
}
|
|
295
|
+
catch {
|
|
296
|
+
// Synchronous errors swallowed for the same reason.
|
|
297
|
+
}
|
|
256
298
|
}
|
|
257
299
|
this.emitState(enrichQuotaState({
|
|
258
300
|
...liveQuotaWithResetCredits,
|
|
@@ -260,8 +302,12 @@ class CodexQuotaWatcher {
|
|
|
260
302
|
providerId: 'codex',
|
|
261
303
|
}, account));
|
|
262
304
|
}
|
|
263
|
-
emitCachedOrUnavailable() {
|
|
264
|
-
const account = this.
|
|
305
|
+
emitCachedOrUnavailable(knownAccount) {
|
|
306
|
+
const account = knownAccount ?? this.safeGetActiveAccount();
|
|
307
|
+
if (!account) {
|
|
308
|
+
this.emitState(makeUnavailableState(null, 'No Codex account configured'));
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
265
311
|
const scanNow = this.now();
|
|
266
312
|
if (scanNow - this.lastLocalScanAt < this.localScanCacheMs) {
|
|
267
313
|
if (this.lastLocalScanState) {
|
|
@@ -296,7 +342,7 @@ class CodexQuotaWatcher {
|
|
|
296
342
|
localProvider?.dispose();
|
|
297
343
|
}
|
|
298
344
|
}
|
|
299
|
-
const cached =
|
|
345
|
+
const cached = this.readSnapshot('codex', account.id);
|
|
300
346
|
if (cached) {
|
|
301
347
|
this.emitState(enrichQuotaState({
|
|
302
348
|
...cached,
|
|
@@ -331,6 +377,14 @@ class CodexQuotaWatcher {
|
|
|
331
377
|
}
|
|
332
378
|
return this.provider;
|
|
333
379
|
}
|
|
380
|
+
safeGetActiveAccount() {
|
|
381
|
+
try {
|
|
382
|
+
return this.getActiveAccount();
|
|
383
|
+
}
|
|
384
|
+
catch {
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
334
388
|
teardownActiveSession() {
|
|
335
389
|
if (this.fileWatcher) {
|
|
336
390
|
this.fileWatcher.close();
|
|
@@ -12,6 +12,7 @@ exports.createSessionContextProjector = createSessionContextProjector;
|
|
|
12
12
|
exports.readSessionContextSnapshot = readSessionContextSnapshot;
|
|
13
13
|
const EventAggregator_1 = require("../aggregation/EventAggregator");
|
|
14
14
|
const modelContext_1 = require("../modelContext");
|
|
15
|
+
const mcpToolName_1 = require("../parsers/mcpToolName");
|
|
15
16
|
const tokenEstimation_1 = require("../tokenEstimation");
|
|
16
17
|
const DEFAULT_CONTEXT_SOURCE_LIMIT = 200;
|
|
17
18
|
const DEFAULT_SNIPPET_MAX_CHARS = 240;
|
|
@@ -490,10 +491,7 @@ function inferMcpServer(toolName, input) {
|
|
|
490
491
|
const explicit = input._sidekickMcpServerName ?? input.server_name ?? input.serverName;
|
|
491
492
|
if (typeof explicit === 'string' && explicit.trim())
|
|
492
493
|
return explicit.trim();
|
|
493
|
-
|
|
494
|
-
if (match)
|
|
495
|
-
return match[1];
|
|
496
|
-
return undefined;
|
|
494
|
+
return (0, mcpToolName_1.parseMcpToolName)(toolName)?.serverName;
|
|
497
495
|
}
|
|
498
496
|
function extractText(content) {
|
|
499
497
|
if (typeof content === 'string')
|
|
@@ -72,14 +72,14 @@ async function ensureDefaultClaudeAccount(options) {
|
|
|
72
72
|
function cleanupPendingCodexProfile(profileId) {
|
|
73
73
|
fs.rmSync(path.join((0, codexProfiles_1.getCodexProfilesDir)(), profileId), { recursive: true, force: true });
|
|
74
74
|
}
|
|
75
|
-
function ensureDefaultCodexAccount(options) {
|
|
75
|
+
async function ensureDefaultCodexAccount(options) {
|
|
76
76
|
try {
|
|
77
77
|
if ((0, codexProfiles_1.getActiveCodexAccount)())
|
|
78
78
|
return 'skipped';
|
|
79
79
|
const systemAuthPath = path.join((0, codexProfiles_1.getSystemCodexHome)(), 'auth.json');
|
|
80
80
|
if (!fs.existsSync(systemAuthPath))
|
|
81
81
|
return 'skipped';
|
|
82
|
-
const result = (0, codexProfiles_1.
|
|
82
|
+
const result = await (0, codexProfiles_1.prepareCodexAccountAsync)('Default');
|
|
83
83
|
if (result.success && !result.needsLogin)
|
|
84
84
|
return 'registered';
|
|
85
85
|
if (result.profileId) {
|
|
@@ -95,7 +95,7 @@ function ensureDefaultCodexAccount(options) {
|
|
|
95
95
|
}
|
|
96
96
|
async function ensureDefaultAccounts(options) {
|
|
97
97
|
const claude = await ensureDefaultClaudeAccount(options);
|
|
98
|
-
const codex = ensureDefaultCodexAccount(options);
|
|
98
|
+
const codex = await ensureDefaultCodexAccount(options);
|
|
99
99
|
try {
|
|
100
100
|
(0, accounts_1.reconcileClaudeAuthState)();
|
|
101
101
|
}
|
|
@@ -103,7 +103,7 @@ async function ensureDefaultAccounts(options) {
|
|
|
103
103
|
logFailure(options, 'Claude auth reconciliation failed.', error);
|
|
104
104
|
}
|
|
105
105
|
try {
|
|
106
|
-
(0, codexProfiles_1.
|
|
106
|
+
await (0, codexProfiles_1.reconcileCodexAuthStateAsync)();
|
|
107
107
|
}
|
|
108
108
|
catch (error) {
|
|
109
109
|
logFailure(options, 'Codex auth reconciliation failed.', error);
|
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export { projectSessionTranscript } from './transcript';
|
|
|
9
9
|
export type { TranscriptFidelity, TranscriptSourceProvenance, CanonicalTranscriptBlock, CanonicalTranscriptMessage, CanonicalToolCall, CanonicalTranscriptUsageTotals, CanonicalSessionTranscript, ProjectSessionTranscriptOptions, } from './transcript';
|
|
10
10
|
export { listRecentSessions, readSessionTranscript } from './sessionTranscripts';
|
|
11
11
|
export type { ProviderSessionIndex, ListRecentSessionsOptions } from './sessionTranscripts';
|
|
12
|
-
export { ObservedSessionCollector, observedSessionSourceFromProvider, fileFingerprint, } from './observedSessionCollector';
|
|
13
|
-
export type { ObservedSessionReference, ObservedSessionCollectionSource, ProviderObservedSessionCollectionSource, ObservedSessionDiagnosticKind, ObservedSessionDiagnostic, ObservedSessionCollection, ObservedSessionCollectorOptions, } from './observedSessionCollector';
|
|
12
|
+
export { ObservedSessionCollector, observedSessionSourceFromProvider, fileFingerprint, fileFingerprintParts, } from './observedSessionCollector';
|
|
13
|
+
export type { KnownObservedSessionFingerprint, ObservedSessionChange, ObservedSessionChangeBatch, ObservedSessionChangeType, ObservedSessionReference, ObservedSessionFingerprintParts, ObservedSessionSourceSubscribeOptions, ObservedSessionSubscribeOptions, ObservedSessionCollectionSource, ProviderObservedSessionCollectionSource, ObservedSessionDiagnosticKind, ObservedSessionDiagnosticPhase, ObservedSessionDiagnosticSeverity, ObservedSessionDiagnostic, ObservedSessionCollection, ObservedSessionCollectorOptions, } from './observedSessionCollector';
|
|
14
14
|
export type { SessionEvent, ClaudeSessionEvent, MessageUsage, SessionMessage, SessionEventBase, MessageSessionEvent, UserSessionEvent, AssistantSessionEvent, SummarySessionEvent, SystemSessionEvent, ToolUseSessionEvent, ToolResultSessionEvent, TokenUsage, ToolCall, ToolAnalytics, TimelineEvent, PendingToolCall, TaskStatus as SessionTaskStatus, TrackedTask, TaskState, SubagentStats, PendingUserRequest, ResponseLatency, LatencyStats, PlanStep, PlanState, SessionStats, CompactionEvent, TruncationEvent, ContextAttribution, TurnAttribution, ContextSizePoint, PermissionMode, PermissionModeChange, } from './types/sessionEvent';
|
|
15
15
|
export type { OpenCodeSession, OpenCodeMessage, OpenCodePart, OpenCodeTextPart, OpenCodeReasoningPart, OpenCodeToolInvocationPart, OpenCodeCompactionPart, OpenCodeDbToolPart, OpenCodeStepStartPart, OpenCodeStepFinishPart, OpenCodePatchPart, OpenCodeSubtaskPart, OpenCodeAgentPart, OpenCodeFilePart, OpenCodeRetryPart, OpenCodeSnapshotPart, OpenCodeProject, DbProject as OpenCodeDbProject, DbSession as OpenCodeDbSession, DbMessage as OpenCodeDbMessage, DbPart as OpenCodeDbPart, } from './types/opencode';
|
|
16
16
|
export type { CodexRolloutLine, CodexSessionMeta, CodexResponseItem, CodexMessageItem, CodexContentPart, CodexReasoningItem, CodexFunctionCallItem, CodexFunctionCallOutputItem, CodexLocalShellCallItem, CodexWebSearchCallItem, CodexCustomToolCallItem, CodexCustomToolCallOutputItem, CodexCompacted, CodexTurnContext, CodexEventMsg, CodexEvent, CodexTurnStartedEvent, CodexTurnCompleteEvent, CodexTaskStartedEvent, CodexTaskCompleteEvent, CodexTurnAbortedEvent, CodexTokenCountEvent, CodexTokenUsage, CodexRateLimits, CodexAgentMessageEvent, CodexAgentReasoningEvent, CodexUserMessageEvent, CodexExecCommandBeginEvent, CodexExecCommandEndEvent, CodexMcpToolCallBeginEvent, CodexMcpToolCallEndEvent, CodexErrorEvent, CodexContextCompactedEvent, CodexPatchAppliedEvent, CodexBackgroundEvent, CodexGenericEvent, CodexDbThread, CodexReasoningSummary, } from './types/codex';
|
|
@@ -38,29 +38,39 @@ export { readHistory } from './readers/history';
|
|
|
38
38
|
export { readLatestHandoff } from './readers/handoff';
|
|
39
39
|
export { readPlans, getLatestPlan, writePlans, getPlanAnalytics, readClaudeCodePlanFiles, } from './readers/plans';
|
|
40
40
|
export type { ReadPlansOptions, PlanAnalytics } from './readers/plans';
|
|
41
|
-
export { atomicWriteJson, atomicWriteJsonSync, updateJsonStoreAtomic } from './writers/atomic';
|
|
41
|
+
export { atomicWriteJson, atomicWriteJsonSync, atomicWriteFileSync, updateJsonStoreAtomic, updateJsonStoreAtomicSync, withFileLockSync, } from './writers/atomic';
|
|
42
42
|
export { addTask, completeTask } from './writers/tasks';
|
|
43
43
|
export { addDecision, decisionFingerprint } from './writers/decisions';
|
|
44
44
|
export { addNote } from './writers/notes';
|
|
45
45
|
export { renderHandoffUrlTemplate } from './handoffUrl';
|
|
46
46
|
export type { HandoffUrlIdentifiers } from './handoffUrl';
|
|
47
|
-
export type { ProviderId, SessionProvider, SessionProviderBase, SessionFileStats, SessionFileInfo, SearchHit, ProjectFolderInfo, SessionReader, ProviderRuntimeStatus, } from './providers/types';
|
|
47
|
+
export type { ProviderId, SessionProvider, SessionProviderBase, SessionFileStats, SessionFileInfo, SearchHit, ProjectFolderInfo, SessionReader, SessionProviderOptions, ProviderOperationStatus, SessionProviderDiagnostic, SessionProviderDiagnosticKind, SessionProviderDiagnosticPhase, SessionProviderDiagnosticSeverity, ProviderRuntimeStatus, } from './providers/types';
|
|
48
|
+
export { SESSION_PROVIDER_IDS } from './providers/types';
|
|
49
|
+
export { createSessionProviders } from './providers/factory';
|
|
50
|
+
export type { CreateSessionProvidersOptions, CreateSessionProvidersResult, } from './providers/factory';
|
|
48
51
|
export { createProviderSessionAdapterV1, derivePendingUserRequestV1, } from './types/observedSessionV1';
|
|
49
|
-
export type { ObservationProvenanceV1, ObservedAgentSessionV1, ObservedValueV1, PendingUserRequestV1, ProviderCapabilitiesV1, ProviderSessionAdapterV1, SessionEvidenceRefV1, } from './types/observedSessionV1';
|
|
52
|
+
export type { ObservationProvenanceV1, ObservedAgentSessionV1, ObservedValueV1, PendingUserRequestV1, ProviderCapabilitiesV1, ProviderSessionAdapterV1, ProviderSessionAdapterV1Options, SessionEvidenceRefV1, } from './types/observedSessionV1';
|
|
50
53
|
export { detectProvider, getAllDetectedProviders } from './providers/detect';
|
|
51
54
|
export { ClaudeCodeProvider } from './providers/claudeCode';
|
|
52
55
|
export { OpenCodeProvider, getOpenCodeDataDir } from './providers/openCode';
|
|
53
|
-
export { CodexProvider } from './providers/codex';
|
|
56
|
+
export { CodexProvider, findCodexRolloutFile } from './providers/codex';
|
|
57
|
+
export type { FindCodexRolloutFileOptions } from './providers/codex';
|
|
54
58
|
export { JsonlParser, TRUNCATION_PATTERNS } from './parsers/jsonl';
|
|
55
59
|
export type { RawSessionEvent, JsonlParserCallbacks, JsonlParserOptions } from './parsers/jsonl';
|
|
56
60
|
export { normalizeToolName, normalizeToolInput, detectPlanModeFromText, convertOpenCodeMessage, parseDbMessageData, parseDbPartData, } from './parsers/openCodeParser';
|
|
57
61
|
export { CodexRolloutParser, extractPatchFilePaths, normalizeCodexToolName, normalizeCodexToolInput, } from './parsers/codexParser';
|
|
58
62
|
export { scanSubagentDir, extractTaskInfo } from './parsers/subagentScanner';
|
|
59
|
-
export { detectSessionActivity } from './parsers/sessionActivityDetector';
|
|
63
|
+
export { detectSessionActivity, refreshSessionActivityState, } from './parsers/sessionActivityDetector';
|
|
60
64
|
export type { SessionActivityState, SessionActivityResult, } from './parsers/sessionActivityDetector';
|
|
61
65
|
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';
|
|
62
66
|
export { scanSubagentTraces } from './parsers/subagentTraceParser';
|
|
63
67
|
export type { SubagentTrace, SubagentTraceEvent } from './parsers/subagentTraceParser';
|
|
68
|
+
export { parseMcpToolName } from './parsers/mcpToolName';
|
|
69
|
+
export type { McpToolNameParts } from './parsers/mcpToolName';
|
|
70
|
+
export { readCodexHistory } from './parsers/codexHistory';
|
|
71
|
+
export type { CodexHistoryEntry, ReadCodexHistoryOptions } from './parsers/codexHistory';
|
|
72
|
+
export { listSessionPreviews, listSessionPreviewsAsync, readSessionPreview, readSessionPreviewAsync, } from './sessionPreviews';
|
|
73
|
+
export type { AsyncSessionPreviewOptions, ListSessionPreviewsAsyncOptions, ListSessionPreviewsOptions, ReadSessionPreviewAsyncOptions, ReadSessionPreviewOptions, SessionPreview, SessionPreviewListResult, SessionPreviewReadResult, } from './sessionPreviews';
|
|
64
74
|
export { parseDebugLog, filterByLevel, collapseDuplicates, discoverDebugLogs, } from './parsers/debugLogParser';
|
|
65
75
|
export type { DebugLogEntry, DebugLogFile, DebugLogLevel } from './parsers/debugLogParser';
|
|
66
76
|
export { OpenCodeDatabase } from './providers/openCodeDatabase';
|
|
@@ -98,7 +108,7 @@ export { ALL_PHRASES, PHRASE_CATEGORIES, getRandomPhrase } from './phrases';
|
|
|
98
108
|
export type { PhraseCategory } from './phrases';
|
|
99
109
|
export { EventAggregator, parseTodoDependencies } from './aggregation/EventAggregator';
|
|
100
110
|
export { SessionMonitor } from './sessionMonitor';
|
|
101
|
-
export type { SessionMonitorOptions } from './sessionMonitor';
|
|
111
|
+
export type { SessionMonitorOptions, SessionMonitorSubscribeOptions } from './sessionMonitor';
|
|
102
112
|
export type { SerializedAggregatorState } from './aggregation/EventAggregator';
|
|
103
113
|
export { saveSnapshot, loadSnapshot, deleteSnapshot, isSnapshotValid, getSnapshotPath, } from './aggregation/snapshot';
|
|
104
114
|
export type { SessionSnapshot } from './aggregation/snapshot';
|
|
@@ -126,21 +136,24 @@ export { ensureDefaultAccounts } from './ensureDefaultAccounts';
|
|
|
126
136
|
export type { EnsureDefaultAccountStatus, EnsureDefaultAccountsOptions, EnsureDefaultAccountsResult, } from './ensureDefaultAccounts';
|
|
127
137
|
export { readAccountRegistry, writeAccountRegistry, readActiveClaudeAccount, addCurrentAccount, switchToAccount, resolveActiveClaudeHome, applyActiveClaudeToLiveHome, reconcileClaudeAuthState, removeAccount, listAccounts, getActiveAccount, resolveActiveClaudeAccount, isMultiAccountEnabled, } from './accounts';
|
|
128
138
|
export type { AccountEntry, AccountRegistry, ActiveAccountInfo, AccountManagerResult, } from './accounts';
|
|
129
|
-
export { beginAccountLogin, getAccountLoginStatus, finalizeAccountLogin, spawnAccountLogin, switchAccount, listAllAccounts, resolveClaudeLoginCommand, } from './accountManager';
|
|
139
|
+
export { beginAccountLogin, getAccountLoginStatus, getAccountLoginStatusAsync, finalizeAccountLogin, finalizeAccountLoginAsync, spawnAccountLogin, switchAccount, switchAccountAsync, listAllAccounts, resolveClaudeLoginCommand, } from './accountManager';
|
|
130
140
|
export type { AccountLoginCommand, AccountLoginState, AccountLoginStatus, BeginAccountLoginResult, FinalizeAccountLoginOptions, ListAllAccountsResult, SpawnAccountLoginOptions, } from './accountManager';
|
|
131
141
|
export { getAccountsDir, readSavedAccountRegistry, writeSavedAccountRegistry, listSavedAccountProfiles, getActiveSavedAccount, upsertSavedAccountProfile, setActiveSavedAccount, replaceSavedAccountProfiles, removeSavedAccountProfile, } from './accountRegistry';
|
|
132
142
|
export type { AccountProviderId, AccountIdentityMetadata, ResolvedActiveAccount, SavedAccountProfile, SavedAccountRegistry, } from './accountRegistry';
|
|
143
|
+
export { ACCOUNT_PROVIDER_IDS } from './accountRegistry';
|
|
133
144
|
export { getActiveAccountStatus } from './accountStatus';
|
|
134
145
|
export type { ActiveAccountStatus, ActiveProviderAccountStatus } from './accountStatus';
|
|
146
|
+
export { onAccountsChanged } from './accountChanges';
|
|
147
|
+
export type { AccountsChangedEvent, OnAccountsChangedOptions } from './accountChanges';
|
|
135
148
|
export { getClaudeProfilesDir, getClaudeProfileHome, claudeKeychainSuffix, claudeKeychainService, isClaudeProfileAuthenticated, readClaudeProfileIdentity, } from './claudeProfiles';
|
|
136
149
|
export type { ClaudeProfileIdentity } from './claudeProfiles';
|
|
137
|
-
export { getCodexProfilesDir, getCodexProfileHome, getCodexMonitoringHomes, getSystemCodexHome, listCodexAccounts, getActiveCodexAccount, resolveActiveCodexAccount, resolveSidekickCodexHome, getCodexExecutionEnv, prepareCodexAccount, finalizeCodexAccount, switchToCodexAccount, removeCodexAccount, } from './codexProfiles';
|
|
150
|
+
export { getCodexProfilesDir, getCodexProfileHome, getCodexMonitoringHomes, getSystemCodexHome, listCodexAccounts, getActiveCodexAccount, resolveActiveCodexAccount, resolveSidekickCodexHome, getCodexExecutionEnv, prepareCodexAccount, prepareCodexAccountAsync, finalizeCodexAccount, finalizeCodexAccountAsync, switchToCodexAccount, switchToCodexAccountAsync, removeCodexAccount, } from './codexProfiles';
|
|
138
151
|
export type { CodexAccountManagerResult } from './codexProfiles';
|
|
139
152
|
export { setTerminalActiveProfile, installShellHook, uninstallShellHook, isShellHookInstalled, writeLauncher, removeLauncher, } from './terminalSync';
|
|
140
153
|
export { DEFAULT_AUTO_SWITCH_CONFIG, decideAutoSwitch, AutoSwitchController } from './autoSwitch';
|
|
141
154
|
export type { AutoSwitchActiveAccount, AutoSwitchCandidate, AutoSwitchConfig, AutoSwitchControllerOptions, AutoSwitchDecision, AutoSwitchTransitionEvent, } from './autoSwitch';
|
|
142
|
-
export { FIVE_HOUR_WINDOW_MS, SEVEN_DAY_WINDOW_MS, fetchQuota, projectQuotaWindow, withQuotaProjections, } from './quota';
|
|
143
|
-
export type { CodexResetCredit, CodexResetCreditsSnapshot, QuotaProjectionInput, QuotaWindow, QuotaState, } from './quota';
|
|
155
|
+
export { FIVE_HOUR_WINDOW_MS, QUOTA_PROVIDER_IDS, SEVEN_DAY_WINDOW_MS, fetchQuota, projectQuotaWindow, withQuotaProjections, } from './quota';
|
|
156
|
+
export type { CodexResetCredit, CodexResetCreditsSnapshot, QuotaProjectionInput, QuotaProviderId, QuotaWindow, QuotaState, } from './quota';
|
|
144
157
|
export { describeQuotaFailure } from './quotaPresentation';
|
|
145
158
|
export type { QuotaFailureDescriptor } from './quotaPresentation';
|
|
146
159
|
export { QuotaPoller } from './quotaPoller';
|
|
@@ -156,14 +169,18 @@ export { fetchZaiQuotaFromApi, quotaStateFromZaiQuotaLimitPayload, readZaiCreden
|
|
|
156
169
|
export type { ReadZaiCredentialsOptions, ZaiCredentialSource, ZaiCredentials, ZaiPlatform, ZaiQuotaApiOptions, ZaiQuotaResolveOptions, } from './zaiQuotaApi';
|
|
157
170
|
export { MultiProviderQuotaService } from './multiProviderQuotaService';
|
|
158
171
|
export type { MultiProviderQuotaServiceOptions } from './multiProviderQuotaService';
|
|
172
|
+
export { RUNTIME_QUOTA_PROVIDER_IDS } from './providerQuota';
|
|
159
173
|
export type { ProviderQuotaMap, ProviderQuotaState, RuntimeQuotaProvider } from './providerQuota';
|
|
160
174
|
export type { QuotaSnapshotProviderId } from './quotaSnapshots';
|
|
161
175
|
export { BurnRateCalculator, estimateTimeToQuota } from './statusline/BurnRateCalculator';
|
|
162
176
|
export { formatStatusline, selectStatuslineAccount } from './statusline/formatter';
|
|
163
177
|
export type { StatuslineInput, StatuslineSelection } from './statusline/formatter';
|
|
164
|
-
export { getModelContextWindowSize, DEFAULT_CONTEXT_WINDOW } from './modelContext';
|
|
165
|
-
export {
|
|
166
|
-
export
|
|
178
|
+
export { getModelContextWindowSize, resolveModelContextWindow, DEFAULT_CONTEXT_WINDOW, } from './modelContext';
|
|
179
|
+
export type { ModelCatalogMatch, ModelContextWindowProvenance, ModelContextWindowSource, ResolvedModelContextWindow, } from './modelContext';
|
|
180
|
+
export { parseModelId, getModelPricing, resolveModelPricing, getModelInfo, calculateCost, calculateCostWithPricing, calculateCostWithProvenance, mergeCostSources, shortModelName, getModelDisplayInfo, compareModelIds, sortModelIds, formatCost, MODEL_PROVIDER_IDS, } from './modelInfo';
|
|
181
|
+
export type { ModelPricing, CostTokenUsage, CostSource, CostProvenanceInput, CostWithProvenance, ModelInfo, ModelProvider, ParsedModelId, ModelDisplayInfo, ModelPricingMatch, ModelPricingProvenance, ModelPricingSource, ResolvedModelPricing, } from './modelInfo';
|
|
182
|
+
export { exportResolvedModelCatalog, importResolvedModelCatalog, registerModelAlias, resolveModelAlias, RESOLVED_MODEL_CATALOG_SCHEMA_VERSION, } from './modelCatalog';
|
|
183
|
+
export type { ImportResolvedModelCatalogResult, ResolvedModelCatalogEntry, ResolvedModelCatalogSnapshot, } from './modelCatalog';
|
|
167
184
|
export { hydratePricingCatalog, normalizeLiteLlmCatalog, normalizeLiteLlmContextWindows, LITELLM_CATALOG_URL, } from './pricingCatalog';
|
|
168
185
|
export type { HydrateOptions, HydrateResult } from './pricingCatalog';
|
|
169
186
|
export { loadObservedContextWindows, recordObservedContextWindow, getObservedContextWindowPath, } from './observedContextWindows';
|