sidekick-shared 0.26.5 → 0.26.6
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 +35 -0
- package/README.md +56 -51
- package/dist/accountChanges.js +21 -2
- package/dist/accountHealth.d.ts +72 -0
- package/dist/accountHealth.js +286 -0
- package/dist/accountLaunch.d.ts +30 -0
- package/dist/accountLaunch.js +124 -0
- package/dist/accountManager.d.ts +33 -8
- package/dist/accountManager.js +183 -50
- package/dist/accountRegistry.d.ts +10 -0
- package/dist/accountRegistry.js +42 -22
- package/dist/accountSwitch.d.ts +43 -0
- package/dist/accountSwitch.js +115 -0
- package/dist/accountSync.d.ts +30 -0
- package/dist/accountSync.js +180 -0
- package/dist/accountSyncTypes.d.ts +25 -0
- package/dist/accountSyncTypes.js +7 -0
- package/dist/accounts.d.ts +58 -6
- package/dist/accounts.js +408 -189
- package/dist/claudeCredentials.d.ts +38 -0
- package/dist/claudeCredentials.js +74 -0
- package/dist/claudeProfiles.d.ts +40 -0
- package/dist/claudeProfiles.js +102 -10
- package/dist/codexAuth.d.ts +32 -0
- package/dist/codexAuth.js +127 -0
- package/dist/codexPaths.d.ts +21 -0
- package/dist/codexPaths.js +117 -0
- package/dist/codexProfiles.d.ts +58 -5
- package/dist/codexProfiles.js +574 -289
- package/dist/credentialIO.d.ts +12 -5
- package/dist/credentialIO.js +63 -29
- package/dist/credentials.d.ts +8 -0
- package/dist/credentials.js +28 -32
- package/dist/ensureDefaultAccounts.d.ts +8 -0
- package/dist/ensureDefaultAccounts.js +42 -82
- package/dist/index.d.ts +27 -10
- package/dist/index.js +61 -9
- package/dist/keepAlive.d.ts +44 -0
- package/dist/keepAlive.js +106 -0
- package/dist/processDetection.d.ts +32 -0
- package/dist/processDetection.js +210 -0
- package/dist/schemas/accountManager.d.ts +283 -1
- package/dist/schemas/accountManager.js +122 -1
- package/dist/schemas/assistantTurn.d.ts +2 -2
- package/dist/schemas/index.d.ts +6 -1
- package/dist/schemas/index.js +14 -1
- package/dist/schemas/observedSessionV1.d.ts +21 -21
- package/dist/schemas/quota.d.ts +18 -18
- package/dist/schemas/quotaHistory.d.ts +1 -1
- package/dist/schemas/stateFile.d.ts +5 -5
- package/dist/terminalSync.d.ts +5 -5
- package/dist/terminalSync.js +7 -112
- package/dist/writers/atomic.d.ts +2 -0
- package/dist/writers/atomic.js +49 -2
- package/package.json +1 -1
package/dist/codexProfiles.d.ts
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
import type { AccountIdentityMetadata, ResolvedActiveAccount, SavedAccountProfile } from './accountRegistry';
|
|
2
2
|
import type { AccountManagerResult } from './accounts';
|
|
3
|
+
import { type AccountHealthSource } from './accountHealth';
|
|
4
|
+
import { type SwitchAccountOptions, type SwitchAccountResult } from './accountSwitch';
|
|
5
|
+
import { type ProviderSyncReport } from './accountSyncTypes';
|
|
6
|
+
export { getCodexProfilesDir, getCodexProfileHome, getSystemCodexHome, getCodexCredentialStoreMode, } from './codexPaths';
|
|
7
|
+
export type { CodexCredentialStoreMode } from './codexPaths';
|
|
3
8
|
export interface CodexAccountManagerResult extends AccountManagerResult {
|
|
4
9
|
needsLogin?: boolean;
|
|
5
10
|
profileId?: string;
|
|
6
11
|
codexHome?: string;
|
|
7
12
|
}
|
|
8
|
-
export declare
|
|
13
|
+
export declare const CODEX_KEYRING_FIX_HINT = "Set `cli_auth_credentials_store = \"file\"` in ~/.codex/config.toml and run `codex login` again.";
|
|
9
14
|
export declare function getCodexMonitoringHomes(): string[];
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The single chokepoint for storing a Codex credential in a profile: the raw
|
|
17
|
+
* `auth.json` bytes (never re-serialized), the legacy `.credentials.json`
|
|
18
|
+
* when present, and the secret-free health sidecar.
|
|
19
|
+
*/
|
|
20
|
+
export declare function storeCodexProfileAuth(profileId: string, authRaw: string | null, legacyRaw: string | null, source: AccountHealthSource): void;
|
|
21
|
+
interface CodexLoginStatus {
|
|
22
|
+
loggedIn: boolean;
|
|
23
|
+
authMode?: 'chatgpt' | 'api-key';
|
|
24
|
+
}
|
|
25
|
+
export declare function parseCodexLoginStatusOutput(status: number | null, stdout: string): CodexLoginStatus;
|
|
26
|
+
/**
|
|
27
|
+
* Blocks the caller's event loop for up to {@link PROBE_TIMEOUT_MS}. Async code
|
|
28
|
+
* paths must use {@link getCodexLoginStatusAsync} instead — external consumers
|
|
29
|
+
* embed this package in processes where a blocked event loop freezes all IPC.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getCodexLoginStatus(codexHome: string): CodexLoginStatus;
|
|
32
|
+
export declare function getCodexLoginStatusAsync(codexHome: string): Promise<CodexLoginStatus>;
|
|
12
33
|
export declare function readCodexAccountMetadata(codexHome: string): AccountIdentityMetadata;
|
|
13
34
|
/** {@link readCodexAccountMetadata} without blocking the event loop on the CLI probe. */
|
|
14
35
|
export declare function readCodexAccountMetadataAsync(codexHome: string): Promise<AccountIdentityMetadata>;
|
|
@@ -45,9 +66,41 @@ export declare function finalizeCodexAccount(profileId: string, opts?: {
|
|
|
45
66
|
export declare function finalizeCodexAccountAsync(profileId: string, opts?: {
|
|
46
67
|
activate?: boolean;
|
|
47
68
|
}): Promise<CodexAccountManagerResult>;
|
|
48
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Serializes live-auth mutations across processes. Codex rotates refresh
|
|
71
|
+
* tokens, so two interleaved swaps stashing and restoring auth.json can
|
|
72
|
+
* resurrect a stale token and permanently invalidate the login. Lock ordering:
|
|
73
|
+
* this lock is taken first and the registry lock (inside setActiveSavedAccount
|
|
74
|
+
* / upsertSavedAccountProfile) inside it — never the reverse. Never spawn a
|
|
75
|
+
* child process while holding it.
|
|
76
|
+
*/
|
|
77
|
+
export declare function withCodexAuthSwapLock<T>(operation: () => T): T;
|
|
78
|
+
/**
|
|
79
|
+
* Merge duplicate Codex profiles (same workspace, else same email). The oldest
|
|
80
|
+
* profile keeps its id and label, receives the freshest `auth.json` and the
|
|
81
|
+
* quota snapshot, and the active pointer; losers are stashed, never deleted.
|
|
82
|
+
* Returns the removed ids. Caller holds the swap lock.
|
|
83
|
+
*/
|
|
84
|
+
export declare function dedupeCodexProfiles(): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Fold the live `auth.json` into the saved profiles: register an unknown login
|
|
87
|
+
* (label = email), refresh the matching profile's backup when the live file is
|
|
88
|
+
* newer, and re-point the active pointer at it. Caller holds the swap lock.
|
|
89
|
+
* Never throws; problems land in `warnings`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function syncCodexLiveStateUnlocked(source?: AccountHealthSource, probes?: {
|
|
92
|
+
systemKeyringLoggedIn?: boolean;
|
|
93
|
+
}): ProviderSyncReport;
|
|
94
|
+
/** {@link syncCodexLiveStateUnlocked} under the swap lock. */
|
|
95
|
+
export declare function syncCodexLiveState(source?: AccountHealthSource): ProviderSyncReport;
|
|
96
|
+
/**
|
|
97
|
+
* Remove isolated login homes that never authenticated once they are older
|
|
98
|
+
* than `olderThanMs`. Returns the removed profile ids.
|
|
99
|
+
*/
|
|
100
|
+
export declare function cleanupAbandonedCodexLogins(olderThanMs?: number, now?: number): string[];
|
|
101
|
+
export declare function switchToCodexAccount(profileId: string, options?: SwitchAccountOptions): SwitchAccountResult;
|
|
49
102
|
/** {@link switchToCodexAccount} without blocking the event loop on CLI probes. */
|
|
50
|
-
export declare function switchToCodexAccountAsync(profileId: string): Promise<
|
|
103
|
+
export declare function switchToCodexAccountAsync(profileId: string, options?: SwitchAccountOptions): Promise<SwitchAccountResult>;
|
|
51
104
|
export declare function reconcileCodexAuthState(): void;
|
|
52
105
|
/** {@link reconcileCodexAuthState} without blocking the event loop on CLI probes. */
|
|
53
106
|
export declare function reconcileCodexAuthStateAsync(): Promise<void>;
|