export async function fetchContext(client) {
    try {
        const result = await client.getWorkspaceContext(process.cwd(), process.env.AGENT_TOWER_SESSION_ID);
        if (!result)
            return null;
        return {
            projectId: result.projectId,
            projectName: result.projectName,
            taskId: result.taskId,
            taskTitle: result.taskTitle,
            workspaceId: result.workspaceId,
            workspaceBranch: result.workspaceBranch,
            ...(process.env.AGENT_TOWER_TEAM_RUN_ID || result.teamRunId
                ? { teamRunId: process.env.AGENT_TOWER_TEAM_RUN_ID ?? result.teamRunId }
                : {}),
            ...(process.env.AGENT_TOWER_MEMBER_ID || result.memberId
                ? { memberId: process.env.AGENT_TOWER_MEMBER_ID ?? result.memberId }
                : {}),
            ...(process.env.AGENT_TOWER_INVOCATION_ID || result.invocationId
                ? { invocationId: process.env.AGENT_TOWER_INVOCATION_ID ?? result.invocationId }
                : {}),
        };
    }
    catch {
        return null;
    }
}
//# sourceMappingURL=context.js.map