@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
25 lines • 1.35 kB
TypeScript
import type { SessionView } from '../../../view/types.ts';
import type { Context } from '../../config.ts';
export declare const UNKNOWN_NAME = "-";
/**
* Who a session is: its profile, the one name POSIX renders as both owner
* and group.
*
* The profile is the permission set the session acts with, so it is the
* user `whoami` prints and the group `id` names. A backend that reports a
* uid or gid on an entry (disk, or a `chown` held in the attr overlay) wins
* over it, so `ls -l`, `stat %U %G` and `find -printf %u %g` all agree on
* one rule.
*/
export interface Identity {
readonly profile: string | null;
}
/** The identity the session plane describes; absent outside a workspace. */
export declare function identityFrom(sessionView: SessionView | undefined): Identity;
/** The identity a command invocation runs as, read off its ctx. */
export declare function identityOf(ctx: Context): Identity;
/** The owner column: the entry's own uid, else the session's profile, else `-`. */
export declare function ownerName(uid: number | string | null | undefined, identity: Identity | null): string;
/** The group column: the entry's own gid, else the session's profile, else `-`. */
export declare function groupName(gid: number | string | null | undefined, identity: Identity | null): string;
//# sourceMappingURL=identity.d.ts.map