@omnicross/daemon 0.4.4 → 0.4.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/dist/cli.cjs +2015 -993
- package/dist/cli.js +1705 -667
- package/dist/index.cjs +2017 -992
- package/dist/index.d.cts +143 -2
- package/dist/index.d.ts +143 -2
- package/dist/index.js +1712 -674
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger, OutboundApiServerConfig, ProviderConfigSource, TransformerService, Transformer, ResolvedTransformerChain, ApiServerSettingsStore, PricingStore, AutomaticPricingSource, OutboundPermission, OutboundKeyDb, OutboundKeyDbRow, OutboundKeyPolicy, PricingEngine as PricingEngine$1, OpenAIOperationRegistry } from '@omnicross/core';
|
|
1
|
+
import { Logger, OutboundApiServerConfig, ProviderConfigSource, TransformerService, Transformer, ResolvedTransformerChain, ApiServerSettingsStore, PricingStore, AutomaticPricingSource, OutboundPermission, OutboundKeyDb, OutboundKeyDbRow, GatewayBindingTarget, OutboundKeyPolicy, PricingEngine as PricingEngine$1, OpenAIOperationRegistry } from '@omnicross/core';
|
|
2
2
|
import { SearchRuntime, SearchFrontendModes } from '@omnicross/core/search';
|
|
3
3
|
import { ApiKeyPoolService } from '@omnicross/core/completion/ApiKeyPoolService';
|
|
4
4
|
import { AllowanceSchedulingConfig, AccountProbeConfig, ImagesServerConfig, ImageProviderId, OutboundKeyDb as OutboundKeyDb$1, VoucherDb, KeySpendReader, OutboundApiServer } from '@omnicross/core/outbound-api';
|
|
@@ -2263,6 +2263,119 @@ type AuditCompactor = () => {
|
|
|
2263
2263
|
/** The read surface the AdminServer consumes (bootstrap binds it to the ledger dir). */
|
|
2264
2264
|
type BillingStatusReader = () => BillingDeliveryStatus;
|
|
2265
2265
|
|
|
2266
|
+
/**
|
|
2267
|
+
* Codex session discovery and provider migration.
|
|
2268
|
+
*
|
|
2269
|
+
* Codex stores the human-readable rollout in JSONL files and keeps the index
|
|
2270
|
+
* used by `codex resume` in state_5.sqlite. These two stores must move
|
|
2271
|
+
* together: changing only one of them makes a session either appear under the
|
|
2272
|
+
* wrong provider or disappear from resume entirely.
|
|
2273
|
+
*
|
|
2274
|
+
* This module deliberately exposes metadata only. It never returns a JSONL
|
|
2275
|
+
* line, prompt, tool output, or response body to the admin API.
|
|
2276
|
+
*/
|
|
2277
|
+
interface CodexSessionManagerOptions {
|
|
2278
|
+
/** Defaults to CODEX_HOME or the current user's `.codex` directory. */
|
|
2279
|
+
codexHome?: string;
|
|
2280
|
+
/** Defaults to `<codexHome>/state_5.sqlite`. */
|
|
2281
|
+
stateDatabasePath?: string;
|
|
2282
|
+
}
|
|
2283
|
+
interface CodexStateDatabaseStatus {
|
|
2284
|
+
path: string;
|
|
2285
|
+
available: boolean;
|
|
2286
|
+
reason?: string;
|
|
2287
|
+
}
|
|
2288
|
+
type CodexSessionStatus = 'ready' | 'missing_rollout' | 'unreadable_rollout';
|
|
2289
|
+
interface CodexSessionSummary {
|
|
2290
|
+
id: string;
|
|
2291
|
+
cwd: string;
|
|
2292
|
+
rolloutPath: string;
|
|
2293
|
+
provider: string | null;
|
|
2294
|
+
/** Provider from the JSONL session_meta record, when available. */
|
|
2295
|
+
jsonlProvider: string | null;
|
|
2296
|
+
model: string | null;
|
|
2297
|
+
createdAt: string | null;
|
|
2298
|
+
updatedAt: string | null;
|
|
2299
|
+
fileSize: number | null;
|
|
2300
|
+
fileModifiedAt: string | null;
|
|
2301
|
+
status: CodexSessionStatus;
|
|
2302
|
+
/** True when the session has a row in state_5.sqlite. */
|
|
2303
|
+
inStateDatabase: boolean;
|
|
2304
|
+
}
|
|
2305
|
+
interface CodexSessionListResult {
|
|
2306
|
+
projectPath: string;
|
|
2307
|
+
codexHome: string;
|
|
2308
|
+
stateDatabase: CodexStateDatabaseStatus;
|
|
2309
|
+
sessions: CodexSessionSummary[];
|
|
2310
|
+
warnings: string[];
|
|
2311
|
+
}
|
|
2312
|
+
interface CodexSessionProviderPlan {
|
|
2313
|
+
id: string;
|
|
2314
|
+
provider: string | null;
|
|
2315
|
+
model: string | null;
|
|
2316
|
+
rolloutPath: string;
|
|
2317
|
+
status: CodexSessionStatus | 'blocked';
|
|
2318
|
+
/** All provider values found in structured JSON properties. */
|
|
2319
|
+
providers: string[];
|
|
2320
|
+
/** Number of structured provider properties matching fromProvider. */
|
|
2321
|
+
matchingFields: number;
|
|
2322
|
+
/** Number of structured provider properties that would change. */
|
|
2323
|
+
changedFields: number;
|
|
2324
|
+
sqliteWillUpdate: boolean;
|
|
2325
|
+
action: 'update' | 'no_change' | 'blocked';
|
|
2326
|
+
reason?: string;
|
|
2327
|
+
}
|
|
2328
|
+
interface CodexSessionProviderPreview {
|
|
2329
|
+
projectPath: string;
|
|
2330
|
+
fromProvider: string | null;
|
|
2331
|
+
toProvider: string;
|
|
2332
|
+
stateDatabase: CodexStateDatabaseStatus;
|
|
2333
|
+
sessions: CodexSessionProviderPlan[];
|
|
2334
|
+
warnings: string[];
|
|
2335
|
+
}
|
|
2336
|
+
interface ApplyCodexSessionProviderInput {
|
|
2337
|
+
projectPath: string;
|
|
2338
|
+
sessionIds: string[];
|
|
2339
|
+
toProvider: string;
|
|
2340
|
+
fromProvider?: string;
|
|
2341
|
+
}
|
|
2342
|
+
interface CodexSessionProviderApplyResult {
|
|
2343
|
+
ok: true;
|
|
2344
|
+
projectPath: string;
|
|
2345
|
+
fromProvider: string | null;
|
|
2346
|
+
toProvider: string;
|
|
2347
|
+
updatedSessions: number;
|
|
2348
|
+
jsonlFiles: number;
|
|
2349
|
+
jsonlFields: number;
|
|
2350
|
+
sqliteRows: number;
|
|
2351
|
+
backups: string[];
|
|
2352
|
+
}
|
|
2353
|
+
declare class CodexSessionManagerError extends Error {
|
|
2354
|
+
constructor(message: string);
|
|
2355
|
+
}
|
|
2356
|
+
/**
|
|
2357
|
+
* The manager serializes mutations in one daemon process. This does not try
|
|
2358
|
+
* to lock Codex itself; the file snapshot check below still refuses to replace
|
|
2359
|
+
* a rollout that changed while it was being prepared.
|
|
2360
|
+
*/
|
|
2361
|
+
declare class CodexSessionManager {
|
|
2362
|
+
readonly codexHome: string;
|
|
2363
|
+
readonly stateDatabasePath: string;
|
|
2364
|
+
private mutationTail;
|
|
2365
|
+
constructor(options?: CodexSessionManagerOptions);
|
|
2366
|
+
list(projectPath: string): Promise<CodexSessionListResult>;
|
|
2367
|
+
preview(input: Omit<ApplyCodexSessionProviderInput, 'toProvider'> & {
|
|
2368
|
+
toProvider: string;
|
|
2369
|
+
}): Promise<CodexSessionProviderPreview>;
|
|
2370
|
+
apply(input: ApplyCodexSessionProviderInput): Promise<CodexSessionProviderApplyResult>;
|
|
2371
|
+
private applyLocked;
|
|
2372
|
+
private withMutationLock;
|
|
2373
|
+
}
|
|
2374
|
+
declare function replaceStructuredProviderFields(value: unknown, fromProvider: string | undefined, toProvider: string, providers?: Set<string>): {
|
|
2375
|
+
matchingFields: number;
|
|
2376
|
+
changedFields: number;
|
|
2377
|
+
};
|
|
2378
|
+
|
|
2266
2379
|
/**
|
|
2267
2380
|
* ProviderKeyQuota — BYO provider-row key quota parsing (pure functions).
|
|
2268
2381
|
*
|
|
@@ -3349,6 +3462,15 @@ declare class IntegrationManager {
|
|
|
3349
3462
|
}>;
|
|
3350
3463
|
/** Resolve the plaintext only for the command-auth helper; callers must not log it. */
|
|
3351
3464
|
getIntegrationToken(client: IntegrationClientId): Promise<string>;
|
|
3465
|
+
/**
|
|
3466
|
+
* Resolve ONE access key's plaintext by id — the `--key-id` variant the
|
|
3467
|
+
* command-auth helper serves for key-scoped Codex launches (each terminal
|
|
3468
|
+
* picks its own gateway key, so concurrent sessions can route to different
|
|
3469
|
+
* upstreams through their keys' bindings). Enforces the SAME usability
|
|
3470
|
+
* contract as the client-bound path: existing, enabled, not revoked,
|
|
3471
|
+
* revealable, and holding the codex-required endpoint permissions.
|
|
3472
|
+
*/
|
|
3473
|
+
getKeyToken(keyId: string): Promise<string>;
|
|
3352
3474
|
/** Compatibility alias for callers predating per-client bindings. */
|
|
3353
3475
|
getGatewayToken(client?: IntegrationClientId): Promise<string>;
|
|
3354
3476
|
private ensureClientKey;
|
|
@@ -3409,6 +3531,14 @@ type AntigravityLoopbackFn = (state: string, timeoutMs?: number, signal?: AbortS
|
|
|
3409
3531
|
* never a provider key. On win32 the token rides the spawned process environment
|
|
3410
3532
|
* (inherited by the terminal), never the command line / a file on disk.
|
|
3411
3533
|
*
|
|
3534
|
+
* KEY-SCOPED LAUNCH (`{ keyId }` body, codex only): instead of a route lease, the
|
|
3535
|
+
* terminal's Codex authenticates to the RESIDENT outbound gateway as ONE chosen
|
|
3536
|
+
* access key, so routing follows that key's gateway bindings. Concurrent
|
|
3537
|
+
* terminals can then use different keys (hence different upstreams) at once.
|
|
3538
|
+
* The redirect rides `-c` overrides reusing the INSTALLED provider name
|
|
3539
|
+
* (`omnicross`) plus a `--key-id`-scoped auth command; no secret ever enters the
|
|
3540
|
+
* spawned env (Codex invokes the helper itself).
|
|
3541
|
+
*
|
|
3412
3542
|
* @module @omnicross/daemon/admin/cliLaunch
|
|
3413
3543
|
*/
|
|
3414
3544
|
|
|
@@ -3771,6 +3901,12 @@ interface AdminApiDeps {
|
|
|
3771
3901
|
* actually runs.
|
|
3772
3902
|
*/
|
|
3773
3903
|
readonly cliCommandRunner?: CommandRunner;
|
|
3904
|
+
/**
|
|
3905
|
+
* Codex command-auth helper invocation for KEY-SCOPED launches (the `--key-id`
|
|
3906
|
+
* variant). Wired by bootstrap from the same inputs as the integration
|
|
3907
|
+
* install's helper; absent ⇒ `keyId` launches answer 501 (light embedders).
|
|
3908
|
+
*/
|
|
3909
|
+
readonly codexAuthHelper?: CodexAuthHelperConfig;
|
|
3774
3910
|
/** Factory so each request observes the outbound server's current loopback port. */
|
|
3775
3911
|
readonly integrationManagerFactory?: () => IntegrationManager;
|
|
3776
3912
|
/**
|
|
@@ -3815,6 +3951,8 @@ declare function handleAdminApi(req: http.IncomingMessage, res: http.ServerRespo
|
|
|
3815
3951
|
|
|
3816
3952
|
/** The dependencies the admin server + its API need (live daemon handles). */
|
|
3817
3953
|
interface AdminServerDeps extends AdminApiDeps {
|
|
3954
|
+
/** Authenticated Codex rollout/state database manager. */
|
|
3955
|
+
codexSessionManager?: CodexSessionManager;
|
|
3818
3956
|
/** Read the resolved admin config (enabled/port/networkBinding/token). */
|
|
3819
3957
|
getAdminConfig: () => ResolvedAdminConfig;
|
|
3820
3958
|
/**
|
|
@@ -4209,6 +4347,7 @@ declare class JsonOutboundKeyDb implements OutboundKeyDb {
|
|
|
4209
4347
|
outboundApiKeysSetEnabled(id: string, enabled: boolean): Promise<boolean>;
|
|
4210
4348
|
outboundApiKeysSetPermissions(id: string, permissions: OutboundPermission[]): Promise<boolean>;
|
|
4211
4349
|
outboundApiKeysSetMaxConcurrency(id: string, maxConcurrency: number | null): Promise<boolean>;
|
|
4350
|
+
outboundApiKeysSetUpstream(id: string, target: GatewayBindingTarget | null): Promise<boolean>;
|
|
4212
4351
|
outboundApiKeysSetPolicy(id: string, policy: OutboundKeyPolicy): Promise<boolean>;
|
|
4213
4352
|
outboundApiKeysMarkActivated(id: string, activatedAt: number): Promise<boolean>;
|
|
4214
4353
|
/** Apply `fn` to the row with `id`, persisting when it returns true. */
|
|
@@ -4896,6 +5035,8 @@ interface Daemon {
|
|
|
4896
5035
|
readonly usageRecorder: UsageRecorder;
|
|
4897
5036
|
/** The localhost admin/dashboard HTTP listener (RT3). Started by `start.ts`. */
|
|
4898
5037
|
readonly adminServer: AdminServer;
|
|
5038
|
+
/** Codex JSONL + state_5.sqlite session provider manager. */
|
|
5039
|
+
readonly codexSessionManager: CodexSessionManager;
|
|
4899
5040
|
/**
|
|
4900
5041
|
* Proactive background OAuth refresh sweep (external-cli-sync). NOT started
|
|
4901
5042
|
* here — `start.ts` arms it for the resident daemon; the short-lived `launch`
|
|
@@ -5212,4 +5353,4 @@ declare function mapCcrToOmnicross(ccr: CcrConfig): {
|
|
|
5212
5353
|
notes: string[];
|
|
5213
5354
|
};
|
|
5214
5355
|
|
|
5215
|
-
export { type AdminApiDeps, AdminServer, type AdminServerDeps, type AdminServerStatus, type CcrConfig, type CcrProvider, type CcrRouter, ConfigFileProviderConfigSource, ConfigurableLogger, ConsoleLogger, DEFAULT_ADMIN_PORT, type Daemon, type DaemonAdminConfig, type DaemonApiFormat, type DaemonConfig, type DaemonPaths, type DaemonProviderConfig, type HealthReportDeps, type HostedImageContributionFactory, type HostedImageRuntimeGenerationLease, type ImageApiMetricDimensions, type ImageApiMetricSnapshot, type ImageExecutionMetricDimensions, type ImageExecutionMetricSnapshot, type ImageHistogramSnapshot, ImageObservability, type ImageObservabilityOptions, type ImageObservabilitySnapshot, type ImageRuntimeCapabilityInspection, type ImageRuntimeGenerationFactoryOptions, type ImageRuntimeGenerationSharedStorage, ImageRuntimeManager, type ImageRuntimeManagerStatus, type ImageRuntimeMetadataObservability, type ImageRuntimeResourceStatus, type ImageRuntimeSafeUnavailableReason, JsonApiServerSettingsStore, JsonOutboundKeyDb, JsonSubscriptionCredentialStore, type PreparedImageRuntimeChange, type PreparedImageRuntimeGeneration, type ProductionImageRuntimeComponents, type ProductionImageRuntimeGeneration, type ResolvedAdminConfig, type TrustedImageApiRuntimeResolver, type TrustedImageApiRuntimeResolverOptions, buildDaemon, buildHealthReport, createHostedImageContributionFactory, createImageRuntimeGeneration, createTrustedImageApiRuntimeResolver, handleAdminApi, inferApiFormat, loadConfig, mapCcrToOmnicross, parseCcrConfig, resetDaemonSingletonsForTests, resolveAdminConfig, saveConfig, validateConfig };
|
|
5356
|
+
export { type AdminApiDeps, AdminServer, type AdminServerDeps, type AdminServerStatus, type ApplyCodexSessionProviderInput, type CcrConfig, type CcrProvider, type CcrRouter, type CodexSessionListResult, CodexSessionManager, CodexSessionManagerError, type CodexSessionManagerOptions, type CodexSessionProviderApplyResult, type CodexSessionProviderPlan, type CodexSessionProviderPreview, type CodexSessionSummary, type CodexStateDatabaseStatus, ConfigFileProviderConfigSource, ConfigurableLogger, ConsoleLogger, DEFAULT_ADMIN_PORT, type Daemon, type DaemonAdminConfig, type DaemonApiFormat, type DaemonConfig, type DaemonPaths, type DaemonProviderConfig, type HealthReportDeps, type HostedImageContributionFactory, type HostedImageRuntimeGenerationLease, type ImageApiMetricDimensions, type ImageApiMetricSnapshot, type ImageExecutionMetricDimensions, type ImageExecutionMetricSnapshot, type ImageHistogramSnapshot, ImageObservability, type ImageObservabilityOptions, type ImageObservabilitySnapshot, type ImageRuntimeCapabilityInspection, type ImageRuntimeGenerationFactoryOptions, type ImageRuntimeGenerationSharedStorage, ImageRuntimeManager, type ImageRuntimeManagerStatus, type ImageRuntimeMetadataObservability, type ImageRuntimeResourceStatus, type ImageRuntimeSafeUnavailableReason, JsonApiServerSettingsStore, JsonOutboundKeyDb, JsonSubscriptionCredentialStore, type PreparedImageRuntimeChange, type PreparedImageRuntimeGeneration, type ProductionImageRuntimeComponents, type ProductionImageRuntimeGeneration, type ResolvedAdminConfig, type TrustedImageApiRuntimeResolver, type TrustedImageApiRuntimeResolverOptions, buildDaemon, buildHealthReport, createHostedImageContributionFactory, createImageRuntimeGeneration, createTrustedImageApiRuntimeResolver, handleAdminApi, inferApiFormat, loadConfig, mapCcrToOmnicross, parseCcrConfig, replaceStructuredProviderFields, resetDaemonSingletonsForTests, resolveAdminConfig, saveConfig, validateConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger, OutboundApiServerConfig, ProviderConfigSource, TransformerService, Transformer, ResolvedTransformerChain, ApiServerSettingsStore, PricingStore, AutomaticPricingSource, OutboundPermission, OutboundKeyDb, OutboundKeyDbRow, OutboundKeyPolicy, PricingEngine as PricingEngine$1, OpenAIOperationRegistry } from '@omnicross/core';
|
|
1
|
+
import { Logger, OutboundApiServerConfig, ProviderConfigSource, TransformerService, Transformer, ResolvedTransformerChain, ApiServerSettingsStore, PricingStore, AutomaticPricingSource, OutboundPermission, OutboundKeyDb, OutboundKeyDbRow, GatewayBindingTarget, OutboundKeyPolicy, PricingEngine as PricingEngine$1, OpenAIOperationRegistry } from '@omnicross/core';
|
|
2
2
|
import { SearchRuntime, SearchFrontendModes } from '@omnicross/core/search';
|
|
3
3
|
import { ApiKeyPoolService } from '@omnicross/core/completion/ApiKeyPoolService';
|
|
4
4
|
import { AllowanceSchedulingConfig, AccountProbeConfig, ImagesServerConfig, ImageProviderId, OutboundKeyDb as OutboundKeyDb$1, VoucherDb, KeySpendReader, OutboundApiServer } from '@omnicross/core/outbound-api';
|
|
@@ -2263,6 +2263,119 @@ type AuditCompactor = () => {
|
|
|
2263
2263
|
/** The read surface the AdminServer consumes (bootstrap binds it to the ledger dir). */
|
|
2264
2264
|
type BillingStatusReader = () => BillingDeliveryStatus;
|
|
2265
2265
|
|
|
2266
|
+
/**
|
|
2267
|
+
* Codex session discovery and provider migration.
|
|
2268
|
+
*
|
|
2269
|
+
* Codex stores the human-readable rollout in JSONL files and keeps the index
|
|
2270
|
+
* used by `codex resume` in state_5.sqlite. These two stores must move
|
|
2271
|
+
* together: changing only one of them makes a session either appear under the
|
|
2272
|
+
* wrong provider or disappear from resume entirely.
|
|
2273
|
+
*
|
|
2274
|
+
* This module deliberately exposes metadata only. It never returns a JSONL
|
|
2275
|
+
* line, prompt, tool output, or response body to the admin API.
|
|
2276
|
+
*/
|
|
2277
|
+
interface CodexSessionManagerOptions {
|
|
2278
|
+
/** Defaults to CODEX_HOME or the current user's `.codex` directory. */
|
|
2279
|
+
codexHome?: string;
|
|
2280
|
+
/** Defaults to `<codexHome>/state_5.sqlite`. */
|
|
2281
|
+
stateDatabasePath?: string;
|
|
2282
|
+
}
|
|
2283
|
+
interface CodexStateDatabaseStatus {
|
|
2284
|
+
path: string;
|
|
2285
|
+
available: boolean;
|
|
2286
|
+
reason?: string;
|
|
2287
|
+
}
|
|
2288
|
+
type CodexSessionStatus = 'ready' | 'missing_rollout' | 'unreadable_rollout';
|
|
2289
|
+
interface CodexSessionSummary {
|
|
2290
|
+
id: string;
|
|
2291
|
+
cwd: string;
|
|
2292
|
+
rolloutPath: string;
|
|
2293
|
+
provider: string | null;
|
|
2294
|
+
/** Provider from the JSONL session_meta record, when available. */
|
|
2295
|
+
jsonlProvider: string | null;
|
|
2296
|
+
model: string | null;
|
|
2297
|
+
createdAt: string | null;
|
|
2298
|
+
updatedAt: string | null;
|
|
2299
|
+
fileSize: number | null;
|
|
2300
|
+
fileModifiedAt: string | null;
|
|
2301
|
+
status: CodexSessionStatus;
|
|
2302
|
+
/** True when the session has a row in state_5.sqlite. */
|
|
2303
|
+
inStateDatabase: boolean;
|
|
2304
|
+
}
|
|
2305
|
+
interface CodexSessionListResult {
|
|
2306
|
+
projectPath: string;
|
|
2307
|
+
codexHome: string;
|
|
2308
|
+
stateDatabase: CodexStateDatabaseStatus;
|
|
2309
|
+
sessions: CodexSessionSummary[];
|
|
2310
|
+
warnings: string[];
|
|
2311
|
+
}
|
|
2312
|
+
interface CodexSessionProviderPlan {
|
|
2313
|
+
id: string;
|
|
2314
|
+
provider: string | null;
|
|
2315
|
+
model: string | null;
|
|
2316
|
+
rolloutPath: string;
|
|
2317
|
+
status: CodexSessionStatus | 'blocked';
|
|
2318
|
+
/** All provider values found in structured JSON properties. */
|
|
2319
|
+
providers: string[];
|
|
2320
|
+
/** Number of structured provider properties matching fromProvider. */
|
|
2321
|
+
matchingFields: number;
|
|
2322
|
+
/** Number of structured provider properties that would change. */
|
|
2323
|
+
changedFields: number;
|
|
2324
|
+
sqliteWillUpdate: boolean;
|
|
2325
|
+
action: 'update' | 'no_change' | 'blocked';
|
|
2326
|
+
reason?: string;
|
|
2327
|
+
}
|
|
2328
|
+
interface CodexSessionProviderPreview {
|
|
2329
|
+
projectPath: string;
|
|
2330
|
+
fromProvider: string | null;
|
|
2331
|
+
toProvider: string;
|
|
2332
|
+
stateDatabase: CodexStateDatabaseStatus;
|
|
2333
|
+
sessions: CodexSessionProviderPlan[];
|
|
2334
|
+
warnings: string[];
|
|
2335
|
+
}
|
|
2336
|
+
interface ApplyCodexSessionProviderInput {
|
|
2337
|
+
projectPath: string;
|
|
2338
|
+
sessionIds: string[];
|
|
2339
|
+
toProvider: string;
|
|
2340
|
+
fromProvider?: string;
|
|
2341
|
+
}
|
|
2342
|
+
interface CodexSessionProviderApplyResult {
|
|
2343
|
+
ok: true;
|
|
2344
|
+
projectPath: string;
|
|
2345
|
+
fromProvider: string | null;
|
|
2346
|
+
toProvider: string;
|
|
2347
|
+
updatedSessions: number;
|
|
2348
|
+
jsonlFiles: number;
|
|
2349
|
+
jsonlFields: number;
|
|
2350
|
+
sqliteRows: number;
|
|
2351
|
+
backups: string[];
|
|
2352
|
+
}
|
|
2353
|
+
declare class CodexSessionManagerError extends Error {
|
|
2354
|
+
constructor(message: string);
|
|
2355
|
+
}
|
|
2356
|
+
/**
|
|
2357
|
+
* The manager serializes mutations in one daemon process. This does not try
|
|
2358
|
+
* to lock Codex itself; the file snapshot check below still refuses to replace
|
|
2359
|
+
* a rollout that changed while it was being prepared.
|
|
2360
|
+
*/
|
|
2361
|
+
declare class CodexSessionManager {
|
|
2362
|
+
readonly codexHome: string;
|
|
2363
|
+
readonly stateDatabasePath: string;
|
|
2364
|
+
private mutationTail;
|
|
2365
|
+
constructor(options?: CodexSessionManagerOptions);
|
|
2366
|
+
list(projectPath: string): Promise<CodexSessionListResult>;
|
|
2367
|
+
preview(input: Omit<ApplyCodexSessionProviderInput, 'toProvider'> & {
|
|
2368
|
+
toProvider: string;
|
|
2369
|
+
}): Promise<CodexSessionProviderPreview>;
|
|
2370
|
+
apply(input: ApplyCodexSessionProviderInput): Promise<CodexSessionProviderApplyResult>;
|
|
2371
|
+
private applyLocked;
|
|
2372
|
+
private withMutationLock;
|
|
2373
|
+
}
|
|
2374
|
+
declare function replaceStructuredProviderFields(value: unknown, fromProvider: string | undefined, toProvider: string, providers?: Set<string>): {
|
|
2375
|
+
matchingFields: number;
|
|
2376
|
+
changedFields: number;
|
|
2377
|
+
};
|
|
2378
|
+
|
|
2266
2379
|
/**
|
|
2267
2380
|
* ProviderKeyQuota — BYO provider-row key quota parsing (pure functions).
|
|
2268
2381
|
*
|
|
@@ -3349,6 +3462,15 @@ declare class IntegrationManager {
|
|
|
3349
3462
|
}>;
|
|
3350
3463
|
/** Resolve the plaintext only for the command-auth helper; callers must not log it. */
|
|
3351
3464
|
getIntegrationToken(client: IntegrationClientId): Promise<string>;
|
|
3465
|
+
/**
|
|
3466
|
+
* Resolve ONE access key's plaintext by id — the `--key-id` variant the
|
|
3467
|
+
* command-auth helper serves for key-scoped Codex launches (each terminal
|
|
3468
|
+
* picks its own gateway key, so concurrent sessions can route to different
|
|
3469
|
+
* upstreams through their keys' bindings). Enforces the SAME usability
|
|
3470
|
+
* contract as the client-bound path: existing, enabled, not revoked,
|
|
3471
|
+
* revealable, and holding the codex-required endpoint permissions.
|
|
3472
|
+
*/
|
|
3473
|
+
getKeyToken(keyId: string): Promise<string>;
|
|
3352
3474
|
/** Compatibility alias for callers predating per-client bindings. */
|
|
3353
3475
|
getGatewayToken(client?: IntegrationClientId): Promise<string>;
|
|
3354
3476
|
private ensureClientKey;
|
|
@@ -3409,6 +3531,14 @@ type AntigravityLoopbackFn = (state: string, timeoutMs?: number, signal?: AbortS
|
|
|
3409
3531
|
* never a provider key. On win32 the token rides the spawned process environment
|
|
3410
3532
|
* (inherited by the terminal), never the command line / a file on disk.
|
|
3411
3533
|
*
|
|
3534
|
+
* KEY-SCOPED LAUNCH (`{ keyId }` body, codex only): instead of a route lease, the
|
|
3535
|
+
* terminal's Codex authenticates to the RESIDENT outbound gateway as ONE chosen
|
|
3536
|
+
* access key, so routing follows that key's gateway bindings. Concurrent
|
|
3537
|
+
* terminals can then use different keys (hence different upstreams) at once.
|
|
3538
|
+
* The redirect rides `-c` overrides reusing the INSTALLED provider name
|
|
3539
|
+
* (`omnicross`) plus a `--key-id`-scoped auth command; no secret ever enters the
|
|
3540
|
+
* spawned env (Codex invokes the helper itself).
|
|
3541
|
+
*
|
|
3412
3542
|
* @module @omnicross/daemon/admin/cliLaunch
|
|
3413
3543
|
*/
|
|
3414
3544
|
|
|
@@ -3771,6 +3901,12 @@ interface AdminApiDeps {
|
|
|
3771
3901
|
* actually runs.
|
|
3772
3902
|
*/
|
|
3773
3903
|
readonly cliCommandRunner?: CommandRunner;
|
|
3904
|
+
/**
|
|
3905
|
+
* Codex command-auth helper invocation for KEY-SCOPED launches (the `--key-id`
|
|
3906
|
+
* variant). Wired by bootstrap from the same inputs as the integration
|
|
3907
|
+
* install's helper; absent ⇒ `keyId` launches answer 501 (light embedders).
|
|
3908
|
+
*/
|
|
3909
|
+
readonly codexAuthHelper?: CodexAuthHelperConfig;
|
|
3774
3910
|
/** Factory so each request observes the outbound server's current loopback port. */
|
|
3775
3911
|
readonly integrationManagerFactory?: () => IntegrationManager;
|
|
3776
3912
|
/**
|
|
@@ -3815,6 +3951,8 @@ declare function handleAdminApi(req: http.IncomingMessage, res: http.ServerRespo
|
|
|
3815
3951
|
|
|
3816
3952
|
/** The dependencies the admin server + its API need (live daemon handles). */
|
|
3817
3953
|
interface AdminServerDeps extends AdminApiDeps {
|
|
3954
|
+
/** Authenticated Codex rollout/state database manager. */
|
|
3955
|
+
codexSessionManager?: CodexSessionManager;
|
|
3818
3956
|
/** Read the resolved admin config (enabled/port/networkBinding/token). */
|
|
3819
3957
|
getAdminConfig: () => ResolvedAdminConfig;
|
|
3820
3958
|
/**
|
|
@@ -4209,6 +4347,7 @@ declare class JsonOutboundKeyDb implements OutboundKeyDb {
|
|
|
4209
4347
|
outboundApiKeysSetEnabled(id: string, enabled: boolean): Promise<boolean>;
|
|
4210
4348
|
outboundApiKeysSetPermissions(id: string, permissions: OutboundPermission[]): Promise<boolean>;
|
|
4211
4349
|
outboundApiKeysSetMaxConcurrency(id: string, maxConcurrency: number | null): Promise<boolean>;
|
|
4350
|
+
outboundApiKeysSetUpstream(id: string, target: GatewayBindingTarget | null): Promise<boolean>;
|
|
4212
4351
|
outboundApiKeysSetPolicy(id: string, policy: OutboundKeyPolicy): Promise<boolean>;
|
|
4213
4352
|
outboundApiKeysMarkActivated(id: string, activatedAt: number): Promise<boolean>;
|
|
4214
4353
|
/** Apply `fn` to the row with `id`, persisting when it returns true. */
|
|
@@ -4896,6 +5035,8 @@ interface Daemon {
|
|
|
4896
5035
|
readonly usageRecorder: UsageRecorder;
|
|
4897
5036
|
/** The localhost admin/dashboard HTTP listener (RT3). Started by `start.ts`. */
|
|
4898
5037
|
readonly adminServer: AdminServer;
|
|
5038
|
+
/** Codex JSONL + state_5.sqlite session provider manager. */
|
|
5039
|
+
readonly codexSessionManager: CodexSessionManager;
|
|
4899
5040
|
/**
|
|
4900
5041
|
* Proactive background OAuth refresh sweep (external-cli-sync). NOT started
|
|
4901
5042
|
* here — `start.ts` arms it for the resident daemon; the short-lived `launch`
|
|
@@ -5212,4 +5353,4 @@ declare function mapCcrToOmnicross(ccr: CcrConfig): {
|
|
|
5212
5353
|
notes: string[];
|
|
5213
5354
|
};
|
|
5214
5355
|
|
|
5215
|
-
export { type AdminApiDeps, AdminServer, type AdminServerDeps, type AdminServerStatus, type CcrConfig, type CcrProvider, type CcrRouter, ConfigFileProviderConfigSource, ConfigurableLogger, ConsoleLogger, DEFAULT_ADMIN_PORT, type Daemon, type DaemonAdminConfig, type DaemonApiFormat, type DaemonConfig, type DaemonPaths, type DaemonProviderConfig, type HealthReportDeps, type HostedImageContributionFactory, type HostedImageRuntimeGenerationLease, type ImageApiMetricDimensions, type ImageApiMetricSnapshot, type ImageExecutionMetricDimensions, type ImageExecutionMetricSnapshot, type ImageHistogramSnapshot, ImageObservability, type ImageObservabilityOptions, type ImageObservabilitySnapshot, type ImageRuntimeCapabilityInspection, type ImageRuntimeGenerationFactoryOptions, type ImageRuntimeGenerationSharedStorage, ImageRuntimeManager, type ImageRuntimeManagerStatus, type ImageRuntimeMetadataObservability, type ImageRuntimeResourceStatus, type ImageRuntimeSafeUnavailableReason, JsonApiServerSettingsStore, JsonOutboundKeyDb, JsonSubscriptionCredentialStore, type PreparedImageRuntimeChange, type PreparedImageRuntimeGeneration, type ProductionImageRuntimeComponents, type ProductionImageRuntimeGeneration, type ResolvedAdminConfig, type TrustedImageApiRuntimeResolver, type TrustedImageApiRuntimeResolverOptions, buildDaemon, buildHealthReport, createHostedImageContributionFactory, createImageRuntimeGeneration, createTrustedImageApiRuntimeResolver, handleAdminApi, inferApiFormat, loadConfig, mapCcrToOmnicross, parseCcrConfig, resetDaemonSingletonsForTests, resolveAdminConfig, saveConfig, validateConfig };
|
|
5356
|
+
export { type AdminApiDeps, AdminServer, type AdminServerDeps, type AdminServerStatus, type ApplyCodexSessionProviderInput, type CcrConfig, type CcrProvider, type CcrRouter, type CodexSessionListResult, CodexSessionManager, CodexSessionManagerError, type CodexSessionManagerOptions, type CodexSessionProviderApplyResult, type CodexSessionProviderPlan, type CodexSessionProviderPreview, type CodexSessionSummary, type CodexStateDatabaseStatus, ConfigFileProviderConfigSource, ConfigurableLogger, ConsoleLogger, DEFAULT_ADMIN_PORT, type Daemon, type DaemonAdminConfig, type DaemonApiFormat, type DaemonConfig, type DaemonPaths, type DaemonProviderConfig, type HealthReportDeps, type HostedImageContributionFactory, type HostedImageRuntimeGenerationLease, type ImageApiMetricDimensions, type ImageApiMetricSnapshot, type ImageExecutionMetricDimensions, type ImageExecutionMetricSnapshot, type ImageHistogramSnapshot, ImageObservability, type ImageObservabilityOptions, type ImageObservabilitySnapshot, type ImageRuntimeCapabilityInspection, type ImageRuntimeGenerationFactoryOptions, type ImageRuntimeGenerationSharedStorage, ImageRuntimeManager, type ImageRuntimeManagerStatus, type ImageRuntimeMetadataObservability, type ImageRuntimeResourceStatus, type ImageRuntimeSafeUnavailableReason, JsonApiServerSettingsStore, JsonOutboundKeyDb, JsonSubscriptionCredentialStore, type PreparedImageRuntimeChange, type PreparedImageRuntimeGeneration, type ProductionImageRuntimeComponents, type ProductionImageRuntimeGeneration, type ResolvedAdminConfig, type TrustedImageApiRuntimeResolver, type TrustedImageApiRuntimeResolverOptions, buildDaemon, buildHealthReport, createHostedImageContributionFactory, createImageRuntimeGeneration, createTrustedImageApiRuntimeResolver, handleAdminApi, inferApiFormat, loadConfig, mapCcrToOmnicross, parseCcrConfig, replaceStructuredProviderFields, resetDaemonSingletonsForTests, resolveAdminConfig, saveConfig, validateConfig };
|