agent-shim 11.85.0 → 11.86.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.
@@ -5505,7 +5505,7 @@ type CategoryClassificationOverlay = z.infer<typeof CategoryClassificationOverla
5505
5505
  interface LayoutPaths {
5506
5506
  /** The resolved root directory, see `resolveAgentShimHome`. */
5507
5507
  readonly root: string;
5508
- /** Directory holding one subdirectory per identity (symlink farm + local credentials/daemon state). */
5508
+ /** Directory holding one subdirectory per identity (symlink farm + local credentials/daemon state), named by the identity's id: the name it was created with, or a free variant of it, kept for good by a rename, which changes only the `name` in its `identity.json`. */
5509
5509
  readonly identitiesDir: string;
5510
5510
  /** Directory holding named, reusable configuration profile JSON files. */
5511
5511
  readonly configProfilesDir: string;
@@ -5579,7 +5579,7 @@ interface LayoutPaths {
5579
5579
  readonly usageDir: string;
5580
5580
  /** Directory of the append-only usage log: one `<YYYY-MM-DD>.<writer-pid>.jsonl` segment per writing process per UTC day. */
5581
5581
  readonly usageLogDir: string;
5582
- /** Directory of the latest-state snapshots, one `<identity>.json` per identity: the stable file other tools read. */
5582
+ /** Directory of the latest-state snapshots, one `<id>.json` per identity, named by the id the identity is stored under (its directory's name, which a rename keeps), never by its name: the stable file other tools read. */
5583
5583
  readonly usageSnapshotsDir: string;
5584
5584
  /** Directory of the built-in statusline's own state (the day's cost ledger, under `session/` what it keeps between refreshes about each transcript it reads, and under `run/` the short-lived output files of the programs it runs), each file of the ledger and under `session/` read as absent when it is missing, is not a regular file or is not of its shape, and none restored: a session's entry for today in the cost ledger starts again from the cost reported by the session's next render that lists the `dailyCost` segment and has a cost to record (or from the previous day's total, by the rule a session's first render of the day carries it by), so the day's total no longer counts what the session spent before that figure, and its entry for the day before, which is only read, carries nothing; the transcript reader's cache is folded again from the start of the transcript; the speed sample is replaced by that of the next render that lists the `speed` segment and has a figure to measure, which draws no speed; and the transcript's last good context frame is none until the next good frame is written. */
5585
5585
  readonly statuslineDir: string;
@@ -5597,7 +5597,9 @@ interface LayoutPaths {
5597
5597
  readonly jobLogsDir: string;
5598
5598
  /** Directory holding one journal per unfinished `identity rename`, written before its first step and removed when it ends: the trace a rename that was killed leaves, which a re-run resumes from and `doctor` reports. Runtime state, never configuration. */
5599
5599
  readonly identityRenamesDir: string;
5600
- /** Directory holding one `<launcher-pid>.<identity>.json` record per launch in progress, written before the identity's farm is resynced and removed once the child has exited. Runtime state, never configuration: it is what lets an identity rename see a launch that has resynced but not yet started its child. */
5600
+ /** Directory holding one record per rename of the name alone that is applying, written before its first rewrite and removed when it ends or is rolled back: what tells a rename killed part way, whose references already name the new name, from references a person wrote. Runtime state, never configuration. */
5601
+ readonly identityNameRenamesDir: string;
5602
+ /** Directory holding one `<launcher-pid>.<id>.json` record per launch in progress, named by the id of the identity it launches, written before the identity's farm is resynced and removed once the child has exited. Runtime state, never configuration: it is what lets `identity rename --move` see a launch that has resynced but not yet started its child. */
5601
5603
  readonly launchesDir: string;
5602
5604
  /** Directory of the supervised sessions' shared state, one subdirectory per pool: the live sessions each launcher registers, so sessions on one account see each other, and the lock that serialises their moves. Runtime state, never configuration. */
5603
5605
  readonly superviseDir: string;
@@ -6319,7 +6321,7 @@ interface ResyncFarmParams {
6319
6321
  /** Distinguishes this resync's scratch and superseded directory names from any other process's. `${pid}.${uuid}` in real use; a fixed string in tests. */
6320
6322
  readonly uniqueSuffix: string;
6321
6323
  /**
6322
- * Whether the identity still exists, asked once the lock is held and any interrupted swap recovered. A launch that waited for the lock while the identity was renamed or removed must not rebuild its directory, so a caller that can answer passes it and `resyncFarm` throws `IdentityGoneError` on `false`. Absent means the caller has no way to tell.
6324
+ * Whether the identity still exists, asked once the lock is held and any interrupted swap recovered. A launch that waited for the lock while the identity's directory was moved with `identity rename --move` or removed must not rebuild it (a rename of the name alone leaves the directory where it was), so a caller that can answer passes it and `resyncFarm` throws `IdentityGoneError` on `false`. Absent means the caller has no way to tell.
6323
6325
  */
6324
6326
  readonly identityExists?: () => boolean;
6325
6327
  readonly lock: {
@@ -8478,7 +8480,7 @@ declare const CheckReportJsonSchema: z.ZodObject<{
8478
8480
  }, z.core.$strict>;
8479
8481
  type CheckReportJson = z.output<typeof CheckReportJsonSchema>;
8480
8482
 
8481
- /** What a cache stores for one credential: the token, when it was fetched, and the source that produced it (a non-secret descriptor, kept so `check` and the launch log can still say where the token came from). */
8483
+ /** What a cache stores for one credential: the token, when it was fetched, the source that produced it (a non-secret descriptor, kept so `check` and the launch log can still say where the token came from), and, in the file store, the owner it was cached for (`identity <id>`, `provider <name>`), which the file store records on every write; the Keychain store files each entry under its owner's account and records none. A file-store entry with no `owner` was written before owners were recorded. */
8482
8484
  declare const CachedCredentialSchema: z.ZodObject<{
8483
8485
  token: z.ZodString;
8484
8486
  fetchedAt: z.ZodNumber;
@@ -8504,6 +8506,7 @@ declare const CachedCredentialSchema: z.ZodObject<{
8504
8506
  }, z.core.$strict>, z.ZodObject<{
8505
8507
  literal: z.ZodString;
8506
8508
  }, z.core.$strict>]>;
8509
+ owner: z.ZodOptional<z.ZodString>;
8507
8510
  }, z.core.$strict>;
8508
8511
  type CachedCredential = z.infer<typeof CachedCredentialSchema>;
8509
8512
  /**
@@ -8811,6 +8814,8 @@ interface RunCheckParams {
8811
8814
  readonly overlay?: CategoryClassificationOverlay;
8812
8815
  };
8813
8816
  readonly identityName?: string;
8817
+ /** The id the resolved identity is stored under, which keys its cached credential (see `identityCacheKey`). */
8818
+ readonly identityId?: string;
8814
8819
  readonly identitySource: IdentityDecisionSource;
8815
8820
  /** The pool the launch selected and how it ranks right now, when it named a pool instead of an identity; `identityName` is then the member it would pick. */
8816
8821
  readonly poolPick?: PoolPickReport;
@@ -8906,94 +8911,6 @@ type PathShadowStatus = {
8906
8911
  readonly by: string;
8907
8912
  };
8908
8913
 
8909
- /** Raised by any operation that requires an identity to already exist, when it does not. */
8910
- declare class IdentityNotFoundError extends CliError {
8911
- readonly name: string;
8912
- constructor(name: string);
8913
- }
8914
- /** Raised by `addIdentity` when an identity with the given name already has an `identity.json`. */
8915
- declare class IdentityAlreadyExistsError extends CliError {
8916
- readonly identityName: string;
8917
- constructor(identityName: string);
8918
- }
8919
- /** Raised by `addIdentity` when `name` fails `IdentitySchema`'s own naming rule — it must start with a letter or number and may then contain letters, numbers, dots, hyphens, underscores, and at signs, so an email address names an identity directly while a *leading* `@` stays invalid (it would collide with the `@name` selector syntax's first-`@` split). */
8920
- declare class InvalidIdentityNameError extends CliError {
8921
- readonly attemptedName: string;
8922
- constructor(attemptedName: string);
8923
- }
8924
- declare function identityExists(paths: LayoutPaths, name: string): boolean;
8925
- /** Reads and validates one identity's `identity.json`, or undefined when it does not exist. */
8926
- declare function readIdentity(paths: LayoutPaths, name: string): Identity | undefined;
8927
- /**
8928
- * Creates a new identity: validates `name` against `IdentitySchema`'s own naming rule and writes a fresh `identity.json` with `allowAmbientCredential: false` and no `defaultConfigProfile`.
8929
- *
8930
- * Throws a `CliError` naming the command that finishes the rename when an unfinished rename names `name` (see `requireNoUnfinishedRenameNaming`), `IdentityAlreadyExistsError` if an identity with this name already has an `identity.json`, since `add` never silently overwrites an existing identity. Throws `InvalidIdentityNameError` when `name` fails `IdentitySchema`'s naming rule, rather than letting the underlying `ZodError` escape as an unhandled crash.
8931
- */
8932
- declare function addIdentity(paths: LayoutPaths, name: string): Identity;
8933
- /**
8934
- * Persists `name` as the active identity, written atomically as plain text (not JSON — this file is read by `decideIdentity` in `src/launcher/identity.ts` via a simple UTF-8 read-and-trim, matching the README's documented `~/.agent-shim/active-identity` file).
8935
- *
8936
- * `name` may be a `pool:<name>` selector, which makes launches pick a member of that pool. Throws `IdentityNotFoundError` when no identity with this name exists yet, and `PoolNotFoundError` for a pool that is not defined: selecting either would silently persist a name nothing else can ever load.
8937
- */
8938
- declare function useIdentity(paths: LayoutPaths, name: string): void;
8939
- /** Reads the persisted active-identity file, or undefined when none is set. */
8940
- declare function readActiveIdentity(paths: LayoutPaths): string | undefined;
8941
- /**
8942
- * Whether a directory name directly under `identitiesDir` names an actual identity, rather than one of agent-shim's own farm directories.
8943
- *
8944
- * `IdentitySchema` requires an identity name to start with a letter or digit, so a leading `.` can only be a resync's own bookkeeping: a `.<identity>.scratch.<suffix>` tree still being built, or a `.<identity>.previous.<suffix>` superseded farm retained for `agent-shim identity resolve-conflicts`. Neither is an identity, and neither should be reported as a broken one for lacking an `identity.json` a resync never put there.
8945
- */
8946
- declare function isIdentityDirectoryName(name: string): boolean;
8947
- /** An entry directly under `identitiesDir` that cannot be reached, and why: `code` is the error the filesystem gave. */
8948
- interface UnreachableIdentityEntry {
8949
- readonly name: string;
8950
- readonly code: string;
8951
- }
8952
- /** One identity as reported by `listIdentities`, whose `identity.json` parsed and validated cleanly. */
8953
- interface IdentityListEntry {
8954
- readonly name: string;
8955
- readonly identity: Identity;
8956
- readonly isActive: boolean;
8957
- readonly problem?: never;
8958
- }
8959
- /** One identity whose `identity.json` is present but unreadable — malformed JSON, or valid JSON this version's `IdentitySchema` rejects. `problem` carries the reason, already flattened onto a single line. */
8960
- interface UnreadableIdentityListEntry {
8961
- readonly name: string;
8962
- readonly identity?: never;
8963
- readonly isActive: boolean;
8964
- readonly problem: string;
8965
- }
8966
- /** Either shape `listIdentities` can report, discriminated by which of `identity`/`problem` is present rather than by a tag field — the two are never simultaneously satisfiable. */
8967
- type IdentityListing = IdentityListEntry | UnreadableIdentityListEntry;
8968
- /**
8969
- * Lists every identity under `identitiesDir`, marking which one (if any) is currently active.
8970
- *
8971
- * One identity whose `identity.json` cannot be read is reported as its own `UnreadableIdentityListEntry` rather than aborting the whole listing. A single bad file blocking `identity list` outright is exactly the failure mode that hides every *other* identity from view at the moment the user most needs to see them — and the file need not even be corrupt to land here, since a name written by a newer agent-shim whose naming rule has since widened is rejected outright by an older binary's own copy of `IdentitySchema`.
8972
- */
8973
- declare function listIdentities(paths: LayoutPaths): readonly IdentityListing[];
8974
- /**
8975
- * Sets `identity`'s `defaultConfigProfile` field, or clears it when `profileName` is undefined. Throws `IdentityNotFoundError` when the identity does not exist. Whether the profile exists is the caller's concern: `identity set --default-profile` checks it first.
8976
- */
8977
- declare function setDefaultConfigProfile(paths: LayoutPaths, identityName: string, profileName: string | undefined): Identity;
8978
- /**
8979
- * Patches `identity`'s `allowAmbientCredential` field. Throws `IdentityNotFoundError` when the identity does not exist.
8980
- */
8981
- declare function setAllowAmbientCredential(paths: LayoutPaths, identityName: string, allow: boolean): Identity;
8982
- /** The change `setIdentityCredential` makes: new sources and/or a new target for the credential block, or `false` to remove the block and return the identity to its stored login. */
8983
- type IdentityCredentialChange = {
8984
- readonly sources?: readonly CredentialSource[];
8985
- readonly target?: CredentialTarget;
8986
- readonly cache?: CredentialCache | false;
8987
- } | false;
8988
- /**
8989
- * Sets, changes or removes `identityName`'s credential block. New `sources` replace the whole ordered list (the order is the meaning); a `target` alone keeps the existing sources, and so needs a credential block to exist already. Throws `IdentityNotFoundError` when the identity does not exist, and `UsageError` when only a target is given for an identity with no credential yet.
8990
- */
8991
- declare function setIdentityCredential(paths: LayoutPaths, identityName: string, change: IdentityCredentialChange): Identity;
8992
- /**
8993
- * Deletes identity `name` entirely: its directory under `identitiesDir` (the farm, its `identity.json`, and whatever that farm holds unshared, credentials included), its resync lock, any scratch or superseded farm a resync left behind, and the active-identity selection when it names this identity. Data shared into `~/.claude` stays there, since the farm only ever symlinks to it. Throws a `CliError` naming the command that finishes the rename when an unfinished rename names `name`, and `IdentityNotFoundError` when the identity does not exist.
8994
- */
8995
- declare function removeIdentity(paths: LayoutPaths, name: string): void;
8996
-
8997
8914
  /** One routed request, appended to the usage log when its response has finished. */
8998
8915
  declare const UsageRecordSchema: z.ZodObject<{
8999
8916
  schemaVersion: z.ZodLiteral<1>;
@@ -9067,7 +8984,7 @@ declare const AccountMetadataSchema: z.ZodObject<{
9067
8984
  }, z.core.$strict>;
9068
8985
  type AccountMetadata = z.infer<typeof AccountMetadataSchema>;
9069
8986
  /**
9070
- * The latest state for one identity, rewritten atomically after each recorded response: the snapshot file other tools read (`~/.agent-shim/usage/snapshots/<identity>.json`) without shelling out to `agent-shim`.
8987
+ * The latest state for one identity, rewritten atomically after each recorded response: the snapshot file other tools read (`~/.agent-shim/usage/snapshots/<id>.json`, named and keyed in `identity` by the identity's id) without shelling out to `agent-shim`.
9071
8988
  */
9072
8989
  declare const UsageSnapshotSchema: z.ZodObject<{
9073
8990
  schemaVersion: z.ZodLiteral<1>;
@@ -9168,6 +9085,193 @@ declare const UsageSnapshotSchema: z.ZodObject<{
9168
9085
  }, z.core.$strict>;
9169
9086
  type UsageSnapshot = z.infer<typeof UsageSnapshotSchema>;
9170
9087
 
9088
+ /**
9089
+ * The read side of the usage store: pure over an injected filesystem, so the CLI, the library surface and tests all read the same way, and nothing here writes.
9090
+ */
9091
+ /** The filesystem reads the usage store's readers need. */
9092
+ type UsageReadFs = Pick<FarmFs, "readFileUtf8" | "readdir">;
9093
+ /** Raised for a snapshot file that exists but does not hold a snapshot of this schema version. */
9094
+ declare class UsageSnapshotError extends Error {
9095
+ readonly file: string;
9096
+ constructor(file: string, detail: string);
9097
+ }
9098
+ /** The path of the snapshot filed under identity id `identity` (`<snapshotsDir>/<id>.json`). Throws for an id that is not a valid identity directory id, since such an id could name a path outside the snapshots directory. */
9099
+ declare function snapshotPath(snapshotsDir: string, identity: string): string;
9100
+ /** Reads the snapshot filed under identity id `identity`: undefined when there is none yet, `UsageSnapshotError` when the file is there but unreadable. */
9101
+ declare function readUsageSnapshot(fs: Pick<FarmFs, "readFileUtf8">, snapshotsDir: string, identity: string): UsageSnapshot | undefined;
9102
+ /** Reads every snapshot in the directory, each filed under the id of the identity it belongs to (its `identity` field is that id). */
9103
+ declare function listUsageSnapshots(fs: UsageReadFs, snapshotsDir: string): readonly UsageSnapshot[];
9104
+
9105
+ /** Everything `acquireIdentityLock` needs, all of it injected so a test never sleeps for real, never reads a real pid table, and never writes outside its own fake filesystem. */
9106
+ interface AcquireIdentityLockParams {
9107
+ readonly identity: string;
9108
+ /** The directory the lock file lives in — `~/.agent-shim/identities`, alongside (never inside) the farm the lock protects, so a farm swap can rename the farm root out from under itself without disturbing the lock. */
9109
+ readonly dir: string;
9110
+ readonly fs: FarmFs;
9111
+ readonly nowMs: () => number;
9112
+ readonly pid: number;
9113
+ /** Answers whether a process is still running, so a lock left behind by a crash is recognised rather than waited out for the full staleness window. Zombie-aware: a holder that exited without being reaped still answers signal 0 as alive, but will never release the lock itself. */
9114
+ readonly isRunning: (pid: number) => boolean;
9115
+ /** Blocks for the given number of milliseconds. Synchronous by necessity: the whole launcher is synchronous, right through to `spawnSync`. */
9116
+ readonly sleep: (ms: number) => void;
9117
+ readonly staleAfterMs?: number;
9118
+ readonly retryDelayMs?: number;
9119
+ readonly maxAttempts?: number;
9120
+ }
9121
+
9122
+ /** What taking the identity names lock needs from the machine: the lock's own ports, and how many attempts to make before giving up (one for a caller that must not wait, such as the front door, whose event loop a sleep would hold). */
9123
+ type IdentityNamesLockPorts = Pick<AcquireIdentityLockParams, "fs" | "nowMs" | "pid" | "isRunning" | "sleep" | "maxAttempts">;
9124
+
9125
+ /**
9126
+ * One identity as its storage knows it. `id` is the name of its directory under the identities directory: it is chosen when the identity is created and never changes, so everything filed under it (the directory, the `CLAUDE_CONFIG_DIR` every session holds, the macOS Keychain login filed under a hash of that path, the resync lock, the usage snapshot) stays valid across a rename. `name` is what `identity.json` calls the identity: every command, selector and configuration reference uses it, and `identity rename` changes it alone.
9127
+ */
9128
+ interface IdentityRecord {
9129
+ readonly id: string;
9130
+ /** Undefined when the record's `identity.json` gives no name that can be read: such a record claims no name, so it can never collide with one another identity holds. */
9131
+ readonly name: string | undefined;
9132
+ }
9133
+ /** What reading one `identity.json` for its name found: the name, no file there, or a file whose name cannot be read (not JSON, or no string `name`). */
9134
+ type IdentityNameRead = {
9135
+ readonly name: string;
9136
+ } | "absent" | "unreadable";
9137
+ /** What reading the records needs: the entries directly under the identities directory, and the name in one `identity.json`. Injected so the launcher's configuration port, the farm's filesystem port and the real filesystem all resolve through the same rule. */
9138
+ interface IdentityRecordsPort {
9139
+ readonly readdir: (directory: string) => readonly string[];
9140
+ readonly readName: (identityJson: string) => IdentityNameRead;
9141
+ /** Whether two entries are one directory on disk, which a symlink beside an identity's directory makes them. */
9142
+ readonly sameDirectory: (first: string, second: string) => boolean;
9143
+ /** Whether an entry is itself a symlink, read without following it: of two entries that are one directory, the one that is not is the identity's own. */
9144
+ readonly isSymlink: (entry: string) => boolean;
9145
+ }
9146
+ /**
9147
+ * Every identity record under `identitiesDir`, sorted by id. An entry whose name does not start with a dot is an identity when it holds an `identity.json`: the record takes the name that file gives, or no name when the file's name cannot be read (see `identityIdIn` for how such a record is still reached). An entry with no `identity.json` is not an identity unless a superseded farm of it holds one (below).
9148
+ *
9149
+ * Two entries that are one directory on disk, as a symlink beside an identity's directory makes them, are one record: the entry that is the directory itself rather than a symlink to it, or else the first by id. The choice reads the filesystem, never the name, so a rename of the name never changes which entry is the identity's id.
9150
+ *
9151
+ * A superseded farm (`.<id>.previous.<suffix>`) whose identity's entry holds no `identity.json` (no directory at all, a resync killed between the two renames of its swap; or the new farm swapped in before the file was carried over into it) is the trace the launcher's recovery repairs: until then the identity's `identity.json` is inside it, so the record is read from there (from the first such farm in name order that holds an `identity.json`, which is the farm the launcher's recovery restores; a farm retained from an earlier swap for its conflicts holds none, since a completed swap carries the file over), and the identity can still be found by name to be recovered.
9152
+ */
9153
+ declare function readIdentityRecords(port: IdentityRecordsPort, identitiesDir: string): readonly IdentityRecord[];
9154
+ /** Raised when two identity records claim one name: nothing can tell which of them a reference to the name means, so nothing resolves it until one is renamed. `doctor` reports the same. */
9155
+ declare class DuplicateIdentityNameError extends CliError {
9156
+ readonly identityName: string;
9157
+ readonly ids: readonly string[];
9158
+ constructor(identityName: string, ids: readonly string[]);
9159
+ }
9160
+
9161
+ /** Raised by any operation that requires an identity to already exist, when it does not. `remedy` says what to do, adding the identity unless given (`identityNotFound` gives it from the state on disk). */
9162
+ declare class IdentityNotFoundError extends CliError {
9163
+ readonly name: string;
9164
+ constructor(name: string, remedy?: string);
9165
+ }
9166
+ /** Raised when an identity already claims the given name: by `addIdentity`, and by a rename to that name. */
9167
+ declare class IdentityAlreadyExistsError extends CliError {
9168
+ readonly identityName: string;
9169
+ constructor(identityName: string);
9170
+ }
9171
+ /** Raised by `addIdentity` when `name` fails `IdentitySchema`'s own naming rule — it must start with a letter or number and may then contain letters, numbers, dots, hyphens, underscores, and at signs, so an email address names an identity directly while a *leading* `@` stays invalid (it would collide with the `@name` selector syntax's first-`@` split). */
9172
+ declare class InvalidIdentityNameError extends CliError {
9173
+ readonly attemptedName: string;
9174
+ constructor(attemptedName: string);
9175
+ }
9176
+ /** Every identity's record (its id, the directory it is stored in, and its name), read fresh from the identities directory. See `readIdentityRecords`. */
9177
+ declare function identityRecords(paths: LayoutPaths): readonly IdentityRecord[];
9178
+ /** The id (the directory under `identitiesDir`) of the identity named `name`, or undefined when there is none. Every lookup of an identity by name goes through this, since a renamed identity keeps the directory it was created with. Throws `DuplicateIdentityNameError` when two identities claim the name. */
9179
+ declare function identityIdOf(paths: LayoutPaths, name: string): string | undefined;
9180
+ /** The name of the identity stored under id `id`, or undefined when no identity is. */
9181
+ declare function identityNameOf(paths: LayoutPaths, id: string): string | undefined;
9182
+ /** Whether an identity is named `name`. Throws `DuplicateIdentityNameError` when two are. */
9183
+ declare function identityExists(paths: LayoutPaths, name: string): boolean;
9184
+ /** Reads and validates the `identity.json` of the identity named `name`, or undefined when there is none. */
9185
+ declare function readIdentity(paths: LayoutPaths, name: string): Identity | undefined;
9186
+ /** Reads and validates the `identity.json` stored under id `id`, or undefined when there is none. */
9187
+ declare function readIdentityById(paths: LayoutPaths, id: string): Identity | undefined;
9188
+ /** How `addIdentity` reaches what it needs beyond the files: the identity names lock, and, for an add whose id was checked before the lock was taken (`requireIdentityAddable`), that id. */
9189
+ interface AddIdentityOptions {
9190
+ readonly namesLock?: IdentityNamesLockPorts;
9191
+ readonly checkedId?: string;
9192
+ }
9193
+ /**
9194
+ * Creates a new identity: validates `name` against `IdentitySchema`'s own naming rule and writes a fresh `identity.json` with `allowAmbientCredential: false` and no `defaultConfigProfile`, in the directory `newIdentityId` gives (the name itself unless something is already filed under it), or in `options.checkedId` when the add was checked against that id, which is used only while it is still free.
9195
+ *
9196
+ * Every check is made, and the file written, holding the identity names lock (`options.namesLock` reaches it; see `acquireIdentityNamesLock`), so a rename or another add cannot give the name to a second identity in between. Throws `IdentityLockBusyError` when the lock stays held, a `CliError` naming the command that finishes the rename when an unfinished rename names `name` or its id (see `requireNoUnfinishedRenameNaming`), `IdentityAlreadyExistsError` if an identity is already named `name`, since `add` never silently overwrites an existing identity, and a `CliError` when the checked id was taken in between. Throws `InvalidIdentityNameError` when `name` fails `IdentitySchema`'s naming rule, rather than letting the underlying `ZodError` escape as an unhandled crash.
9197
+ *
9198
+ * It does not ask the Keychain: called alone, it neither passes over an id whose cached credential the Keychain store still holds nor refuses over a Claude Code login left for the directory. `identity add` and the door make those checks first (`requireIdentityAddable`, then this with `checkedId`, as `addNewIdentity` does).
9199
+ */
9200
+ declare function addIdentity(paths: LayoutPaths, name: string, options?: AddIdentityOptions): Identity;
9201
+ /**
9202
+ * Persists `name` as the active identity, written atomically as plain text (not JSON — this file is read by `decideIdentity` in `src/launcher/identity.ts` via a simple UTF-8 read-and-trim, matching the README's documented `~/.agent-shim/active-identity` file).
9203
+ *
9204
+ * `name` may be a `pool:<name>` selector, which makes launches pick a member of that pool. Throws `IdentityNotFoundError` when no identity with this name exists yet, and `PoolNotFoundError` for a pool that is not defined: selecting either would silently persist a name nothing else can ever load.
9205
+ */
9206
+ declare function useIdentity(paths: LayoutPaths, name: string, namesLock?: IdentityNamesLockPorts): void;
9207
+ /** Reads the persisted active-identity file, or undefined when none is set. */
9208
+ declare function readActiveIdentity(paths: LayoutPaths): string | undefined;
9209
+ /**
9210
+ * Whether a directory name directly under `identitiesDir` names an actual identity, rather than one of agent-shim's own farm directories.
9211
+ *
9212
+ * `IdentitySchema` requires an identity name to start with a letter or digit, so a leading `.` can only be a resync's own bookkeeping: a `.<identity>.scratch.<suffix>` tree still being built, or a `.<identity>.previous.<suffix>` superseded farm retained for `agent-shim identity resolve-conflicts`. Neither is an identity, and neither should be reported as a broken one for lacking an `identity.json` a resync never put there.
9213
+ */
9214
+ declare function isIdentityDirectoryName(name: string): boolean;
9215
+ /** An entry directly under `identitiesDir` that cannot be reached, and why: `code` is the error the filesystem gave. */
9216
+ interface UnreachableIdentityEntry {
9217
+ readonly name: string;
9218
+ readonly code: string;
9219
+ }
9220
+ /** One identity as reported by `listIdentities`, whose `identity.json` parsed and validated cleanly. `name` is the name it gives; `id` is the directory it is stored under. */
9221
+ interface IdentityListEntry {
9222
+ readonly name: string;
9223
+ readonly id: string;
9224
+ readonly identity: Identity;
9225
+ readonly isActive: boolean;
9226
+ readonly problem?: never;
9227
+ readonly displaced?: never;
9228
+ }
9229
+ /** One identity whose `identity.json` cannot be read where it belongs: malformed, rejected by `IdentitySchema`, or (with `displaced`) left only in a superseded farm. `problem` carries the reason, already flattened onto a single line. `name` is the name the file gives when that much of it can be read, and otherwise its id (the record of such a file claims no name). */
9230
+ interface UnreadableIdentityListEntry {
9231
+ readonly name: string;
9232
+ readonly id: string;
9233
+ readonly identity?: never;
9234
+ readonly isActive: boolean;
9235
+ readonly problem: string;
9236
+ /** Set when the file is not unreadable but displaced: an interrupted resync left it only in a superseded farm, and the next launch of the identity puts it back. */
9237
+ readonly displaced?: true;
9238
+ }
9239
+ /** Either shape `listIdentities` can report, discriminated by which of `identity`/`problem` is present rather than by a tag field — the two are never simultaneously satisfiable. */
9240
+ type IdentityListing = IdentityListEntry | UnreadableIdentityListEntry;
9241
+ /**
9242
+ * Lists every identity under `identitiesDir`, sorted by name, marking which one (if any) is currently active. Two identities that claim one name are both listed; `doctor` reports them.
9243
+ *
9244
+ * One identity whose `identity.json` cannot be read is reported as its own `UnreadableIdentityListEntry` rather than aborting the whole listing. A single bad file blocking `identity list` outright is exactly the failure mode that hides every *other* identity from view at the moment the user most needs to see them — and the file need not even be corrupt to land here, since a name written by a newer agent-shim whose naming rule has since widened is rejected outright by an older binary's own copy of `IdentitySchema`.
9245
+ */
9246
+ declare function listIdentities(paths: LayoutPaths): readonly IdentityListing[];
9247
+ /**
9248
+ * Sets `identity`'s `defaultConfigProfile` field, or clears it when `profileName` is undefined. Throws `IdentityNotFoundError` when the identity does not exist. Whether the profile exists is the caller's concern: `identity set --default-profile` checks it first.
9249
+ */
9250
+ declare function setDefaultConfigProfile(paths: LayoutPaths, identityName: string, profileName: string | undefined): Identity;
9251
+ /**
9252
+ * Patches `identity`'s `allowAmbientCredential` field. Throws `IdentityNotFoundError` when the identity does not exist.
9253
+ */
9254
+ declare function setAllowAmbientCredential(paths: LayoutPaths, identityName: string, allow: boolean): Identity;
9255
+ /** The change `setIdentityCredential` makes: new sources and/or a new target for the credential block, or `false` to remove the block and return the identity to its stored login. */
9256
+ type IdentityCredentialChange = {
9257
+ readonly sources?: readonly CredentialSource[];
9258
+ readonly target?: CredentialTarget;
9259
+ readonly cache?: CredentialCache | false;
9260
+ } | false;
9261
+ /**
9262
+ * Sets, changes or removes `identityName`'s credential block. New `sources` replace the whole ordered list (the order is the meaning); a `target` alone keeps the existing sources, and so needs a credential block to exist already. Throws `IdentityNotFoundError` when the identity does not exist, and `UsageError` when only a target is given for an identity with no credential yet.
9263
+ */
9264
+ declare function setIdentityCredential(paths: LayoutPaths, identityName: string, change: IdentityCredentialChange): Identity;
9265
+ /**
9266
+ * Deletes the identity named `name` entirely: its directory under `identitiesDir` (the farm, its `identity.json`, and whatever that farm holds unshared, credentials included; for an entry that is a symlink, the link and not what it points to), every other entry there that is the same directory (each symlink to it), its resync lock, any scratch or superseded farm a resync left behind, the files outside the directory that hold its state under its id (`REMOVED_STATE`: its stored token, its cached credential in the file store, which the store deletes only when it is this identity's own or was cached before owners were recorded, and its usage snapshot), and the active-identity selection when it names this identity. Returns the id it was stored under, so a caller that can reach the Keychain forgets a credential cached there too. Data shared into `~/.claude` stays there, since the farm only ever symlinks to it. Throws a `CliError` naming the command that finishes the rename when an unfinished rename names `name` or the identity's id, `IdentityNotFoundError` when no identity is named `name`, and `DuplicateIdentityNameError` when two are. It holds the identity names lock throughout, so it never removes an identity a rename is applying to, and throws `IdentityLockBusyError` when that stays held; it then takes the identity's own resync lock, so it never removes an identity a launch is resyncing, and throws `IdentityRemovalBusyError` (naming the launch to let finish or stop) when that is held.
9267
+ */
9268
+ declare function removeIdentity(paths: LayoutPaths, name: string, namesLock?: IdentityNamesLockPorts): string;
9269
+
9270
+ /** A record read from a superseded farm, with whether its identity's directory is present (holding no `identity.json` yet) or missing. */
9271
+ interface DisplacedIdentityRecord extends IdentityRecord {
9272
+ readonly directoryPresent: boolean;
9273
+ }
9274
+
9171
9275
  /**
9172
9276
  * How the allowlist the headroom daemon serves lags the allowlist computed now. The daemon re-reads its allowlist file on every request that follows a change to it, and its supervisor rewrites the file and records the hash in the same tick, so a lag that lasts beyond one tick means the supervisor is not running or cannot write the file. A daemon started by an earlier release reads no file, and is reported as such instead.
9173
9277
  */
@@ -9399,10 +9503,13 @@ interface DoctorReport {
9399
9503
  }
9400
9504
  /** One identity's raw `identity.json`, unparsed — `runDoctor` does its own JSON.parse/schema validation so one malformed file never aborts the rest of the report. */
9401
9505
  interface DoctorIdentityInput {
9506
+ /** The name its `identity.json` gives it when that much of the file can be read, and otherwise its id (the record of such a file claims no name). */
9402
9507
  readonly name: string;
9508
+ /** Its storage id: the directory under the identities directory it is stored in. */
9509
+ readonly id: string;
9403
9510
  readonly path: string;
9404
9511
  readonly raw: string | undefined;
9405
- /** The identity's own farm root (`identitiesDir/<name>`) — the account name the Keychain lookup uses. */
9512
+ /** The identity's own farm root (`identitiesDir/<id>`): the account name the Keychain lookup uses. */
9406
9513
  readonly farmRoot: string;
9407
9514
  /** Whether the identity's `.credentials.json` exists, pre-resolved by the wiring layer since it is a file-existence check. */
9408
9515
  readonly credentialsFilePresent: boolean;
@@ -9467,6 +9574,16 @@ interface RunDoctorParams {
9467
9574
  readonly renameJournals?: RenameJournalListing;
9468
9575
  /** The entries of the identities directory that cannot be reached (a symlink the filesystem would not follow, or a directory nobody can enter), which are not counted as identities. Omit to leave them out of the findings. */
9469
9576
  readonly unreachableIdentities?: readonly UnreachableIdentityEntry[];
9577
+ /** Every identity's record as the resolver reads it (`all`, see `readIdentityRecords`), which a name two of them claim is found in, and those whose directory is missing, or present without `identity.json`, while a superseded farm a resync left holds their `identity.json` (`displaced`), which the next launch puts back, and the renames of the name alone left half done, each with the sentence that says what it rewrote and how it is finished (`unfinishedNameRenames`), and the files under `identity-name-renames/` holding a record that no rename filed there (`strayNameRenameFiles`, see `strayNameRenameRecordFiles`). Omit to leave them out of the findings. */
9578
+ readonly identityRecords?: {
9579
+ readonly all: readonly IdentityRecord[];
9580
+ readonly displaced: readonly DisplacedIdentityRecord[];
9581
+ readonly nameRenames?: readonly {
9582
+ readonly from: string;
9583
+ readonly description: string;
9584
+ }[];
9585
+ readonly strayNameRenameFiles?: readonly string[];
9586
+ };
9470
9587
  readonly directoryRules: DoctorFileInput;
9471
9588
  readonly globalConfig: DoctorFileInput;
9472
9589
  /** The parsed `models` block of the global config, when one is defined. Omit to skip the models checks. */
@@ -9508,6 +9625,13 @@ interface RunDoctorParams {
9508
9625
  readonly listeners?: readonly FrontDoorListenerReading[];
9509
9626
  };
9510
9627
  }
9628
+ /**
9629
+ * Audits the whole `~/.agent-shim` config graph for internal consistency: every identity, every configuration profile's own `extends` chain, every provider, `directory-rules.json`, `config.json`, `categories.local.json`, `active-identity`, plus real Claude Code binary discoverability and ambient-credential exposure.
9630
+ *
9631
+ * Deliberately identity/directory-agnostic, unlike `runCheck` — there is no single cascade to resolve `doctor` against, so it never touches settings-exposure (which only means anything relative to one resolved cascade).
9632
+ *
9633
+ * Every check aggregates rather than throws: a malformed file becomes one `fail` finding for that file, not an aborted report. This is the one place in the codebase that deliberately breaks the "throw a validation error and let it propagate" convention every other command relies on — `doctor`'s whole purpose is to survive a broken file and keep auditing everything else.
9634
+ */
9511
9635
  declare function runDoctor(params: RunDoctorParams): DoctorReport;
9512
9636
  /** Renders a full `DoctorReport` as plain text lines, one section header at a time, in the order `agent-shim doctor` prints them. */
9513
9637
  declare function formatDoctorReport(report: DoctorReport): string[];
@@ -13408,7 +13532,8 @@ type DoorHealthEvent = z.output<typeof DoorHealthEventSchema>;
13408
13532
  * One expiring-quota event: an identity's window with allowance still unspent that is about to reset, published once when the window enters its final span (so a scheduler can spend what would otherwise be lost, the moment spending it is still possible). `resetsAt` is the window's own reset instant; `observedAt` is when the door's tick saw it cross.
13409
13533
  */
13410
13534
  declare const QuotaExpiringEventSchema: z.ZodObject<{
13411
- identity: z.ZodString;
13535
+ id: z.ZodString;
13536
+ name: z.ZodOptional<z.ZodString>;
13412
13537
  provider: z.ZodString;
13413
13538
  window: z.ZodEnum<{
13414
13539
  fiveHour: "fiveHour";
@@ -13421,10 +13546,109 @@ declare const QuotaExpiringEventSchema: z.ZodObject<{
13421
13546
  /** One expiring-quota event, as the TypeScript the publisher emits and its consumers handle. */
13422
13547
  type QuotaExpiringEvent = z.output<typeof QuotaExpiringEventSchema>;
13423
13548
  /**
13424
- * The usage source's payload: the snapshot the door just wrote, verbatim, so a consumer sees the quota change or reset in the payload itself rather than the door guessing which of the two a write was. The snapshot schema is the payload schema (identity, observed instant, every provider's state with its windows), the one definition `usage --json` readers already share.
13549
+ * The usage source's payload: the snapshot the door just wrote, verbatim, so a consumer sees a quota change or a reset in the payload itself rather than the door guessing what the two writes were, with the identity it belongs to named both ways. A snapshot is filed by the identity's id, which its `identity` field also holds; `id` repeats it under the name every event uses, and `name` is the identity's name when the door wrote it, absent for a snapshot of an identity no longer stored under that id.
13425
13550
  */
13426
- /** One usage change event, as the TypeScript the publisher emits and its consumers handle: the written snapshot itself, so the snapshot's own schema (`UsageSnapshotSchema`) is this payload's schema rather than a renamed copy. */
13427
- type UsageChangeEvent = UsageSnapshot;
13551
+ declare const UsageChangeEventSchema: z.ZodObject<{
13552
+ schemaVersion: z.ZodLiteral<1>;
13553
+ identity: z.ZodString;
13554
+ updatedAt: z.ZodISODateTime;
13555
+ account: z.ZodOptional<z.ZodObject<{
13556
+ accountUuid: z.ZodOptional<z.ZodString>;
13557
+ emailAddress: z.ZodOptional<z.ZodString>;
13558
+ displayName: z.ZodOptional<z.ZodString>;
13559
+ organizationUuid: z.ZodOptional<z.ZodString>;
13560
+ organizationName: z.ZodOptional<z.ZodString>;
13561
+ organizationType: z.ZodOptional<z.ZodString>;
13562
+ organizationRole: z.ZodOptional<z.ZodString>;
13563
+ workspaceRole: z.ZodOptional<z.ZodString>;
13564
+ billingType: z.ZodOptional<z.ZodString>;
13565
+ seatTier: z.ZodOptional<z.ZodString>;
13566
+ organizationRateLimitTier: z.ZodOptional<z.ZodString>;
13567
+ userRateLimitTier: z.ZodOptional<z.ZodString>;
13568
+ hasExtraUsageEnabled: z.ZodOptional<z.ZodBoolean>;
13569
+ subscriptionCreatedAt: z.ZodOptional<z.ZodString>;
13570
+ accountCreatedAt: z.ZodOptional<z.ZodString>;
13571
+ }, z.core.$strict>>;
13572
+ providers: z.ZodRecord<z.ZodString, z.ZodObject<{
13573
+ lastRequestAt: z.ZodOptional<z.ZodISODateTime>;
13574
+ lastStatus: z.ZodOptional<z.ZodNumber>;
13575
+ lastModel: z.ZodOptional<z.ZodString>;
13576
+ rateLimit: z.ZodOptional<z.ZodObject<{
13577
+ observedAt: z.ZodISODateTime;
13578
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
13579
+ unified: z.ZodOptional<z.ZodObject<{
13580
+ status: z.ZodOptional<z.ZodString>;
13581
+ fiveHour: z.ZodOptional<z.ZodObject<{
13582
+ utilization: z.ZodOptional<z.ZodNumber>;
13583
+ resetsAt: z.ZodOptional<z.ZodISODateTime>;
13584
+ status: z.ZodOptional<z.ZodString>;
13585
+ graceUtilization: z.ZodOptional<z.ZodNumber>;
13586
+ }, z.core.$strict>>;
13587
+ sevenDay: z.ZodOptional<z.ZodObject<{
13588
+ utilization: z.ZodOptional<z.ZodNumber>;
13589
+ resetsAt: z.ZodOptional<z.ZodISODateTime>;
13590
+ status: z.ZodOptional<z.ZodString>;
13591
+ graceUtilization: z.ZodOptional<z.ZodNumber>;
13592
+ }, z.core.$strict>>;
13593
+ sevenDayOverageIncluded: z.ZodOptional<z.ZodObject<{
13594
+ utilization: z.ZodOptional<z.ZodNumber>;
13595
+ resetsAt: z.ZodOptional<z.ZodISODateTime>;
13596
+ status: z.ZodOptional<z.ZodString>;
13597
+ graceUtilization: z.ZodOptional<z.ZodNumber>;
13598
+ }, z.core.$strict>>;
13599
+ representativeClaim: z.ZodOptional<z.ZodString>;
13600
+ resetAt: z.ZodOptional<z.ZodISODateTime>;
13601
+ overageStatus: z.ZodOptional<z.ZodString>;
13602
+ overageUtilization: z.ZodOptional<z.ZodNumber>;
13603
+ overageResetsAt: z.ZodOptional<z.ZodISODateTime>;
13604
+ overageDisabledReason: z.ZodOptional<z.ZodString>;
13605
+ overageInUse: z.ZodOptional<z.ZodBoolean>;
13606
+ extraUsageSpend: z.ZodOptional<z.ZodObject<{
13607
+ usedMinor: z.ZodNumber;
13608
+ limitMinor: z.ZodOptional<z.ZodNumber>;
13609
+ currency: z.ZodString;
13610
+ }, z.core.$strict>>;
13611
+ fallbackAvailable: z.ZodOptional<z.ZodBoolean>;
13612
+ }, z.core.$strict>>;
13613
+ planWindowsUnavailableAt: z.ZodOptional<z.ZodISODateTime>;
13614
+ }, z.core.$strict>>;
13615
+ lastLimit: z.ZodOptional<z.ZodObject<{
13616
+ kind: z.ZodEnum<{
13617
+ "rate-limited": "rate-limited";
13618
+ "quota-exhausted": "quota-exhausted";
13619
+ }>;
13620
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
13621
+ resetAt: z.ZodOptional<z.ZodISODateTime>;
13622
+ window: z.ZodOptional<z.ZodString>;
13623
+ evidence: z.ZodArray<z.ZodString>;
13624
+ observedAt: z.ZodISODateTime;
13625
+ status: z.ZodNumber;
13626
+ }, z.core.$strict>>;
13627
+ quota: z.ZodOptional<z.ZodObject<{
13628
+ observedAt: z.ZodISODateTime;
13629
+ source: z.ZodString;
13630
+ level: z.ZodOptional<z.ZodString>;
13631
+ account: z.ZodOptional<z.ZodObject<{
13632
+ email: z.ZodOptional<z.ZodString>;
13633
+ accountId: z.ZodOptional<z.ZodString>;
13634
+ }, z.core.$strict>>;
13635
+ windows: z.ZodArray<z.ZodObject<{
13636
+ measures: z.ZodString;
13637
+ periodMs: z.ZodOptional<z.ZodNumber>;
13638
+ period: z.ZodOptional<z.ZodString>;
13639
+ utilization: z.ZodNumber;
13640
+ resetsAt: z.ZodOptional<z.ZodISODateTime>;
13641
+ limit: z.ZodOptional<z.ZodNumber>;
13642
+ used: z.ZodOptional<z.ZodNumber>;
13643
+ remaining: z.ZodOptional<z.ZodNumber>;
13644
+ }, z.core.$strict>>;
13645
+ }, z.core.$strict>>;
13646
+ }, z.core.$strict>>;
13647
+ id: z.ZodString;
13648
+ name: z.ZodOptional<z.ZodString>;
13649
+ }, z.core.$strict>;
13650
+ /** One usage change event, as the TypeScript the publisher emits and its consumers handle (the schema's own inferred type). */
13651
+ type UsageChangeEvent = z.output<typeof UsageChangeEventSchema>;
13428
13652
 
13429
13653
  /**
13430
13654
  * The door's event backbone: the publisher/subscriber machinery the Remote Control client stream's fan-out first proved, generalised so any door-wide source can publish and any consumer can subscribe once instead of each source growing its own channel. A publisher registers under a source tag and publishes payloads; the backbone stamps each event with its source's own monotonic sequence and delivers to every matching subscriber synchronously, in publication order. A source that carries its own ordering on the wire (the Remote Control envelope's per-session `sequence_num`, the number its resume rule resumes after) keeps it inside the payload, verbatim: the backbone's sequence is deliberately not any protocol's number.
@@ -14206,6 +14430,7 @@ interface FarmRuntime {
14206
14430
  /** Inputs to `prepareLaunch`: everything a launch needs except the means of spawning the child. */
14207
14431
  interface PrepareLaunchParams {
14208
14432
  readonly paths: LayoutPaths;
14433
+ readonly namesLock?: IdentityNamesLockPorts;
14209
14434
  readonly fs: FsPort;
14210
14435
  readonly proc: ProcPort;
14211
14436
  readonly log: LogPort;
@@ -14266,6 +14491,8 @@ interface LaunchPoolDecision {
14266
14491
  interface LaunchDecision {
14267
14492
  /** The identity the launch runs as. Absent when the escape hatch applied or nothing resolved one. */
14268
14493
  readonly identity?: string;
14494
+ /** The id `identity` is stored under: the directory under the identities directory, which a rename keeps. Absent exactly when `identity` is. */
14495
+ readonly identityId?: string;
14269
14496
  /** Which precedence rule selected the identity (or the pool the identity was picked from). */
14270
14497
  readonly identitySource: IdentityDecisionSource;
14271
14498
  /** The pool pick behind `identity`, when the launch selected a pool. */
@@ -14379,6 +14606,7 @@ declare function createLaunchApiRouter(deps: LaunchApiDeps): {
14379
14606
  }, zod_v4_core.$strict>, zod.ZodObject<{
14380
14607
  decision: zod.ZodObject<{
14381
14608
  identity: zod.ZodOptional<zod.ZodString>;
14609
+ identityId: zod.ZodOptional<zod.ZodString>;
14382
14610
  identitySource: zod.ZodEnum<{
14383
14611
  "config-dir-escape-hatch": "config-dir-escape-hatch";
14384
14612
  argv: "argv";
@@ -16053,6 +16281,7 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
16053
16281
  }, zod_v4_core.$strict>, zod.ZodObject<{
16054
16282
  decision: zod.ZodObject<{
16055
16283
  identity: zod.ZodOptional<zod.ZodString>;
16284
+ identityId: zod.ZodOptional<zod.ZodString>;
16056
16285
  identitySource: zod.ZodEnum<{
16057
16286
  "config-dir-escape-hatch": "config-dir-escape-hatch";
16058
16287
  argv: "argv";
@@ -25312,6 +25541,7 @@ declare const LaunchResolveInputSchema: z.ZodObject<{
25312
25541
  declare const LaunchResolveOutputSchema: z.ZodObject<{
25313
25542
  decision: z.ZodObject<{
25314
25543
  identity: z.ZodOptional<z.ZodString>;
25544
+ identityId: z.ZodOptional<z.ZodString>;
25315
25545
  identitySource: z.ZodEnum<{
25316
25546
  "config-dir-escape-hatch": "config-dir-escape-hatch";
25317
25547
  argv: "argv";
@@ -26000,10 +26230,11 @@ interface QuotaExpiringPublisher {
26000
26230
  /** Checks every held window against the clock and publishes each one newly inside its final span. Idempotent within one span; cheap enough for the supervisor's every tick. */
26001
26231
  readonly check: () => void;
26002
26232
  }
26003
- /** Creates the expiring-quota publisher. One per door process, checked on the supervisor's tick. */
26233
+ /** Creates the expiring-quota publisher. One per door process, checked on the supervisor's tick. Snapshots are held by identity id, and `nameOf` names the identity of an id when an event is published, so a rename since the snapshot was written shows. */
26004
26234
  declare function createQuotaExpiringPublisher(hub: DoorEventHub, deps: {
26005
26235
  readonly seed: readonly UsageSnapshot[];
26006
26236
  readonly now: () => number;
26237
+ readonly nameOf: (id: string) => string | undefined;
26007
26238
  }): QuotaExpiringPublisher;
26008
26239
 
26009
26240
  /**
@@ -26186,8 +26417,8 @@ declare const RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
26186
26417
  declare const RC_SELF_HOST_RECORD_FILE = "credential.json";
26187
26418
  /** Everything the minting needs, injected so it runs against an in-memory fake filesystem in unit tests. */
26188
26419
  interface RcSelfHostMintDeps {
26189
- readonly fs: Pick<FarmFs, "readFileUtf8" | "writeFilePrivate" | "mkdirPrivate">;
26190
- /** The agent-shim identities directory (the mint writes inside `<identitiesDir>/<identity>/`). */
26420
+ readonly fs: Pick<FarmFs, "readFileUtf8" | "readdir" | "writeFilePrivate" | "mkdirPrivate">;
26421
+ /** The agent-shim identities directory (the mint writes inside `<identitiesDir>/<id>/`, the directory of the identity's id). */
26191
26422
  readonly identitiesDir: string;
26192
26423
  /** The door's state directory (the record is written under `<frontdoorDir>/rc-selfhost/`). */
26193
26424
  readonly frontdoorDir: string;
@@ -26433,23 +26664,6 @@ interface RunFrontDoorSupervisorOptions {
26433
26664
  */
26434
26665
  declare function runFrontDoorSupervisor(idleShutdownMinutes: number, ports: FrontDoorSupervisorPorts, options?: RunFrontDoorSupervisorOptions): Promise<number>;
26435
26666
 
26436
- /**
26437
- * The read side of the usage store: pure over an injected filesystem, so the CLI, the library surface and tests all read the same way, and nothing here writes.
26438
- */
26439
- /** The filesystem reads the usage store's readers need. */
26440
- type UsageReadFs = Pick<FarmFs, "readFileUtf8" | "readdir">;
26441
- /** Raised for a snapshot file that exists but does not hold a snapshot of this schema version. */
26442
- declare class UsageSnapshotError extends Error {
26443
- readonly file: string;
26444
- constructor(file: string, detail: string);
26445
- }
26446
- /** The path of an identity's snapshot. Throws for an invalid identity name, which could otherwise name a path outside the snapshots directory. */
26447
- declare function snapshotPath(snapshotsDir: string, identity: string): string;
26448
- /** Reads one identity's snapshot: undefined when it has none yet, `UsageSnapshotError` when the file is there but unreadable. */
26449
- declare function readUsageSnapshot(fs: Pick<FarmFs, "readFileUtf8">, snapshotsDir: string, identity: string): UsageSnapshot | undefined;
26450
- /** Reads every identity's snapshot, by identity name. */
26451
- declare function listUsageSnapshots(fs: UsageReadFs, snapshotsDir: string): readonly UsageSnapshot[];
26452
-
26453
26667
  /** A quota window as it stands at a given instant. */
26454
26668
  interface EffectiveWindow {
26455
26669
  /** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
@@ -26675,6 +26889,8 @@ interface IdentitySession extends SessionSummary {
26675
26889
  declare class SessionLookupError extends CliError {
26676
26890
  constructor(message: string);
26677
26891
  }
26892
+ /** The configuration directory an identity's sessions live under, by the identity's name: its directory under the identities directory, which is named by the identity's id and so not necessarily by its name. */
26893
+ type IdentityConfigDirOf = (identity: string) => string;
26678
26894
  /** Filters for `session list`. */
26679
26895
  interface SessionListFilters {
26680
26896
  /** Only this identity's sessions. */
@@ -26685,7 +26901,7 @@ interface SessionListFilters {
26685
26901
  /**
26686
26902
  * Collects `session list`, read-only: every session of the given identities with its agent and workflow-run counts, newest transcript first. Sessions with nothing to inspect are left out unless `all` is set, because most sessions never spawn an agent and listing them would bury the ones that did.
26687
26903
  */
26688
- declare function collectSessionList(fs: SessionCommandFs, identitiesDir: string, identities: readonly string[], filters: Readonly<SessionListFilters>): readonly IdentitySession[];
26904
+ declare function collectSessionList(fs: SessionCommandFs, configDirOf: IdentityConfigDirOf, identities: readonly string[], filters: Readonly<SessionListFilters>): readonly IdentitySession[];
26689
26905
  /** A resolved session: where it is read from and which identities expose it. */
26690
26906
  interface LocatedSession {
26691
26907
  readonly identities: readonly string[];
@@ -26695,14 +26911,14 @@ interface LocatedSession {
26695
26911
  /**
26696
26912
  * Resolves a session id, or an unambiguous prefix of one, across the given identities. Fails with every candidate named when the prefix matches several, so the caller can say which it meant.
26697
26913
  */
26698
- declare function locateSession(fs: SessionCommandFs, identitiesDir: string, identities: readonly string[], query: string, onlyIdentity?: string): LocatedSession;
26914
+ declare function locateSession(fs: SessionCommandFs, configDirOf: IdentityConfigDirOf, identities: readonly string[], query: string, onlyIdentity?: string): LocatedSession;
26699
26915
  /** One session resolved and read: the tree and every identity that exposes it. */
26700
26916
  interface SessionView {
26701
26917
  readonly identities: readonly string[];
26702
26918
  readonly tree: SessionAgentTree;
26703
26919
  }
26704
26920
  /** Resolves a session id or prefix and reads its tree: what `session show` and the door's `sessions.show` both answer. */
26705
- declare function showSession(fs: SessionCommandFs, identitiesDir: string, identities: readonly string[], query: string, onlyIdentity?: string): SessionView;
26921
+ declare function showSession(fs: SessionCommandFs, configDirOf: IdentityConfigDirOf, identities: readonly string[], query: string, onlyIdentity?: string): SessionView;
26706
26922
 
26707
26923
  /** One quota window's pool-selection facts, in the units a policy reads: fractions of the window, and hours until it resets. */
26708
26924
  interface PoolWindowFacts {
@@ -26972,7 +27188,7 @@ interface UpdateProviderInput {
26972
27188
  * Updates an existing provider definition in place. Throws `ProviderNotFoundError` when it does not exist, and `ConfigValidationError` when the updated definition fails `ProviderSchema`, leaving the file untouched.
26973
27189
  */
26974
27190
  declare function updateProvider(paths: LayoutPaths, name: string, input: UpdateProviderInput): Provider;
26975
- /** Deletes a provider definition. Throws `ProviderNotFoundError` when it does not exist. */
27191
+ /** Deletes a provider definition and its file-cached credential, leaving another provider's entry in the same file alone. Throws `ProviderNotFoundError` when it does not exist. */
26976
27192
  declare function removeProvider(paths: LayoutPaths, name: string): void;
26977
27193
 
26978
27194
  /** One pool member entry, whichever form it takes: the plain selector string, or the object form carrying its policy condition. */
@@ -27228,5 +27444,5 @@ declare const OWN_CLI_FILE_NAME = "cli.cjs";
27228
27444
  */
27229
27445
  declare function agentShimCliPath(distDir?: string | undefined): string;
27230
27446
 
27231
- export { AMBIENT_CREDENTIAL_VARS, AgentKindSchema, AgentMetaSchema, AgentNodeSchema, AgentTreesListInputSchema, AgentTreesListOutputSchema, AgentTreesShowInputSchema, AgentTreesShowOutputSchema, CHECK_CREDENTIAL_APPLIES, CODEX_APP_SERVER_GENERATED_AGAINST, CODEX_APP_SERVER_TIMEOUT_MS, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CheckReportJsonSchema, CheckRunInputSchema, CliError, CodexAccountReadSchema, CodexAppServerProtocolError, CodexAppServerRequestError, CodexAppServerUnavailableError, CodexLogoutOutputSchema, CodexRateLimitsReadSchema, CodexSignInSchema, CodexStatusOutputSchema, ConfigIdentityAddInputSchema, ConfigIdentityAddOutputSchema, ConfigIdentityRemoveInputSchema, ConfigIdentityRemoveOutputSchema, ConfigIdentitySetInputSchema, ConfigIdentitySetOutputSchema, ConfigIdentityUseOutputSchema, ConfigNameInputSchema, ConfigPoolAddInputSchema, ConfigPoolAddOutputSchema, ConfigPoolRemoveInputSchema, ConfigPoolRemoveOutputSchema, ConfigPoolSetInputSchema, ConfigPoolSetOutputSchema, ConfigPoolUseOutputSchema, ConfigProfileAddInputSchema, ConfigProfileAddOutputSchema, ConfigProfileRemoveInputSchema, ConfigProfileRemoveOutputSchema, ConfigProfileSchema, ConfigProfileSetInputSchema, ConfigProfileSetOutputSchema, ConfigProfileUseOutputSchema, ConfigProviderAddInputSchema, ConfigProviderAddOutputSchema, ConfigProviderRemoveInputSchema, ConfigProviderRemoveOutputSchema, ConfigProviderSetInputSchema, ConfigProviderSetOutputSchema, ConfigRuleAddInputSchema, ConfigRuleAddOutputSchema, ConfigRuleRemoveInputSchema, ConfigRuleRemoveOutputSchema, ConfigRuleSetInputSchema, ConfigRuleSetOutputSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, CredentialSummarySchema, DOOR_EVENT_BUFFER_EVENTS, DOOR_EVENT_SOURCE_RC, DOOR_HEALTH_EVENT_SOURCE, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, DoctorFindingSchema, DoctorRunOutputSchema, DoorEventSchema, DoorEventSourceQuerySchema, DoorHealthEventSchema, EXIT_FAILURE, EXIT_USAGE, EffectiveWindowSchema, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorControlMaterialError, FrontDoorNotServingError, FrontDoorRestartOutputSchema, FrontDoorSessionStatusSchema, FrontDoorSessionsOutputSchema, FrontDoorStartError, FrontDoorStateSchema, FrontDoorStatusOutputSchema, GlobalConfigSchema, HeadroomSocketTargetSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LAUNCH_EVENT_SOURCE, LIVE_TASK_CAP, LaunchLifecycleEventSchema, LaunchRefusedError, LaunchResolveInputSchema, LaunchResolveOutputSchema, LegacyProviderFileError, LiveTaskSchema, MergedAgentNodeSchema, MergedAgentTreeSchema, OWN_CLI_FILE_NAME, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolGraphError, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, QUOTA_EXPIRING_EVENT_SOURCE, QuotaExpiringEventSchema, RC_CONTEXT_USAGE_DETAILS, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_DEADLINE_MS, RC_PERMISSION_MODES, RC_READ_FILE_ENCODINGS, RC_REQUEST_PARSE_CAP_BYTES, RC_SELF_HOST_ENV, RC_SELF_HOST_KEEPALIVE_MS, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE, RC_SELF_HOST_RETENTION_MS, RC_SELF_HOST_SCOPE_LIST, RC_SELF_HOST_WORKER_JWT_TTL_SECONDS, RC_SESSIONS_PATH_PREFIX, RC_STREAM_BACKOFF_MS, RC_WEB_FETCH_ALLOW_PRIVATE_ENV, RC_WEB_FETCH_DEADLINE_MS, RC_WEB_FETCH_MAX_BYTES, RC_WEB_FETCH_MAX_REDIRECTS, ROUTED_PATH_PREFIX, RcLiveRateLimitSchema, RcPermissionModeSchema, RcRateLimitInfoSchema, RcRateLimitWindowSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, ResetRowSchema, ResetScheduleSchema, SessionAgentTreeSchema, SessionLookupError, SessionSummarySchema, TaskItemSchema, USAGE_EVENT_SOURCE, UpdateCheckOutputSchema, UsageError, UsageListOutputSchema, UsageLiveOutputSchema, UsageSnapshotError, UsageSnapshotSchema, UsageWindowsInputSchema, UsageWindowsOutputSchema, WhenSchema, WorkflowRunSchema, addDirectoryRule, addIdentity, addPool, addProvider, agentShimCliPath, answerRcControlRequest, applyAgentTaskEvent, authenticateRcSessionMcpServer, buildEntryFacts, buildLayoutPaths, buildRcControlRequestPayload, buildRcControlResponsePayload, buildRcEndSessionPayload, buildRcEventWriteBody, buildRcFileSuggestionsPayload, buildRcGetContextUsagePayload, buildRcGetUsagePayload, buildRcInterruptPayload, buildRcKeepAlivePayload, buildRcMarkReadBody, buildRcMcpAuthenticatePayload, buildRcMcpOAuthCallbackUrlPayload, buildRcMcpReconnectPayload, buildRcMcpStatusPayload, buildRcReadFilePayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, changePool, checkReportHasWarnings, checkReportToJson, collectCheckReport, collectDoctorReport, collectFrontDoorStatus, collectPoolPick, collectResets, collectSessionList, createAgentTreesApiRouter, createCodexApiRouter, createConfigApiRouter, createControlApiRouter, createDoorApiNodeHandler, createDoorApiRouter, createDoorEventHub, createDoorHealthPublisher, createEventsApiRouter, createLaunchApiRouter, createLaunchEventPublisher, createLeafCache, createLifecycleApiRouter, createLiveSessionRegistry, createProfile, createQuotaExpiringPublisher, createRcApiNodeHandler, createRcApiRouter, createRcControlHandler, createRcCredentialStore, createRcEventFanout, createRcLiveUsage, createRcSelfHostSurface, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, doorApiAuth, doorApiNodeHandlerOf, effectiveWindow, endRcSession, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, fetchThroughWebProxy, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, formatFrontDoorStatus, forwardableHeaders, frontDoorApiClient, frontDoorApiFromState, frontDoorApiLink, frontDoorRcApiClient, frontDoorRcControl, generateCa, getRcSessionContextUsage, getRcSessionMcpStatus, getRcSessionUsage, headroomSocketTarget, identityExists, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isPrivateAddress, isRcContextUsageDetail, isRcPermissionMode, isRcReadFileEncoding, lateRcEventDial, lateRcStreamDial, launchRequiredUpstreams, listDirectoryRules, listIdentities, listProfiles, listProviders, listSessions, listUsageSnapshots, locateSession, matchBranch, mergeLiveTasks, mintLeaf, mintRcSelfHostCredential, observingRoutedRoute, parseConnectTarget, parseRcStreamEnvelope, planOf, poolIdentities, poolSelectedByLaunch, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcFanoutOnDoorHub, rcObserverAsPassthrough, rcRateLimitInfoOf, rcSelfHostFromEnv, rcWebFetchAllowsPrivateFromEnv, readActiveIdentity, readCodexAccount, readCodexRateLimits, readDirectoryRules, readFarmManifest, readFrontDoorControlMaterial, readGlobalConfig, readIdentity, readPools, readProfile, readProvider, readRcSelfHostRecord, readRcSessionFile, readSessionAgentTree, readUsageSnapshot, realCodexAppServerPort, realConnectCertStore, realConnectEffects, realRcControlTransport, realRcEventDial, realRcStreamDial, realRcWebFetch, realSessionFs, reconnectRcSessionMcpServer, recoverFarm, recoveryDiagnostics, refreshLaunchPoolUsage, refreshPoolUsage, refreshStalePoolMembers, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveClaudeLaunch, resolveDecisions, resolveLaunch, resolveLaunchSelection, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runClaudeLaunch, runDoctor, runFrontDoorSupervisor, runLaunchPlan, runLauncher, runSupervisor, sendRcKeepAlive, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, showSession, snapshotPath, spawnClaude, startConnectServer, submitRcSessionMcpOAuthCallbackUrl, suggestRcSessionFiles, summariseSession, teleportRcSession, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, watchedInstallEntry, writeDirectoryRules };
27232
- export type { AddDirectoryRuleOptions, AddProviderInput, AgentKind, AgentNode, AgentReadFs, AgentTreesApiDeps, AgentTreesApiRouter, AmbientCredentialDetection, AmbientCredentialGuardResult, AmbientCredentialVar, AnthropicUsageRefresher, BuildEntryFactsParams, CaMaterial, Candidate, CarryOverParams, CarryOverResult, CategoryMap, CheckReport, CheckReportJson, ClaudeLaunchResolution, CodexAccountRead, CodexApiClient, CodexApiDeps, CodexApiRouter, CodexAppServerConnection, CodexAppServerPort, CodexAppServerReadOptions, CodexRateLimitsRead, CollectCheckReportParams, CollectDoctorReportParams, CompiledRule, ConditionContext, ConfigApiDeps, ConfigApiRouter, ConfigProfile, ConnectCertStore, ConnectEffects, ConnectLimits, ConnectLocalSurface, ConnectServerConfig, ConnectServerHandle, ConnectTarget, ControlApiClient, ControlApiDeps, ControlApiRouter, Credential, CredentialSource, Decision, Diagnostic, DirectoryRule, DirectoryRules, DoctorReport, DoorApiClient, DoorApiContext, DoorApiDeps, DoorApiRouter, DoorEvent, DoorEventHub, DoorEventPublisher, DoorEventStream, DoorEventsApiDeps, DoorHealthEvent, DoorHealthPublisher, EffectiveWindow, EliminatedRule, EnsureFrontDoorPorts, EnsureHeadroomPorts, EntryFact, EntryFacts, EntryValue, EvaluateAmbientCredentialGuardParams, FlattenedCascade, FrontDoorControlMaterial, FrontDoorRcControl, FrontDoorSessionStatus, FrontDoorStatus, FrontDoorSupervisorPorts, GlobalConfig, HeadroomSupervisorConfig, Identity, IdentityCredentialChange, IdentityListEntry, IdentityListing, IdentitySession, InjectedCredential, LaunchApiDeps, LaunchApiRouter, LaunchDecision, LaunchEventPublisher, LaunchLifecycleEvent, LaunchPlan, LaunchPoolDecision, LaunchResolution, LaunchSelection, Layer, LayerId, LayoutPaths, LeafCert, LifecycleApiClient, LifecycleApiDeps, LifecycleApiRouter, LiveSessionRegistry, LiveSessionRegistryPorts, LiveTask, LiveTaskBook, LocatedSession, MergedAgentNode, MergedAgentTree, NestedContribution, OwnExecutableStat, PlanClass, Pool, PoolChange, PoolMember, PoolPickReport, PoolPolicy, PoolRanking, PortableConfig, PrepareClaudeLaunchOptions, PrepareLaunchParams, ProfileListEntry, Provider, ProviderListEntry, QuotaExpiringEvent, QuotaExpiringPublisher, RankPoolInput, RcAnswerDecision, RcAnswerDeps, RcApiClient, RcApiDeps, RcApiRouter, RcContextUsageDetail, RcControlAnswer, RcControlHandlerDeps, RcControlRequestDeps, RcControlTransport, RcCredentialStore, RcDialAnswer, RcDialTarget, RcEventDial, RcEventFanout, RcEventWriteResult, RcExchangeObserver, RcInjectDeps, RcLiveRateLimit, RcLiveUsage, RcLiveUsageDeps, RcObservedCredential, RcObservedRequest, RcPendingRequestSummary, RcPermissionMode, RcPresenceAnswer, RcRateLimitInfo, RcRateLimitWindow, RcReadFileEncoding, RcReadFileOptions, RcSelfHostCredentialRecord, RcSelfHostDeps, RcSelfHostMintResult, RcSelfHostSurface, RcSessionStatus, RcSessionSummary, RcSessionTracker, RcSessionTrackerDeps, RcStreamAnswer, RcStreamDial, RcStreamEnvelope, RcStreamEvent, RcStreamHub, RcStreamHubDeps, RcWebFetchDeps, RcWebFetchHop, RcWebFetchOutcome, RcWebFetcher, RcWorkerFact, RcWriteHeaders, ReadSessionOptions, RecoverFarmParams, RecoveryResult, RefreshLaunchPoolUsageOptions, RefreshPoolUsageParams, RefreshStalePoolMembersParams, ResetRow, ResetSchedule, ResolveClaudeLaunchOptions, ResolveDecisionsInput, ResolveLaunchSelectionParams, ResolvedState, ResyncFarmParams, ResyncFarmResult, RunCheckParams, RunClaudeLaunchOptions, RunDoctorParams, RunFrontDoorSupervisorOptions, RunLauncherParams, RunSupervisorOptions, SessionAgentTree, SessionCommandFs, SessionListFilters, SessionRef, SessionSummary, SessionView, SpawnClaudeParams, SseParsedEvent, StickyPick, SupervisorPorts, TaskItem, UnreadableIdentityListEntry, UpdateDirectoryRuleOptions, UpdateProviderInput, UsageChangeEvent, UsageReadFs, UsageSnapshot, WhenCondition, WhenEvaluation, WorkflowRun };
27447
+ export { AMBIENT_CREDENTIAL_VARS, AgentKindSchema, AgentMetaSchema, AgentNodeSchema, AgentTreesListInputSchema, AgentTreesListOutputSchema, AgentTreesShowInputSchema, AgentTreesShowOutputSchema, CHECK_CREDENTIAL_APPLIES, CODEX_APP_SERVER_GENERATED_AGAINST, CODEX_APP_SERVER_TIMEOUT_MS, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CheckReportJsonSchema, CheckRunInputSchema, CliError, CodexAccountReadSchema, CodexAppServerProtocolError, CodexAppServerRequestError, CodexAppServerUnavailableError, CodexLogoutOutputSchema, CodexRateLimitsReadSchema, CodexSignInSchema, CodexStatusOutputSchema, ConfigIdentityAddInputSchema, ConfigIdentityAddOutputSchema, ConfigIdentityRemoveInputSchema, ConfigIdentityRemoveOutputSchema, ConfigIdentitySetInputSchema, ConfigIdentitySetOutputSchema, ConfigIdentityUseOutputSchema, ConfigNameInputSchema, ConfigPoolAddInputSchema, ConfigPoolAddOutputSchema, ConfigPoolRemoveInputSchema, ConfigPoolRemoveOutputSchema, ConfigPoolSetInputSchema, ConfigPoolSetOutputSchema, ConfigPoolUseOutputSchema, ConfigProfileAddInputSchema, ConfigProfileAddOutputSchema, ConfigProfileRemoveInputSchema, ConfigProfileRemoveOutputSchema, ConfigProfileSchema, ConfigProfileSetInputSchema, ConfigProfileSetOutputSchema, ConfigProfileUseOutputSchema, ConfigProviderAddInputSchema, ConfigProviderAddOutputSchema, ConfigProviderRemoveInputSchema, ConfigProviderRemoveOutputSchema, ConfigProviderSetInputSchema, ConfigProviderSetOutputSchema, ConfigRuleAddInputSchema, ConfigRuleAddOutputSchema, ConfigRuleRemoveInputSchema, ConfigRuleRemoveOutputSchema, ConfigRuleSetInputSchema, ConfigRuleSetOutputSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, CredentialSummarySchema, DOOR_EVENT_BUFFER_EVENTS, DOOR_EVENT_SOURCE_RC, DOOR_HEALTH_EVENT_SOURCE, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, DoctorFindingSchema, DoctorRunOutputSchema, DoorEventSchema, DoorEventSourceQuerySchema, DoorHealthEventSchema, DuplicateIdentityNameError, EXIT_FAILURE, EXIT_USAGE, EffectiveWindowSchema, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorControlMaterialError, FrontDoorNotServingError, FrontDoorRestartOutputSchema, FrontDoorSessionStatusSchema, FrontDoorSessionsOutputSchema, FrontDoorStartError, FrontDoorStateSchema, FrontDoorStatusOutputSchema, GlobalConfigSchema, HeadroomSocketTargetSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LAUNCH_EVENT_SOURCE, LIVE_TASK_CAP, LaunchLifecycleEventSchema, LaunchRefusedError, LaunchResolveInputSchema, LaunchResolveOutputSchema, LegacyProviderFileError, LiveTaskSchema, MergedAgentNodeSchema, MergedAgentTreeSchema, OWN_CLI_FILE_NAME, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolGraphError, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, QUOTA_EXPIRING_EVENT_SOURCE, QuotaExpiringEventSchema, RC_CONTEXT_USAGE_DETAILS, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_DEADLINE_MS, RC_PERMISSION_MODES, RC_READ_FILE_ENCODINGS, RC_REQUEST_PARSE_CAP_BYTES, RC_SELF_HOST_ENV, RC_SELF_HOST_KEEPALIVE_MS, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE, RC_SELF_HOST_RETENTION_MS, RC_SELF_HOST_SCOPE_LIST, RC_SELF_HOST_WORKER_JWT_TTL_SECONDS, RC_SESSIONS_PATH_PREFIX, RC_STREAM_BACKOFF_MS, RC_WEB_FETCH_ALLOW_PRIVATE_ENV, RC_WEB_FETCH_DEADLINE_MS, RC_WEB_FETCH_MAX_BYTES, RC_WEB_FETCH_MAX_REDIRECTS, ROUTED_PATH_PREFIX, RcLiveRateLimitSchema, RcPermissionModeSchema, RcRateLimitInfoSchema, RcRateLimitWindowSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, ResetRowSchema, ResetScheduleSchema, SessionAgentTreeSchema, SessionLookupError, SessionSummarySchema, TaskItemSchema, USAGE_EVENT_SOURCE, UpdateCheckOutputSchema, UsageChangeEventSchema, UsageError, UsageListOutputSchema, UsageLiveOutputSchema, UsageSnapshotError, UsageSnapshotSchema, UsageWindowsInputSchema, UsageWindowsOutputSchema, WhenSchema, WorkflowRunSchema, addDirectoryRule, addIdentity, addPool, addProvider, agentShimCliPath, answerRcControlRequest, applyAgentTaskEvent, authenticateRcSessionMcpServer, buildEntryFacts, buildLayoutPaths, buildRcControlRequestPayload, buildRcControlResponsePayload, buildRcEndSessionPayload, buildRcEventWriteBody, buildRcFileSuggestionsPayload, buildRcGetContextUsagePayload, buildRcGetUsagePayload, buildRcInterruptPayload, buildRcKeepAlivePayload, buildRcMarkReadBody, buildRcMcpAuthenticatePayload, buildRcMcpOAuthCallbackUrlPayload, buildRcMcpReconnectPayload, buildRcMcpStatusPayload, buildRcReadFilePayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, changePool, checkReportHasWarnings, checkReportToJson, collectCheckReport, collectDoctorReport, collectFrontDoorStatus, collectPoolPick, collectResets, collectSessionList, createAgentTreesApiRouter, createCodexApiRouter, createConfigApiRouter, createControlApiRouter, createDoorApiNodeHandler, createDoorApiRouter, createDoorEventHub, createDoorHealthPublisher, createEventsApiRouter, createLaunchApiRouter, createLaunchEventPublisher, createLeafCache, createLifecycleApiRouter, createLiveSessionRegistry, createProfile, createQuotaExpiringPublisher, createRcApiNodeHandler, createRcApiRouter, createRcControlHandler, createRcCredentialStore, createRcEventFanout, createRcLiveUsage, createRcSelfHostSurface, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, doorApiAuth, doorApiNodeHandlerOf, effectiveWindow, endRcSession, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, fetchThroughWebProxy, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, formatFrontDoorStatus, forwardableHeaders, frontDoorApiClient, frontDoorApiFromState, frontDoorApiLink, frontDoorRcApiClient, frontDoorRcControl, generateCa, getRcSessionContextUsage, getRcSessionMcpStatus, getRcSessionUsage, headroomSocketTarget, identityExists, identityIdOf, identityNameOf, identityRecords, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isPrivateAddress, isRcContextUsageDetail, isRcPermissionMode, isRcReadFileEncoding, lateRcEventDial, lateRcStreamDial, launchRequiredUpstreams, listDirectoryRules, listIdentities, listProfiles, listProviders, listSessions, listUsageSnapshots, locateSession, matchBranch, mergeLiveTasks, mintLeaf, mintRcSelfHostCredential, observingRoutedRoute, parseConnectTarget, parseRcStreamEnvelope, planOf, poolIdentities, poolSelectedByLaunch, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcFanoutOnDoorHub, rcObserverAsPassthrough, rcRateLimitInfoOf, rcSelfHostFromEnv, rcWebFetchAllowsPrivateFromEnv, readActiveIdentity, readCodexAccount, readCodexRateLimits, readDirectoryRules, readFarmManifest, readFrontDoorControlMaterial, readGlobalConfig, readIdentity, readIdentityById, readIdentityRecords, readPools, readProfile, readProvider, readRcSelfHostRecord, readRcSessionFile, readSessionAgentTree, readUsageSnapshot, realCodexAppServerPort, realConnectCertStore, realConnectEffects, realRcControlTransport, realRcEventDial, realRcStreamDial, realRcWebFetch, realSessionFs, reconnectRcSessionMcpServer, recoverFarm, recoveryDiagnostics, refreshLaunchPoolUsage, refreshPoolUsage, refreshStalePoolMembers, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveClaudeLaunch, resolveDecisions, resolveLaunch, resolveLaunchSelection, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runClaudeLaunch, runDoctor, runFrontDoorSupervisor, runLaunchPlan, runLauncher, runSupervisor, sendRcKeepAlive, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, showSession, snapshotPath, spawnClaude, startConnectServer, submitRcSessionMcpOAuthCallbackUrl, suggestRcSessionFiles, summariseSession, teleportRcSession, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, watchedInstallEntry, writeDirectoryRules };
27448
+ export type { AddDirectoryRuleOptions, AddProviderInput, AgentKind, AgentNode, AgentReadFs, AgentTreesApiDeps, AgentTreesApiRouter, AmbientCredentialDetection, AmbientCredentialGuardResult, AmbientCredentialVar, AnthropicUsageRefresher, BuildEntryFactsParams, CaMaterial, Candidate, CarryOverParams, CarryOverResult, CategoryMap, CheckReport, CheckReportJson, ClaudeLaunchResolution, CodexAccountRead, CodexApiClient, CodexApiDeps, CodexApiRouter, CodexAppServerConnection, CodexAppServerPort, CodexAppServerReadOptions, CodexRateLimitsRead, CollectCheckReportParams, CollectDoctorReportParams, CompiledRule, ConditionContext, ConfigApiDeps, ConfigApiRouter, ConfigProfile, ConnectCertStore, ConnectEffects, ConnectLimits, ConnectLocalSurface, ConnectServerConfig, ConnectServerHandle, ConnectTarget, ControlApiClient, ControlApiDeps, ControlApiRouter, Credential, CredentialSource, Decision, Diagnostic, DirectoryRule, DirectoryRules, DoctorReport, DoorApiClient, DoorApiContext, DoorApiDeps, DoorApiRouter, DoorEvent, DoorEventHub, DoorEventPublisher, DoorEventStream, DoorEventsApiDeps, DoorHealthEvent, DoorHealthPublisher, EffectiveWindow, EliminatedRule, EnsureFrontDoorPorts, EnsureHeadroomPorts, EntryFact, EntryFacts, EntryValue, EvaluateAmbientCredentialGuardParams, FlattenedCascade, FrontDoorControlMaterial, FrontDoorRcControl, FrontDoorSessionStatus, FrontDoorStatus, FrontDoorSupervisorPorts, GlobalConfig, HeadroomSupervisorConfig, Identity, IdentityCredentialChange, IdentityListEntry, IdentityListing, IdentityNameRead, IdentityRecord, IdentityRecordsPort, IdentitySession, InjectedCredential, LaunchApiDeps, LaunchApiRouter, LaunchDecision, LaunchEventPublisher, LaunchLifecycleEvent, LaunchPlan, LaunchPoolDecision, LaunchResolution, LaunchSelection, Layer, LayerId, LayoutPaths, LeafCert, LifecycleApiClient, LifecycleApiDeps, LifecycleApiRouter, LiveSessionRegistry, LiveSessionRegistryPorts, LiveTask, LiveTaskBook, LocatedSession, MergedAgentNode, MergedAgentTree, NestedContribution, OwnExecutableStat, PlanClass, Pool, PoolChange, PoolMember, PoolPickReport, PoolPolicy, PoolRanking, PortableConfig, PrepareClaudeLaunchOptions, PrepareLaunchParams, ProfileListEntry, Provider, ProviderListEntry, QuotaExpiringEvent, QuotaExpiringPublisher, RankPoolInput, RcAnswerDecision, RcAnswerDeps, RcApiClient, RcApiDeps, RcApiRouter, RcContextUsageDetail, RcControlAnswer, RcControlHandlerDeps, RcControlRequestDeps, RcControlTransport, RcCredentialStore, RcDialAnswer, RcDialTarget, RcEventDial, RcEventFanout, RcEventWriteResult, RcExchangeObserver, RcInjectDeps, RcLiveRateLimit, RcLiveUsage, RcLiveUsageDeps, RcObservedCredential, RcObservedRequest, RcPendingRequestSummary, RcPermissionMode, RcPresenceAnswer, RcRateLimitInfo, RcRateLimitWindow, RcReadFileEncoding, RcReadFileOptions, RcSelfHostCredentialRecord, RcSelfHostDeps, RcSelfHostMintResult, RcSelfHostSurface, RcSessionStatus, RcSessionSummary, RcSessionTracker, RcSessionTrackerDeps, RcStreamAnswer, RcStreamDial, RcStreamEnvelope, RcStreamEvent, RcStreamHub, RcStreamHubDeps, RcWebFetchDeps, RcWebFetchHop, RcWebFetchOutcome, RcWebFetcher, RcWorkerFact, RcWriteHeaders, ReadSessionOptions, RecoverFarmParams, RecoveryResult, RefreshLaunchPoolUsageOptions, RefreshPoolUsageParams, RefreshStalePoolMembersParams, ResetRow, ResetSchedule, ResolveClaudeLaunchOptions, ResolveDecisionsInput, ResolveLaunchSelectionParams, ResolvedState, ResyncFarmParams, ResyncFarmResult, RunCheckParams, RunClaudeLaunchOptions, RunDoctorParams, RunFrontDoorSupervisorOptions, RunLauncherParams, RunSupervisorOptions, SessionAgentTree, SessionCommandFs, SessionListFilters, SessionRef, SessionSummary, SessionView, SpawnClaudeParams, SseParsedEvent, StickyPick, SupervisorPorts, TaskItem, UnreadableIdentityListEntry, UpdateDirectoryRuleOptions, UpdateProviderInput, UsageChangeEvent, UsageReadFs, UsageSnapshot, WhenCondition, WhenEvaluation, WorkflowRun };