@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
24 lines • 992 B
JavaScript
// What an owner or group column prints when nothing names one: no uid or
// gid on the entry and no profile.
export const UNKNOWN_NAME = '-';
/** The identity the session plane describes; absent outside a workspace. */
export function identityFrom(sessionView) {
return { profile: sessionView?.profile() ?? null };
}
/** The identity a command invocation runs as, read off its ctx. */
export function identityOf(ctx) {
return identityFrom(ctx.session);
}
/** The owner column: the entry's own uid, else the session's profile, else `-`. */
export function ownerName(uid, identity) {
if (uid !== null && uid !== undefined)
return String(uid);
return identity?.profile ?? UNKNOWN_NAME;
}
/** The group column: the entry's own gid, else the session's profile, else `-`. */
export function groupName(gid, identity) {
if (gid !== null && gid !== undefined)
return String(gid);
return identity?.profile ?? UNKNOWN_NAME;
}
//# sourceMappingURL=identity.js.map