OrgCache: the mechanism OrgCacheRepo implements. The whole repo, except that
orgIdsOfProject is named rather than inherited — a Map has no wire form, so the
contract carries it as an opaque host object the way the kernel's other live values are.
API
@Interface()
export abstract class OrgCache {
abstract deskSessions(projectId: string, orgId: string): OrgSessionRow[];
abstract syncDeskSessions(
projectId: string,
orgId: string,
rows: Array<{ sessionId: string; agentId: string; current: boolean }>,
): void;
abstract ticketSessions(projectId: string, orgId: string): OrgTicketSessionRow[];
abstract syncTicketSessions(
projectId: string,
orgId: string,
rows: Array<{ ticketId: string; sessionId: string; agentId: string }>,
): void;
abstract addTicketSession(
projectId: string,
orgId: string,
ticketId: string,
sessionId: string,
agentId: string,
): void;
abstract ownerOfSession(sessionId: string): OrgSessionOwner | null;
abstract orgIdsOfProject(projectId: string): Opaque<"OrgIdsBySession", Map<string, string>>;
abstract setTriggerHop(sessionId: string, hop: number): void;
abstract findCalendar(
projectId: string,
orgId: string,
agentId: string,
name: string,
): OrgCalendarStateRow | null;
abstract listCalendar(projectId: string, orgId: string): OrgCalendarStateRow[];
abstract registerCalendar(args: {
projectId: string;
orgId: string;
agentId: string;
name: string;
startAtMs: number;
defHash: string;
}): { row: OrgCalendarStateRow; fresh: boolean };
abstract markCalendarSlot(
projectId: string,
orgId: string,
agentId: string,
name: string,
slotMs: number | null,
): void;
abstract markCalendarFired(
projectId: string,
orgId: string,
agentId: string,
name: string,
firedAt: string,
oneShot: boolean,
): void;
abstract markCalendarMissed(
projectId: string,
orgId: string,
agentId: string,
name: string,
): void;
abstract markCalendarOutcome(
projectId: string,
orgId: string,
agentId: string,
name: string,
outcome: OrgCalendarOutcome,
): void;
abstract deleteMissingCalendar(
projectId: string,
orgId: string,
present: Array<{ agentId: string; name: string }>,
): void;
abstract deleteCalendar(projectId: string, orgId: string, agentId: string, name: string): void;
abstract findTicketState(
projectId: string,
orgId: string,
ticketId: string,
): OrgTicketStateRow | null;
abstract upsertTicketState(row: OrgTicketStateRow): void;
abstract deleteMissingTicketState(projectId: string, orgId: string, presentIds: string[]): void;
abstract channelOffset(projectId: string, orgId: string, channelId: string, date: string): number;
abstract setChannelOffset(
projectId: string,
orgId: string,
channelId: string,
date: string,
offset: number,
): void;
abstract readCursor(
projectId: string,
orgId: string,
channelId: string,
userId: string,
): string | null;
abstract setReadCursor(
projectId: string,
orgId: string,
channelId: string,
userId: string,
lastReadId: string,
): void;
abstract budgetState(
projectId: string,
orgId: string,
agentId: string,
period: string,
): OrgBudgetStateRow | null;
abstract listBudgetStates(projectId: string, orgId: string, period: string): OrgBudgetStateRow[];
abstract markBudget(
projectId: string,
orgId: string,
agentId: string,
period: string,
patch: { warnedAt?: string | null; pausedAt?: string | null },
): void;
abstract queueDeskNotice(row: Omit<OrgDeskNoticeRow, "seq">): void;
abstract takeDeskNotices(projectId: string, orgId: string, agentId: string): OrgDeskNoticeRow[];
abstract deleteDeskNotices(projectId: string, orgId: string, agentId: string): void;
abstract deleteOrg(projectId: string, orgId: string): void;
abstract deleteProject(projectId: string): void;
}Contract Topology
Static AST wiring across @Module / @Provide / @UseMembers (32)
deskSessions
deskSessions(projectId: string, orgId: string): OrgSessionRow[]@paramprojectId
string@paramorgId
string@returns
OrgSessionRow[]syncDeskSessions
syncDeskSessions(projectId: string, orgId: string, rows: Array<{ sessionId: string; agentId: string; current: boolean }>): void@paramprojectId
string@paramorgId
string@paramrows
Array<{ sessionId: string; agentId: string; current: boolean }>@returns
voidticketSessions
ticketSessions(projectId: string, orgId: string): OrgTicketSessionRow[]@paramprojectId
string@paramorgId
string@returns
OrgTicketSessionRow[]syncTicketSessions
syncTicketSessions(projectId: string, orgId: string, rows: Array<{ ticketId: string; sessionId: string; agentId: string }>): void@paramprojectId
string@paramorgId
string@paramrows
Array<{ ticketId: string; sessionId: string; agentId: string }>@returns
voidaddTicketSession
addTicketSession(projectId: string, orgId: string, ticketId: string, sessionId: string, agentId: string): void@paramprojectId
string@paramorgId
string@paramticketId
string@paramsessionId
string@paramagentId
string@returns
voidownerOfSession
ownerOfSession(sessionId: string): OrgSessionOwner | null@paramsessionId
string@returns
OrgSessionOwner | nullorgIdsOfProject
orgIdsOfProject(projectId: string): Opaque<"OrgIdsBySession", Map<string, string>>@paramprojectId
string@returns
Opaque<"OrgIdsBySession", Map<string, string>>setTriggerHop
setTriggerHop(sessionId: string, hop: number): void@paramsessionId
string@paramhop
number@returns
voidfindCalendar
findCalendar(projectId: string, orgId: string, agentId: string, name: string): OrgCalendarStateRow | null@paramprojectId
string@paramorgId
string@paramagentId
string@paramname
string@returns
OrgCalendarStateRow | nulllistCalendar
listCalendar(projectId: string, orgId: string): OrgCalendarStateRow[]@paramprojectId
string@paramorgId
string@returns
OrgCalendarStateRow[]registerCalendar
registerCalendar(args: { projectId: string; orgId: string; agentId: string; name: string; startAtMs: number; defHash: string; }): { row: OrgCalendarStateRow; fresh: boolean }@paramargs
{ projectId: string; orgId: string; agentId: string; name: string; startAtMs: number; defHash: string; }@returns
{ row: OrgCalendarStateRow; fresh: boolean }markCalendarSlot
markCalendarSlot(projectId: string, orgId: string, agentId: string, name: string, slotMs: number | null): void@paramprojectId
string@paramorgId
string@paramagentId
string@paramname
string@paramslotMs
number | null@returns
voidmarkCalendarFired
markCalendarFired(projectId: string, orgId: string, agentId: string, name: string, firedAt: string, oneShot: boolean): void@paramprojectId
string@paramorgId
string@paramagentId
string@paramname
string@paramfiredAt
string@paramoneShot
boolean@returns
voidmarkCalendarMissed
markCalendarMissed(projectId: string, orgId: string, agentId: string, name: string): void@paramprojectId
string@paramorgId
string@paramagentId
string@paramname
string@returns
voidmarkCalendarOutcome
markCalendarOutcome(projectId: string, orgId: string, agentId: string, name: string, outcome: OrgCalendarOutcome): void@paramprojectId
string@paramorgId
string@paramagentId
string@paramname
string@paramoutcome
OrgCalendarOutcome@returns
voiddeleteMissingCalendar
deleteMissingCalendar(projectId: string, orgId: string, present: Array<{ agentId: string; name: string }>): void@paramprojectId
string@paramorgId
string@parampresent
Array<{ agentId: string; name: string }>@returns
voiddeleteCalendar
deleteCalendar(projectId: string, orgId: string, agentId: string, name: string): void@paramprojectId
string@paramorgId
string@paramagentId
string@paramname
string@returns
voidfindTicketState
findTicketState(projectId: string, orgId: string, ticketId: string): OrgTicketStateRow | null@paramprojectId
string@paramorgId
string@paramticketId
string@returns
OrgTicketStateRow | nullupsertTicketState
upsertTicketState(row: OrgTicketStateRow): void@paramrow
OrgTicketStateRow@returns
voiddeleteMissingTicketState
deleteMissingTicketState(projectId: string, orgId: string, presentIds: string[]): void@paramprojectId
string@paramorgId
string@parampresentIds
string[]@returns
voidchannelOffset
channelOffset(projectId: string, orgId: string, channelId: string, date: string): number@paramprojectId
string@paramorgId
string@paramchannelId
string@paramdate
string@returns
numbersetChannelOffset
setChannelOffset(projectId: string, orgId: string, channelId: string, date: string, offset: number): void@paramprojectId
string@paramorgId
string@paramchannelId
string@paramdate
string@paramoffset
number@returns
voidreadCursor
readCursor(projectId: string, orgId: string, channelId: string, userId: string): string | null@paramprojectId
string@paramorgId
string@paramchannelId
string@paramuserId
string@returns
string | nullsetReadCursor
setReadCursor(projectId: string, orgId: string, channelId: string, userId: string, lastReadId: string): void@paramprojectId
string@paramorgId
string@paramchannelId
string@paramuserId
string@paramlastReadId
string@returns
voidbudgetState
budgetState(projectId: string, orgId: string, agentId: string, period: string): OrgBudgetStateRow | null@paramprojectId
string@paramorgId
string@paramagentId
string@paramperiod
string@returns
OrgBudgetStateRow | nulllistBudgetStates
listBudgetStates(projectId: string, orgId: string, period: string): OrgBudgetStateRow[]@paramprojectId
string@paramorgId
string@paramperiod
string@returns
OrgBudgetStateRow[]markBudget
markBudget(projectId: string, orgId: string, agentId: string, period: string, patch: { warnedAt?: string | null; pausedAt?: string | null }): void@paramprojectId
string@paramorgId
string@paramagentId
string@paramperiod
string@parampatch
{ warnedAt?: string | null; pausedAt?: string | null }@returns
voidqueueDeskNotice
queueDeskNotice(row: Omit<OrgDeskNoticeRow, "seq">): void@paramrow
Omit<OrgDeskNoticeRow, "seq">@returns
voidtakeDeskNotices
takeDeskNotices(projectId: string, orgId: string, agentId: string): OrgDeskNoticeRow[]@paramprojectId
string@paramorgId
string@paramagentId
string@returns
OrgDeskNoticeRow[]deleteDeskNotices
deleteDeskNotices(projectId: string, orgId: string, agentId: string): void@paramprojectId
string@paramorgId
string@paramagentId
string@returns
voiddeleteOrg
deleteOrg(projectId: string, orgId: string): void@paramprojectId
string@paramorgId
string@returns
voiddeleteProject
deleteProject(projectId: string): void@paramprojectId
string@returns
void