mirror of
https://github.com/stablyai/orca.git
synced 2026-10-12 16:03:03 +00:00
Resolve run mailbox owners by agent session id
This commit is contained in:
@@ -65,6 +65,18 @@ export function getRunMailboxOwnerIdsForHandle(
|
||||
return [...new Set(runIds)].sort()
|
||||
}
|
||||
|
||||
/** Resolves mailbox ownership by durable agent session identity. */
|
||||
export function getRunMailboxOwnerIdsForAgentSession(
|
||||
this: OrchestrationDb,
|
||||
agentSessionId: string
|
||||
): string[] {
|
||||
return (
|
||||
this.db
|
||||
.prepare('SELECT id FROM runs WHERE legacy = 0 AND coordinator_agent_session_id = ?')
|
||||
.all(agentSessionId) as { id: string }[]
|
||||
).map((row) => row.id)
|
||||
}
|
||||
|
||||
export function listRuns(
|
||||
this: OrchestrationDb,
|
||||
params: { limit?: number; cursor?: string } = {}
|
||||
@@ -160,6 +172,7 @@ export type RunLookupMethods = {
|
||||
getRun: typeof getRun
|
||||
getLegacyAdoptedRunMailboxOwner: typeof getLegacyAdoptedRunMailboxOwner
|
||||
getRunMailboxOwnerIdsForHandle: typeof getRunMailboxOwnerIdsForHandle
|
||||
getRunMailboxOwnerIdsForAgentSession: typeof getRunMailboxOwnerIdsForAgentSession
|
||||
listRuns: typeof listRuns
|
||||
getCurrentRunForPane: typeof getCurrentRunForPane
|
||||
runsBoundToPane: typeof runsBoundToPane
|
||||
@@ -174,6 +187,7 @@ export function attachRunLookup(ctor: { prototype: object }): void {
|
||||
getRun,
|
||||
getLegacyAdoptedRunMailboxOwner,
|
||||
getRunMailboxOwnerIdsForHandle,
|
||||
getRunMailboxOwnerIdsForAgentSession,
|
||||
listRuns,
|
||||
getCurrentRunForPane,
|
||||
runsBoundToPane,
|
||||
|
||||
Reference in New Issue
Block a user