MCPcopy Create free account
hub / github.com/tiann/hapi / resolveLocalResumeTarget

Method resolveLocalResumeTarget

hub/src/sync/syncEngine.ts:716–760  ·  view source on GitHub ↗
(sessionId: string, namespace: string)

Source from the content-addressed store, hash-verified

714 }
715
716 resolveLocalResumeTarget(sessionId: string, namespace: string): LocalResumeTargetResult {
717 const access = this.sessionCache.resolveSessionAccess(sessionId, namespace)
718 if (!access.ok) {
719 return {
720 type: 'error',
721 message: access.reason === 'access-denied' ? 'Session access denied' : 'Session not found',
722 code: access.reason === 'access-denied' ? 'access_denied' : 'session_not_found'
723 }
724 }
725
726 const session = access.session
727 const metadata = session.metadata
728 if (!metadata || typeof metadata.path !== 'string' || metadata.path.length === 0) {
729 return { type: 'error', message: 'Session metadata missing path', code: 'resume_unavailable' }
730 }
731
732 const agentSessionId = this.resolveAgentResumeId(session, namespace)
733 if (!agentSessionId) {
734 return {
735 type: 'error',
736 message: 'Resume session ID unavailable. Start a new session in this directory, or retry after the agent has initialized.',
737 code: 'resume_unavailable'
738 }
739 }
740
741 return {
742 type: 'success',
743 target: {
744 sessionId: access.sessionId,
745 flavor: this.resolveFlavor(session),
746 directory: metadata.path,
747 machineId: metadata.machineId,
748 host: metadata.host,
749 active: session.active,
750 thinking: session.thinking,
751 controlledByUser: session.agentState?.controlledByUser === true,
752 agentSessionId,
753 model: session.model ?? null,
754 effort: session.effort ?? null,
755 modelReasoningEffort: session.modelReasoningEffort ?? null,
756 permissionMode: session.permissionMode,
757 collaborationMode: session.collaborationMode
758 }
759 }
760 }
761
762 listLocalResumableSessions(namespace: string, opts?: { machineId?: string }): ResumableSession[] {
763 return this.getSessionsByNamespace(namespace)

Callers 4

resumeSessionMethod · 0.95
createCliRoutesFunction · 0.80

Calls 3

resolveAgentResumeIdMethod · 0.95
resolveFlavorMethod · 0.95
resolveSessionAccessMethod · 0.45

Tested by

no test coverage detected