sidekick-shared 0.19.3 → 0.21.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/README.md +40 -1
- package/dist/accountManager.d.ts +52 -0
- package/dist/accountManager.js +344 -0
- package/dist/accounts.d.ts +3 -0
- package/dist/accounts.js +180 -40
- package/dist/autoSwitch.d.ts +70 -0
- package/dist/autoSwitch.js +160 -0
- package/dist/claudeProfiles.d.ts +12 -0
- package/dist/claudeProfiles.js +96 -0
- package/dist/codexProfiles.d.ts +6 -2
- package/dist/codexProfiles.js +6 -1
- package/dist/credentialIO.d.ts +3 -2
- package/dist/credentialIO.js +11 -9
- package/dist/ensureDefaultAccounts.js +6 -0
- package/dist/extractors/gatherAssets.d.ts +20 -0
- package/dist/extractors/gatherAssets.js +35 -0
- package/dist/extractors/sessionAssets.d.ts +52 -0
- package/dist/extractors/sessionAssets.js +219 -0
- package/dist/extractors/sources/claudeAssets.d.ts +11 -0
- package/dist/extractors/sources/claudeAssets.js +156 -0
- package/dist/extractors/sources/codexAssets.d.ts +11 -0
- package/dist/extractors/sources/codexAssets.js +227 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.js +55 -3
- package/dist/schemas/accountManager.d.ts +104 -0
- package/dist/schemas/accountManager.js +84 -0
- package/dist/schemas/assistantTurn.d.ts +5 -5
- package/dist/schemas/index.d.ts +4 -0
- package/dist/schemas/index.js +9 -1
- package/dist/schemas/quota.d.ts +20 -20
- package/dist/schemas/quotaHistory.d.ts +1 -1
- package/dist/terminalSync.d.ts +7 -0
- package/dist/terminalSync.js +202 -0
- package/package.json +1 -1
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Codex CLI rollout reader for actionable asset extraction.
|
|
4
|
+
*
|
|
5
|
+
* Portions adapted from `trawl` by Juan Fourie (B33pBeeps), MIT licensed:
|
|
6
|
+
* https://github.com/B33pBeeps/trawl
|
|
7
|
+
*
|
|
8
|
+
* @module extractors/sources/codexAssets
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.codexSessions = codexSessions;
|
|
12
|
+
exports.readCodexAssets = readCodexAssets;
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
14
|
+
const node_fs_1 = require("node:fs");
|
|
15
|
+
const codexProfiles_1 = require("../../codexProfiles");
|
|
16
|
+
const sessionAssets_1 = require("../sessionAssets");
|
|
17
|
+
const EXEC_NAMES = new Set(['exec_command', 'shell', 'local_shell', 'container.exec']);
|
|
18
|
+
function dirExists(path) {
|
|
19
|
+
try {
|
|
20
|
+
return (0, node_fs_1.statSync)(path).isDirectory();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function firstJsonLine(filePath) {
|
|
27
|
+
let fd;
|
|
28
|
+
try {
|
|
29
|
+
fd = (0, node_fs_1.openSync)(filePath, 'r');
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const buffer = Buffer.alloc(65536);
|
|
35
|
+
let data = '';
|
|
36
|
+
try {
|
|
37
|
+
let bytesRead;
|
|
38
|
+
while ((bytesRead = (0, node_fs_1.readSync)(fd, buffer, 0, buffer.length, null)) > 0) {
|
|
39
|
+
data += buffer.toString('utf8', 0, bytesRead);
|
|
40
|
+
const newlineIndex = data.indexOf('\n');
|
|
41
|
+
if (newlineIndex >= 0) {
|
|
42
|
+
data = data.slice(0, newlineIndex);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
if (data.length > 1_000_000)
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
(0, node_fs_1.closeSync)(fd);
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
return JSON.parse(data);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function readJsonl(filePath, skip) {
|
|
63
|
+
let raw;
|
|
64
|
+
try {
|
|
65
|
+
raw = (0, node_fs_1.readFileSync)(filePath, 'utf8');
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
const lines = [];
|
|
71
|
+
for (const line of raw.split('\n')) {
|
|
72
|
+
const trimmed = line.trim();
|
|
73
|
+
if (!trimmed)
|
|
74
|
+
continue;
|
|
75
|
+
if (skip?.(trimmed))
|
|
76
|
+
continue;
|
|
77
|
+
try {
|
|
78
|
+
lines.push(JSON.parse(trimmed));
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// Ignore partial or malformed JSONL lines.
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return lines;
|
|
85
|
+
}
|
|
86
|
+
function rolloutFiles(limit = 150) {
|
|
87
|
+
const entries = [];
|
|
88
|
+
const seen = new Set();
|
|
89
|
+
const walk = (dir) => {
|
|
90
|
+
let dirEntries;
|
|
91
|
+
try {
|
|
92
|
+
dirEntries = (0, node_fs_1.readdirSync)(dir, { withFileTypes: true });
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
for (const entry of dirEntries) {
|
|
98
|
+
const fullPath = (0, node_path_1.join)(dir, entry.name);
|
|
99
|
+
if (entry.isDirectory()) {
|
|
100
|
+
walk(fullPath);
|
|
101
|
+
}
|
|
102
|
+
else if (entry.isFile() && entry.name.startsWith('rollout-') && entry.name.endsWith('.jsonl')) {
|
|
103
|
+
try {
|
|
104
|
+
if (seen.has(fullPath))
|
|
105
|
+
continue;
|
|
106
|
+
seen.add(fullPath);
|
|
107
|
+
entries.push({ path: fullPath, mtime: (0, node_fs_1.statSync)(fullPath).mtimeMs });
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// Ignore inaccessible files.
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
for (const home of (0, codexProfiles_1.getCodexMonitoringHomes)()) {
|
|
116
|
+
const sessionsDir = (0, node_path_1.join)(home, 'sessions');
|
|
117
|
+
if (dirExists(sessionsDir))
|
|
118
|
+
walk(sessionsDir);
|
|
119
|
+
}
|
|
120
|
+
return entries.sort((a, b) => b.mtime - a.mtime).slice(0, limit).map((entry) => entry.path);
|
|
121
|
+
}
|
|
122
|
+
function codexSessions(cwd, limit = 3) {
|
|
123
|
+
const exactCwd = (0, node_path_1.resolve)(cwd);
|
|
124
|
+
const sessions = [];
|
|
125
|
+
for (const filePath of rolloutFiles()) {
|
|
126
|
+
const meta = firstJsonLine(filePath);
|
|
127
|
+
const payload = meta?.payload;
|
|
128
|
+
if (payload?.cwd === exactCwd) {
|
|
129
|
+
sessions.push(filePath);
|
|
130
|
+
if (sessions.length >= limit)
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return sessions;
|
|
135
|
+
}
|
|
136
|
+
function parseArgs(value) {
|
|
137
|
+
if (typeof value !== 'string')
|
|
138
|
+
return value && typeof value === 'object' ? value : {};
|
|
139
|
+
try {
|
|
140
|
+
return JSON.parse(value);
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
return {};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function asString(value) {
|
|
147
|
+
return typeof value === 'string' ? value : undefined;
|
|
148
|
+
}
|
|
149
|
+
function provenance(sessionPath, source) {
|
|
150
|
+
return { agent: 'codex', sessionPath, source };
|
|
151
|
+
}
|
|
152
|
+
function commandFromLocalShell(item) {
|
|
153
|
+
const action = item.action;
|
|
154
|
+
const command = action?.command;
|
|
155
|
+
if (Array.isArray(command))
|
|
156
|
+
return command.map(String).join(' ');
|
|
157
|
+
return asString(command);
|
|
158
|
+
}
|
|
159
|
+
function patchFiles(patch, cwd) {
|
|
160
|
+
const paths = [];
|
|
161
|
+
for (const match of String(patch).matchAll(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/gm)) {
|
|
162
|
+
for (const filePath of (0, sessionAssets_1.extractFilePaths)(match[1].trim(), cwd)) {
|
|
163
|
+
paths.push(filePath);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return paths;
|
|
167
|
+
}
|
|
168
|
+
function addMessageAssets(acc, text, cwd, timestamp, meta) {
|
|
169
|
+
for (const url of (0, sessionAssets_1.extractUrls)(text))
|
|
170
|
+
acc.urls.push((0, sessionAssets_1.urlAsset)(url, timestamp, meta));
|
|
171
|
+
for (const filePath of (0, sessionAssets_1.extractFilePaths)(text, cwd))
|
|
172
|
+
acc.paths.push((0, sessionAssets_1.pathAsset)(filePath, timestamp, meta));
|
|
173
|
+
for (const command of (0, sessionAssets_1.extractCommands)(text))
|
|
174
|
+
acc.commands.push((0, sessionAssets_1.commandAsset)(command, timestamp, meta));
|
|
175
|
+
}
|
|
176
|
+
function addExecutedCommandAssets(acc, command, cwd, timestamp, meta) {
|
|
177
|
+
for (const url of (0, sessionAssets_1.extractUrls)(command))
|
|
178
|
+
acc.urls.push((0, sessionAssets_1.urlAsset)(url, timestamp, meta));
|
|
179
|
+
for (const filePath of (0, sessionAssets_1.extractFilePaths)(command, cwd))
|
|
180
|
+
acc.paths.push((0, sessionAssets_1.pathAsset)(filePath, timestamp, meta));
|
|
181
|
+
}
|
|
182
|
+
function readCodexAssets(cwd, limit = 3) {
|
|
183
|
+
const exactCwd = (0, node_path_1.resolve)(cwd);
|
|
184
|
+
const files = codexSessions(exactCwd, limit);
|
|
185
|
+
const acc = { urls: [], paths: [], commands: [], plans: [], hadSession: files.length > 0 };
|
|
186
|
+
const skip = (line) => line.includes('"type":"function_call_output"') ||
|
|
187
|
+
line.includes('"type":"reasoning"') ||
|
|
188
|
+
line.includes('"type":"token_count"');
|
|
189
|
+
for (const filePath of files) {
|
|
190
|
+
for (const line of readJsonl(filePath, skip)) {
|
|
191
|
+
const payload = line.payload;
|
|
192
|
+
if (!payload)
|
|
193
|
+
continue;
|
|
194
|
+
const timestamp = asString(line.timestamp);
|
|
195
|
+
if (payload.type === 'function_call') {
|
|
196
|
+
if (EXEC_NAMES.has(payload.name)) {
|
|
197
|
+
const args = parseArgs(payload.arguments);
|
|
198
|
+
addExecutedCommandAssets(acc, args.cmd ?? args.command, exactCwd, timestamp, provenance(filePath, `tool:${String(payload.name)}`));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else if (payload.type === 'local_shell_call') {
|
|
202
|
+
addExecutedCommandAssets(acc, commandFromLocalShell(payload), exactCwd, timestamp, provenance(filePath, 'tool:local_shell'));
|
|
203
|
+
}
|
|
204
|
+
else if (payload.type === 'item_completed') {
|
|
205
|
+
const item = payload.item;
|
|
206
|
+
const text = asString(item?.text);
|
|
207
|
+
if (item?.type === 'Plan' && text?.trim())
|
|
208
|
+
acc.plans.push((0, sessionAssets_1.planAsset)(text, timestamp, provenance(filePath, 'plan')));
|
|
209
|
+
}
|
|
210
|
+
else if (payload.type === 'custom_tool_call' && payload.name === 'apply_patch') {
|
|
211
|
+
const meta = provenance(filePath, 'tool:apply_patch');
|
|
212
|
+
for (const file of patchFiles(payload.input, exactCwd))
|
|
213
|
+
acc.paths.push((0, sessionAssets_1.pathAsset)(file, timestamp, meta));
|
|
214
|
+
}
|
|
215
|
+
else if (payload.type === 'message' && Array.isArray(payload.content)) {
|
|
216
|
+
for (const block of payload.content) {
|
|
217
|
+
const typedBlock = block;
|
|
218
|
+
addMessageAssets(acc, typedBlock.text, exactCwd, timestamp, provenance(filePath, 'message'));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
else if (payload.type === 'agent_message') {
|
|
222
|
+
addMessageAssets(acc, payload.message, exactCwd, timestamp, provenance(filePath, 'message'));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return acc;
|
|
227
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -93,14 +93,21 @@ export { readClaudeMaxCredentials, readClaudeMaxAccessTokenSync } from './creden
|
|
|
93
93
|
export type { ClaudeMaxCredentials } from './credentials';
|
|
94
94
|
export { ensureDefaultAccounts, } from './ensureDefaultAccounts';
|
|
95
95
|
export type { EnsureDefaultAccountStatus, EnsureDefaultAccountsOptions, EnsureDefaultAccountsResult, } from './ensureDefaultAccounts';
|
|
96
|
-
export { readAccountRegistry, writeAccountRegistry, readActiveClaudeAccount, addCurrentAccount, switchToAccount, removeAccount, listAccounts, getActiveAccount, isMultiAccountEnabled, } from './accounts';
|
|
96
|
+
export { readAccountRegistry, writeAccountRegistry, readActiveClaudeAccount, addCurrentAccount, switchToAccount, resolveActiveClaudeHome, applyActiveClaudeToLiveHome, reconcileClaudeAuthState, removeAccount, listAccounts, getActiveAccount, isMultiAccountEnabled, } from './accounts';
|
|
97
97
|
export type { AccountEntry, AccountRegistry, ActiveAccountInfo, AccountManagerResult } from './accounts';
|
|
98
|
+
export { beginAccountLogin, getAccountLoginStatus, finalizeAccountLogin, spawnAccountLogin, switchAccount, listAllAccounts, resolveClaudeLoginCommand, } from './accountManager';
|
|
99
|
+
export type { AccountLoginCommand, AccountLoginState, AccountLoginStatus, BeginAccountLoginResult, FinalizeAccountLoginOptions, ListAllAccountsResult, SpawnAccountLoginOptions, } from './accountManager';
|
|
98
100
|
export { getAccountsDir, readSavedAccountRegistry, writeSavedAccountRegistry, listSavedAccountProfiles, getActiveSavedAccount, upsertSavedAccountProfile, setActiveSavedAccount, replaceSavedAccountProfiles, removeSavedAccountProfile, } from './accountRegistry';
|
|
99
101
|
export type { AccountProviderId, AccountIdentityMetadata, SavedAccountProfile, SavedAccountRegistry, } from './accountRegistry';
|
|
100
102
|
export { getActiveAccountStatus } from './accountStatus';
|
|
101
103
|
export type { ActiveAccountStatus, ActiveProviderAccountStatus } from './accountStatus';
|
|
104
|
+
export { getClaudeProfilesDir, getClaudeProfileHome, claudeKeychainSuffix, claudeKeychainService, isClaudeProfileAuthenticated, readClaudeProfileIdentity, } from './claudeProfiles';
|
|
105
|
+
export type { ClaudeProfileIdentity } from './claudeProfiles';
|
|
102
106
|
export { getCodexProfilesDir, getCodexProfileHome, getCodexMonitoringHomes, getSystemCodexHome, listCodexAccounts, getActiveCodexAccount, resolveSidekickCodexHome, getCodexExecutionEnv, prepareCodexAccount, finalizeCodexAccount, switchToCodexAccount, removeCodexAccount, } from './codexProfiles';
|
|
103
107
|
export type { CodexAccountManagerResult } from './codexProfiles';
|
|
108
|
+
export { setTerminalActiveProfile, installShellHook, uninstallShellHook, isShellHookInstalled, writeLauncher, removeLauncher, } from './terminalSync';
|
|
109
|
+
export { DEFAULT_AUTO_SWITCH_CONFIG, decideAutoSwitch, AutoSwitchController, } from './autoSwitch';
|
|
110
|
+
export type { AutoSwitchActiveAccount, AutoSwitchCandidate, AutoSwitchConfig, AutoSwitchControllerOptions, AutoSwitchDecision, AutoSwitchTransitionEvent, } from './autoSwitch';
|
|
104
111
|
export { fetchQuota } from './quota';
|
|
105
112
|
export type { QuotaWindow, QuotaState } from './quota';
|
|
106
113
|
export { describeQuotaFailure } from './quotaPresentation';
|
|
@@ -124,10 +131,17 @@ export { hydratePricingCatalog, normalizeLiteLlmCatalog, LITELLM_CATALOG_URL } f
|
|
|
124
131
|
export type { HydrateOptions, HydrateResult } from './pricingCatalog';
|
|
125
132
|
export { extractTokenUsage } from './extractors/tokenUsage';
|
|
126
133
|
export { extractToolCall, extractToolCalls } from './extractors/toolCall';
|
|
134
|
+
export { extractUrls, extractFilePaths, extractCommands, } from './extractors/sessionAssets';
|
|
135
|
+
export type { AssetAgent, ExtractedAsset, ExtractedAssetProvenance, ExtractedAssetType, ExtractedAssets, SourceAssets, } from './extractors/sessionAssets';
|
|
136
|
+
export { readClaudeAssets, claudeSessions } from './extractors/sources/claudeAssets';
|
|
137
|
+
export { readCodexAssets, codexSessions } from './extractors/sources/codexAssets';
|
|
138
|
+
export { gatherAssetsForCwd } from './extractors/gatherAssets';
|
|
139
|
+
export type { GatherAssetsOptions, GatherAssetsResult } from './extractors/gatherAssets';
|
|
127
140
|
export { messageUsageSchema, sessionMessageSchema, sessionEventSchema, permissionModeSchema, extractSessionEvents, } from './schemas/sessionEvent';
|
|
128
141
|
export { quotaWindowSchema, quotaStateSchema, quotaFailureKindSchema, quotaProviderIdSchema, quotaSourceSchema, peakHoursStateSchema, quotaFailureDescriptorSchema, runtimeQuotaProviderSchema, providerQuotaStateSchema, claudeProviderQuotaStateSchema, codexProviderQuotaStateSchema, providerQuotaMapSchema, } from './schemas/quota';
|
|
129
142
|
export { quotaHistoryRuntimeProviderSchema, quotaHistorySampleSchema, quotaHistoryDailyBucketSchema, } from './schemas/quotaHistory';
|
|
130
143
|
export { activeProviderAccountStatusSchema, activeAccountStatusSchema, } from './schemas/accountStatus';
|
|
144
|
+
export { accountProviderIdSchema, accountManagerResultSchema, beginAccountLoginResultSchema, accountLoginStatusSchema, accountEntrySchema, savedAccountProfileSchema, listAllAccountsResultSchema, } from './schemas/accountManager';
|
|
131
145
|
export { assistantTurnEventSchema, assistantTurnEventTypeSchema, assistantTurnNarrationStepSchema, assistantTurnProcessSchema, assistantTurnProcessStepSchema, assistantTurnProjectionSchema, assistantTurnReasoningTimelineItemSchema, assistantTurnSubagentSchema, assistantTurnSubagentStatusSchema, assistantTurnTimelineItemSchema, assistantTurnToolGroupStepSchema, assistantTurnToolRefSchema, } from './schemas/assistantTurn';
|
|
132
146
|
export { fetchProviderStatus, fetchOpenAIStatus } from './providerStatus';
|
|
133
147
|
export type { ProviderStatusState } from './providerStatus';
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.findActiveClaudeSession = exports.discoverSessionDirectory = exports.getClaudeSessionDirectory = exports.encodeClaudeWorkspacePath = exports.detectSessionActivity = exports.extractTaskInfo = exports.scanSubagentDir = exports.normalizeCodexToolInput = exports.normalizeCodexToolName = exports.extractPatchFilePaths = exports.CodexRolloutParser = exports.parseDbPartData = exports.parseDbMessageData = exports.convertOpenCodeMessage = exports.detectPlanModeFromText = exports.normalizeToolInput = exports.normalizeToolName = exports.TRUNCATION_PATTERNS = exports.JsonlParser = exports.CodexProvider = exports.OpenCodeProvider = exports.ClaudeCodeProvider = exports.getAllDetectedProviders = exports.detectProvider = exports.readClaudeCodePlanFiles = exports.getPlanAnalytics = exports.writePlans = exports.getLatestPlan = exports.readPlans = exports.readLatestHandoff = exports.readHistory = exports.readNotes = exports.readDecisions = exports.readTasks = exports.getProjectSlugRaw = exports.getProjectSlug = exports.encodeWorkspacePath = exports.getGlobalDataPath = exports.getProjectDataPath = exports.getConfigDir = exports.MAX_PLANS_PER_PROJECT = exports.PLAN_SCHEMA_VERSION = exports.createEmptyTokenTotals = exports.HISTORICAL_DATA_SCHEMA_VERSION = exports.STALENESS_THRESHOLDS = exports.IMPORTANCE_DECAY_FACTORS = exports.KNOWLEDGE_NOTE_SCHEMA_VERSION = exports.DECISION_LOG_SCHEMA_VERSION = exports.normalizeTaskStatus = exports.TASK_PERSISTENCE_SCHEMA_VERSION = void 0;
|
|
7
7
|
exports.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.formatTokenCount = exports.formatDurationMs = exports.createJsonlTail = exports.toFollowEvents = exports.createWatcher = exports.parseChangelog = exports.extractProposedPlanShared = exports.parsePlanMarkdownShared = exports.PlanExtractor = exports.segmentAssistantTurn = exports.reasoningSummary = exports.isAssistantTurnSubagentTool = exports.extractTurnSubagents = exports.assistantTurnEventsFromSessionEvents = exports.readSessionContextSnapshot = exports.createSessionContextProjector = exports.calculateSessionContextPressure = exports.buildSessionContextSnapshot = exports.composeContext = exports.FilterEngine = exports.searchSessions = exports.CodexDatabase = exports.OpenCodeDatabase = exports.discoverDebugLogs = exports.collapseDuplicates = exports.filterByLevel = exports.parseDebugLog = exports.scanSubagentTraces = exports.findAllSessionsWithWorktrees = exports.discoverWorktreeSiblings = exports.resolveWorktreeMainRepo = exports.getAllClaudeProjectFolders = exports.decodeEncodedPath = exports.getMostRecentlyActiveSessionDir = exports.findSubdirectorySessionDirs = exports.findSessionsInDirectory = exports.findAllClaudeSessions = void 0;
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
8
|
+
exports.replaceSavedAccountProfiles = exports.setActiveSavedAccount = exports.upsertSavedAccountProfile = exports.getActiveSavedAccount = exports.listSavedAccountProfiles = exports.writeSavedAccountRegistry = exports.readSavedAccountRegistry = exports.getAccountsDir = exports.resolveClaudeLoginCommand = exports.listAllAccounts = exports.switchAccount = exports.spawnAccountLogin = exports.finalizeAccountLogin = exports.getAccountLoginStatus = exports.beginAccountLogin = exports.isMultiAccountEnabled = exports.getActiveAccount = exports.listAccounts = exports.removeAccount = exports.reconcileClaudeAuthState = exports.applyActiveClaudeToLiveHome = exports.resolveActiveClaudeHome = exports.switchToAccount = exports.addCurrentAccount = exports.readActiveClaudeAccount = exports.writeAccountRegistry = exports.readAccountRegistry = exports.ensureDefaultAccounts = exports.readClaudeMaxAccessTokenSync = exports.readClaudeMaxCredentials = exports.writeActiveCredentials = exports.readActiveCredentials = exports.openInBrowser = exports.parseTranscriptFromEvents = exports.parseTranscript = exports.generateHtmlReport = exports.PatternExtractor = exports.HeatmapTracker = exports.FrequencyTracker = exports.getSnapshotPath = exports.isSnapshotValid = exports.deleteSnapshot = exports.loadSnapshot = exports.saveSnapshot = exports.parseTodoDependencies = exports.EventAggregator = exports.getRandomPhrase = exports.PHRASE_CATEGORIES = exports.ALL_PHRASES = exports.HIGHLIGHT_CSS = void 0;
|
|
9
|
+
exports.getModelPricing = exports.parseModelId = exports.DEFAULT_CONTEXT_WINDOW = exports.getModelContextWindowSize = exports.MultiProviderQuotaService = exports.CodexQuotaWatcher = exports.resolveCodexQuotaFromLocalSources = exports.resolveCodexQuota = exports.readLatestCodexQuotaFromRollouts = exports.quotaFromCodexRateLimits = exports.fetchCodexQuotaFromApi = exports.getWorkspaceIdFromPath = exports.pruneQuotaHistory = exports.readQuotaHistoryDailyBuckets = exports.readQuotaHistoryRange = exports.appendQuotaHistorySample = exports.writeQuotaSnapshot = exports.readQuotaSnapshot = exports.QuotaPoller = exports.describeQuotaFailure = exports.fetchQuota = exports.AutoSwitchController = exports.decideAutoSwitch = exports.DEFAULT_AUTO_SWITCH_CONFIG = exports.removeLauncher = exports.writeLauncher = exports.isShellHookInstalled = exports.uninstallShellHook = exports.installShellHook = exports.setTerminalActiveProfile = exports.removeCodexAccount = exports.switchToCodexAccount = exports.finalizeCodexAccount = exports.prepareCodexAccount = exports.getCodexExecutionEnv = exports.resolveSidekickCodexHome = exports.getActiveCodexAccount = exports.listCodexAccounts = exports.getSystemCodexHome = exports.getCodexMonitoringHomes = exports.getCodexProfileHome = exports.getCodexProfilesDir = exports.readClaudeProfileIdentity = exports.isClaudeProfileAuthenticated = exports.claudeKeychainService = exports.claudeKeychainSuffix = exports.getClaudeProfileHome = exports.getClaudeProfilesDir = exports.getActiveAccountStatus = exports.removeSavedAccountProfile = void 0;
|
|
10
|
+
exports.accountLoginStatusSchema = exports.beginAccountLoginResultSchema = exports.accountManagerResultSchema = exports.accountProviderIdSchema = exports.activeAccountStatusSchema = exports.activeProviderAccountStatusSchema = exports.quotaHistoryDailyBucketSchema = exports.quotaHistorySampleSchema = exports.quotaHistoryRuntimeProviderSchema = exports.providerQuotaMapSchema = exports.codexProviderQuotaStateSchema = exports.claudeProviderQuotaStateSchema = exports.providerQuotaStateSchema = exports.runtimeQuotaProviderSchema = exports.quotaFailureDescriptorSchema = exports.peakHoursStateSchema = exports.quotaSourceSchema = exports.quotaProviderIdSchema = exports.quotaFailureKindSchema = exports.quotaStateSchema = exports.quotaWindowSchema = exports.extractSessionEvents = exports.permissionModeSchema = exports.sessionEventSchema = exports.sessionMessageSchema = exports.messageUsageSchema = exports.gatherAssetsForCwd = exports.codexSessions = exports.readCodexAssets = exports.claudeSessions = exports.readClaudeAssets = exports.extractCommands = exports.extractFilePaths = exports.extractUrls = exports.extractToolCalls = exports.extractToolCall = exports.extractTokenUsage = exports.LITELLM_CATALOG_URL = exports.normalizeLiteLlmCatalog = exports.hydratePricingCatalog = exports.formatCost = exports.sortModelIds = exports.compareModelIds = exports.getModelDisplayInfo = exports.shortModelName = exports.mergeCostSources = exports.calculateCostWithProvenance = exports.calculateCostWithPricing = exports.calculateCost = exports.getModelInfo = void 0;
|
|
11
|
+
exports.scopePeakHoursToSessionProvider = exports.isClaudeCodeSessionProvider = exports.fetchPeakHoursStatus = exports.createPeakHoursNotApplicableState = exports.fetchOpenAIStatus = exports.fetchProviderStatus = exports.assistantTurnToolRefSchema = exports.assistantTurnToolGroupStepSchema = exports.assistantTurnTimelineItemSchema = exports.assistantTurnSubagentStatusSchema = exports.assistantTurnSubagentSchema = exports.assistantTurnReasoningTimelineItemSchema = exports.assistantTurnProjectionSchema = exports.assistantTurnProcessStepSchema = exports.assistantTurnProcessSchema = exports.assistantTurnNarrationStepSchema = exports.assistantTurnEventTypeSchema = exports.assistantTurnEventSchema = exports.listAllAccountsResultSchema = exports.savedAccountProfileSchema = exports.accountEntrySchema = void 0;
|
|
11
12
|
var taskPersistence_1 = require("./types/taskPersistence");
|
|
12
13
|
Object.defineProperty(exports, "TASK_PERSISTENCE_SCHEMA_VERSION", { enumerable: true, get: function () { return taskPersistence_1.TASK_PERSISTENCE_SCHEMA_VERSION; } });
|
|
13
14
|
Object.defineProperty(exports, "normalizeTaskStatus", { enumerable: true, get: function () { return taskPersistence_1.normalizeTaskStatus; } });
|
|
@@ -212,10 +213,21 @@ Object.defineProperty(exports, "writeAccountRegistry", { enumerable: true, get:
|
|
|
212
213
|
Object.defineProperty(exports, "readActiveClaudeAccount", { enumerable: true, get: function () { return accounts_1.readActiveClaudeAccount; } });
|
|
213
214
|
Object.defineProperty(exports, "addCurrentAccount", { enumerable: true, get: function () { return accounts_1.addCurrentAccount; } });
|
|
214
215
|
Object.defineProperty(exports, "switchToAccount", { enumerable: true, get: function () { return accounts_1.switchToAccount; } });
|
|
216
|
+
Object.defineProperty(exports, "resolveActiveClaudeHome", { enumerable: true, get: function () { return accounts_1.resolveActiveClaudeHome; } });
|
|
217
|
+
Object.defineProperty(exports, "applyActiveClaudeToLiveHome", { enumerable: true, get: function () { return accounts_1.applyActiveClaudeToLiveHome; } });
|
|
218
|
+
Object.defineProperty(exports, "reconcileClaudeAuthState", { enumerable: true, get: function () { return accounts_1.reconcileClaudeAuthState; } });
|
|
215
219
|
Object.defineProperty(exports, "removeAccount", { enumerable: true, get: function () { return accounts_1.removeAccount; } });
|
|
216
220
|
Object.defineProperty(exports, "listAccounts", { enumerable: true, get: function () { return accounts_1.listAccounts; } });
|
|
217
221
|
Object.defineProperty(exports, "getActiveAccount", { enumerable: true, get: function () { return accounts_1.getActiveAccount; } });
|
|
218
222
|
Object.defineProperty(exports, "isMultiAccountEnabled", { enumerable: true, get: function () { return accounts_1.isMultiAccountEnabled; } });
|
|
223
|
+
var accountManager_1 = require("./accountManager");
|
|
224
|
+
Object.defineProperty(exports, "beginAccountLogin", { enumerable: true, get: function () { return accountManager_1.beginAccountLogin; } });
|
|
225
|
+
Object.defineProperty(exports, "getAccountLoginStatus", { enumerable: true, get: function () { return accountManager_1.getAccountLoginStatus; } });
|
|
226
|
+
Object.defineProperty(exports, "finalizeAccountLogin", { enumerable: true, get: function () { return accountManager_1.finalizeAccountLogin; } });
|
|
227
|
+
Object.defineProperty(exports, "spawnAccountLogin", { enumerable: true, get: function () { return accountManager_1.spawnAccountLogin; } });
|
|
228
|
+
Object.defineProperty(exports, "switchAccount", { enumerable: true, get: function () { return accountManager_1.switchAccount; } });
|
|
229
|
+
Object.defineProperty(exports, "listAllAccounts", { enumerable: true, get: function () { return accountManager_1.listAllAccounts; } });
|
|
230
|
+
Object.defineProperty(exports, "resolveClaudeLoginCommand", { enumerable: true, get: function () { return accountManager_1.resolveClaudeLoginCommand; } });
|
|
219
231
|
var accountRegistry_1 = require("./accountRegistry");
|
|
220
232
|
Object.defineProperty(exports, "getAccountsDir", { enumerable: true, get: function () { return accountRegistry_1.getAccountsDir; } });
|
|
221
233
|
Object.defineProperty(exports, "readSavedAccountRegistry", { enumerable: true, get: function () { return accountRegistry_1.readSavedAccountRegistry; } });
|
|
@@ -228,6 +240,13 @@ Object.defineProperty(exports, "replaceSavedAccountProfiles", { enumerable: true
|
|
|
228
240
|
Object.defineProperty(exports, "removeSavedAccountProfile", { enumerable: true, get: function () { return accountRegistry_1.removeSavedAccountProfile; } });
|
|
229
241
|
var accountStatus_1 = require("./accountStatus");
|
|
230
242
|
Object.defineProperty(exports, "getActiveAccountStatus", { enumerable: true, get: function () { return accountStatus_1.getActiveAccountStatus; } });
|
|
243
|
+
var claudeProfiles_1 = require("./claudeProfiles");
|
|
244
|
+
Object.defineProperty(exports, "getClaudeProfilesDir", { enumerable: true, get: function () { return claudeProfiles_1.getClaudeProfilesDir; } });
|
|
245
|
+
Object.defineProperty(exports, "getClaudeProfileHome", { enumerable: true, get: function () { return claudeProfiles_1.getClaudeProfileHome; } });
|
|
246
|
+
Object.defineProperty(exports, "claudeKeychainSuffix", { enumerable: true, get: function () { return claudeProfiles_1.claudeKeychainSuffix; } });
|
|
247
|
+
Object.defineProperty(exports, "claudeKeychainService", { enumerable: true, get: function () { return claudeProfiles_1.claudeKeychainService; } });
|
|
248
|
+
Object.defineProperty(exports, "isClaudeProfileAuthenticated", { enumerable: true, get: function () { return claudeProfiles_1.isClaudeProfileAuthenticated; } });
|
|
249
|
+
Object.defineProperty(exports, "readClaudeProfileIdentity", { enumerable: true, get: function () { return claudeProfiles_1.readClaudeProfileIdentity; } });
|
|
231
250
|
var codexProfiles_1 = require("./codexProfiles");
|
|
232
251
|
Object.defineProperty(exports, "getCodexProfilesDir", { enumerable: true, get: function () { return codexProfiles_1.getCodexProfilesDir; } });
|
|
233
252
|
Object.defineProperty(exports, "getCodexProfileHome", { enumerable: true, get: function () { return codexProfiles_1.getCodexProfileHome; } });
|
|
@@ -241,6 +260,17 @@ Object.defineProperty(exports, "prepareCodexAccount", { enumerable: true, get: f
|
|
|
241
260
|
Object.defineProperty(exports, "finalizeCodexAccount", { enumerable: true, get: function () { return codexProfiles_1.finalizeCodexAccount; } });
|
|
242
261
|
Object.defineProperty(exports, "switchToCodexAccount", { enumerable: true, get: function () { return codexProfiles_1.switchToCodexAccount; } });
|
|
243
262
|
Object.defineProperty(exports, "removeCodexAccount", { enumerable: true, get: function () { return codexProfiles_1.removeCodexAccount; } });
|
|
263
|
+
var terminalSync_1 = require("./terminalSync");
|
|
264
|
+
Object.defineProperty(exports, "setTerminalActiveProfile", { enumerable: true, get: function () { return terminalSync_1.setTerminalActiveProfile; } });
|
|
265
|
+
Object.defineProperty(exports, "installShellHook", { enumerable: true, get: function () { return terminalSync_1.installShellHook; } });
|
|
266
|
+
Object.defineProperty(exports, "uninstallShellHook", { enumerable: true, get: function () { return terminalSync_1.uninstallShellHook; } });
|
|
267
|
+
Object.defineProperty(exports, "isShellHookInstalled", { enumerable: true, get: function () { return terminalSync_1.isShellHookInstalled; } });
|
|
268
|
+
Object.defineProperty(exports, "writeLauncher", { enumerable: true, get: function () { return terminalSync_1.writeLauncher; } });
|
|
269
|
+
Object.defineProperty(exports, "removeLauncher", { enumerable: true, get: function () { return terminalSync_1.removeLauncher; } });
|
|
270
|
+
var autoSwitch_1 = require("./autoSwitch");
|
|
271
|
+
Object.defineProperty(exports, "DEFAULT_AUTO_SWITCH_CONFIG", { enumerable: true, get: function () { return autoSwitch_1.DEFAULT_AUTO_SWITCH_CONFIG; } });
|
|
272
|
+
Object.defineProperty(exports, "decideAutoSwitch", { enumerable: true, get: function () { return autoSwitch_1.decideAutoSwitch; } });
|
|
273
|
+
Object.defineProperty(exports, "AutoSwitchController", { enumerable: true, get: function () { return autoSwitch_1.AutoSwitchController; } });
|
|
244
274
|
// Quota
|
|
245
275
|
var quota_1 = require("./quota");
|
|
246
276
|
Object.defineProperty(exports, "fetchQuota", { enumerable: true, get: function () { return quota_1.fetchQuota; } });
|
|
@@ -297,6 +327,20 @@ Object.defineProperty(exports, "extractTokenUsage", { enumerable: true, get: fun
|
|
|
297
327
|
var toolCall_1 = require("./extractors/toolCall");
|
|
298
328
|
Object.defineProperty(exports, "extractToolCall", { enumerable: true, get: function () { return toolCall_1.extractToolCall; } });
|
|
299
329
|
Object.defineProperty(exports, "extractToolCalls", { enumerable: true, get: function () { return toolCall_1.extractToolCalls; } });
|
|
330
|
+
// Extractors — actionable session assets. Node-only: safe for CLI and
|
|
331
|
+
// extension-host code, not for browser/webview bundles.
|
|
332
|
+
var sessionAssets_1 = require("./extractors/sessionAssets");
|
|
333
|
+
Object.defineProperty(exports, "extractUrls", { enumerable: true, get: function () { return sessionAssets_1.extractUrls; } });
|
|
334
|
+
Object.defineProperty(exports, "extractFilePaths", { enumerable: true, get: function () { return sessionAssets_1.extractFilePaths; } });
|
|
335
|
+
Object.defineProperty(exports, "extractCommands", { enumerable: true, get: function () { return sessionAssets_1.extractCommands; } });
|
|
336
|
+
var claudeAssets_1 = require("./extractors/sources/claudeAssets");
|
|
337
|
+
Object.defineProperty(exports, "readClaudeAssets", { enumerable: true, get: function () { return claudeAssets_1.readClaudeAssets; } });
|
|
338
|
+
Object.defineProperty(exports, "claudeSessions", { enumerable: true, get: function () { return claudeAssets_1.claudeSessions; } });
|
|
339
|
+
var codexAssets_1 = require("./extractors/sources/codexAssets");
|
|
340
|
+
Object.defineProperty(exports, "readCodexAssets", { enumerable: true, get: function () { return codexAssets_1.readCodexAssets; } });
|
|
341
|
+
Object.defineProperty(exports, "codexSessions", { enumerable: true, get: function () { return codexAssets_1.codexSessions; } });
|
|
342
|
+
var gatherAssets_1 = require("./extractors/gatherAssets");
|
|
343
|
+
Object.defineProperty(exports, "gatherAssetsForCwd", { enumerable: true, get: function () { return gatherAssets_1.gatherAssetsForCwd; } });
|
|
300
344
|
// Schemas — Zod runtime validation for session events
|
|
301
345
|
var sessionEvent_1 = require("./schemas/sessionEvent");
|
|
302
346
|
Object.defineProperty(exports, "messageUsageSchema", { enumerable: true, get: function () { return sessionEvent_1.messageUsageSchema; } });
|
|
@@ -327,6 +371,14 @@ Object.defineProperty(exports, "quotaHistoryDailyBucketSchema", { enumerable: tr
|
|
|
327
371
|
var accountStatus_2 = require("./schemas/accountStatus");
|
|
328
372
|
Object.defineProperty(exports, "activeProviderAccountStatusSchema", { enumerable: true, get: function () { return accountStatus_2.activeProviderAccountStatusSchema; } });
|
|
329
373
|
Object.defineProperty(exports, "activeAccountStatusSchema", { enumerable: true, get: function () { return accountStatus_2.activeAccountStatusSchema; } });
|
|
374
|
+
var accountManager_2 = require("./schemas/accountManager");
|
|
375
|
+
Object.defineProperty(exports, "accountProviderIdSchema", { enumerable: true, get: function () { return accountManager_2.accountProviderIdSchema; } });
|
|
376
|
+
Object.defineProperty(exports, "accountManagerResultSchema", { enumerable: true, get: function () { return accountManager_2.accountManagerResultSchema; } });
|
|
377
|
+
Object.defineProperty(exports, "beginAccountLoginResultSchema", { enumerable: true, get: function () { return accountManager_2.beginAccountLoginResultSchema; } });
|
|
378
|
+
Object.defineProperty(exports, "accountLoginStatusSchema", { enumerable: true, get: function () { return accountManager_2.accountLoginStatusSchema; } });
|
|
379
|
+
Object.defineProperty(exports, "accountEntrySchema", { enumerable: true, get: function () { return accountManager_2.accountEntrySchema; } });
|
|
380
|
+
Object.defineProperty(exports, "savedAccountProfileSchema", { enumerable: true, get: function () { return accountManager_2.savedAccountProfileSchema; } });
|
|
381
|
+
Object.defineProperty(exports, "listAllAccountsResultSchema", { enumerable: true, get: function () { return accountManager_2.listAllAccountsResultSchema; } });
|
|
330
382
|
var assistantTurn_2 = require("./schemas/assistantTurn");
|
|
331
383
|
Object.defineProperty(exports, "assistantTurnEventSchema", { enumerable: true, get: function () { return assistantTurn_2.assistantTurnEventSchema; } });
|
|
332
384
|
Object.defineProperty(exports, "assistantTurnEventTypeSchema", { enumerable: true, get: function () { return assistantTurn_2.assistantTurnEventTypeSchema; } });
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for runtime validation of account management payloads.
|
|
3
|
+
*
|
|
4
|
+
* These schemas mirror the TypeScript interfaces in `accounts.ts`,
|
|
5
|
+
* `accountRegistry.ts`, and `accountManager.ts` (keep in sync when those
|
|
6
|
+
* change). They let consumers validate account-management IPC payloads
|
|
7
|
+
* without hand-mirroring the interfaces.
|
|
8
|
+
*
|
|
9
|
+
* @module schemas/accountManager
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
export declare const accountProviderIdSchema: z.ZodEnum<{
|
|
13
|
+
"claude-code": "claude-code";
|
|
14
|
+
codex: "codex";
|
|
15
|
+
}>;
|
|
16
|
+
export declare const accountManagerResultSchema: z.ZodObject<{
|
|
17
|
+
success: z.ZodBoolean;
|
|
18
|
+
error: z.ZodOptional<z.ZodString>;
|
|
19
|
+
warning: z.ZodOptional<z.ZodString>;
|
|
20
|
+
needsLogin: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
profileId: z.ZodOptional<z.ZodString>;
|
|
22
|
+
codexHome: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const beginAccountLoginResultSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
25
|
+
success: z.ZodLiteral<true>;
|
|
26
|
+
loginId: z.ZodString;
|
|
27
|
+
alreadyComplete: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
command: z.ZodOptional<z.ZodString>;
|
|
29
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
30
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
31
|
+
configDir: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
success: z.ZodLiteral<false>;
|
|
34
|
+
error: z.ZodString;
|
|
35
|
+
}, z.core.$strip>]>;
|
|
36
|
+
export declare const accountLoginStatusSchema: z.ZodObject<{
|
|
37
|
+
state: z.ZodEnum<{
|
|
38
|
+
pending: "pending";
|
|
39
|
+
authenticated: "authenticated";
|
|
40
|
+
failed: "failed";
|
|
41
|
+
}>;
|
|
42
|
+
email: z.ZodOptional<z.ZodString>;
|
|
43
|
+
error: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export declare const accountEntrySchema: z.ZodObject<{
|
|
46
|
+
uuid: z.ZodString;
|
|
47
|
+
email: z.ZodString;
|
|
48
|
+
label: z.ZodOptional<z.ZodString>;
|
|
49
|
+
addedAt: z.ZodString;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export declare const savedAccountProfileSchema: z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
providerId: z.ZodEnum<{
|
|
54
|
+
"claude-code": "claude-code";
|
|
55
|
+
codex: "codex";
|
|
56
|
+
}>;
|
|
57
|
+
addedAt: z.ZodString;
|
|
58
|
+
label: z.ZodOptional<z.ZodString>;
|
|
59
|
+
email: z.ZodOptional<z.ZodString>;
|
|
60
|
+
providerAccountId: z.ZodOptional<z.ZodString>;
|
|
61
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
email: z.ZodOptional<z.ZodString>;
|
|
63
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
64
|
+
planType: z.ZodOptional<z.ZodString>;
|
|
65
|
+
authMode: z.ZodOptional<z.ZodEnum<{
|
|
66
|
+
chatgpt: "chatgpt";
|
|
67
|
+
"api-key": "api-key";
|
|
68
|
+
unknown: "unknown";
|
|
69
|
+
}>>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export declare const listAllAccountsResultSchema: z.ZodObject<{
|
|
73
|
+
claude: z.ZodArray<z.ZodObject<{
|
|
74
|
+
uuid: z.ZodString;
|
|
75
|
+
email: z.ZodString;
|
|
76
|
+
label: z.ZodOptional<z.ZodString>;
|
|
77
|
+
addedAt: z.ZodString;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
codex: z.ZodArray<z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
providerId: z.ZodEnum<{
|
|
82
|
+
"claude-code": "claude-code";
|
|
83
|
+
codex: "codex";
|
|
84
|
+
}>;
|
|
85
|
+
addedAt: z.ZodString;
|
|
86
|
+
label: z.ZodOptional<z.ZodString>;
|
|
87
|
+
email: z.ZodOptional<z.ZodString>;
|
|
88
|
+
providerAccountId: z.ZodOptional<z.ZodString>;
|
|
89
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
email: z.ZodOptional<z.ZodString>;
|
|
91
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
92
|
+
planType: z.ZodOptional<z.ZodString>;
|
|
93
|
+
authMode: z.ZodOptional<z.ZodEnum<{
|
|
94
|
+
chatgpt: "chatgpt";
|
|
95
|
+
"api-key": "api-key";
|
|
96
|
+
unknown: "unknown";
|
|
97
|
+
}>>;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
100
|
+
activeByProvider: z.ZodObject<{
|
|
101
|
+
'claude-code': z.ZodNullable<z.ZodString>;
|
|
102
|
+
codex: z.ZodNullable<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for runtime validation of account management payloads.
|
|
4
|
+
*
|
|
5
|
+
* These schemas mirror the TypeScript interfaces in `accounts.ts`,
|
|
6
|
+
* `accountRegistry.ts`, and `accountManager.ts` (keep in sync when those
|
|
7
|
+
* change). They let consumers validate account-management IPC payloads
|
|
8
|
+
* without hand-mirroring the interfaces.
|
|
9
|
+
*
|
|
10
|
+
* @module schemas/accountManager
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.listAllAccountsResultSchema = exports.savedAccountProfileSchema = exports.accountEntrySchema = exports.accountLoginStatusSchema = exports.beginAccountLoginResultSchema = exports.accountManagerResultSchema = exports.accountProviderIdSchema = void 0;
|
|
14
|
+
const zod_1 = require("zod");
|
|
15
|
+
// ── AccountProviderId ──
|
|
16
|
+
exports.accountProviderIdSchema = zod_1.z.enum([
|
|
17
|
+
'claude-code',
|
|
18
|
+
'codex',
|
|
19
|
+
]);
|
|
20
|
+
// ── AccountManagerResult ──
|
|
21
|
+
exports.accountManagerResultSchema = zod_1.z.object({
|
|
22
|
+
success: zod_1.z.boolean(),
|
|
23
|
+
error: zod_1.z.string().optional(),
|
|
24
|
+
warning: zod_1.z.string().optional(),
|
|
25
|
+
needsLogin: zod_1.z.boolean().optional(),
|
|
26
|
+
profileId: zod_1.z.string().optional(),
|
|
27
|
+
codexHome: zod_1.z.string().optional(),
|
|
28
|
+
});
|
|
29
|
+
// ── BeginAccountLoginResult ──
|
|
30
|
+
const beginAccountLoginSuccessSchema = zod_1.z.object({
|
|
31
|
+
success: zod_1.z.literal(true),
|
|
32
|
+
loginId: zod_1.z.string(),
|
|
33
|
+
alreadyComplete: zod_1.z.boolean().optional(),
|
|
34
|
+
command: zod_1.z.string().optional(),
|
|
35
|
+
args: zod_1.z.array(zod_1.z.string()).optional(),
|
|
36
|
+
env: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional(),
|
|
37
|
+
configDir: zod_1.z.string().optional(),
|
|
38
|
+
});
|
|
39
|
+
const beginAccountLoginFailureSchema = zod_1.z.object({
|
|
40
|
+
success: zod_1.z.literal(false),
|
|
41
|
+
error: zod_1.z.string(),
|
|
42
|
+
});
|
|
43
|
+
exports.beginAccountLoginResultSchema = zod_1.z.union([
|
|
44
|
+
beginAccountLoginSuccessSchema,
|
|
45
|
+
beginAccountLoginFailureSchema,
|
|
46
|
+
]);
|
|
47
|
+
// ── AccountLoginStatus ──
|
|
48
|
+
exports.accountLoginStatusSchema = zod_1.z.object({
|
|
49
|
+
state: zod_1.z.enum(['pending', 'authenticated', 'failed']),
|
|
50
|
+
email: zod_1.z.string().optional(),
|
|
51
|
+
error: zod_1.z.string().optional(),
|
|
52
|
+
});
|
|
53
|
+
// ── AccountEntry ──
|
|
54
|
+
exports.accountEntrySchema = zod_1.z.object({
|
|
55
|
+
uuid: zod_1.z.string(),
|
|
56
|
+
email: zod_1.z.string(),
|
|
57
|
+
label: zod_1.z.string().optional(),
|
|
58
|
+
addedAt: zod_1.z.string(),
|
|
59
|
+
});
|
|
60
|
+
// ── SavedAccountProfile ──
|
|
61
|
+
const accountIdentityMetadataSchema = zod_1.z.object({
|
|
62
|
+
email: zod_1.z.string().optional(),
|
|
63
|
+
workspaceId: zod_1.z.string().optional(),
|
|
64
|
+
planType: zod_1.z.string().optional(),
|
|
65
|
+
authMode: zod_1.z.enum(['chatgpt', 'api-key', 'unknown']).optional(),
|
|
66
|
+
});
|
|
67
|
+
exports.savedAccountProfileSchema = zod_1.z.object({
|
|
68
|
+
id: zod_1.z.string(),
|
|
69
|
+
providerId: exports.accountProviderIdSchema,
|
|
70
|
+
addedAt: zod_1.z.string(),
|
|
71
|
+
label: zod_1.z.string().optional(),
|
|
72
|
+
email: zod_1.z.string().optional(),
|
|
73
|
+
providerAccountId: zod_1.z.string().optional(),
|
|
74
|
+
metadata: accountIdentityMetadataSchema.optional(),
|
|
75
|
+
});
|
|
76
|
+
// ── ListAllAccountsResult ──
|
|
77
|
+
exports.listAllAccountsResultSchema = zod_1.z.object({
|
|
78
|
+
claude: zod_1.z.array(exports.accountEntrySchema),
|
|
79
|
+
codex: zod_1.z.array(exports.savedAccountProfileSchema),
|
|
80
|
+
activeByProvider: zod_1.z.object({
|
|
81
|
+
'claude-code': zod_1.z.string().nullable(),
|
|
82
|
+
codex: zod_1.z.string().nullable(),
|
|
83
|
+
}),
|
|
84
|
+
});
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
export declare const assistantTurnEventTypeSchema: z.ZodEnum<{
|
|
9
9
|
status: "status";
|
|
10
|
+
error: "error";
|
|
10
11
|
tool_use: "tool_use";
|
|
11
12
|
tool_result: "tool_result";
|
|
12
|
-
error: "error";
|
|
13
13
|
text: "text";
|
|
14
14
|
progress: "progress";
|
|
15
15
|
thinking: "thinking";
|
|
@@ -18,9 +18,9 @@ export declare const assistantTurnEventTypeSchema: z.ZodEnum<{
|
|
|
18
18
|
export declare const assistantTurnEventSchema: z.ZodObject<{
|
|
19
19
|
eventType: z.ZodEnum<{
|
|
20
20
|
status: "status";
|
|
21
|
+
error: "error";
|
|
21
22
|
tool_use: "tool_use";
|
|
22
23
|
tool_result: "tool_result";
|
|
23
|
-
error: "error";
|
|
24
24
|
text: "text";
|
|
25
25
|
progress: "progress";
|
|
26
26
|
thinking: "thinking";
|
|
@@ -96,8 +96,8 @@ export declare const assistantTurnProcessSchema: z.ZodObject<{
|
|
|
96
96
|
}, z.core.$strip>], "kind">>;
|
|
97
97
|
}, z.core.$strip>;
|
|
98
98
|
export declare const assistantTurnSubagentStatusSchema: z.ZodEnum<{
|
|
99
|
-
completed: "completed";
|
|
100
99
|
failed: "failed";
|
|
100
|
+
completed: "completed";
|
|
101
101
|
running: "running";
|
|
102
102
|
}>;
|
|
103
103
|
export declare const assistantTurnSubagentSchema: z.ZodObject<{
|
|
@@ -105,8 +105,8 @@ export declare const assistantTurnSubagentSchema: z.ZodObject<{
|
|
|
105
105
|
label: z.ZodString;
|
|
106
106
|
agentType: z.ZodOptional<z.ZodString>;
|
|
107
107
|
status: z.ZodEnum<{
|
|
108
|
-
completed: "completed";
|
|
109
108
|
failed: "failed";
|
|
109
|
+
completed: "completed";
|
|
110
110
|
running: "running";
|
|
111
111
|
}>;
|
|
112
112
|
}, z.core.$strip>;
|
|
@@ -147,8 +147,8 @@ export declare const assistantTurnProjectionSchema: z.ZodObject<{
|
|
|
147
147
|
label: z.ZodString;
|
|
148
148
|
agentType: z.ZodOptional<z.ZodString>;
|
|
149
149
|
status: z.ZodEnum<{
|
|
150
|
-
completed: "completed";
|
|
151
150
|
failed: "failed";
|
|
151
|
+
completed: "completed";
|
|
152
152
|
running: "running";
|
|
153
153
|
}>;
|
|
154
154
|
}, z.core.$strip>>;
|